IDEMPIERE-738 Reduce duplicate string reported by Eclipse Memory Analyzer

This commit is contained in:
Heng Sin Low 2013-03-14 18:29:58 +08:00
parent a9bde8fbb5
commit cd1ee182ed
6 changed files with 38 additions and 13 deletions

View File

@ -157,9 +157,15 @@ public class GridFieldVO implements Serializable
else if (columnName.equalsIgnoreCase("IsParent"))
vo.IsParent = "Y".equals(rs.getString (i));
else if (columnName.equalsIgnoreCase("Description"))
vo.Description = rs.getString (i);
{
String s = rs.getString (i);
vo.Description = s != null ? s.intern() : s;
}
else if (columnName.equalsIgnoreCase("Help"))
vo.Help = rs.getString (i);
{
String s = rs.getString (i);
vo.Help = s != null ? s.intern() : s;
}
else if (columnName.equalsIgnoreCase("Callout"))
vo.Callout = rs.getString (i);
else if (columnName.equalsIgnoreCase("AD_Process_ID"))

View File

@ -1381,7 +1381,21 @@ public abstract class PO
else if (DisplayType.isLOB(dt))
m_oldValues[index] = get_LOB (rs.getObject(columnName));
else if (clazz == String.class)
m_oldValues[index] = decrypt(index, rs.getString(columnName));
{
String value = (String)decrypt(index, rs.getString(columnName));
if (value != null)
{
if (get_Table_ID() == I_AD_Column.Table_ID || get_Table_ID() == I_AD_Element.Table_ID
|| get_Table_ID() == I_AD_Field.Table_ID)
{
if ("Description".equals(columnName) || "Help".equals(columnName))
{
value = value.intern();
}
}
}
m_oldValues[index] = value;
}
else
m_oldValues[index] = loadSpecial(rs, index);
// NULL

View File

@ -44,9 +44,10 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton
super.setDisabled(disabled);
if (disabled) {
LayoutUtils.addSclass("disableFilter", this);
this.setSclass(getSclass().intern());
} else {
if (this.getSclass() != null && this.getSclass().indexOf("disableFilter") >= 0)
this.setSclass(this.getSclass().replace("disableFilter", ""));
this.setSclass(this.getSclass().replace("disableFilter", "").intern());
}
}

View File

@ -555,7 +555,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
public void updateLabelStyle() {
if (getLabel() != null) {
getLabel().setStyle( (isZoomable() ? STYLE_ZOOMABLE_LABEL : "") + (isMandatoryStyle() ? STYLE_EMPTY_MANDATORY_LABEL : STYLE_NORMAL_LABEL));
String style = (isZoomable() ? STYLE_ZOOMABLE_LABEL : "") + (isMandatoryStyle() ? STYLE_EMPTY_MANDATORY_LABEL : STYLE_NORMAL_LABEL);
getLabel().setStyle(style.intern());
}
}

View File

@ -154,7 +154,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
zoomItem = new Menuitem();
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
zoomItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")));
zoomItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")).intern());
zoomItem.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
zoomItem.addEventListener(Events.ON_CLICK, this);
@ -165,7 +165,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
requeryItem = new Menuitem();
requeryItem.setAttribute(EVENT_ATTRIBUTE, REQUERY_EVENT);
requeryItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
requeryItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")).intern());
requeryItem.setImage(ThemeManager.getThemeResource("images/Refresh16.png"));
requeryItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(requeryItem);
@ -175,7 +175,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
prefItem = new Menuitem();
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
prefItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ValuePreference")));
prefItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ValuePreference")).intern());
prefItem.setImage(ThemeManager.getThemeResource("images/VPreference16.png"));
prefItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(prefItem);
@ -185,7 +185,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
newItem = new Menuitem();
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
newItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
newItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")).intern());
newItem.setImage(ThemeManager.getThemeResource("images/New16.png"));
newItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(newItem);
@ -196,7 +196,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
updateItem = new Menuitem();
updateItem.setAttribute(EVENT_ATTRIBUTE, UPDATE_EVENT);
updateItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Update")));
updateItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Update")).intern());
updateItem.setImage(ThemeManager.getThemeResource("images/InfoBPartner16.png"));
updateItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(updateItem);
@ -206,7 +206,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
{
showLocationItem = new Menuitem();
showLocationItem.setAttribute(EVENT_ATTRIBUTE, SHOWLOCATION_EVENT);
showLocationItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ShowLocation")));
showLocationItem.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ShowLocation")).intern());
showLocationItem.setImage(ThemeManager.getThemeResource("images/InfoBPartner16.png"));
showLocationItem.addEventListener(Events.ON_CLICK, this);
this.appendChild(showLocationItem);

View File

@ -121,7 +121,10 @@ public final class ThemeManager {
* @return full resource url
*/
public static String getThemeResource(String name) {
String theme = getTheme();
return ITheme.THEME_PATH_PREFIX + theme + "/" + name;
StringBuilder builder = new StringBuilder(ITheme.THEME_PATH_PREFIX);
builder.append(getTheme());
builder.append("/").append(name);
String url = builder.toString().intern();
return url;
}
}