Author: julien(a)jboss.com
Date: 2007-03-02 21:38:55 -0500 (Fri, 02 Mar 2007)
New Revision: 6492
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
Removed:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PreferenceAction.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPreferences.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
redone the UI preferences editor which was crappy
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-02
20:28:32 UTC (rev 6491)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-03
02:38:55 UTC (rev 6492)
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.Comparator;
import java.util.Collections;
+import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -36,14 +37,10 @@
import javax.faces.application.FacesMessage;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.value.Value;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.instance.NoSuchInstanceException;
import org.jboss.portal.core.model.instance.InstanceDefinition;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
@@ -51,9 +48,12 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.PreferenceInfo;
import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.common.value.Value;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -97,10 +97,10 @@
// Runtime fields depending on the navigational state
/** . */
- private Instance selectedInstance;
+ private PreferencesBean selectedPrefs;
/** . */
- private PreferencesBean selectedPreferences;
+ private Instance selectedInstance;
/** . */
private List instances;
@@ -203,70 +203,37 @@
return selectedInstance;
}
- public PreferencesBean getSelectedPreferences()
+ public PreferencesBean getSelectedPrefs()
{
Instance selectedInstance = getSelectedInstance();
//
- if (selectedInstance != null)
+ if (selectedPrefs == null && selectedInstance != null)
{
try
{
+ selectedPrefs = new PreferencesBean(true);
+
+ //
PreferencesInfo prefsInfo =
selectedInstance.getPortlet().getInfo().getPreferences();
- if (prefsInfo != null)
+ Set keys = prefsInfo.getKeys();
+ PropertyMap props = selectedInstance.getProperties();
+ for (Iterator i = keys.iterator();i.hasNext();)
{
- RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
- PropertyMap prefs = getSelectedInstance().getProperties();
-
- //
- int index = 0;
- for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
- {
- String key = (String)i.next();
-
- // Get info for this key
-// PreferenceInfo info = prefsInfo.getPreference(key);
-// boolean readOnly = info.isReadOnly();
- boolean readOnly = false;
-// Value value = info.getValue();
-
- // Get value from the state
- Value value = prefs.getProperty(key);
-
- //
- Row row = model.getRow(index);
- row.setReadOnly(readOnly);
-
- //
- Cell cell = row.getCell();
- cell.setHandback("" + i);
- cell.setValue(value.asStringArray());
-
- //
- row.setHandback(key);
- row.setKey(key);
- row.setName("Description");
- row.setReadOnly(false);
- row.setValue(value.asStringArray());
- }
-
- //
- selectedPreferences = new PreferencesBean(model);
-
- //
- if (selectedRow != null)
- {
- selectedPreferences.selectRow(selectedRow);
- }
+ String key = (String)i.next();
+ PreferenceInfo prefInfo = prefsInfo.getPreference(key);
+ Value value = props.getProperty(key);
+ selectedPrefs.addEntry(prefInfo, value);
}
}
catch (PortletInvokerException e)
{
- log.warn("Couldn't access portlet invoker associated to instance
" + selectedInstance.getId()
- + ". This instance won't be refreshed.\nReason:\n\t" +
e.getLocalizedMessage());
+ e.printStackTrace();
}
}
- return selectedPreferences;
+
+ //
+ return selectedPrefs;
}
public AbstractAuthorizationBean getAuth()
@@ -306,7 +273,6 @@
/** Refresh the selected prefs. */
public void refresh()
{
- selectedPreferences = null;
selectedInstance = null;
instances = null;
}
@@ -334,7 +300,7 @@
Map params = ectx.getRequestParameterMap();
selectedId = (String)params.get("id");
selectedPlugin = (String)params.get("plugin");
- selectedPreferences = null;
+ selectedPrefs = null;
}
public void deleteInstance()
@@ -351,8 +317,9 @@
//
selectedId = null;
- selectedPreferences = null;
+ selectedPrefs = null;
selectedFrom = 0;
+ selectedPlugin = null;
}
catch (NoSuchInstanceException e)
{
@@ -364,6 +331,45 @@
}
}
+ public void updatePrefs()
+ {
+ try
+ {
+ List tmp = new ArrayList();
+ List entries = selectedPrefs.getEntries();
+ for (int i = 0;i < entries.size();i++)
+ {
+ PreferenceBean entry = (PreferenceBean)entries.get(i);
+ if (entry.isStale())
+ {
+ PropertyChange change = PropertyChange.newUpdate(entry.getName(),
entry.getValue());
+ tmp.add(change);
+ }
+ }
+ PropertyChange[] changes = (PropertyChange[])tmp.toArray(new
PropertyChange[tmp.size()]);
+ getSelectedInstance().setProperties(changes);
+
+ // Todo handle that change was ok in the UI
+ }
+ catch (PortletInvokerException e)
+ {
+ // Todo handle issue in the UI
+ e.printStackTrace();
+ }
+
+ //
+ selectedId = null;
+ selectedPrefs = null;
+ selectedPlugin = null;
+ }
+
+ public void cancelPrefs()
+ {
+ selectedId = null;
+ selectedPrefs = null;
+ selectedPlugin = null;
+ }
+
/** A comparator for portlets. */
static final Comparator INSTANCE_COMPARATOR = new Comparator()
{
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-02
20:28:32 UTC (rev 6491)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-03
02:38:55 UTC (rev 6492)
@@ -35,12 +35,7 @@
import javax.faces.model.SelectItem;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.common.value.StringValue;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
@@ -242,38 +237,13 @@
// If the portlet has preferences info then we display them
if (prefsInfo != null)
{
- RowSetModel model = new RowSetModel(null, prefsInfo.getKeys().size());
- model.setMutable(false);
-
- //
- int index = 0;
- for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext(); index++)
+ selectedPreferences = new PreferencesBean(false);
+ for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext();)
{
String key = (String)i.next();
-
- //
- PreferenceInfo prefs = prefsInfo.getPreference(key);
- Value value = new StringValue("not available");
- Boolean readOnly = prefs.isReadOnly();
-
- //
- Row row = model.getRow(index);
-
- //
- Cell cell = row.getCell();
- cell.setHandback("" + i);
- cell.setValue(value.asStringArray());
-
- //
- row.setHandback(key);
- row.setKey(key);
- row.setName(prefs.getDisplayName().getString(locale, true));
- row.setReadOnly(Boolean.TRUE.equals(readOnly));
- row.setValue(value.asStringArray());
+ PreferenceInfo preferenceInfo = prefsInfo.getPreference(key);
+ selectedPreferences.addEntry(preferenceInfo);
}
-
- //
- selectedPreferences = new PreferencesBean(model);
}
}
return selectedPreferences;
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java 2007-03-03
02:38:55 UTC (rev 6492)
@@ -0,0 +1,226 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.admin.ui;
+
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.el.PropertyValue;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+
+import javax.faces.event.ActionEvent;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PreferenceBean implements Comparable, DynamicBean
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private boolean readOnly;
+
+ /** . */
+ private LocalizedString displayName;
+
+ /** . */
+ private LocalizedString description;
+
+ /** . */
+ private Value value;
+
+ /** . */
+ private String line;
+
+ /** . */
+ PreferencesBean container;
+
+ /** . */
+ private boolean stale;
+
+ public PreferenceBean(PreferenceInfo prefInfo, Value value)
+ {
+ this.name = prefInfo.getKey();
+ this.readOnly = Boolean.TRUE.equals(prefInfo.isReadOnly());
+ this.displayName = prefInfo.getDisplayName();
+ this.description = prefInfo.getDescription();
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+ public Value getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Value value)
+ {
+ this.value = value;
+ }
+
+ public boolean isStale()
+ {
+ return stale;
+ }
+
+ public List getIndices()
+ {
+ List list = new ArrayList(value.size());
+ for (int i = 0;i < value.size();i++)
+ {
+ list.add("index_" + i);
+ }
+ return list;
+ }
+
+ public String getLine()
+ {
+ return line;
+ }
+
+ public void setLine(String line)
+ {
+ this.line = line;
+ }
+
+ public void select()
+ {
+ if (container == null)
+ {
+ throw new IllegalStateException("Not attached to a container");
+ }
+ container.selectedIndex = container.entries.indexOf(this);
+ }
+
+ public void deleteLine(ActionEvent event)
+ {
+ 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;
+ }
+
+ public void appendLine()
+ {
+ 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;
+ }
+
+ public Class getType(Object propertyName) throws IllegalArgumentException
+ {
+ if (propertyName instanceof String)
+ {
+ String s = (String)propertyName;
+ if (s.startsWith("index_"))
+ {
+ return String.class;
+ }
+ }
+ return null;
+ }
+
+ public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ {
+ 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;
+ }
+
+ 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)
+ {
+ PreferenceBean that = (PreferenceBean)o;
+ return name.compareTo(that.name);
+ }
+}
Deleted: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2007-03-02
20:28:32 UTC (rev 6491)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2007-03-03
02:38:55 UTC (rev 6492)
@@ -1,74 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.admin.ui;
-
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PreferencesBean
-{
-
- /** . */
- private RowSetModel model;
-
- /** . */
- private Cell selectedPreference;
-
- public PreferencesBean(RowSetModel selectedPreferences)
- {
- this.model = selectedPreferences;
- }
-
- public Cell getSelectedPreference()
- {
- return selectedPreference;
- }
-
- public void setSelectedPreference(Cell selectedPreference)
- {
- this.selectedPreference = selectedPreference;
- }
-
- public RowSetModel getModel()
- {
- return model;
- }
-
- public void selectRow(Integer index)
- {
- if (index != null)
- {
- Row row = model.getRow(index.intValue());
- selectedPreference = row.getCell();
- }
- else
- {
- selectedPreference = null;
- }
- }
-}
Deleted:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PreferenceAction.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PreferenceAction.java 2007-03-02
20:28:32 UTC (rev 6491)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PreferenceAction.java 2007-03-03
02:38:55 UTC (rev 6492)
@@ -1,181 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.admin.ui.actions;
-
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.admin.ui.InstanceManagerBean;
-import org.jboss.portal.faces.matrix.AbstractCellAction;
-import org.jboss.portal.faces.matrix.Cell;
-import org.jboss.portal.faces.matrix.Row;
-import org.jboss.portal.faces.matrix.RowSetModel;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyMap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PreferenceAction extends AbstractCellAction
-{
-
- /** The instance manager bean. */
- private InstanceManagerBean manager;
-
- public InstanceManagerBean getManager()
- {
- return manager;
- }
-
- public void setManager(InstanceManagerBean manager)
- {
- this.manager = manager;
- }
-
- public void appendLine(String appendedValue)
- {
- try
- {
- //
- Row row = getSelectedRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
- PropertyMap prefs = instance.getProperties();
-
- Value value = prefs.getProperty(key);
- String[] strings = value.asStringArray();
- String[] strings2 = new String[strings.length + 1];
- System.arraycopy(strings, 0, strings2, 0, strings.length);
- strings2[strings.length] = appendedValue;
- Value value2 = new StringValue(strings2);
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value2);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- public void deleteLine(int index)
- {
- try
- {
- Row row = getSelectedRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
- PropertyMap prefs = instance.getProperties();
-
- //
- Value value = prefs.getProperty(key);
- String[] strings = value.asStringArray();
- List list = new ArrayList(Arrays.asList(strings));
- list.remove(index);
- String[] strings2 = (String[])list.toArray(new String[list.size()]);
- Value value2 = new StringValue(strings2);
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value2);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- public void updateCell()
- {
- try
- {
- Cell cell = manager.getSelectedPreferences().getSelectedPreference();
- StringValue value = new StringValue(cell.getValue());
-
- //
- Row row = cell.getRow();
- String key = row.getHandback();
-
- //
- Instance instance = manager.getSelectedInstance();
-
- //
- PropertyChange change = PropertyChange.newUpdate(key, value);
- instance.setProperties(new PropertyChange[]{change});
-
- // Unselect the current row has we consider that the update work is done
- manager.setSelectedRow(null);
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
-
- public void selectRow(int rowIndex)
- {
- manager.setSelectedRow(new Integer(rowIndex));
- }
-
- public void deleteRow(int rowIndex)
- {
- try
- {
- //
- Instance instance = manager.getSelectedInstance();
-
- //
- Row row = manager.getSelectedPreferences().getModel().getRow(rowIndex);
-
- //
- String key = row.getHandback();
-
- //
- PropertyChange change = PropertyChange.newReset(key);
- instance.setProperties(new PropertyChange[]{change});
- }
- catch (PortletInvokerException e)
- {
- throw new Error("Handle me gracefully please", e);
- }
- }
-
- private Row getSelectedRow()
- {
- int selectedRow = manager.getSelectedRow().intValue();
- RowSetModel model = manager.getSelectedPreferences().getModel();
- return model.getRow(selectedRow);
- }
-}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-02
20:28:32 UTC (rev 6491)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-03
02:38:55 UTC (rev 6492)
@@ -140,15 +140,6 @@
<value>#{applicationScope.AuthorizationDomainRegistry}</value>
</managed-property>
</managed-bean>
- <managed-bean>
- <managed-bean-name>preferenceAction</managed-bean-name>
-
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.PreferenceAction</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- <managed-property>
- <property-name>manager</property-name>
- <value>#{instancemgr}</value>
- </managed-property>
- </managed-bean>
<!-- The portlet manager managed bean -->
<managed-bean>
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPreferences.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPreferences.xhtml 2007-03-02
20:28:32 UTC (rev 6491)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPreferences.xhtml 2007-03-03
02:38:55 UTC (rev 6492)
@@ -12,65 +12,76 @@
<th>Key</th>
<th>Name</th>
<th>ReadOnly</th>
- <c:if test="#{action != null}">
- <th>Actions</th>
+ <c:if test="#{prefs.mutable}">
+ <th>Value</th>
</c:if>
- <th>Value</th>
</tr>
</thead>
<tbody>
- <c:forEach items="#{preferences.model.wrappedData}"
var="row" varStatus="status">
+ <c:forEach items="#{prefs.entries}" var="pref"
varStatus="status">
<tr class="#{status.index % 2 == 0 ?
'portlet-section-body' : 'portlet-section-alternate'}">
<td>
- <h:outputText value="#{row.key}"/>
+ <c:choose>
+ <c:when test="#{prefs.mutable and pref.readOnly ==
false}">
+ <h:commandLink
+ rendered="#{pref.readOnly == false}"
+
action="#{pref.select}">#{pref.name}</h:commandLink>
+ </c:when>
+ <c:otherwise>#{pref.name}</c:otherwise>
+ </c:choose>
</td>
<td>
- <h:outputText value="#{row.name}"/>
+ <h:outputText value="#{pref.displayName}"/>
</td>
<td>
- <h:outputText value="#{row.readOnly}"/>
+ <h:selectBooleanCheckbox disabled="true"
value="#{pref.readOnly}"/>
</td>
- <c:if test="#{action != null}">
+ <c:if test="#{prefs.mutable}">
<td>
- <h:commandLink
- rendered="#{row.cell.value != null and
preferences.model.mutable}"
- action="#{action.selectRow}"><f:param
name="row" value="#{status.index}"/>Edit</h:commandLink> |
- <h:commandLink
- rendered="#{row.cell.value != null and
preferences.model.mutable}"
- action="#{action.deleteCell}"><f:param
name="row" value="#{status.index}"/>Reset</h:commandLink>
+ <h:outputText value="#{pref.value}"/>
</td>
</c:if>
- <td>
- <h:outputText value="#{row.cell.description}"/>
- </td>
</tr>
</c:forEach>
</tbody>
</table>
</h:form>
- <c:if test="#{preferences.selectedPreference != null}">
+ <c:if test="#{prefs.selectedEntry != null}">
+
<h:form>
- <h:dataTable
- id="string_values"
- var="row"
- value="#{preferences.selectedPreference.valueIndices}">
- <h:column>
- <h:outputLabel for="value_#{row}">
- <h:outputText value="Value #{row}: "
styleClass="portlet-form-field-label"/>
- </h:outputLabel>
- <h:inputText
value="#{preferences.selectedPreference.value[row]}"
styleClass="portlet-form-input-field"/>
- <h:commandButton id="value_#{row}"
action="#{action.deleteLine}" value="Delete"
styleClass="portlet-form-button"/>
- </h:column>
- </h:dataTable>
- <h:commandButton action="#{action.updateCell}"
value="Update" styleClass="portlet-form-button"/>
+ <table width="100%">
+ <tbody>
+ <c:forEach items="#{prefs.selectedEntry.indices}"
var="index" varStatus="status">
+ <tr>
+ <td>
+ <h:outputText value="Value #{status.index}:
#{index}" styleClass="portlet-form-field-label"/>
+ </td>
+ <td>
+ <h:inputText value="#{prefs.selectedEntry[index]}"
styleClass="portlet-form-input-field"/>
+ </td>
+ <td>
+ <h:commandButton
+ id="row_#{status.index}"
+ actionListener="#{prefs.selectedEntry.deleteLine}"
+ value="Delete"
+ styleClass="portlet-form-button"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <h:commandButton value="Update"
styleClass="portlet-form-button"/>
</h:form>
+
<h:form>
<h:outputLabel for="new_value">
<h:outputText value="New value: "
styleClass="portlet-form-field-label"/>
</h:outputLabel>
- <h:inputText id="new_value"
value="#{action.appendedValue}"
styleClass="portlet-form-input-field"/>
- <h:commandButton action="#{action.appendLine}"
value="Append" styleClass="portlet-form-button"/>
+ <h:inputText id="new_value"
value="#{prefs.selectedEntry.line}"
styleClass="portlet-form-input-field"/>
+ <h:commandButton action="#{prefs.selectedEntry.appendLine}"
value="Append" styleClass="portlet-form-button"/>
</h:form>
+
</c:if>
+
</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-03-02
20:28:32 UTC (rev 6491)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-03-03
02:38:55 UTC (rev 6492)
@@ -88,9 +88,12 @@
<c:if test="#{instancemgr.selectedPlugin ==
'preferences'}">
<h3>Editing preferences of #{instancemgr.selectedInstance.id}: </h3>
<ui:include src="common/editPreferences.xhtml">
- <ui:param name="preferences"
value="#{instancemgr.selectedPreferences}"/>
- <ui:param name="action"
value="#{preferenceAction}"/>
+ <ui:param name="prefs"
value="#{instancemgr.selectedPrefs}"/>
</ui:include>
+ <h:form>
+ <h:commandButton value="Save"
action="#{instancemgr.updatePrefs}"/>
+ <h:commandButton value="Cancel"
action="#{instancemgr.cancelPrefs}"/>
+ </h:form>
</c:if>
<c:if test="#{instancemgr.selectedPlugin == 'security'}">
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-03-02
20:28:32 UTC (rev 6491)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-03-03
02:38:55 UTC (rev 6492)
@@ -80,7 +80,7 @@
<hr/>
<h3>Portlet preferences</h3>
<ui:include src="common/editPreferences.xhtml">
- <ui:param name="preferences"
value="#{portletmgr.selectedPreferences}"/>
+ <ui:param name="prefs"
value="#{portletmgr.selectedPreferences}"/>
</ui:include>
</c:if>
</c:if>