Author: thomas.heute(a)jboss.com
Date: 2007-04-18 09:22:03 -0400 (Wed, 18 Apr 2007)
New Revision: 7004
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesFilter.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
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
Log:
Typed properties (Boolean + String)
Fix NPE on:
org.jboss.portal.core.admin.ui.dashboard.DashboardBean.renderRefresh(DashboardBean.java:167)
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesFilter.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesFilter.java 2007-04-18
12:30:16 UTC (rev 7003)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesFilter.java 2007-04-18
13:22:03 UTC (rev 7004)
@@ -8,6 +8,7 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
public class PropertiesFilter
{
@@ -40,6 +41,11 @@
{
propertyBean.setDisplayName(new LocalizedString("Default child
name", Locale.ENGLISH));
}
+ else if (propertyBean.getName().equals(DynaRenderOptions.ASYNC_WINDOW_ENABLED))
+ {
+ propertyBean.setDisplayName(new LocalizedString("Asynchronous Windows
Enabled", Locale.ENGLISH));
+ propertyBean.setType("java.lang.Boolean");
+ }
}
it = toRemove.iterator();
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-04-18
12:30:16 UTC (rev 7003)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2007-04-18
13:22:03 UTC (rev 7004)
@@ -33,180 +33,77 @@
public class PropertyBean implements Comparable
{
- /** . */
- private String name;
/** . */
- private boolean readOnly;
-
- /** . */
- private LocalizedString displayName;
-
- /** . */
private String value;
- /** . */
PropertiesBean container;
- private PortalObject portalObject;
-
- public PropertyBean()
- {
- name="toto";
- value="foo";
- }
+ private PropertyInfo info;
public PropertyBean(PropertyInfo info, String value)
{
- this.name = info.getName();
- this.portalObject = info.getPortalObject();
- this.readOnly = info.isReadOnly();
- this.displayName = info.getDisplayName();
+ this.info = info;
this.value = value;
}
+
+ private PortalObject getPortalObject()
+ {
+ return info.getPortalObject();
+ }
public String getName()
{
- return name;
+ return info.getName();
}
public boolean isReadOnly()
{
- return readOnly;
+ return info.isReadOnly();
}
- public void setReadOnly(boolean readOnly)
- {
- this.readOnly = readOnly;
- }
-
public LocalizedString getDisplayName()
{
- return displayName;
+ return info.getDisplayName();
}
public void setDisplayName(LocalizedString displayName)
{
- this.displayName = displayName;
+ info.setDisplayName(displayName);
}
- public String getValue()
+ public Object getValue()
{
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- portalObject.setDeclaredProperty(name, value);
- }
-
-
- /*
- public List getIndices()
- {
- List list = new ArrayList(value.size());
- for (int i = 0;i < value.size();i++)
+ if (info.getType().equals("java.lang.Boolean"))
{
- list.add("index_" + i);
+ return new Boolean(value);
}
- return list;
- }
-
- public String getLine()
- {
- return line;
- }
-
- public void setLine(String line)
- {
- this.line = line;
- }
- */
-
- public void select()
- {
- if (container == null)
+ else
{
- throw new IllegalStateException("Not attached to a container");
+ return value;
}
- container.selectedIndex = container.entries.indexOf(this);
}
- /*
- public void deleteLine(ActionEvent event)
+ public void setValue(Object value)
{
- String s = event.getComponent().getId();
- int index = Integer.parseInt(s.substring(4));
- List list = new ArrayList(value.asStringList());
- list.remove(index);
- String[] strings = (String[])list.toArray(new String[list.size()]);
- value = new StringValue(strings);
- stale = true;
+ this.value = value.toString();
+ getPortalObject().setDeclaredProperty(getName(), value.toString());
}
- public void appendLine()
+ public int compareTo(Object o)
{
- List list = new ArrayList(value.asStringList());
- list.add(line);
- String[] strings = (String[])list.toArray(new String[list.size()]);
- value = new StringValue(strings);
- stale = true;
- line = null;
+ PropertyBean that = (PropertyBean)o;
+ return info.getName().compareTo(that.getName());
}
-
- public Class getType(Object propertyName) throws IllegalArgumentException
+ public String getType()
{
- if (propertyName instanceof String)
- {
- String s = (String)propertyName;
- if (s.startsWith("index_"))
- {
- return String.class;
- }
- }
- return null;
+ return info.getType();
}
- */
- /*
- public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ public void setType(String type)
{
- if (propertyName instanceof String)
- {
- String s = (String)propertyName;
- if (s.startsWith("index_"))
- {
- int index = Integer.parseInt(s.substring(6));
- return new PropertyValue(value.asStringList().get(index));
- }
- }
- return null;
+ info.setType(type);
}
-
- public boolean setValue(Object propertyName, Object value) throws
IllegalArgumentException
- {
- if (propertyName instanceof String)
- {
- String s = (String)propertyName;
- if (s.startsWith("index_"))
- {
- String[] tmp = this.value.asStringArray();
- int index = Integer.parseInt(s.substring(6));
- tmp[index] = (String)value;
- this.value = new StringValue(tmp);
- stale = true;
- return true;
- }
- }
- return false;
- }
-*/
- public int compareTo(Object o)
- {
- PropertyBean that = (PropertyBean)o;
- return name.compareTo(that.name);
- }
}
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-04-18
12:30:16 UTC (rev 7003)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyInfo.java 2007-04-18
13:22:03 UTC (rev 7004)
@@ -36,6 +36,8 @@
/** . */
private boolean readOnly;
+
+ private String type;
/** . */
private LocalizedString displayName;
@@ -47,6 +49,7 @@
this.name = name;
this.readOnly = readOnly;
this.portalObject = portalObject;
+ this.type = "java.lang.String";
}
public LocalizedString getDisplayName()
@@ -84,4 +87,14 @@
return portalObject;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
}
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2007-04-18
12:30:16 UTC (rev 7003)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2007-04-18
13:22:03 UTC (rev 7004)
@@ -123,7 +123,12 @@
if (! propertyName.equals(""))
{
-
getPortalObjectManager().getSelectedObject().setDeclaredProperty(propertyName,
getPropertyValue());
+ String value = getPropertyValue();
+ if (value == null)
+ {
+ value = "";
+ }
+
getPortalObjectManager().getSelectedObject().setDeclaredProperty(propertyName, value);
}
}
}
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-04-18
12:30:16 UTC (rev 7003)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-04-18
13:22:03 UTC (rev 7004)
@@ -163,18 +163,21 @@
{
refresh();
- //
- selectedPageTheme =
userPortal.getDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME);
- if (selectedPageTheme == null)
+ if (userPortal != null)
{
- selectedPageTheme = "";
- }
+ //
+ selectedPageTheme =
userPortal.getDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME);
+ if (selectedPageTheme == null)
+ {
+ selectedPageTheme = "";
+ }
- //
- selectedPageLayout =
userPortal.getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
- if (selectedPageLayout == null)
- {
- selectedPageLayout = "";
+ //
+ selectedPageLayout =
userPortal.getDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ if (selectedPageLayout == null)
+ {
+ selectedPageLayout = "";
+ }
}
}
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-04-18
12:30:16 UTC (rev 7003)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-04-18
13:22:03 UTC (rev 7004)
@@ -25,7 +25,14 @@
<h:outputText>#{prop.name}</h:outputText>
</td>
<td>
- <h:inputText value="#{prop.value}"/>
+ <c:choose>
+ <c:when
test="#{prop.type=='java.lang.Boolean'}">
+ <h:selectBooleanCheckbox value="#{prop.value}" />
+ </c:when>
+ <c:otherwise>
+ <h:inputText value="#{prop.value}" />
+ </c:otherwise>
+ </c:choose>
</td>
<td>
<h:commandLink
action="#{propertyAction.removeProperty}">
@@ -45,7 +52,6 @@
<thead class="portlet-section-header"
style="text-align:left;">
<tr>
<th>Property name</th>
- <th>Property value</th>
</tr>
</thead>
<tbody>
@@ -53,13 +59,9 @@
<td>
<h:selectOneMenu
value="#{propertyAction.selectedProperty}">
<f:selectItems value="#{portalobjectmgr.properties}"/>
- </h:selectOneMenu><br />
- <h:outputText value="Other"/><h:inputText
value="#{propertyAction.otherPropertyName}"
- validator="#{propertyAction.validatePropertyName}"
/>
+ </h:selectOneMenu>
+ <h:outputText value="Other:"/> <h:inputText
value="#{propertyAction.otherPropertyName}" />
</td>
- <td>
- <h:inputText value="#{propertyAction.propertyValue}"/>
- </td>
</tr>
</tbody>
</table>
Show replies by date