Author: phuong_vu
Date: 2011-11-07 05:35:02 -0500 (Mon, 07 Nov 2011)
New Revision: 7996
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/Util.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationOrganizer.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
portal/trunk/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java
portal/trunk/webui/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardSelectContainer.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIApplicationList.java
Log:
GTNPORTAL-1990 NPE if an ApplicationCategory doesn't have a display name
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -58,6 +58,20 @@
public String getDisplayName()
{
+ return getDisplayName(false);
+ }
+
+ /**
+ * Return display name <br/>
+ * If it's null or empty and checkEmpty is true, return name instead
+ * @param checkEmpty
+ */
+ public String getDisplayName(boolean checkEmpty)
+ {
+ if (checkEmpty && (displayName == null || displayName.trim().length() ==
0))
+ {
+ return getName();
+ }
return displayName;
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/Util.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/Util.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/Util.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -47,7 +47,7 @@
public int compare(ApplicationCategory cate1, ApplicationCategory cate2)
{
- return cate1.getDisplayName().compareToIgnoreCase(cate2.getDisplayName());
+ return
cate1.getDisplayName(true).compareToIgnoreCase(cate2.getDisplayName(true));
}
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -136,15 +136,9 @@
UIFormInputSet uiSetting = uiForm.getChildById(FIELD_SETTING);
UIFormInputSet uiPermission = uiForm.getChildById(FIELD_PERMISSION);
category.setName(uiSetting.getUIStringInput(FIELD_NAME).getValue());
- String displayName = uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).getValue();
- if (displayName == null || displayName.length() < 1)
- {
- category.setDisplayName(category.getName());
- }
- else
- {
- category.setDisplayName(displayName);
- }
+ String displayName = uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).getValue();
+ category.setDisplayName(displayName);
+
category.setDescription(uiSetting.getUIFormTextAreaInput(FIELD_DESCRIPTION).getValue());
UIListPermissionSelector uiListPermissionSelector =
uiPermission.getChild(UIListPermissionSelector.class);
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -94,7 +94,7 @@
defaultValue = appRegService.getApplication(category.getName(),
definitionName) != null;
}
checkBoxInput = new UIFormCheckBoxInput<Boolean>("category_" +
category.getName(), null, defaultValue);
- uiInfo = new UIFormInputInfo("categoryName", null,
encoder.encode(category.getDisplayName()));
+ uiInfo = new UIFormInputInfo("categoryName", null,
encoder.encode(category.getDisplayName(true)));
uiInputSet.addChild(checkBoxInput);
uiInputSet.addChild(uiInfo);
uiTableInputSet.addChild(uiInputSet);
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -95,7 +95,7 @@
{
if (appRegService.getApplication(category.getName(), gadget_.getName()) !=
null)
{
- nameList.add(category.getDisplayName());
+ nameList.add(category.getDisplayName(true));
}
}
StringBuffer names = new StringBuffer("");
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -106,7 +106,7 @@
{
if (application.getContentId().equals(portlet_.getId()))
{
- nameList.add(category.getDisplayName());
+ nameList.add(category.getDisplayName(true));
}
}
}
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl 2011-11-07
10:35:02 UTC (rev 7996)
@@ -9,7 +9,7 @@
EntityEncoder encoder = HTMLEntityEncoder.getInstance();
-String categoryDisplayName = encoder.encode(category.getDisplayName());
+String categoryDisplayName = encoder.encode(category.getDisplayName(true));
String applicationDisplayName = encoder.encode(application.getDisplayName());
String applicationDescription = encoder.encode(application.getDescription());
%>
@@ -17,7 +17,7 @@
<div class="UIBreadcumb">
<div class="ControlIcon EditIcon"
title="<%=_ctx.appRes("UIApplicationInfo.title.editApplication")%>"
onclick="<%= uicomponent.event("EditApplication")
%>"><span></span></div>
<div class="BreadcumbInfo">
- <div class="LeftBlock" title="<%= category.getDisplayName()
%>"><%= categoryDisplayName %></div>
+ <div class="LeftBlock" title="<%= category.getDisplayName(true)
%>"><%= categoryDisplayName %></div>
<div
class="RightBlackGridArrow16x16Icon"><span></span></div>
<div class="Selected" title="<%= application.getDisplayName()
%> "><%= applicationDisplayName %></div>
</div>
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationOrganizer.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationOrganizer.gtmpl 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIApplicationOrganizer.gtmpl 2011-11-07
10:35:02 UTC (rev 7996)
@@ -28,8 +28,7 @@
boolean isSelected = false;
for(category in categories) {
cName = category.getName();
- displayName =category.getDisplayName();
- if(displayName == null || displayName.length() < 1 ) displayName = cName;
+ displayName =category.getDisplayName(true);
EntityEncoder encoder = HTMLEntityEncoder.getInstance();
displayName = encoder.encode(displayName);
if(selectedCategory != null && cName == selectedCategory.getName()) {
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIApplicationList.gtmpl 2011-11-07
10:35:02 UTC (rev 7996)
@@ -19,8 +19,7 @@
boolean isSelected = false;
for(category in categories) {
cName = category.getName();
- displayName = encoder.encode(category.getDisplayName());
- if (displayName == null || displayName.length() < 1 ) displayName = cName;
+ displayName = encoder.encode(category.getDisplayName(true));
if (selectedCategory != null && cName == selectedCategory.getName()) {
isSelected = true;
cTab = "SelectedTab";
Modified:
portal/trunk/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java
===================================================================
---
portal/trunk/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardSelectContainer.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -89,7 +89,7 @@
{
public int compare(ApplicationCategory cate1, ApplicationCategory cate2)
{
- return cate1.getDisplayName().compareToIgnoreCase(cate2.getDisplayName());
+ return
cate1.getDisplayName(true).compareToIgnoreCase(cate2.getDisplayName(true));
}
});
categories = listCategories;
Modified:
portal/trunk/webui/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardSelectContainer.gtmpl
===================================================================
---
portal/trunk/webui/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardSelectContainer.gtmpl 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/webui/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardSelectContainer.gtmpl 2011-11-07
10:35:02 UTC (rev 7996)
@@ -25,8 +25,8 @@
<% List categories = uicomponent.getCategories();
if(categories != null && categories.size() > 0){
for(category in categories){
- String categoryName = category.getDisplayName();
- categoryName = categoryName == null ? "" :
encoder.encode(categoryName);
+ String categoryName = category.getDisplayName(true);
+ categoryName = encoder.encode(categoryName);
%>
<div class="GadgetCategory" id="${category.getName()}">
<div class="GadgetTab SelectedTab"
onclick="eXo.webui.UIDashboard.onTabClick(this, 'NormalTab',
'SelectedTab')">
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIApplicationList.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIApplicationList.java 2011-11-07
08:48:21 UTC (rev 7995)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIApplicationList.java 2011-11-07
10:35:02 UTC (rev 7996)
@@ -150,7 +150,7 @@
{
public int compare(ApplicationCategory p_1, ApplicationCategory p_2)
{
- return p_1.getDisplayName().compareToIgnoreCase(p_2.getDisplayName());
+ return
p_1.getDisplayName(true).compareToIgnoreCase(p_2.getDisplayName(true));
}
};
Show replies by date