Author: julien(a)jboss.com
Date: 2007-06-23 18:23:07 -0400 (Sat, 23 Jun 2007)
New Revision: 7518
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyInfo.java
Log:
- sort entries in PropertiesBean otherwise it leads to update a wrong property since the
update rely on the order in the iteration
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesBean.java 2007-06-23
21:59:43 UTC (rev 7517)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesBean.java 2007-06-23
22:23:07 UTC (rev 7518)
@@ -28,8 +28,8 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
+import java.util.SortedMap;
+import java.util.TreeMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,21 +41,18 @@
{
/** . */
- List entryList;
+ private final SortedMap entryMap;
/** . */
- Map entryMap;
-
- /** . */
- int selectedIndex;
-
- /** . */
final PortalObjectManagerBean pomgr;
/** . */
private final PropertiesInfo info;
/** . */
+ int selectedIndex;
+
+ /** . */
private List items;
public PropertiesBean(PortalObjectManagerBean pomgr)
@@ -67,8 +64,7 @@
PropertiesInfo info = new PropertiesInfo(selectedObject);
//
- List entryList = new ArrayList(info.getNames().size());
- Map entryMap = new HashMap(info.getNames().size());
+ SortedMap entryMap = new TreeMap();
//
boolean inheritable = selectedObject.getType() != PortalObject.TYPE_CONTEXT;
@@ -86,17 +82,13 @@
if (propertyInfo != null && propertyInfo.getScope() ==
PropertyInfo.PUBLIC_SCOPE)
{
PropertyBean propertyBean = new PropertyBean(this, propertyInfo, inherited,
inheritable, propertyValue);
- entryList.add(propertyBean);
entryMap.put(propertyName, propertyBean);
}
}
- //initiate control
-
//
this.info = info;
this.pomgr = pomgr;
- this.entryList = entryList;
this.entryMap = entryMap;
this.selectedIndex = -1;
}
@@ -108,7 +100,7 @@
public void setSelectedIndex(int selectedIndex)
{
- if (selectedIndex < 0 || selectedIndex >= entryList.size())
+ if (selectedIndex < 0 || selectedIndex >= entryMap.size())
{
throw new IllegalArgumentException();
}
@@ -120,23 +112,14 @@
selectedIndex = -1;
}
- public PreferenceBean getSelectedEntry()
- {
- if (selectedIndex < 0 || selectedIndex >= entryList.size())
- {
- return null;
- }
- return (PreferenceBean)entryList.get(selectedIndex);
- }
-
public List getEntries()
{
- return entryList;
+ return new ArrayList(entryMap.values());
}
public int getSize()
{
- return entryList.size();
+ return entryMap.size();
}
public SelectItem[] getPropertyItems()
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2007-06-23
21:59:43 UTC (rev 7517)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2007-06-23
22:23:07 UTC (rev 7518)
@@ -135,4 +135,9 @@
{
return PropertiesInfo.isControlProperty(info.getName());
}
+
+ public String toString()
+ {
+ return "PropertyBean[name=" + info.getName() + ",value=" +
value + "]";
+ }
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyInfo.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyInfo.java 2007-06-23
21:59:43 UTC (rev 7517)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyInfo.java 2007-06-23
22:23:07 UTC (rev 7518)
@@ -103,4 +103,9 @@
{
return scope;
}
+
+ public String toString()
+ {
+ return "PropertyInfo[" + name + "]";
+ }
}
Show replies by date