Author: adrianc
Date: Fri May 30 11:01:42 2008 New Revision: 661798 URL: http://svn.apache.org/viewvc?rev=661798&view=rev Log: Small enhancement to the screenlet widget - you can specify if its initial state is collapsed. Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=661798&r1=661797&r2=661798&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Fri May 30 11:01:42 2008 @@ -875,6 +875,15 @@ </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute name="initially-collapsed" default="false"> + <xs:annotation><xs:documentation>When set to true, screenlet will be collapsed initially. Defaults to false.</xs:documentation></xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="padded" default="true"> <xs:annotation><xs:documentation>When set to true, screenlet content will be padded. Defaults to true.</xs:documentation></xs:annotation> <xs:simpleType> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=661798&r1=661797&r2=661798&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Fri May 30 11:01:42 2008 @@ -327,6 +327,7 @@ protected Menu tabMenu = null; protected Form navigationForm = null; protected boolean collapsible = false; + protected boolean initiallyCollapsed = false; protected boolean padded = true; protected List<ModelScreenWidget> subWidgets; @@ -334,6 +335,7 @@ super(modelScreen, screenletElement); this.idExdr = new FlexibleStringExpander(screenletElement.getAttribute("id")); this.collapsible = "true".equals(screenletElement.getAttribute("collapsible")); + this.initiallyCollapsed = "true".equals(screenletElement.getAttribute("initially-collapsed")); this.padded = !"false".equals(screenletElement.getAttribute("padded")); if (this.collapsible && UtilValidate.isEmpty(this.name) && idExdr.isEmpty()) { throw new IllegalArgumentException("Collapsible screenlets must have a name or id [" + this.modelScreen.getName() + "]"); @@ -376,12 +378,15 @@ } public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException { - boolean collapsed = false; + boolean collapsed = initiallyCollapsed; if (this.collapsible) { String preferenceKey = getPreferenceKey(context) + "_collapsed"; Map requestParameters = (Map)context.get("requestParameters"); if (requestParameters != null) { - collapsed = "true".equals(requestParameters.get(preferenceKey)); + String collapsedParam = (String) requestParameters.get(preferenceKey); + if (UtilValidate.isNotEmpty(collapsedParam)) { + collapsed = "true".equals(collapsedParam); + } } } try { @@ -403,6 +408,10 @@ return this.collapsible; } + public boolean initiallyCollapsed() { + return this.initiallyCollapsed; + } + public boolean padded() { return this.padded; } @@ -1491,3 +1500,4 @@ + |
Free forum by Nabble | Edit this page |