Author: wesleyhales
Date: 2008-01-22 21:59:20 -0500 (Tue, 22 Jan 2008)
New Revision: 9574
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/DisplayNameBean.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalInstanceDisplayNameAction.java
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/showPortletDetails.xhtml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceCustomization.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/instance/Instance.java
Log:
JBPORTAL-1775 - Let a user define multiple display-name for a portlet-instance in the
admin portlet
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceCustomization.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceCustomization.java 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceCustomization.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -40,6 +40,7 @@
protected Long key;
protected PersistentInstanceDefinition relatedDefinition;
protected String customizationId;
+ protected LocalizedString displayName;
// Runtime fields
@@ -99,6 +100,11 @@
return owner.getDisplayName();
}
+ public void setDisplayName(LocalizedString localizedString)
+ {
+ this.displayName = localizedString;
+ }
+
public String getCustomizationId()
{
return customizationId;
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/instance/persistent/PersistentInstanceDefinition.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -119,6 +119,24 @@
return new LocalizedString(displayNames, Locale.ENGLISH);
}
+ public void setDisplayName(LocalizedString localizedString)
+ {
+ if (localizedString == null)
+ {
+ throw new IllegalArgumentException("No null display name accepted");
+ }
+
+ displayNames = new HashMap();
+
+ Map map = localizedString.getValues();
+ Iterator it = map.values().iterator();
+ while (it.hasNext())
+ {
+ LocalizedString.Value value = (LocalizedString.Value)it.next();
+ displayNames.put(value.getLocale(), value.getString());
+ }
+ }
+
// Hibernate
********************************************************************************************************
public Long getKey()
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/instance/Instance.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/instance/Instance.java 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/instance/Instance.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -58,6 +58,13 @@
LocalizedString getDisplayName();
/**
+ * Set the display name
+ *
+ * @param localizedString
+ */
+ void setDisplayName(LocalizedString localizedString);
+
+ /**
* Return the runtime metadata for this portlet.
*
* @return the info
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/bin/portal-admin-war/css/style.css 2008-01-23
02:59:20 UTC (rev 9574)
@@ -56,6 +56,26 @@
padding: 4px;
}
+.admin-ui dl {
+
+}
+
+.admin-ui dt {
+
+}
+
+.admin-ui dd {
+ margin:0;
+}
+
+.admin-ui .panelGrid-basic{
+ width: 100%;
+}
+
+.admin-ui .panelGrid-basic td {
+ padding: 8px;
+}
+
/* Pagination. */
.admin-ui ul.pagination {
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/DisplayNameBean.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/DisplayNameBean.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/DisplayNameBean.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -0,0 +1,158 @@
+/******************************************************************************
+ * 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.i18n.LocaleManager;
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
+ * @version $Revision: 630 $
+ */
+public class DisplayNameBean
+{
+
+
+ public Map createLocalizedStringMap(Locale locale, LocalizedString displayName, String
name)
+ {
+ Map<Locale, String> map = new HashMap<Locale, String>();
+ if (displayName != null)
+ {
+ Map<Locale, LocalizedString.Value> oldMap = displayName.getValues();
+ Collection<LocalizedString.Value> values = oldMap.values();
+ for (LocalizedString.Value value : values)
+ {
+ map.put(value.getLocale(), value.getString());
+ }
+ }
+ map.put(locale, name);
+ return map;
+ }
+
+ public SortedMap getLocales()
+ {
+ SortedMap smap = new TreeMap();
+ Locale[] localList = (Locale[])LocaleManager.getLocales().toArray(new Locale[0]);
+
+ for (int i = 0; i < localList.length; i++)
+ {
+ Locale thisLocale = localList[i];
+ Locale requestedLocale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+
smap.put(convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)),
thisLocale.getLanguage());
+ }
+ return smap;
+ }
+
+ public List populateCurrentLocales(Map displayNames)
+ {
+ List tempList = new ArrayList();
+ Iterator it = displayNames.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry pairs = (Map.Entry)it.next();
+ Locale thisLocale = (Locale)pairs.getKey();
+ Locale requestedLocale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ tempList.add(new Value(thisLocale,
convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)),
getDisplayNameByLocale(thisLocale,displayNames)));
+
+ }
+ return tempList;
+ }
+
+ private String getDisplayNameByLocale(Locale locale, Map displayNames)
+ {
+ LocalizedString.Value lsv = (LocalizedString.Value)displayNames.get(locale);
+ return lsv.getString();
+ }
+
+ private String convertLocaleDisplayName(String str)
+ {
+ if (str.length() > 0)
+ {
+ return str.substring(0, 1).toUpperCase() + str.substring(1, str.length());
+ }
+ else
+ {
+ return str;
+ }
+ }
+
+ public class Value
+ {
+ private String localeDisplayName;
+
+ private Locale locale;
+
+ private String text;
+
+ public Value(Locale locale, String localeDisplayName, String text)
+ {
+ this.localeDisplayName = localeDisplayName;
+ this.locale = locale;
+ this.text = text;
+ }
+
+ public String getLocaleDisplayName()
+ {
+ return localeDisplayName;
+ }
+
+ public void setLocaleDisplayName(String localeDisplayName)
+ {
+ this.localeDisplayName = localeDisplayName;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalInstanceDisplayNameAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalInstanceDisplayNameAction.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalInstanceDisplayNameAction.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -0,0 +1,217 @@
+/******************************************************************************
+ * 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.i18n.LocaleFormat;
+import org.jboss.portal.common.i18n.LocaleManager;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.util.ConversionException;
+import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.admin.ui.PortletManagerBean;
+import org.jboss.portal.core.admin.ui.InstanceManagerBean;
+import org.jboss.portal.core.admin.ui.DisplayNameBean;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.portal.PortalObject;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
+ * @version $Revision: 630 $
+ */
+public class PortalInstanceDisplayNameAction
+{
+ private Instance selectedInstance;
+
+ public Object bean;
+
+ private String newLocale;
+
+ private String newText;
+
+ private SortedMap locales;
+
+ private String displayNameByLocale;
+
+ private InstanceManagerBean instanceManager;
+
+ private DisplayNameBean displayNameBean;
+
+ public void addDisplayName() throws ConversionException
+ {
+ if (newText != null)
+ {
+ Instance instance = getSelectedInstance();
+ Map map =
getDisplayNameBean().createLocalizedStringMap(LocaleFormat.DEFAULT.getLocale(newLocale),instance.getDisplayName(),newText);
+ LocalizedString newLocalizedString = new LocalizedString(map, Locale.ENGLISH);
+ selectedInstance.setDisplayName(newLocalizedString);
+ }
+ else
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "You
must enter a name", "You must enter a name");
+ FacesContext.getCurrentInstance().addMessage("status", message);
+ }
+ }
+
+ public Instance getSelectedInstance()
+ {
+ if (instanceManager instanceof InstanceManagerBean)
+ {
+ selectedInstance = instanceManager.getSelectedInstance();
+ }
+ return selectedInstance;
+ }
+
+ public void setSelectedInstance(Instance selectedInstance)
+ {
+ this.selectedInstance = selectedInstance;
+ }
+
+ public String getNewText()
+ {
+ return newText;
+ }
+
+ public void setNewText(String newText)
+ {
+ this.newText = newText;
+ }
+
+ public SortedMap getLocales()
+ {
+ return getDisplayNameBean().getLocales();
+ }
+
+ public void setLocales(SortedMap locales)
+ {
+ this.locales = locales;
+ }
+
+ public String getNewLocale()
+ {
+ return newLocale;
+ }
+
+ public void setNewLocale(String newLocale)
+ {
+ this.newLocale = newLocale;
+ }
+
+ public List<DisplayNameBean.Value> getCurrentLocales()
+ {
+ selectedInstance = getSelectedInstance();
+ if (selectedInstance != null && selectedInstance.getDisplayName() != null)
+ {
+ List<DisplayNameBean.Value> currentLocales =
getDisplayNameBean().populateCurrentLocales(selectedInstance.getDisplayName().getValues());
+
+ return currentLocales;
+ }
+ return null;
+ }
+
+ public void editDisplayName()
+ {
+ String locale = getFacesParam("locale");
+ String editAction = getFacesParam("editAction");
+
+ Instance selectedInstance = getSelectedInstance();
+ LocalizedString displayName = selectedInstance.getDisplayName();
+ Map<Locale, String> map = new HashMap<Locale, String>();
+ if (displayName != null)
+ {
+ Map<Locale, LocalizedString.Value> oldMap = displayName.getValues();
+ Collection<LocalizedString.Value> values = oldMap.values();
+ if (editAction.equals("delete"))
+ {
+ for (LocalizedString.Value value : values)
+ {
+ if (!value.getLocale().toString().equals(locale.toString()))
+ {
+ map.put(value.getLocale(), value.getString());
+ }
+ }
+ }
+ if (editAction.equals("rename"))
+ {
+ for (LocalizedString.Value value : values)
+ {
+ map.put(value.getLocale(), value.getString());
+ if (value.getLocale().toString().equals(locale.toString()))
+ {
+ newText = value.getString();
+ newLocale = value.getLocale().getLanguage();
+ }
+ }
+ }
+ }
+ LocalizedString newLocalizedString = new LocalizedString(map, Locale.ENGLISH);
+ selectedInstance.setDisplayName(newLocalizedString);
+ }
+
+
+ public String getFacesParam(String param)
+ {
+ return
(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(param);
+ }
+
+
+ public String editDisplayNames() throws ConversionException
+ {
+ getSelectedInstance();
+ getCurrentLocales();
+ return "editDisplayNames";
+ }
+
+ public InstanceManagerBean getInstanceManager()
+ {
+ return instanceManager;
+ }
+
+ public void setInstanceManager(InstanceManagerBean instanceManager)
+ {
+ this.instanceManager = instanceManager;
+ }
+
+ public DisplayNameBean getDisplayNameBean()
+ {
+ if(displayNameBean == null){
+ displayNameBean = new DisplayNameBean();
+ }
+ return displayNameBean;
+ }
+
+ public void setDisplayNameBean(DisplayNameBean displayNameBean)
+ {
+ this.displayNameBean = displayNameBean;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java 2008-01-23
02:59:20 UTC (rev 9574)
@@ -27,8 +27,10 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.admin.ui.DisplayNameBean;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.instance.Instance;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
@@ -53,36 +55,25 @@
private String displayNameByLocale;
+ private DisplayNameBean displayNameBean;
+
public void addDisplayName() throws ConversionException
{
-
if (newText != null)
{
PortalObject portalObject = getSelectedObject();
- Locale locale = LocaleFormat.DEFAULT.getLocale(newLocale);
- LocalizedString displayName = portalObject.getDisplayName();
- Map<Locale, String> map = new HashMap<Locale, String>();
- if (displayName != null)
- {
- Map<Locale, LocalizedString.Value> oldMap = displayName.getValues();
- Collection<LocalizedString.Value> values = oldMap.values();
- for (LocalizedString.Value value : values)
- {
- map.put(value.getLocale(), value.getString());
- }
- }
- map.put(locale, newText);
+ Map map =
getDisplayNameBean().createLocalizedStringMap(LocaleFormat.DEFAULT.getLocale(newLocale),portalObject.getDisplayName(),newText);
LocalizedString newLocalizedString = new LocalizedString(map, Locale.ENGLISH);
- selectedObject.setDisplayName(newLocalizedString);
+ portalObject.setDisplayName(newLocalizedString);
}
else
{
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "You
must enter a name", "You must enter a name");
FacesContext.getCurrentInstance().addMessage("status", message);
}
-
}
+
public PortalObject getSelectedObject()
{
if (bean instanceof PortalObjectManagerBean)
@@ -107,51 +98,32 @@
this.newText = newText;
}
- public SortedMap getLocales()
+ public String getNewLocale()
{
- SortedMap smap = new TreeMap();
- Locale[] localList = (Locale[]) LocaleManager.getLocales().toArray(new Locale[0]);
-
- for (int i = 0; i < localList.length; i++)
- {
- Locale thisLocale = localList[i];
- Locale requestedLocale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
-
smap.put(convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)),
thisLocale.getLanguage());
- }
- return smap;
+ return newLocale;
}
- public void setLocales(SortedMap locales)
+ public void setNewLocale(String newLocale)
{
- this.locales = locales;
+ this.newLocale = newLocale;
}
- public String getNewLocale()
+ public SortedMap getLocales()
{
- return newLocale;
+ return getDisplayNameBean().getLocales();
}
- public void setNewLocale(String newLocale)
+ public void setLocales(SortedMap locales)
{
- this.newLocale = newLocale;
+ this.locales = locales;
}
- public List<Value> getCurrentLocales()
+ public List<DisplayNameBean.Value> getCurrentLocales()
{
selectedObject = getSelectedObject();
if (selectedObject != null && selectedObject.getDisplayName() != null)
{
- List<Value> currentLocales = new ArrayList<Value>();
- Map displayNames = selectedObject.getDisplayName().getValues();
- Iterator it = displayNames.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry pairs = (Map.Entry) it.next();
- Locale thisLocale = (Locale)pairs.getKey();
- Locale requestedLocale =
FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
- currentLocales.add(new Value(thisLocale,
convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)),getDisplayNameByLocale(thisLocale)));
-
- }
+ List<DisplayNameBean.Value> currentLocales =
getDisplayNameBean().populateCurrentLocales(selectedObject.getDisplayName().getValues());
return currentLocales;
}
return null;
@@ -196,23 +168,10 @@
selectedObject.setDisplayName(newLocalizedString);
}
-
public String getFacesParam(String param){
return
(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(param);
}
-/*
- public void setCurrentLocales(Map currentLocales)
- {
- this.currentLocales = currentLocales;
- }
-*/
- public String getDisplayNameByLocale(Locale locale)
- {
- Map displayNames = selectedObject.getDisplayName().getValues();
- LocalizedString.Value lsv = (LocalizedString.Value)displayNames.get(locale);
- return lsv.getString();
- }
public String editDisplayNames() throws ConversionException
{
@@ -221,66 +180,17 @@
return "editDisplayNames";
}
-
-
- private String convertLocaleDisplayName(String str)
+ public DisplayNameBean getDisplayNameBean()
{
- if (str.length() > 0)
- {
- return str.substring(0,1).toUpperCase() + str.substring(1, str.length());
+ if(displayNameBean == null){
+ displayNameBean = new DisplayNameBean();
}
- else
- {
- return str;
- }
+ return displayNameBean;
}
-
- public class Value
- {
- private String localeDisplayName;
-
- private Locale locale;
-
- private String text;
-
- public Value(Locale locale, String localeDisplayName, String text)
- {
- this.localeDisplayName = localeDisplayName;
- this.locale = locale;
- this.text = text;
- }
- public String getLocaleDisplayName()
- {
- return localeDisplayName;
- }
-
- public void setLocaleDisplayName(String localeDisplayName)
- {
- this.localeDisplayName = localeDisplayName;
- }
-
- public String getText()
- {
- return text;
- }
-
- public void setText(String text)
- {
- this.text = text;
- }
-
- public Locale getLocale()
- {
- return locale;
- }
-
- public void setLocale(Locale locale)
- {
- this.locale = locale;
- }
-
-
+ public void setDisplayNameBean(DisplayNameBean displayNameBean)
+ {
+ this.displayNameBean = displayNameBean;
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-01-23
02:59:20 UTC (rev 9574)
@@ -244,6 +244,8 @@
</managed-property>
</managed-bean>
+
+
<!--
| Dashboard beans
-->
@@ -316,6 +318,16 @@
</managed-bean>
<managed-bean>
+ <managed-bean-name>instanceDisplayNameAction</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.PortalInstanceDisplayNameAction</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>instanceManager</property-name>
+ <value>#{sessionScope.instancemgr}</value>
+ </managed-property>
+ </managed-bean>
+
+ <managed-bean>
<managed-bean-name>renameDashboardPageAction</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.RenameAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/showPortletDetails.xhtml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/showPortletDetails.xhtml 2008-01-22
21:53:15 UTC (rev 9573)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/showPortletDetails.xhtml 2008-01-23
02:59:20 UTC (rev 9574)
@@ -5,35 +5,114 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <table>
- <tr>
- <td class="portlet-form-field-label">Portlet name:</td>
- <td><h:form><h:commandLink
+ <h:form>
+ <p class="portlet-area-header">Portlet Instance
Information</p>
+ <h:panelGrid columns="3" styleClass="panelGrid-basic">
+ <f:subview id="field1">
+ <dl>
+ <dt class="portlet-form-field-label">Portlet name:</dt>
+ <dd><h:commandLink
action="#{portletmgr.selectPortlet}">
<f:param name="id" value="#{portlet.context.id}"/>
<f:param name="plugin" value="manager"/>
#{portlet.name}
- </h:commandLink></h:form></td>
- </tr>
- <tr>
- <td class="portlet-form-field-label">Portlet
description:</td>
- <td>#{portlet.description.value}</td>
- </tr>
- <tr>
- <td class="portlet-form-field-label">Portlet title:</td>
- <td>#{portlet.title.value}</td>
- </tr>
- <tr>
- <td class="portlet-form-field-label">Portlet
keywords:</td>
- <td>#{portlet.keywords.value}</td>
- </tr>
- <c:if test="#{not empty portlet.locales}">
- <tr>
- <td class="portlet-form-field-label">Portlet
locales:</td>
- <td>
- <c:forEach items="#{portlet.locales}"
var="locale"> #{locale} </c:forEach>
- </td>
- </tr>
- </c:if>
- </table>
+ </h:commandLink></dd>
+ </dl>
+ </f:subview>
+ <f:subview id="field2">
+ <dl>
+ <dt class="portlet-form-field-label">Portlet
description:</dt>
+ <dd>#{portlet.description.value}</dd>
+ </dl>
+ </f:subview>
+ <f:subview id="field3">
+ <dl>
+ <dt class="portlet-form-field-label">Portlet
title:</dt>
+ <dd>#{portlet.title.value}</dd>
+ </dl>
+ </f:subview>
+ <f:subview id="field4">
+ <dl>
+ <dt class="portlet-form-field-label">Portlet
keywords:</dt>
+ <dd>#{portlet.keywords.value}</dd>
+ </dl>
+ </f:subview>
+ <f:subview id="field5" rendered="#{not empty
portlet.locales}">
+ <dl>
+ <dt class="portlet-form-field-label">Portlet
locales:</dt>
+ <dd><c:forEach items="#{portlet.locales}"
var="locale"> #{locale} </c:forEach></dd>
+ </dl>
+ </f:subview>
+ </h:panelGrid>
+ <br/>
+ <p class="portlet-area-header">Portlet Instance Display
Names</p>
+ </h:form>
+
+ <div class="float-left third-width-pad5">
+ <h:form id="displayNameForm">
+ <h3 class="sectionTitle zero">Add Instance Display
Names</h3>
+
+ <div class="portlet-area-body">
+ <h:inputText id="newName"
value="#{instanceDisplayNameAction.newText}" required="true"/>
+ <h:selectOneMenu id="locales"
value="#{instanceDisplayNameAction.newLocale}">
+ <f:selectItems
value="#{instanceDisplayNameAction.locales}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="#{instanceDisplayNameAction.newText ne
null ? 'Modify' : 'Add'} Name"
action="#{instanceDisplayNameAction.addDisplayName}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </h:form>
+ </div>
+
+ <div class="float-left two-third-width-pad5">
+ <h:form>
+ <h3 class="sectionTitle zero">Current Instance Display
Names</h3>
+
+ <div class="portlet-area-body">
+
+ <h:dataTable var="value"
value="#{instanceDisplayNameAction.currentLocales}" styleClass="objectList
datatable"
+
rowClasses="portlet-section-body,portlet-section-alternate"
+ columnClasses="objectNameColumn,
objectActionColumn"
+ headerClass="portlet-section-header">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Locale"/>
+ </f:facet>
+ #{value.localeDisplayName}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Display Name"/>
+ </f:facet>
+ #{value.text}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Delete"/>
+ </f:facet>
+
+ <div style="width:150px"><h:commandLink
action="#{instanceDisplayNameAction.editDisplayName}">
+ <h:outputText styleClass="actionDelete"
value="Delete"/>
+ <f:param name="locale"
value="#{value.locale}"/>
+ <f:param name="editAction"
value="delete"/>
+ </h:commandLink></div>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Rename"/>
+ </f:facet>
+
+ <div style="width:150px"><h:commandLink
action="#{instanceDisplayNameAction.editDisplayName}">
+ <h:outputText styleClass="actionRename"
value="Rename"/>
+ <f:param name="locale"
value="#{value.locale}"/>
+ <f:param name="editAction"
value="rename"/>
+ </h:commandLink></div>
+ </h:column>
+ </h:dataTable>
+
+ </div>
+ </h:form>
+
+ </div>
+
+
</div>
\ No newline at end of file