You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2008/05/30 20:01:42 UTC

svn commit: r661798 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/screen/ModelScreenWidget.java

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 @@
 
 
 
+



Re: svn commit: r661798 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/screen/ModelScreenWidget.java

Posted by Bilgin Ibryam <bi...@iguanait.com>.
Opentaps has this feature already and it looks really cool.
-- 
View this message in context: http://www.nabble.com/Re%3A-svn-commit%3A-r661798---in--ofbiz-trunk-framework-widget%3A-dtd-widget-screen.xsd-src-org-ofbiz-widget-screen-ModelScreenWidget.java-tp17572091p17584910.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.


Re: svn commit: r661798 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/screen/ModelScreenWidget.java

Posted by Adrian Crum <ad...@yahoo.com>.
Anil,

My plan is to use JavaScript to collapse/expand screenlet widgets. Stay tuned...

-Adrian

Anil Patel <an...@hotwaxmedia.com> wrote: Adrian,
Will it be too complex if we wanted to enhance this panel to use  
Javascript Scriptaculous Effects for show hide. It will sure save  
server round trip.

Regards
Anil Patel



On May 30, 2008, at 2:01 PM, adrianc@apache.org wrote:

> 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 @@
>                 
>             
>         
> +        
> +            When set to true,  
> screenlet will be collapsed initially. Defaults to false.> xs:documentation>
> +            
> +                
> +                    
> +                    
> +                
> +            
> +        
>         
>             When set to true,  
> screenlet content will be padded. Defaults to true.> xs:documentation>
>             
>
> 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 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 @@
>
>
>
> +
>
>



       

Re: svn commit: r661798 - in /ofbiz/trunk/framework/widget: dtd/widget-screen.xsd src/org/ofbiz/widget/screen/ModelScreenWidget.java

Posted by Anil Patel <an...@hotwaxmedia.com>.
Adrian,
Will it be too complex if we wanted to enhance this panel to use  
Javascript Scriptaculous Effects for show hide. It will sure save  
server round trip.

Regards
Anil Patel



On May 30, 2008, at 2:01 PM, adrianc@apache.org wrote:

> 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 @@
>
>
>
> +
>
>