[portal-commits] JBoss Portal SVN: r9159 - in branches/JBoss_Portal_Branch_2_6/core-admin/src: resources/portal-admin-war/WEB-INF/jsf and 1 other directory.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Wed Nov 28 05:48:22 EST 2007
Author: thomas.heute at jboss.com
Date: 2007-11-28 05:48:22 -0500 (Wed, 28 Nov 2007)
New Revision: 9159
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/jsf/displayNameObject.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
Display-name for windows are not used.
Show full language name
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 09:04:28 UTC (rev 9158)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalObjectDisplayNameAction.java 2007-11-28 10:48:22 UTC (rev 9159)
@@ -51,8 +51,6 @@
private SortedMap locales;
- private Map currentLocales;
-
private String displayNameByLocale;
public void addDisplayName() throws ConversionException
@@ -117,7 +115,8 @@
for (int i = 0; i < localList.length; i++)
{
Locale thisLocale = localList[i];
- smap.put(thisLocale.getLanguage(), thisLocale.getLanguage());
+ Locale requestedLocale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ smap.put(convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)), thisLocale.getLanguage());
}
return smap;
}
@@ -137,29 +136,32 @@
this.newLocale = newLocale;
}
- public Map getCurrentLocales()
+ public List<Value> getCurrentLocales()
{
+ selectedObject = getSelectedObject();
if (selectedObject != null && selectedObject.getDisplayName() != null)
{
- currentLocales = new HashMap();
+ 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();
- currentLocales.put(thisLocale.getLanguage(),getDisplayNameByLocale(thisLocale));
+ Locale requestedLocale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ currentLocales.add(new Value(convertLocaleDisplayName(thisLocale.getDisplayLanguage(requestedLocale)),getDisplayNameByLocale(thisLocale)));
+
}
return currentLocales;
}
return null;
}
-
+/*
public void setCurrentLocales(Map currentLocales)
{
this.currentLocales = currentLocales;
}
-
+*/
public String getDisplayNameByLocale(Locale locale)
{
Map displayNames = selectedObject.getDisplayName().getValues();
@@ -174,6 +176,52 @@
return "editDisplayNames";
}
+ 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 String text;
+
+ public Value(String localeDisplayName, String text)
+ {
+ this.localeDisplayName = localeDisplayName;
+ 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;
+ }
+
+
+ }
+
}
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 09:04:28 UTC (rev 9158)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/displayNameObject.xhtml 2007-11-28 10:48:22 UTC (rev 9159)
@@ -12,58 +12,13 @@
<p class="portlet-area-header">Current Display Names</p>
<div class="portlet-area-body">
-
- <ui:remove>
- <c:forEach items="#{addDisplayNameAction.currentLocales}" var="locale">
+ <ul>
+ <c:forEach items="#{addDisplayNameAction.currentLocales}" var="value">
<!--We should be able to do something like with el,
but it's not working so I printed out all languages :)-->
- #{locale.key} - #{locale.value}
- #{locale}<br/>
+ <li>#{value.localeDisplayName} - #{value.text}</li>
</c:forEach>
- </ui:remove>
-
- <ul>
- <f:subview id="ar_view" rendered="#{addDisplayNameAction.currentLocales['ar'] ne null}"><li>ar - #{addDisplayNameAction.currentLocales['ar']}</li></f:subview>
- <f:subview id="be_view" rendered="#{addDisplayNameAction.currentLocales['be'] ne null}"><li>be - #{addDisplayNameAction.currentLocales['be']}</li></f:subview>
- <f:subview id="bg_view" rendered="#{addDisplayNameAction.currentLocales['bg'] ne null}"><li>bg - #{addDisplayNameAction.currentLocales['bg']}</li></f:subview>
- <f:subview id="ca_view" rendered="#{addDisplayNameAction.currentLocales['ca'] ne null}"><li>ca - #{addDisplayNameAction.currentLocales['ca']}</li></f:subview>
- <f:subview id="cs_view" rendered="#{addDisplayNameAction.currentLocales['cs'] ne null}"><li>cs - #{addDisplayNameAction.currentLocales['cs']}</li></f:subview>
- <f:subview id="da_view" rendered="#{addDisplayNameAction.currentLocales['da'] ne null}"><li>da - #{addDisplayNameAction.currentLocales['da']}</li></f:subview>
- <f:subview id="de_view" rendered="#{addDisplayNameAction.currentLocales['de'] ne null}"><li>de - #{addDisplayNameAction.currentLocales['de']}</li></f:subview>
- <f:subview id="el_view" rendered="#{addDisplayNameAction.currentLocales['el'] ne null}"><li>el - #{addDisplayNameAction.currentLocales['el']}</li></f:subview>
- <f:subview id="en_view" rendered="#{addDisplayNameAction.currentLocales['en'] ne null}"><li>en - #{addDisplayNameAction.currentLocales['en']}</li></f:subview>
- <f:subview id="es_view" rendered="#{addDisplayNameAction.currentLocales['es'] ne null}"><li>es - #{addDisplayNameAction.currentLocales['es']}</li></f:subview>
- <f:subview id="et_view" rendered="#{addDisplayNameAction.currentLocales['et'] ne null}"><li>et - #{addDisplayNameAction.currentLocales['et']}</li></f:subview>
- <f:subview id="fi_view" rendered="#{addDisplayNameAction.currentLocales['fi'] ne null}"><li>fi - #{addDisplayNameAction.currentLocales['fi']}</li></f:subview>
- <f:subview id="fr_view" rendered="#{addDisplayNameAction.currentLocales['fr'] ne null}"><li>fr - #{addDisplayNameAction.currentLocales['fr']}</li></f:subview>
- <f:subview id="hi_view" rendered="#{addDisplayNameAction.currentLocales['hi'] ne null}"><li>hi - #{addDisplayNameAction.currentLocales['hi']}</li></f:subview>
- <f:subview id="hr_view" rendered="#{addDisplayNameAction.currentLocales['hr'] ne null}"><li>hr - #{addDisplayNameAction.currentLocales['hr']}</li></f:subview>
- <f:subview id="hu_view" rendered="#{addDisplayNameAction.currentLocales['hu'] ne null}"><li>hu - #{addDisplayNameAction.currentLocales['hu']}</li></f:subview>
- <f:subview id="is_view" rendered="#{addDisplayNameAction.currentLocales['is'] ne null}"><li>is - #{addDisplayNameAction.currentLocales['is']}</li></f:subview>
- <f:subview id="it_view" rendered="#{addDisplayNameAction.currentLocales['it'] ne null}"><li>it - #{addDisplayNameAction.currentLocales['it']}</li></f:subview>
- <f:subview id="iw_view" rendered="#{addDisplayNameAction.currentLocales['iw'] ne null}"><li>iw - #{addDisplayNameAction.currentLocales['iw']}</li></f:subview>
- <f:subview id="ja_view" rendered="#{addDisplayNameAction.currentLocales['ja'] ne null}"><li>ja - #{addDisplayNameAction.currentLocales['ja']}</li></f:subview>
- <f:subview id="ko_view" rendered="#{addDisplayNameAction.currentLocales['ko'] ne null}"><li>ko - #{addDisplayNameAction.currentLocales['ko']}</li></f:subview>
- <f:subview id="lt_view" rendered="#{addDisplayNameAction.currentLocales['lt'] ne null}"><li>lt - #{addDisplayNameAction.currentLocales['lt']}</li></f:subview>
- <f:subview id="lv_view" rendered="#{addDisplayNameAction.currentLocales['lv'] ne null}"><li>lv - #{addDisplayNameAction.currentLocales['lv']}</li></f:subview>
- <f:subview id="mk_view" rendered="#{addDisplayNameAction.currentLocales['mk'] ne null}"><li>mk - #{addDisplayNameAction.currentLocales['mk']}</li></f:subview>
- <f:subview id="nl_view" rendered="#{addDisplayNameAction.currentLocales['nl'] ne null}"><li>nl - #{addDisplayNameAction.currentLocales['nl']}</li></f:subview>
- <f:subview id="no_view" rendered="#{addDisplayNameAction.currentLocales['no'] ne null}"><li>no - #{addDisplayNameAction.currentLocales['no']}</li></f:subview>
- <f:subview id="pl_view" rendered="#{addDisplayNameAction.currentLocales['pl'] ne null}"><li>pl - #{addDisplayNameAction.currentLocales['pl']}</li></f:subview>
- <f:subview id="pt_view" rendered="#{addDisplayNameAction.currentLocales['pt'] ne null}"><li>pt - #{addDisplayNameAction.currentLocales['pt']}</li></f:subview>
- <f:subview id="ro_view" rendered="#{addDisplayNameAction.currentLocales['ro'] ne null}"><li>ro - #{addDisplayNameAction.currentLocales['ro']}</li></f:subview>
- <f:subview id="ru_view" rendered="#{addDisplayNameAction.currentLocales['ru'] ne null}"><li>ru - #{addDisplayNameAction.currentLocales['ru']}</li></f:subview>
- <f:subview id="sk_view" rendered="#{addDisplayNameAction.currentLocales['sk'] ne null}"><li>sk - #{addDisplayNameAction.currentLocales['sk']}</li></f:subview>
- <f:subview id="sl_view" rendered="#{addDisplayNameAction.currentLocales['sl'] ne null}"><li>sl - #{addDisplayNameAction.currentLocales['sl']}</li></f:subview>
- <f:subview id="sq_view" rendered="#{addDisplayNameAction.currentLocales['sq'] ne null}"><li>sq - #{addDisplayNameAction.currentLocales['sq']}</li></f:subview>
- <f:subview id="sv_view" rendered="#{addDisplayNameAction.currentLocales['sv'] ne null}"><li>sv - #{addDisplayNameAction.currentLocales['sv']}</li></f:subview>
- <f:subview id="th_view" rendered="#{addDisplayNameAction.currentLocales['th'] ne null}"><li>th - #{addDisplayNameAction.currentLocales['th']}</li></f:subview>
- <f:subview id="tr_view" rendered="#{addDisplayNameAction.currentLocales['tr'] ne null}"><li>tr - #{addDisplayNameAction.currentLocales['tr']}</li></f:subview>
- <f:subview id="uk_view" rendered="#{addDisplayNameAction.currentLocales['uk'] ne null}"><li>uk - #{addDisplayNameAction.currentLocales['uk']}</li></f:subview>
- <f:subview id="vi_view" rendered="#{addDisplayNameAction.currentLocales['vi'] ne null}"><li>vi - #{addDisplayNameAction.currentLocales['vi']}</li></f:subview>
- <f:subview id="zh_view" rendered="#{addDisplayNameAction.currentLocales['zh'] ne null}"><li>zh - #{addDisplayNameAction.currentLocales['zh']}</li></f:subview>
- </ul>
-
+ </ul>
</div>
<p class="portlet-area-header">Add Display Names</p>
<div class="portlet-area-body">
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 09:04:28 UTC (rev 9158)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-11-28 10:48:22 UTC (rev 9159)
@@ -187,10 +187,6 @@
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{object.id}"/>
Rename
- </h:commandLink> | <h:commandLink action="#{addDisplayNameAction.editDisplayNames}" styleClass="actionRename"
- actionListener="#{portalobjectmgr.selectObject}">
- <f:param name="id" value="#{object.id}"/>
- Display Names
</h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}"
styleClass="actionDelete">
<f:param name="id" value="#{object.id}"/>
More information about the portal-commits
mailing list