Author: jonesde
Date: Mon May 31 22:40:19 2010
New Revision: 949880
URL: http://svn.apache.org/viewvc?rev=949880&view=rev
Log:
Changed the screenlet -> initially-collapsed attribute to support string
expansion, includes xsd change; this allows custom logic to determine if the
screenlet should appear collapsed or not
Modified:
ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetFactory.java
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=949880&r1=949879&r2=949880&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Mon May 31 22:40:19 2010
@@ -915,8 +915,8 @@ under the License.
<xs:attribute type="xs:string" name="title">
<xs:annotation><xs:documentation>Title text to be placed in the
screenlet title bar.</xs:documentation></xs:annotation>
</xs:attribute>
- <xs:attribute type="xs:string" name="id"/>
- <xs:attribute type="xs:string" name="name"/>
+ <xs:attribute name="id" type="xs:string"/>
+ <xs:attribute name="name" type="xs:string"/>
<xs:attribute name="collapsible" default="false">
<xs:simpleType>
<xs:restriction base="xs:token">
@@ -925,14 +925,8 @@ under the License.
</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 name="initially-collapsed" type="xs:string"
default="false">
+ <xs:annotation><xs:documentation>When set to true, screenlet will
be collapsed initially. Can be an expanded string to get the value from a
variable. Defaults to false.</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute name="save-collapsed" default="true">
<xs:annotation><xs:documentation>When set to true, screenlet
collapse status is saved as user preference. Defaults to
true.</xs:documentation></xs:annotation>
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetFactory.java?rev=949880&r1=949879&r2=949880&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetFactory.java
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetFactory.java Mon
May 31 22:40:19 2010
@@ -77,6 +77,8 @@ public class WidgetFactory {
try {
return widgetConst.newInstance(modelScreen, element);
} catch (Exception e) {
+ // log the original exception since the rethrown exception doesn't
include much info about it and hides the cause
+ Debug.logError(e, "Error getting widget for element " +
element.getTagName(), module);
throw new IllegalArgumentException(e.getMessage() + " for element
" + element.getTagName());
}
}
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=949880&r1=949879&r2=949880&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
Mon May 31 22:40:19 2010
@@ -293,7 +293,7 @@ public abstract class ModelScreenWidget
protected Menu tabMenu = null;
protected Form navigationForm = null;
protected boolean collapsible = false;
- protected boolean initiallyCollapsed = false;
+ protected FlexibleStringExpander initiallyCollapsed;
protected boolean saveCollapsed = true;
protected boolean padded = true;
protected List<ModelScreenWidget> subWidgets;
@@ -302,8 +302,8 @@ public abstract class ModelScreenWidget
super(modelScreen, screenletElement);
this.idExdr =
FlexibleStringExpander.getInstance(screenletElement.getAttribute("id"));
this.collapsible =
"true".equals(screenletElement.getAttribute("collapsible"));
- this.initiallyCollapsed =
"true".equals(screenletElement.getAttribute("initially-collapsed"));
- if (this.initiallyCollapsed) {
+ this.initiallyCollapsed =
FlexibleStringExpander.getInstance(screenletElement.getAttribute("initially-collapsed"));
+ if ("true".equals(this.initiallyCollapsed.getOriginal())) {
this.collapsible = true;
}
// By default, for a collapsible screenlet, the collapsed/expanded
status must be saved
@@ -388,7 +388,7 @@ public abstract class ModelScreenWidget
return
Boolean.valueOf((String)userPreferences.get(screenletId)).booleanValue() ;
}
- return this.initiallyCollapsed;
+ return "true".equals(this.initiallyCollapsed.expand(context));
}
public boolean saveCollapsed() {