[portal-commits] JBoss Portal SVN: r9140 - in branches/JBoss_Portal_Branch_2_6/core-admin/src: resources/portal-admin-war/WEB-INF and 1 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Tue Nov 27 19:40:25 EST 2007


Author: wesleyhales
Date: 2007-11-27 19:40:25 -0500 (Tue, 27 Nov 2007)
New Revision: 9140

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/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/displayNameObject.xhtml
   branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
   branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
Log:
JBPORTAL-1805  Let a user define multiple display-name for a portal object in the admin portlet

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	2007-11-28 00:13:09 UTC (rev 9139)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java	2007-11-28 00:40:25 UTC (rev 9140)
@@ -56,11 +56,13 @@
    private String displayNameByLocale;
 
 
-   public void addDisplayName() throws ConversionException {
+   public void addDisplayName() throws ConversionException
+   {
 
-      if (newText != null)
+      if (newText != null || newText.equals(""))
       {
-         if (bean instanceof PortalObjectManagerBean) {
+         if (bean instanceof PortalObjectManagerBean)
+         {
          selectedObject = ((PortalObjectManagerBean) bean).getSelectedObject();
          }
          Locale locale = LocaleFormat.DEFAULT.getLocale(newLocale);
@@ -76,52 +78,63 @@
 
    }
 
-   public PortalObject getSelectedObject() {
+   public PortalObject getSelectedObject()
+   {
       return selectedObject;
    }
 
-   public void setSelectedObject(PortalObject selectedObject) {
+   public void setSelectedObject(PortalObject selectedObject)
+   {
       this.selectedObject = selectedObject;
    }
 
-   public String getNewText() {
+   public String getNewText()
+   {
       return newText;
    }
 
-   public void setNewText(String newText) {
+   public void setNewText(String newText)
+   {
       this.newText = newText;
    }
 
-   public SortedMap getLocales() {
+   public SortedMap getLocales()
+   {
       SortedMap set = new TreeMap();
       Locale[] localList = (Locale[]) LocaleManager.getLocales().toArray(new Locale[0]);
 
-      for (int i = 0; i < localList.length; i++) {
+      for (int i = 0; i < localList.length; i++)
+      {
          Locale thisLocale = localList[i];
          set.put(thisLocale.getLanguage(), thisLocale.getLanguage());
       }
       return set;
    }
 
-   public void setLocales(SortedMap locales) {
+   public void setLocales(SortedMap locales)
+   {
       this.locales = locales;
    }
 
-   public String getNewLocale() {
+   public String getNewLocale()
+   {
       return newLocale;
    }
 
-   public void setNewLocale(String newLocale) {
+   public void setNewLocale(String newLocale)
+   {
       this.newLocale = newLocale;
    }
 
    public Map getCurrentLocales()
    {
-      if (selectedObject != null && selectedObject.getDisplayName() != null) {
+      if (selectedObject != null && selectedObject.getDisplayName() != null)
+      {
          currentLocales = new HashMap();
          Map displayNames = selectedObject.getDisplayName().getValues();
          Iterator it = displayNames.entrySet().iterator();
-         while (it.hasNext()) {
+         while (it.hasNext())
+         {
             Map.Entry pairs = (Map.Entry) it.next();
             Locale thisLocale = (Locale)pairs.getKey();
             currentLocales.put(thisLocale.getLanguage(),getDisplayNameByLocale(thisLocale));
@@ -131,12 +144,19 @@
       return null;
    }
 
-   public String getDisplayNameByLocale(Locale locale) {
+   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
+   {
+      getCurrentLocales();   
+      return "editDisplayNames";
+   }
 
+
 }
 

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	2007-11-28 00:13:09 UTC (rev 9139)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml	2007-11-28 00:40:25 UTC (rev 9140)
@@ -309,18 +309,10 @@
       <managed-bean-name>addDisplayNameAction</managed-bean-name>
       <managed-bean-class>org.jboss.portal.core.admin.ui.actions.PortalObjectDisplayNameAction</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
-      <!--<managed-property>
-         <property-name>pageContainer</property-name>
-         <value>#{portalobjectmgr.selectedObject}</value>
-      </managed-property>-->
       <managed-property>
          <property-name>bean</property-name>
          <value>#{portalobjectmgr}</value>
       </managed-property>
-      <!--<managed-property>
-         <property-name>domainConfigurator</property-name>
-         <value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
-      </managed-property>-->
    </managed-bean>
 
    <managed-bean>
@@ -430,7 +422,7 @@
          <to-view-id>/WEB-INF/jsf/renameObject.xhtml</to-view-id>
       </navigation-case>
       <navigation-case>
-         <from-outcome>setDisplayName</from-outcome>
+         <from-outcome>editDisplayNames</from-outcome>
          <to-view-id>/WEB-INF/jsf/displayNameObject.xhtml</to-view-id>
       </navigation-case>
       <navigation-case>

Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml	2007-11-28 00:13:09 UTC (rev 9139)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml	2007-11-28 00:40:25 UTC (rev 9140)
@@ -9,17 +9,25 @@
       <ui:define name="content">
          <h3>Add Display Name</h3>
          <h:form id="displayNameForm">
-            <h:messages/>
+
+            <p class="portlet-area-header">Current Display Names</p>
+            <div class="portlet-area-body">
             <c:forEach items="#{addDisplayNameAction.currentLocales}" var="locale">
-               #{locale} - #{locale}<br/>
+               <ui:remove>
+                  <!--We should be able to do something like with el-->
+                  #{locale.key} - #{locale.value}
+               </ui:remove>
+               #{locale}<br/>
             </c:forEach>
-            <p>
+            </div>
+            <p class="portlet-area-header">Add Display Names</p>
+            <div class="portlet-area-body">
                <h:inputText id="newName" value="#{addDisplayNameAction.newText}"/>
                <h:selectOneMenu id="locales" value="#{addDisplayNameAction.newLocale}">
                   <f:selectItems value="#{addDisplayNameAction.locales}"/>
                </h:selectOneMenu>
                <h:commandButton value="Add Name" action="#{addDisplayNameAction.addDisplayName}" styleClass="portlet-form-button"/>
-            </p>
+            </div>
          </h:form>
       </ui:define>
    </ui:composition>

Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml	2007-11-28 00:13:09 UTC (rev 9139)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml	2007-11-28 00:40:25 UTC (rev 9140)
@@ -39,7 +39,7 @@
          </h:commandLink> | </h:panelGroup>
             <h:panelGroup
             rendered="#{!((portalobjectmgr.selectedObject.type == PortalObject.TYPE_PORTAL) and ((portalobjectmgr.selectedObject.name == 'admin') or (portalobjectmgr.selectedObject.name == 'template') or (portalobjectmgr.selectedObject.name == 'default')))}"><h:commandLink
-            action="setDisplayName" actionListener="#{portalobjectmgr.selectObject}" styleClass="actionDisplayName">
+            action="#{addDisplayNameAction.editDisplayNames}" actionListener="#{portalobjectmgr.selectObject}" styleClass="actionDisplayName">
             <f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
             Display Names
          </h:commandLink> | </h:panelGroup><h:commandLink action="confirm" styleClass="actionDelete"

Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml	2007-11-28 00:13:09 UTC (rev 9139)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml	2007-11-28 00:40:25 UTC (rev 9140)
@@ -48,7 +48,7 @@
          </h:panelGroup>
          <h:panelGroup
             rendered="#{(object.name != 'admin') and (object.name != 'template') and (object.name != 'default')}">
-            | <h:commandLink action="setDisplayName" actionListener="#{portalobjectmgr.selectObject}">
+            | <h:commandLink action="#{addDisplayNameAction.editDisplayNames}" actionListener="#{portalobjectmgr.selectObject}">
             <h:outputText value="Display Names"/>
             <f:param name="id" value="#{object.id}"/>
          </h:commandLink>
@@ -107,7 +107,7 @@
                                         actionListener="#{portalobjectmgr.selectObject}">
          <f:param name="id" value="#{object.id}"/>
          Rename
-      </h:commandLink> | <h:commandLink action="setDisplayName" styleClass="actionRename"
+      </h:commandLink> | <h:commandLink action="#{addDisplayNameAction.editDisplayNames}" styleClass="actionRename"
                                         actionListener="#{portalobjectmgr.selectObject}">
          <f:param name="id" value="#{object.id}"/>
          Display Names
@@ -187,7 +187,7 @@
                                         actionListener="#{portalobjectmgr.selectObject}">
          <f:param name="id" value="#{object.id}"/>
          Rename
-      </h:commandLink> | <h:commandLink action="setDisplayName" styleClass="actionRename"
+      </h:commandLink> | <h:commandLink action="#{addDisplayNameAction.editDisplayNames}" styleClass="actionRename"
                                         actionListener="#{portalobjectmgr.selectObject}">
          <f:param name="id" value="#{object.id}"/>
          Display Names




More information about the portal-commits mailing list