JBoss Portal SVN: r6495 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-02 21:43:49 -0500 (Fri, 02 Mar 2007)
New Revision: 6495
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
Log:
forgot to add one class in the previous commits
Added: 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 (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2007-03-03 02:43:49 UTC (rev 6495)
@@ -0,0 +1,130 @@
+/******************************************************************************
+ * 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.portlet.info.PreferenceInfo;
+import org.jboss.portal.common.value.Value;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PreferencesBean
+{
+
+ /** . */
+ List entries;
+
+ /** . */
+ int selectedIndex;
+
+ /** . */
+ private boolean mutable;
+
+ public PreferencesBean(boolean mutable)
+ {
+ this.entries = new ArrayList();
+ this.selectedIndex = -1;
+ this.mutable = mutable;
+ }
+
+ public boolean isMutable()
+ {
+ return mutable;
+ }
+
+ public int getSelectedIndex()
+ {
+ return selectedIndex;
+ }
+
+ public void setSelectedIndex(int selectedIndex)
+ {
+ if (selectedIndex < 0 || selectedIndex >= entries.size())
+ {
+ throw new IllegalArgumentException();
+ }
+ this.selectedIndex = selectedIndex;
+ }
+
+ public void unselectEntry()
+ {
+ selectedIndex = -1;
+ }
+
+ public PreferenceBean getSelectedEntry()
+ {
+ if (selectedIndex < 0 || selectedIndex >= entries.size())
+ {
+ return null;
+ }
+ return (PreferenceBean)entries.get(selectedIndex);
+ }
+
+ public void addEntry(PreferenceInfo prefInfo)
+ {
+ if (mutable)
+ {
+ throw new IllegalStateException("Cannot add non mutable entry to a mutable preferences bean");
+ }
+
+ //
+ addEntry(new PreferenceBean(prefInfo, null));
+ }
+
+ public void addEntry(PreferenceInfo prefInfo, Value value)
+ {
+ if (mutable == false)
+ {
+ throw new IllegalStateException("Cannot add mutable entry to a non mutable preferences bean");
+ }
+
+ //
+ addEntry(new PreferenceBean(prefInfo, value));
+ }
+
+ private void addEntry(PreferenceBean pref)
+ {
+ if (pref.container != null)
+ {
+ throw new IllegalArgumentException("Already contained somewhere");
+ }
+ pref.container = this;
+ entries.add(pref);
+ Collections.sort(entries);
+ }
+
+ public List getEntries()
+ {
+ return Collections.unmodifiableList(entries);
+ }
+
+ public int getSize()
+ {
+ return entries.size();
+ }
+}
17 years, 8 months
JBoss Portal SVN: r6492 - in trunk/core-admin/src: main/org/jboss/portal/core/admin/ui/actions and 3 other directories.
by portal-commits@lists.jboss.org
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>
17 years, 8 months
JBoss Portal SVN: r6491 - in trunk: core-admin/src/main/org/jboss/portal/core/admin/ui/actions and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-02 15:28:32 -0500 (Fri, 02 Mar 2007)
New Revision: 6491
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectIdConverter.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/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/faces/src/main/org/jboss/portal/faces/matrix/AbstractCellAction.java
Log:
improve state management of portal object manager bean
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 16:44:52 UTC (rev 6490)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -279,7 +279,7 @@
if (instances == null)
{
instances = new ArrayList(instanceContainer.getDefinitions());
- Collections.sort(instances, comparator);
+ Collections.sort(instances, INSTANCE_COMPARATOR);
}
//
@@ -365,7 +365,7 @@
}
/** A comparator for portlets. */
- final Comparator comparator = new Comparator()
+ static final Comparator INSTANCE_COMPARATOR = new Comparator()
{
public int compare(Object o1, Object o2)
{
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectIdConverter.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectIdConverter.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectIdConverter.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.core.model.portal.PortalObjectId;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalObjectIdConverter implements Converter
+{
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) throws ConverterException
+ {
+ return string == null ? null : PortalObjectId.parse(string, PortalObjectId.LEGACY_BASE64_FORMAT);
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) throws ConverterException
+ {
+ return object == null ? null : ((PortalObjectId)object).toString(PortalObjectId.LEGACY_BASE64_FORMAT);
+ }
+}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-02 16:44:52 UTC (rev 6490)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -26,11 +26,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -193,16 +191,9 @@
/** . */
private Logger log = Logger.getLogger(getClass());
- /** The selected id. */
- private String selectedId;
+ // Wired services
- /** The current tab name. */
- private String selectedPlugin;
-
/** . */
- private RoleModule roleModule;
-
- /** . */
private PortalObjectContainer portalObjectContainer;
/** . */
@@ -221,35 +212,58 @@
private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
/** . */
- private AbstractAuthorizationBean auth = new PortalObjectAuthorizationBean();
+ private RoleModule roleModule;
- /** . */
- private ThemeBean themes = new ThemeBean();
+ // Navigational state
+ /** The selected id. */
+ private PortalObjectId selectedId;
+
+ /** The current tab name. */
+ private String selectedPlugin;
+
/** The selected type for content. */
private ContentType selectedContentType = ContentType.PORTLET;
/** The uri value for content. */
private String selectedContentURI;
- public ContentType getSelectedContentType()
- {
- return selectedContentType;
- }
+ // Runtime state
- public void setSelectedContentType(ContentType selectedContentType)
- {
- this.selectedContentType = selectedContentType;
- }
+ /** . */
+ private final ThemeBean themes = new ThemeBean();
- public String getSelectedContentURI()
+ /** . */
+ private final AbstractAuthorizationBean auth = new PortalObjectAuthorizationBean();
+
+ /** . */
+ private SelectItem[] instanceItems;
+
+ /** . */
+ private SelectItem[] portalPageItems;
+
+ /** . */
+ private List selectedObjectPath;
+
+ /** . */
+ private PortalObject selectedObject;
+
+ /** . */
+ private PortalObjectBean selectedObjectBean;
+
+ /** . */
+ private List selectedProperties;
+
+ // Wired services
+
+ public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
{
- return selectedContentURI;
+ return portalAuthorizationManagerFactory;
}
- public void setSelectedContentURI(String selectedContentURI)
+ public void setPortalAuthorizationManagerFactory(PortalAuthorizationManagerFactory portalAuthorizationManagerFactory)
{
- this.selectedContentURI = selectedContentURI;
+ this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
}
public RoleModule getRoleModule()
@@ -312,6 +326,38 @@
this.authorizationDomainRegistry = authorizationDomainRegistry;
}
+ public ContentType getSelectedContentType()
+ {
+ return selectedContentType;
+ }
+
+ public void setSelectedContentType(ContentType selectedContentType)
+ {
+ this.selectedContentType = selectedContentType;
+ }
+
+ public String getSelectedContentURI()
+ {
+ return selectedContentURI;
+ }
+
+ public void setSelectedContentURI(String selectedContentURI)
+ {
+ this.selectedContentURI = selectedContentURI;
+ }
+
+ public String getSelectedPlugin()
+ {
+ return selectedPlugin;
+ }
+
+ public void setSelectedPlugin(String selectedPlugin)
+ {
+ this.selectedPlugin = selectedPlugin;
+ }
+
+ // Runtime state
+
public AbstractAuthorizationBean getAuth()
{
return auth;
@@ -322,8 +368,6 @@
return themes;
}
- // ****************************
-
public DomainConfigurator getDomainConfigurator()
{
return authorizationDomainRegistry.getDomain("portalobject").getConfigurator();
@@ -340,86 +384,144 @@
return portalObjectContainer.getObject(id);
}
- public List getSelectedObjectPath()
+ public List getPortalNodes()
{
- PortalObject o = getSelectedObject();
- ArrayList path = new ArrayList();
- while (o != null)
- {
- path.add(new PortalObjectBean(o));
- o = o.getParent();
- }
- Collections.reverse(path);
- return path;
+ return getNodes(PortalObject.PORTAL_MASK);
}
- public PortalObject getSelectedObject()
+ public List getPageNodes()
{
- PortalObject result;
- if (selectedId != null)
- {
- result = getObjectFromId(selectedId);
- }
- else
- {
- result = portalObjectContainer.getRootObject();
- }
- return result;
+ return getNodes(PortalObject.PAGE_MASK);
}
-
- public PortalObjectBean getSelectedObjectBean()
+
+ public List getWindowNodes()
{
- return new PortalObjectBean(getSelectedObject());
+ return getNodes(PortalObject.WINDOW_MASK);
}
-
- public void setSelectedObject(PortalObject po)
+
+ public SelectItem[] getInstanceItems()
{
- selectedId = po.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT);
+ if (instanceItems == null)
+ {
+ List tmp = new ArrayList(instanceContainer.getDefinitions());
+ Collections.sort(tmp, InstanceManagerBean.INSTANCE_COMPARATOR);
+ for (int i = 0;i < tmp.size();i++)
+ {
+ Instance instance = (Instance)tmp.get(i);
+ SelectItem item = new SelectItem(instance.getId());
+ tmp.set(i, item);
+ }
+ instanceItems = (SelectItem[])tmp.toArray(new SelectItem[tmp.size()]);
+ }
+ return instanceItems;
}
- public List getSelectedProperties()
+ public SelectItem[] getPortalPageItems()
{
- //return selectedProperties;
- PortalObject object = getSelectedObject();
- List properties = new ArrayList();
- for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
+ if (portalPageItems == null)
{
- Map.Entry entry = (Map.Entry)i.next();
- properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
+ Collection pages = getSelectedObject().getChildren(PortalObject.PAGE_MASK);
+ ArrayList list = new ArrayList(pages.size() + 1);
+ for (Iterator iterator = pages.iterator(); iterator.hasNext();)
+ {
+ PortalObject o = (PortalObject)iterator.next();
+ SelectItem item = new SelectItem(o.getName());
+ list.add(item);
+ }
+ list.add(new SelectItem("", "no selection"));
+ portalPageItems = (SelectItem[])list.toArray(new SelectItem[list.size()]);
}
- return properties;
+ return portalPageItems;
}
- public String getSelectedPlugin()
+ public List getSelectedObjectPath()
{
- return selectedPlugin;
+ if (selectedObjectPath == null)
+ {
+ PortalObject o = getSelectedObject();
+ ArrayList path = new ArrayList();
+ while (o != null)
+ {
+ path.add(new PortalObjectBean(o));
+ o = o.getParent();
+ }
+ Collections.reverse(path);
+ selectedObjectPath = path;
+ }
+ return selectedObjectPath;
}
- public void selectPlugin()
+ public PortalObject getSelectedObject()
{
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedPlugin = (String)pmap.get("plugin");
+ if (selectedObject == null)
+ {
+ if (selectedId == null)
+ {
+ selectedId = new PortalObjectId();
+ }
+ selectedObject = getObjectFromId(selectedId);
+ if (selectedObject instanceof Window)
+ {
+ Window window = (Window)selectedObject;
+ selectedContentType = window.getContentType();
+ Content content = window.getContent();
+ if (content != null)
+ {
+ selectedContentURI = content.getURI();
+ }
+ }
+ }
+ return selectedObject;
}
-
- public void selectParentObject(ActionEvent ae)
+
+ public PortalObjectBean getSelectedObjectBean()
{
- selectParentObject();
+ if (selectedObjectBean == null)
+ {
+ selectedObjectBean = new PortalObjectBean(getSelectedObject());
+ }
+ return selectedObjectBean;
}
- public void selectParentObject()
+ public List getSelectedProperties()
{
- setSelectedObject(getSelectedObject().getParent());
+ if (selectedProperties == null)
+ {
+ PortalObject object = getSelectedObject();
+ List properties = new ArrayList();
+ for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
+ }
+ selectedProperties = properties;
+ }
+ return selectedProperties;
}
- public void selectRootObject(ActionEvent ae)
+ // UI operations
+
+ public void selectObject(PortalObject po)
{
- setSelectedObject(portalObjectContainer.getRootObject());
+ selectObject(po.getId());
}
- public void udpateContentType()
+ private void selectObject(PortalObjectId id)
{
- // Do nothing
+ if (id == null)
+ {
+ selectedId = null;
+ selectedPlugin = null;
+ selectedContentType = ContentType.PORTLET;
+ selectedContentURI = null;
+ }
+ else
+ {
+ selectedId = id;
+ selectedPlugin = "manager";
+ selectedContentType = ContentType.PORTLET;
+ selectedContentURI = null;
+ }
}
public void selectObject(ActionEvent ae)
@@ -427,58 +529,39 @@
selectObject();
}
- /** Proceed to an object selection. */
public String selectObject()
{
- // Clear state
- selectedId = new PortalObjectId().toString(PortalObjectId.LEGACY_BASE64_FORMAT);
- selectedPlugin = null;
- selectedContentType = ContentType.PORTLET;
- selectedContentURI = null;
-
- //
String next = "portals";
-
try
{
-
// Get id
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String id = (String)pmap.get("id");
// Set the state from the id
- if (id != null)
+ PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.LEGACY_BASE64_FORMAT);
+ PortalObject object = portalObjectContainer.getObject(poid);
+
+ // Update state if possible
+ if (object != null)
{
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.LEGACY_BASE64_FORMAT);
- PortalObject object = portalObjectContainer.getObject(poid);
+ selectObject(poid);
- // Update state if possible
- if (object != null)
+ //
+ switch(object.getType())
{
- selectedId = id;
- selectedPlugin = "manager";
- switch(object.getType())
- {
- case PortalObject.TYPE_CONTEXT:
- next = "portals";
- break;
- case PortalObject.TYPE_PORTAL:
- next = "pages";
- break;
- case PortalObject.TYPE_PAGE:
- next = "pages";
- break;
- case PortalObject.TYPE_WINDOW:
- Window window = (Window)object;
- next = "windows";
- selectedContentType = window.getContentType();
- Content content = window.getContent();
- if (content != null)
- {
- selectedContentURI = content.getURI();
- }
- break;
- }
+ case PortalObject.TYPE_CONTEXT:
+ next = "portals";
+ break;
+ case PortalObject.TYPE_PORTAL:
+ next = "pages";
+ break;
+ case PortalObject.TYPE_PAGE:
+ next = "pages";
+ break;
+ case PortalObject.TYPE_WINDOW:
+ next = "windows";
+ break;
}
}
}
@@ -491,14 +574,36 @@
return next;
}
- /** Proceed to object destroy. */
+ public void selectPlugin()
+ {
+ // Get id
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ selectedPlugin = (String)pmap.get("plugin");
+ }
+
+ public void selectParentObject()
+ {
+ PortalObject current = getSelectedObject();
+ PortalObject parent = current.getParent();
+ selectObject(parent);
+ }
+
+ public void selectRootObject(ActionEvent ae)
+ {
+ PortalObject root = portalObjectContainer.getRootObject();
+ selectObject(root);
+ }
+
+ public void udpateContentType()
+ {
+ // Do nothing
+ }
+
public void destroyObject(ActionEvent ae)
{
try
{
- // Clear state
- selectedId = null;
- selectedPlugin = null;
+ selectObject((PortalObjectId)null);
// Get id
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
@@ -510,7 +615,7 @@
PortalObjectId poid = PortalObjectId.parse(id, PortalObjectId.LEGACY_BASE64_FORMAT);
PortalObject object = portalObjectContainer.getObject(poid);
- setSelectedObject(object.getParent());
+ selectObject(object.getParent());
String stringMessage = object.getName() + " has successfully been destroyed";
@@ -530,8 +635,6 @@
private List getNodes(int mask)
{
Collection test = getSelectedObject().getChildren(mask);
- // TODO: don't recreate the objects each time !
- // TODO: Use a datamodel
ArrayList result = new ArrayList();
Iterator it = test.iterator();
while (it.hasNext())
@@ -542,99 +645,6 @@
return result;
}
- public List getPortalNodes()
- {
- return getNodes(PortalObject.PORTAL_MASK);
- }
-
- public List getPageNodes()
- {
- return getNodes(PortalObject.PAGE_MASK);
- }
-
- public List getWindowNodes()
- {
- return getNodes(PortalObject.WINDOW_MASK);
- }
-
- public SelectItem[] getInstanceItems()
- {
- Collection instances = instanceContainer.getDefinitions();
-
- //sort instances by id
- List sortedInstances = new LinkedList();
- for (Iterator i = instances.iterator(); i.hasNext();)
- {
- Instance instance = (Instance)i.next();
- sortedInstances.add(instance);
- }
- try
- {
- sortInstances(sortedInstances, "id", true);
- }
- catch (Exception e)
- {
- log.warn("Error while sorting instances list");
- }
-
- ArrayList list = new ArrayList(instances.size());
- for (Iterator i = sortedInstances.iterator(); i.hasNext();)
- {
- Instance instance = (Instance)i.next();
- SelectItem item = new SelectItem(instance.getId());
- list.add(item);
- }
- return (SelectItem[])list.toArray(new SelectItem[list.size()]);
- }
-
- public SelectItem[] getPortalPageItems()
- {
- Collection pages = getSelectedObject().getChildren();
-
- ArrayList list = new ArrayList(pages.size() + 1);
- for (Iterator iterator = pages.iterator(); iterator.hasNext();)
- {
- PortalObject o = (PortalObject)iterator.next();
- if (o.getType() == PortalObject.TYPE_PAGE)
- {
- SelectItem item = new SelectItem(o.getName());
- list.add(item);
- }
-
- }
- list.add(new SelectItem("", "no selection"));
-
- return (SelectItem[])list.toArray(new SelectItem[list.size()]);
- }
-
-
- public static void sortInstances(List instances, final String column, final boolean ascending)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- Instance i1 = (Instance)o1;
- Instance i2 = (Instance)o2;
-
- if (column == null)
- {
- return 0;
- }
- if (column.equals("id"))
- {
- return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
- .compareToIgnoreCase(i1.getId());
- }
- else
- {
- return 0;
- }
- }
- };
- Collections.sort(instances, comparator);
- }
-
/** Returns a <Region,<Window>SortedSet>Map. */
private Map getWindows(Page page) throws Exception
{
@@ -713,7 +723,15 @@
return windowMap;
}
- // ****************************
+ public void refresh()
+ {
+ instanceItems = null;
+ portalPageItems = null;
+ selectedObjectPath = null;
+ selectedObject = null;
+ selectedObjectBean = null;
+ selectedProperties = null;
+ }
public class PortalObjectAuthorizationBean extends AbstractAuthorizationBean
{
@@ -755,7 +773,7 @@
//
PortalObject po = getSelectedObject();
- setSelectedObject(po.getParent());
+ selectObject(po.getParent());
//
if (po.getType() == PortalObject.TYPE_PORTAL)
@@ -923,16 +941,6 @@
}
}
- public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
- {
- return portalAuthorizationManagerFactory;
- }
-
- public void setPortalAuthorizationManagerFactory(PortalAuthorizationManagerFactory portalAuthorizationManagerFactory)
- {
- this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
- }
-
public String getPreviewURL()
{
// try
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-02 16:44:52 UTC (rev 6490)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -50,6 +50,10 @@
FacesContext ctx = phaseEvent.getFacesContext();
//
+ PortalObjectManagerBean pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
+ pomgr.refresh();
+
+ //
InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
instancemgr.refresh();
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java 2007-03-02 16:44:52 UTC (rev 6490)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/ThemePropertyAction.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -214,7 +214,7 @@
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
FacesContext.getCurrentInstance().addMessage("status", message);
}
- pomgr.setSelectedObject(po.getParent());
+ pomgr.selectObject(po.getParent());
return "portals";
}
else if (po.getType() == PortalObject.TYPE_PAGE)
@@ -225,7 +225,7 @@
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
FacesContext.getCurrentInstance().addMessage("status", message);
}
- pomgr.setSelectedObject(po.getParent());
+ pomgr.selectObject(po.getParent());
return "pages";
}
else if (po.getType() == PortalObject.TYPE_WINDOW)
@@ -236,7 +236,7 @@
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
FacesContext.getCurrentInstance().addMessage("status", message);
}
- pomgr.setSelectedObject(po.getParent());
+ pomgr.selectObject(po.getParent());
return "windows";
}
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 16:44:52 UTC (rev 6490)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-02 20:28:32 UTC (rev 6491)
@@ -37,6 +37,11 @@
<converter-class>org.jboss.portal.core.admin.ui.ContentTypeConverter</converter-class>
</converter>
+ <converter>
+ <converter-for-class>org.jboss.portal.core.model.portal.PortalObjectId</converter-for-class>
+ <converter-class>org.jboss.portal.core.admin.ui.PortalObjectIdConverter</converter-class>
+ </converter>
+
<!-- The portal object manager bean -->
<managed-bean>
<managed-bean-name>portalobjectmgr</managed-bean-name>
Modified: trunk/faces/src/main/org/jboss/portal/faces/matrix/AbstractCellAction.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/matrix/AbstractCellAction.java 2007-03-02 16:44:52 UTC (rev 6490)
+++ trunk/faces/src/main/org/jboss/portal/faces/matrix/AbstractCellAction.java 2007-03-02 20:28:32 UTC (rev 6491)
@@ -33,6 +33,7 @@
public abstract class AbstractCellAction
{
+ /** . */
private String appendedValue;
public String getAppendedValue()
@@ -88,6 +89,10 @@
deleteRow(rowIndex);
}
+ public void updateCell()
+ {
+ }
+
public abstract void deleteRow(int rowIndex);
public abstract void selectRow(int rowIndex);
17 years, 8 months
JBoss Portal SVN: r6490 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-02 11:44:52 -0500 (Fri, 02 Mar 2007)
New Revision: 6490
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/instances.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
improve admin app performances by defining a clear lifecycle for runtime state and also make the clear distinction between the different scopes of state : nav state fields / runtime state fields / wired services.
it allows to cache the runtime fields for the life cycle of the web request, probably will improve it by moving this state into a separate bean scoped at request and wired with the session beans which hold the navigational state
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 15:59:50 UTC (rev 6489)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-02 16:44:52 UTC (rev 6490)
@@ -27,6 +27,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Comparator;
+import java.util.Collections;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -64,6 +66,8 @@
/** . */
private Logger log = Logger.getLogger(getClass());
+ // Wired services
+
/** . */
private InstanceContainer instanceContainer;
@@ -73,6 +77,8 @@
/** . */
private RoleModule roleModule;
+ // Navigational state of the user
+
/** . */
private String selectedId;
@@ -83,17 +89,59 @@
private int selectedFrom;
/** . */
+ private Integer selectedRow;
+
+ /** . */
+ private final int paginationSize = 10;
+
+ // Runtime fields depending on the navigational state
+
+ /** . */
+ private Instance selectedInstance;
+
+ /** . */
private PreferencesBean selectedPreferences;
/** . */
- private Integer selectedRow;
+ private List instances;
/** . */
private AbstractAuthorizationBean auth = new AuthorizationBean();
- /** . */
- private final int paginationSize = 10;
+ // Services accessors
+ public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ {
+ return authorizationDomainRegistry;
+ }
+
+ public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ {
+ this.authorizationDomainRegistry = authorizationDomainRegistry;
+ }
+
+ public RoleModule getRoleModule()
+ {
+ return roleModule;
+ }
+
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainer instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ // Navigational state accessor
+
public int getPaginationSize()
{
return paginationSize;
@@ -119,16 +167,6 @@
this.selectedRow = selectedRow;
}
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
-
- public void setInstanceContainer(InstanceContainer instanceContainer)
- {
- this.instanceContainer = instanceContainer;
- }
-
public String getSelectedId()
{
return selectedId;
@@ -139,26 +177,18 @@
this.selectedId = selectedId;
}
- public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ public String getSelectedPlugin()
{
- return authorizationDomainRegistry;
+ return selectedPlugin;
}
- public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ public void setSelectedPlugin(String selectedPlugin)
{
- this.authorizationDomainRegistry = authorizationDomainRegistry;
+ this.selectedPlugin = selectedPlugin;
}
- public RoleModule getRoleModule()
- {
- return roleModule;
- }
+ // Runtime fields
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
public DomainConfigurator getDomainConfigurator()
{
return authorizationDomainRegistry.getDomain("instance").getConfigurator();
@@ -166,62 +196,123 @@
public Instance getSelectedInstance()
{
- if (selectedId != null)
+ if (selectedInstance == null && selectedId != null)
{
- return instanceContainer.getDefinition(selectedId);
+ selectedInstance = instanceContainer.getDefinition(selectedId);
}
- else
- {
- return null;
- }
+ return selectedInstance;
}
public PreferencesBean getSelectedPreferences()
{
+ Instance selectedInstance = getSelectedInstance();
+
+ //
+ if (selectedInstance != null)
+ {
+ try
+ {
+ PreferencesInfo prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
+ if (prefsInfo != null)
+ {
+ 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);
+ }
+ }
+ }
+ 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());
+ }
+ }
return selectedPreferences;
}
- public String getSelectedPlugin()
+ public AbstractAuthorizationBean getAuth()
{
- return selectedPlugin;
+ return auth;
}
- public void setSelectedPlugin(String selectedPlugin)
+ private List getInstances()
{
- this.selectedPlugin = selectedPlugin;
- }
+ if (instances == null)
+ {
+ instances = new ArrayList(instanceContainer.getDefinitions());
+ Collections.sort(instances, comparator);
+ }
- public AbstractAuthorizationBean getAuth()
- {
- return auth;
+ //
+ return instances;
}
/** Return an array of all instances known in this container. */
- public Collection getInstances()
+ public Collection getSelectedInstances()
{
- List instances = new ArrayList(instanceContainer.getDefinitions());
+ List list = getInstances();
-// try
-// {
-// sortInstances(instances, sortColumn, sortAscending);
-// }
-// catch (Exception e)
-// {
-// log.warn("Error during sorting instances list");
-// }
-
//
- int to = Math.min(selectedFrom + 10, instances.size());
+ int to = Math.min(selectedFrom + 10, list.size());
//
- return instances.subList(selectedFrom, to);
+ return list.subList(selectedFrom, to);
}
public int getInstanceCount()
{
- return instanceContainer.getDefinitions().size();
+ return getInstances().size();
}
+ /** Refresh the selected prefs. */
+ public void refresh()
+ {
+ selectedPreferences = null;
+ selectedInstance = null;
+ instances = null;
+ }
+
+ // UI operations
+
public void selectFrom()
{
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
@@ -273,125 +364,17 @@
}
}
- /** Refresh the selected prefs. */
- public void refresh()
+ /** A comparator for portlets. */
+ final Comparator comparator = new Comparator()
{
- selectedPreferences = null;
-
- //
- if ("preferences".equals(selectedPlugin))
+ public int compare(Object o1, Object o2)
{
- Instance selectedInstance = getSelectedInstance();
-
- //
- if (selectedInstance != null)
- {
- try
- {
- PreferencesInfo prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
- if (prefsInfo != null)
- {
- 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);
- }
- }
- }
- 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());
- }
- }
+ Instance i1 = (Instance)o1;
+ Instance i2 = (Instance)o2;
+ return i1.getId().compareToIgnoreCase(i2.getId());
}
- }
+ };
-// public static void sortInstances(List instances, final String column, final boolean ascending)
-// {
-// Comparator comparator = new Comparator()
-// {
-// public int compare(Object o1, Object o2)
-// {
-// if (column == null)
-// {
-// return 0;
-// }
-// if (column.equals("id"))
-// {
-// Instance i1 = (Instance)((Object[])o1)[0];
-// Instance i2 = (Instance)((Object[])o2)[0];
-// return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
-// .compareToIgnoreCase(i1.getId());
-// }
-// if (column.equals("portlet"))
-// {
-// Portlet p1 = (Portlet)((Object[])o1)[1];
-// Portlet p2 = (Portlet)((Object[])o2)[1];
-//
-// LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
-// FacesContext ctx = FacesContext.getCurrentInstance();
-// Locale locale = ctx.getExternalContext().getRequestLocale();
-// String name1 = displayName.getString(locale, true);
-// displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
-// String name2 = displayName.getString(locale, true);
-//
-// if (name1 == null || name2 == null)
-// {
-// return 0;
-// }
-//
-// return ascending ? name1.compareToIgnoreCase(name2) : name2
-// .compareToIgnoreCase(name1);
-// }
-//
-// else
-// {
-// return 0;
-// }
-// }
-// };
-// Collections.sort(instances, comparator);
-// }
-
public class AuthorizationBean extends AbstractAuthorizationBean
{
@@ -461,4 +444,52 @@
DelegatingPropertyResolver.registerDecorator(InstanceDefinition.class, instanceDecorator);
}
+// public static void sortInstances(List instances, final String column, final boolean ascending)
+// {
+// Comparator comparator = new Comparator()
+// {
+// public int compare(Object o1, Object o2)
+// {
+// if (column == null)
+// {
+// return 0;
+// }
+// if (column.equals("id"))
+// {
+// Instance i1 = (Instance)((Object[])o1)[0];
+// Instance i2 = (Instance)((Object[])o2)[0];
+// return ascending ? i1.getId().compareToIgnoreCase(i2.getId()) : i2.getId()
+// .compareToIgnoreCase(i1.getId());
+// }
+// if (column.equals("portlet"))
+// {
+// Portlet p1 = (Portlet)((Object[])o1)[1];
+// Portlet p2 = (Portlet)((Object[])o2)[1];
+//
+// LocalizedString displayName = p1.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+// FacesContext ctx = FacesContext.getCurrentInstance();
+// Locale locale = ctx.getExternalContext().getRequestLocale();
+// String name1 = displayName.getString(locale, true);
+// displayName = p2.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+// String name2 = displayName.getString(locale, true);
+//
+// if (name1 == null || name2 == null)
+// {
+// return 0;
+// }
+//
+// return ascending ? name1.compareToIgnoreCase(name2) : name2
+// .compareToIgnoreCase(name1);
+// }
+//
+// else
+// {
+// return 0;
+// }
+// }
+// };
+// Collections.sort(instances, 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 15:59:50 UTC (rev 6489)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-02 16:44:52 UTC (rev 6490)
@@ -65,6 +65,8 @@
/** . */
private Logger log = Logger.getLogger(getClass());
+ // Wired services
+
/** . */
private InstanceContainer instanceContainer;
@@ -72,47 +74,70 @@
private AuthorizationDomainRegistry authorizationDomainRegistry;
/** . */
+ private RoleModule roleModule;
+
+ /** . */
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ // Navigational state
+
+ /** . */
+ private int selectedFrom;
+
+ /** . */
+ private final int paginationSize = 10;
+
+ /** . */
private String selectedPortletId;
/** The current tab name. */
private String selectedPlugin;
/** . */
- private RoleModule roleModule;
+ private String selectedPortletInvokerId;
+ // Runtime state
+
/** . */
- private PreferencesBean selectedPreferences;
+ private AbstractAuthorizationBean auth = new AuthorizationBean();
/** . */
- private String selectedFederatedId;
+ private PreferencesBean selectedPreferences;
/** . */
- private AbstractAuthorizationBean auth = new AuthorizationBean();
+ private Portlet selectedPortlet;
/** . */
- private FederatingPortletInvoker federatingPortletInvoker;
+ private Collection portletInvokerItems;
/** . */
- private int selectedFrom;
+ private List portlets;
/** . */
- private final int paginationSize = 10;
+ private FederatedPortletInvoker selectedPortletInvoker;
- public int getPaginationSize()
+ // Wired services
+
+ public InstanceContainer getInstanceContainer()
{
- return paginationSize;
+ return instanceContainer;
}
- public int getSelectedFrom()
+ public void setInstanceContainer(InstanceContainer instanceContainer)
{
- return selectedFrom;
+ this.instanceContainer = instanceContainer;
}
- public void setSelectedFrom(int selectedFrom)
+ public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
{
- this.selectedFrom = selectedFrom;
+ return authorizationDomainRegistry;
}
+ public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ {
+ this.authorizationDomainRegistry = authorizationDomainRegistry;
+ }
+
public RoleModule getRoleModule()
{
return roleModule;
@@ -123,44 +148,31 @@
this.roleModule = roleModule;
}
- private PortletInvoker getPortletInvoker()
+ public FederatingPortletInvoker getFederatingPortletInvoker()
{
- return federatingPortletInvoker.getFederatedInvoker(selectedFederatedId);
+ return federatingPortletInvoker;
}
- public Collection getFederatedIds()
+ public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
{
- ArrayList toto = new ArrayList();
- toto.add(new SelectItem("local"));
- for (Iterator i = federatingPortletInvoker.getFederatedInvokers().iterator(); i.hasNext();)
- {
- FederatedPortletInvoker federated = (FederatedPortletInvoker)i.next();
- if ("local".equals(federated.getId()) == false)
- {
- toto.add(new SelectItem(federated.getId()));
- }
- }
- return toto;
+ this.federatingPortletInvoker = federatingPortletInvoker;
}
- public InstanceContainer getInstanceContainer()
- {
- return instanceContainer;
- }
+ // Navigational state
- public void setInstanceContainer(InstanceContainer instanceContainer)
+ public int getPaginationSize()
{
- this.instanceContainer = instanceContainer;
+ return paginationSize;
}
- public AuthorizationDomainRegistry getAuthorizationDomainRegistry()
+ public int getSelectedFrom()
{
- return authorizationDomainRegistry;
+ return selectedFrom;
}
- public void setAuthorizationDomainRegistry(AuthorizationDomainRegistry authorizationDomainRegistry)
+ public void setSelectedFrom(int selectedFrom)
{
- this.authorizationDomainRegistry = authorizationDomainRegistry;
+ this.selectedFrom = selectedFrom;
}
public String getSelectedPlugin()
@@ -173,46 +185,110 @@
this.selectedPlugin = selectedPlugin;
}
- public String getSelectedFederatedId()
+ public String getSelectedPortletInvokerId()
{
- return selectedFederatedId;
+ return selectedPortletInvokerId;
}
- public void setSelectedFederatedId(String selectedFederatedId)
+ public void setSelectedPortletInvokerId(String selectedPortletInvokerId)
{
- this.selectedFederatedId = selectedFederatedId;
+ this.selectedPortletInvokerId = selectedPortletInvokerId;
}
- public FederatingPortletInvoker getFederatingPortletInvoker()
+ // Runtime state
+
+ private PortletInvoker getSelectedPortletInvoker()
{
- return federatingPortletInvoker;
+ if (selectedPortletInvoker == null)
+ {
+ selectedPortletInvoker = federatingPortletInvoker.getFederatedInvoker(selectedPortletInvokerId);
+ }
+ return selectedPortletInvoker;
}
- public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
+ public Collection getPortletInvokerItems()
{
- this.federatingPortletInvoker = federatingPortletInvoker;
+ if (portletInvokerItems == null)
+ {
+ portletInvokerItems = new ArrayList();
+ portletInvokerItems.add(new SelectItem("local"));
+ for (Iterator i = federatingPortletInvoker.getFederatedInvokers().iterator(); i.hasNext();)
+ {
+ FederatedPortletInvoker federated = (FederatedPortletInvoker)i.next();
+ if ("local".equals(federated.getId()) == false)
+ {
+ portletInvokerItems.add(new SelectItem(federated.getId()));
+ }
+ }
+ }
+ return portletInvokerItems;
}
public PreferencesBean getSelectedPreferences()
{
+ // Get user locale
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+
+ // Get portlet
+ Portlet portlet = getSelectedPortlet();
+
+ //
+ if (portlet != null)
+ {
+ // Get preferences info
+ PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
+
+ // 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++)
+ {
+ 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());
+ }
+
+ //
+ selectedPreferences = new PreferencesBean(model);
+ }
+ }
return selectedPreferences;
}
- public Collection getPortlets()
+ private List getPortlets()
{
try
{
- // Get portlets
- List portlets = new ArrayList(getPortletInvoker().getPortlets());
-
- // Sort
- Collections.sort(portlets, comparator);
-
- // Compute upper bound
- int to = Math.min(selectedFrom + 10, portlets.size());
-
- // Range
- return portlets.subList(selectedFrom, to);
+ if (portlets == null)
+ {
+ portlets = new ArrayList(getSelectedPortletInvoker().getPortlets());
+ Collections.sort(portlets, comparator);
+ }
+ return portlets;
}
catch (PortletInvokerException e)
{
@@ -221,16 +297,20 @@
}
}
+ public Collection getSelectedPortlets()
+ {
+ List portlets = getPortlets();
+
+ // Compute upper bound
+ int to = Math.min(selectedFrom + 10, portlets.size());
+
+ // Range
+ return portlets.subList(selectedFrom, to);
+ }
+
public int getPortletCount()
{
- try
- {
- return getPortletInvoker().getPortlets().size();
- }
- catch (PortletInvokerException e)
- {
- return 0;
- }
+ return getPortlets().size();
}
public DomainConfigurator getDomainConfigurator()
@@ -245,26 +325,24 @@
public Portlet getSelectedPortlet()
{
- if (selectedPortletId != null)
+ if (selectedPortlet == null && selectedPortletId != null)
{
try
{
- return getPortletInvoker().getPortlet(PortletContext.createPortletContext(selectedPortletId));
+ selectedPortlet = getSelectedPortletInvoker().getPortlet(PortletContext.createPortletContext(selectedPortletId));
}
catch (PortletInvokerException e)
{
// todo: find a way to report these errors to the user
log.warn("Portlet invoker unavailable for portlet: " + selectedPortletId
+ ". Returning null instead.\nReason:\n\t" + e.getLocalizedMessage());
- return null;
}
}
- else
- {
- return null;
- }
+ return selectedPortlet;
}
+ // UI actions
+
public String selectPortlet()
{
FacesContext ctx = FacesContext.getCurrentInstance();
@@ -279,10 +357,10 @@
FederatedPortlet portlet = (FederatedPortlet)federatingPortletInvoker.getPortlet(portletCtx);
//
- selectedFederatedId = portlet.getFederatedId();
+ selectedPortletInvokerId = portlet.getFederatedId();
// Get sorted portlets
- List portlets = new ArrayList(getPortletInvoker().getPortlets());
+ List portlets = new ArrayList(getSelectedPortletInvoker().getPortlets());
Collections.sort(portlets, comparator);
// Find the portlet index in the list
@@ -317,61 +395,10 @@
public void refresh()
{
selectedPreferences = null;
-
- //
- if ("preferences".equals(selectedPlugin))
- {
- // Get user locale
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
-
- // Get portlet
- Portlet portlet = getSelectedPortlet();
-
- //
- if (portlet != null)
- {
- // Get preferences info
- PreferencesInfo prefsInfo = portlet.getInfo().getPreferences();
-
- // 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++)
- {
- 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());
- }
-
- //
- selectedPreferences = new PreferencesBean(model);
- }
- }
- }
+ selectedPortlet = null;
+ selectedPortletInvoker = null;
+ portlets = null;
+ portletInvokerItems = null;
}
/** A comparator for portlets. */
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 15:59:50 UTC (rev 6489)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-02 16:44:52 UTC (rev 6490)
@@ -167,7 +167,7 @@
<value>#{applicationScope.FederatingPortletInvoker}</value>
</managed-property>
<managed-property>
- <property-name>selectedFederatedId</property-name>
+ <property-name>selectedPortletInvokerId</property-name>
<value>local</value>
</managed-property>
</managed-bean>
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 15:59:50 UTC (rev 6489)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-03-02 16:44:52 UTC (rev 6490)
@@ -20,7 +20,7 @@
</tr>
</thead>
<tbody>
- <c:forEach items="#{instancemgr.instances}" var="instance" varStatus="status">
+ <c:forEach items="#{instancemgr.selectedInstances}" var="instance" varStatus="status">
<tr class="#{instance.id == instancemgr.selectedId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
<td>
<h:commandLink action="#{instancemgr.selectInstance}">
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 15:59:50 UTC (rev 6489)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-03-02 16:44:52 UTC (rev 6490)
@@ -15,8 +15,8 @@
<h:outputLabel for="menu">
<h:outputText value="Portlet provider: " styleClass="portlet-form-field-label"/>
</h:outputLabel>
- <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedFederatedId}">
- <f:selectItems value="#{portletmgr.federatedIds}"/>
+ <h:selectOneMenu id="menu" styleClass="portlet-form-field" value="#{portletmgr.selectedPortletInvokerId}">
+ <f:selectItems value="#{portletmgr.portletInvokerItems}"/>
</h:selectOneMenu>
<h:commandButton value="Change" styleClass="portlet-form-button"/>
</h:form>
@@ -33,7 +33,7 @@
</tr>
</thead>
<tbody>
- <c:forEach items="#{portletmgr.portlets}" var="portlet" varStatus="status">
+ <c:forEach items="#{portletmgr.selectedPortlets}" var="portlet" varStatus="status">
<tr class="#{portlet.context.id == portletmgr.selectedPortlet.context.id ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
<td>
<h:commandLink
17 years, 8 months
JBoss Portal SVN: r6489 - in trunk: core/src/main/org/jboss/portal/core/impl/model/portal/content and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-02 10:59:50 -0500 (Fri, 02 Mar 2007)
New Revision: 6489
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
Log:
removed getURI() from the window interface since it belongs rather to the content state object.
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -61,6 +61,11 @@
return state;
}
+ public boolean isMutable()
+ {
+ return true;
+ }
+
public String getURI()
{
return getInstanceRef();
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.CustomizationManager;
+import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.core.controller.ControllerException;
@@ -150,7 +151,17 @@
// No instance means we can't continue
if (instance == null)
{
- throw new ResourceNotFoundException(window.getURI());
+ String ref = null;
+ Content content = window.getContent();
+ if (content != null)
+ {
+ ref = content.getURI();
+ }
+ if (ref == null)
+ {
+ ref = window.getId().toString();
+ }
+ throw new ResourceNotFoundException(ref);
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -40,6 +40,13 @@
LocalizedString getDisplayName();
/**
+ * Returns true if the content state can be changed.
+ *
+ * @return true if the content state can be changed
+ */
+ boolean isMutable();
+
+ /**
* Returns the content URI.
*
* @return the content URI
@@ -50,6 +57,7 @@
* Updates the content URI.
*
* @param uri the new content URI value
+ * @throws IllegalStateException if the content cannot be changed for some reason
*/
- void setURI(String uri);
+ void setURI(String uri) throws IllegalStateException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -33,9 +33,18 @@
*/
public interface Window extends PortalObject
{
- String getURI();
-
+ /**
+ * Return the window content type.
+ *
+ * @return the window content type
+ */
ContentType getContentType();
+ /**
+ * Returns the window content or null if no content can be provided. Content could not be provided
+ * if no content handler has been found in the content handler registry.
+ *
+ * @return the window content
+ */
Content getContent();
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -34,6 +34,7 @@
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -124,7 +125,17 @@
// No instance means we can't continue
if (instance == null)
{
- throw new ResourceNotFoundException(window.getURI());
+ String ref = null;
+ Content content = window.getContent();
+ if (content != null)
+ {
+ ref = content.getURI();
+ }
+ if (ref == null)
+ {
+ ref = window.getId().toString();
+ }
+ throw new ResourceNotFoundException(ref);
}
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -47,6 +47,11 @@
this.state = state;
}
+ public boolean isMutable()
+ {
+ return true;
+ }
+
public String getContextId()
{
return contextId;
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -54,6 +54,7 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.admin.ui.actions.WindowComparator;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
@@ -471,7 +472,11 @@
Window window = (Window)object;
next = "windows";
selectedContentType = window.getContentType();
- selectedContentURI = window.getURI();
+ Content content = window.getContent();
+ if (content != null)
+ {
+ selectedContentURI = content.getURI();
+ }
break;
}
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java 2007-03-01 23:07:44 UTC (rev 6488)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContent.java 2007-03-02 15:59:50 UTC (rev 6489)
@@ -48,6 +48,11 @@
return new LocalizedString(state.getURI() + " cms", Locale.ENGLISH);
}
+ public boolean isMutable()
+ {
+ return true;
+ }
+
/**
*
* @return
17 years, 8 months
JBoss Portal SVN: r6488 - in trunk: core-admin/src/bin/portal-admin-war and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-01 18:07:44 -0500 (Thu, 01 Mar 2007)
New Revision: 6488
Modified:
trunk/core-admin/src/bin/portal-admin-war/style.css
trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
Log:
improving the page layout editor
Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-03-01 18:03:53 UTC (rev 6487)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-03-01 23:07:44 UTC (rev 6488)
@@ -102,14 +102,14 @@
height: 100%;
text-align: left;
width: 100%;
- min-width: 770px;
+ min-width: 770px;
/*
position: absolute;
top: 70px;
left: 0px; / * z-index: 1; * /
/ * part of below IE hack
padding: 0 350px 0 350px; * /
- padding: 0px 100px 0px 0px;
+ padding: 0px 100px 0px 0px;
*/
}
@@ -764,11 +764,6 @@
list-style: url( images/ico_listelement.gif );
}
-input {
- font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
- font-size: 11px;
-}
-
SELECT {
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-size: 11px;
@@ -844,8 +839,9 @@
* FORMS *
*********/
input {
+ font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
+ font-size: 11px;
margin-right: 6px;
- margin-top: 3px;
}
.portlet-form-label {
Modified: trunk/core-admin/src/bin/portal-admin-war/style.css
===================================================================
--- trunk/core-admin/src/bin/portal-admin-war/style.css 2007-03-01 18:03:53 UTC (rev 6487)
+++ trunk/core-admin/src/bin/portal-admin-war/style.css 2007-03-01 23:07:44 UTC (rev 6488)
@@ -77,13 +77,31 @@
}
.admin-ui select.instanceList {
- width:16em;
+ width:11em;
}
.admin-ui select.windowList {
- width:16em;
+ width:11em;
}
+.admin-ui table.form {
+ border-spacing: 10px 4px;
+ margin-left: -10px;
+ margin-right: -10px;
+ margin-top: -4px;
+ margin-bottom: -4px;
+}
+
+.admin-ui table.form td.label {
+ text-align: right;
+ vertical-align: top;
+ padding-top: 0.4em;
+}
+
+.admin-ui table.form td.widget {
+ text-align: left;
+}
+
/* Change dashed line to solid. */
.admin-ui hr {
Modified: trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01 18:03:53 UTC (rev 6487)
+++ trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01 23:07:44 UTC (rev 6488)
@@ -7,31 +7,41 @@
xmlns:pfc="http://www.jboss.com/portal/facelet/common"
xmlns:c="http://java.sun.com/jstl/core">
- <h:selectOneListbox
- value="#{contentURI}"
- styleClass="instanceList portlet-form-field"
- onclick="#{submitFunction}"
- size="13"
- style="">
- <f:selectItems value="#{registry.editors.portlet.instanceItems}"/>
- </h:selectOneListbox>
+ <table>
+ <tr>
+ <td>
+ <h:selectOneListbox
+ value="#{contentURI}"
+ styleClass="instanceList portlet-form-field"
+ onclick="#{submitFunction}"
+ size="13"
+ style="">
+ <f:selectItems value="#{registry.editors.portlet.instanceItems}"/>
+ </h:selectOneListbox>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <pfc:context>
+ <ui:param name="instance" value="#{registry.editors.portlet.instanceMap[contentURI]}"/>
+ <ui:param name="portlet" value="#{instance.portlet}"/>
+ <c:if test="#{instance != null}">
+ <div class="portlet-font" style="float:left">
+ <div><span class="portlet-form-field-label">Portlet instance:</span> #{instance.id}</div>
+ <c:choose>
+ <c:when test="#{portlet != null}">
+ <ui:include src="/WEB-INF/jsf/common/showPortletDetails.xhtml">
+ <ui:param name="portlet" value="#{portlet}"/>
+ </ui:include>
+ </c:when>
+ <c:otherwise>The associated portlet is not available</c:otherwise>
+ </c:choose>
+ </div>
+ </c:if>
+ </pfc:context>
+ </td>
+ </tr>
+ </table>
- <pfc:context>
- <ui:param name="instance" value="#{registry.editors.portlet.instanceMap[contentURI]}"/>
- <ui:param name="portlet" value="#{instance.portlet}"/>
- <c:if test="#{instance != null}">
- <div class="portlet-font">
- <div><span class="portlet-form-field-label">Portlet instance:</span> #{instance.id}</div>
- <c:choose>
- <c:when test="#{portlet != null}">
- <ui:include src="/WEB-INF/jsf/common/showPortletDetails.xhtml">
- <ui:param name="portlet" value="#{portlet}"/>
- </ui:include>
- </c:when>
- <c:otherwise>The associated portlet is not available</c:otherwise>
- </c:choose>
- </div>
- </c:if>
- </pfc:context>
</div>
\ No newline at end of file
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 18:03:53 UTC (rev 6487)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 23:07:44 UTC (rev 6488)
@@ -60,21 +60,23 @@
</table>
</div>
<div style="float:left">
- <table>
+ <table class="form">
<tr>
- <td>
+ <td class="label">
<h:outputLabel for="windowName">
<h:outputText value="Window Name: " styleClass="portlet-form-field-label"/>
</h:outputLabel>
+ </td>
+ <td class="widget">
<h:inputText id="windowName" value="#{assignWindowsAction.windowName}" styleClass="portlet-form-input-field"/>
- <br/><h:message for="windowName" errorClass="portlet-msg-error"/>
+ <h:message for="windowName" errorClass="portlet-msg-error"/>
</td>
</tr>
<tr>
- <td>
- <h:outputLabel for="instanceId">
- <h:outputText value="Content type: " styleClass="portlet-form-field-label"/>
- </h:outputLabel>
+ <td class="label">
+ <span class="portlet-form-field-label label">Content type:</span>
+ </td>
+ <td class="widget">
<h:selectOneMenu
id="instanceId"
value="#{portalobjectmgr.selectedContentType}"
@@ -82,11 +84,14 @@
<f:selectItems value="#{registry.availableTypes}"/>
</h:selectOneMenu>
<h:commandButton value="Update" styleClass="portlet-form-button"/>
- <br/><h:message for="instanceId" errorClass="portlet-msg-error"/>
+ <h:message for="instanceId" errorClass="portlet-msg-error"/>
</td>
</tr>
<tr>
- <td>
+ <td class="label">
+ <span class="portlet-form-field-label label">Portlet instance:</span>
+ </td>
+ <td class="widget">
<ct:content
contentType="#{portalobjectmgr.selectedContentType}"
contentURI="#{portalobjectmgr.selectedContentURI}"
17 years, 8 months
JBoss Portal SVN: r6487 - in trunk: core/src/main/org/jboss/portal/core/model/content and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-01 13:03:53 -0500 (Thu, 01 Mar 2007)
New Revision: 6487
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java
trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
Log:
improving the page layout editor
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -56,6 +56,21 @@
return new LocalizedString(state.getURI() + " portlet", Locale.ENGLISH);
}
+ public ContentState getState()
+ {
+ return state;
+ }
+
+ public String getURI()
+ {
+ return getInstanceRef();
+ }
+
+ public void setURI(String uri)
+ {
+ setInstanceRef(uri);
+ }
+
/**
*
* @return
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -38,4 +38,18 @@
* @return the content display name
*/
LocalizedString getDisplayName();
+
+ /**
+ * Returns the content URI.
+ *
+ * @return the content URI
+ */
+ String getURI();
+
+ /**
+ * Updates the content URI.
+ *
+ * @param uri the new content URI value
+ */
+ void setURI(String uri);
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -61,4 +61,14 @@
{
return new LocalizedString("Null content", Locale.ENGLISH);
}
+
+ public String getURI()
+ {
+ return state.getURI();
+ }
+
+ public void setURI(String uri)
+ {
+ state.setURI(uri);
+ }
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -468,7 +468,10 @@
next = "pages";
break;
case PortalObject.TYPE_WINDOW:
+ Window window = (Window)object;
next = "windows";
+ selectedContentType = window.getContentType();
+ selectedContentURI = window.getURI();
break;
}
}
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.core.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.model.portal.Window;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssignContentToWindowAction
+{
+
+ /** . */
+ private PortalObjectManagerBean portalObjectManager;
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return portalObjectManager;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.portalObjectManager = portalObjectManager;
+ }
+
+ public void execute()
+ {
+ Window window = (Window)portalObjectManager.getSelectedObject();
+ String contentURI = portalObjectManager.getSelectedContentURI();
+ window.getContent().setURI(contentURI);
+ }
+}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java 2007-03-01 18:03:53 UTC (rev 6487)
@@ -55,6 +55,9 @@
/** . */
private final TagAttribute contentURI;
+ /** . */
+ private final TagAttribute submitFunction;
+
public ContentEditorTagHandler(TagConfig tagConfig)
{
super(tagConfig);
@@ -62,6 +65,7 @@
//
this.contentURI = this.getRequiredAttribute("contentURI");
this.contentType = this.getRequiredAttribute("contentType");
+ this.submitFunction = this.getRequiredAttribute("submitFunction");
}
public static String getContentURI()
@@ -113,10 +117,14 @@
nextHandler.apply(ctx, null);
//
- ValueExpression valueVE = contentURI.getValueExpression(ctx, Object.class);
- variableMapper.setVariable(contentURI.getLocalName(), valueVE);
+ ValueExpression contentURIVE = contentURI.getValueExpression(ctx, Object.class);
+ variableMapper.setVariable(contentURI.getLocalName(), contentURIVE);
//
+ ValueExpression submitFunctionVE = submitFunction.getValueExpression(ctx, Object.class);
+ variableMapper.setVariable(submitFunction.getLocalName(), submitFunctionVE);
+
+ //
ctx.includeFacelet(parent, url);
}
finally
Modified: trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01 18:03:53 UTC (rev 6487)
@@ -10,10 +10,12 @@
<h:selectOneListbox
value="#{contentURI}"
styleClass="instanceList portlet-form-field"
- size="13">
+ onclick="#{submitFunction}"
+ size="13"
+ style="">
<f:selectItems value="#{registry.editors.portlet.instanceItems}"/>
</h:selectOneListbox>
- <h:commandButton value="Show details" styleClass="portlet-form-button"/>
+
<pfc:context>
<ui:param name="instance" value="#{registry.editors.portlet.instanceMap[contentURI]}"/>
<ui:param name="portlet" value="#{instance.portlet}"/>
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-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-01 18:03:53 UTC (rev 6487)
@@ -107,6 +107,15 @@
<value>#{sessionScope.portalobjectmgr}</value>
</managed-property>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>assignContentToWindowAction</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AssignContentToWindowAction</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>portalObjectManager</property-name>
+ <value>#{sessionScope.portalobjectmgr}</value>
+ </managed-property>
+ </managed-bean>
<!-- The instance manager managed bean -->
<managed-bean>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 18:03:53 UTC (rev 6487)
@@ -72,13 +72,16 @@
</tr>
<tr>
<td>
+ <h:outputLabel for="instanceId">
+ <h:outputText value="Content type: " styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
<h:selectOneMenu
id="instanceId"
value="#{portalobjectmgr.selectedContentType}"
styleClass="portlet-form-field contentType">
<f:selectItems value="#{registry.availableTypes}"/>
</h:selectOneMenu>
- <h:commandButton value="Change content type" styleClass="portlet-form-button"/>
+ <h:commandButton value="Update" styleClass="portlet-form-button"/>
<br/><h:message for="instanceId" errorClass="portlet-msg-error"/>
</td>
</tr>
@@ -86,7 +89,8 @@
<td>
<ct:content
contentType="#{portalobjectmgr.selectedContentType}"
- contentURI="#{portalobjectmgr.selectedContentURI}"/>
+ contentURI="#{portalobjectmgr.selectedContentURI}"
+ submitFunction="document.layoutForm.submit()"/>
</td>
</tr>
</table>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml 2007-03-01 16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml 2007-03-01 18:03:53 UTC (rev 6487)
@@ -9,9 +9,10 @@
<h:form id="window_form">
<ct:content
- contentType="#{portalobjectmgr.selectedObject.contentType}"
- contentURI="#{portalobjectmgr.selectedObject.instanceRef}"/>
- <h:commandButton value="Change instance" styleClass="portlet-form-button"/>
+ contentType="#{portalobjectmgr.selectedContentType}"
+ contentURI="#{portalobjectmgr.selectedContentURI}"
+ submitFunction="document.window_form.submit()"/>
+ <h:commandButton value="Update" action="#{assignContentToWindowAction.execute}" styleClass="portlet-form-button"/>
</h:form>
</ui:define>
17 years, 8 months
JBoss Portal SVN: r6486 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-01 11:57:55 -0500 (Thu, 01 Mar 2007)
New Revision: 6486
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
Log:
improving the layout for page layout editor
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 16:23:10 UTC (rev 6485)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01 16:57:55 UTC (rev 6486)
@@ -13,40 +13,51 @@
<h3>You are editing the page layout</h3>
<h:form id="layoutForm">
- <div style="float:left">
- <c:forEach items="#{portalobjectmgr.regionNames}" var="regionName">
- <table>
- <tr>
- <td colspan="3" class="portlet-form-field-label">#{regionName} Region</td>
- </tr>
- <tr>
- <td>
- <div>
- <h:commandButton value="Up" id="u_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
- </div>
- <div>
- <h:commandButton value="Down" id="d_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
- </div>
- </td>
- <td>
- <h:selectManyListbox
- value="#{assignWindowsAction.assignedWindows[regionName]}"
- size="7"
- styleClass="windowList portlet-form-field">
- <f:selectItems value="#{portalobjectmgr.windowItemsMap[regionName]}"/>
- </h:selectManyListbox>
- </td>
- <td>
- <div>
- <h:commandButton value="->" id="l_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
- </div>
- <div>
- <h:commandButton value="<-" id="r_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
- </div>
- </td>
- </tr>
- </table>
- </c:forEach>
+ <div style="float:left;padding:0 2em 0 2em">
+ <table>
+ <c:forEach items="#{portalobjectmgr.regionNames}" var="regionName" varStatus="status">
+ <tbody>
+ <c:choose>
+ <c:when test="#{status.index > 0}">
+ <tr>
+ <td colspan="3" class="portlet-form-field-label" style="border-width:0px;border-top:1px dashed #d5d5d5">#{regionName} Region</td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <tr>
+ <td colspan="3" class="portlet-form-field-label">#{regionName} Region</td>
+ </tr>
+ </c:otherwise>
+ </c:choose>
+ <tr>
+ <td>
+ <div>
+ <h:commandButton value="Up" id="u_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
+ </div>
+ <div>
+ <h:commandButton value="Down" id="d_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+ value="#{assignWindowsAction.assignedWindows[regionName]}"
+ size="7"
+ styleClass="windowList portlet-form-field">
+ <f:selectItems value="#{portalobjectmgr.windowItemsMap[regionName]}"/>
+ </h:selectManyListbox>
+ </td>
+ <td>
+ <div>
+ <h:commandButton value="->" id="l_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
+ </div>
+ <div>
+ <h:commandButton value="<-" id="r_#{regionName}" actionListener="#{assignWindowsAction.execute}" styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </c:forEach>
+ </table>
</div>
<div style="float:left">
<table>
17 years, 8 months