Author: nscavell
Date: 2012-01-11 20:18:41 -0500 (Wed, 11 Jan 2012)
New Revision: 8292
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
Log:
GTNPORTAL-2324: Gadgets without titles not handled properly in Application Registry
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2012-01-11
21:37:35 UTC (rev 8291)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/LocalGadgetData.java 2012-01-12
01:18:41 UTC (rev 8292)
@@ -85,7 +85,7 @@
// Update def
def.setDescription(prefs.getDescription());
def.setThumbnail(prefs.getThumbnail().toString()); // Do something better than
that
- def.setTitle(prefs.getTitle());
+ def.setTitle(getGadgetTitle(prefs, def.getName()));
def.setReferenceURL(prefs.getTitleUrl().toString());
// Update content
@@ -107,4 +107,18 @@
NTFile content = getGadgetContent();
return content.getLastModified();
}
+
+ private String getGadgetTitle(ModulePrefs prefs, String defaultValue)
+ {
+ String title = prefs.getDirectoryTitle();
+ if (title == null || title.trim().length() < 1)
+ {
+ title = prefs.getTitle();
+ }
+ if (title == null || title.trim().length() < 1)
+ {
+ return defaultValue;
+ }
+ return title;
+ }
}