You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bi...@apache.org on 2009/12/18 21:25:21 UTC
svn commit: r892371 - in /ofbiz/trunk: applications/accounting/widget/
applications/party/widget/partymgr/ framework/widget/dtd/
framework/widget/src/org/ofbiz/widget/form/
framework/widget/src/org/ofbiz/widget/screen/
Author: bibryam
Date: Fri Dec 18 20:25:20 2009
New Revision: 892371
URL: http://svn.apache.org/viewvc?rev=892371&view=rev
Log:
Made form paginate attribute use FlexibleStringExpander.
Modified:
ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml
ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml
ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml
ofbiz/trunk/framework/widget/dtd/widget-form.xsd
ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java
Modified: ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml Fri Dec 18 20:25:20 2009
@@ -65,7 +65,7 @@
<field name="submitButton" title="${uiLabelMap.AccountingCreateAssignment}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
- <form name="ListGlAccount" list-name="listIt" target="" title="" type="list" default-entity-name="GlAccount" paginate="false"
+ <form name="ListGlAccount" list-name="listIt" target="" title="" type="list" default-entity-name="GlAccount" paginate="${paginate}"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<actions>
<set field="entityName" value="GlAccount"/>
@@ -74,8 +74,6 @@
<field-map field-name="inputFields" from-field="parameters"/>
<field-map field-name="entityName" from-field="entityName"/>
<field-map field-name="noConditionFind" value="Y"/>
- <field-map field-name="viewIndex" from-field="viewIndex"/>
- <field-map field-name="viewSize" from-field="viewSize"/>
</service>
<property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
</actions>
Modified: ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml Fri Dec 18 20:25:20 2009
@@ -249,6 +249,7 @@
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<set field="titleProperty" value="PageTitleListAccounts"/>
<set field="pageLayoutName" value="simple-landscape"/>
+ <set field="paginate" value="false"/>
</actions>
<widgets>
<decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
Modified: ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml Fri Dec 18 20:25:20 2009
@@ -293,7 +293,7 @@
</condition>
<widgets>
<screenlet id="fin-account-summary" title="${uiLabelMap.PageTitleFinancialAccountSummary}">
- <iterate-section entry="ownedFinAccount" paginate="true" paginate-target="viewprofile" view-size="3" list="ownedFinAccountList">
+ <iterate-section entry="ownedFinAccount" paginate-target="viewprofile" view-size="3" list="ownedFinAccountList">
<section>
<actions>
<entity-condition entity-name="FinAccountTrans" list="ownedFinAccountTransList">
Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Fri Dec 18 20:25:20 2009
@@ -111,13 +111,8 @@
<xs:attribute type="xs:string" name="default-sort-field-desc-style">
<xs:annotation><xs:documentation>CSS style to used for form sort fields. Defaults to "sort-order-desc".</xs:documentation></xs:annotation>
</xs:attribute>
- <xs:attribute name="paginate" default="true">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
+ <xs:attribute type="xs:string" name="paginate">
+ <xs:annotation><xs:documentation>Indicate if this form is paginated or not, true by default.</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute type="xs:string" name="paginate-target">
<xs:annotation><xs:documentation>Target location for the [Previous] and [Next] buttons in a form with pagination. Accepts ${} notation.</xs:documentation></xs:annotation>
Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Fri Dec 18 20:25:20 2009
@@ -1125,14 +1125,9 @@
<xs:attribute type="xs:string" name="key"/>
<xs:attribute type="xs:string" name="view-size"/>
<xs:attribute type="xs:string" name="paginate-target"/>
- <xs:attribute name="paginate" default="false">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
+ <xs:attribute type="xs:string" name="paginate">
+ <xs:annotation><xs:documentation>Indicate if this section is paginated or not, true by default.</xs:documentation></xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Fri Dec 18 20:25:20 2009
@@ -100,6 +100,7 @@
protected String defaultWidgetStyle;
protected String defaultTooltipStyle;
protected String itemIndexSeparator;
+ protected FlexibleStringExpander paginate;
protected FlexibleStringExpander paginateTarget;
protected FlexibleStringExpander paginateIndexField;
protected FlexibleStringExpander paginateSizeField;
@@ -112,7 +113,6 @@
protected String paginateTargetAnchor;
protected String paginateStyle;
protected boolean separateColumns = false;
- protected boolean paginate = true;
protected boolean useRowSubmit = false;
protected FlexibleStringExpander targetWindowExdr;
protected String defaultRequiredFieldStyle;
@@ -443,8 +443,10 @@
if (this.paginateStyle == null || formElement.hasAttribute("paginate-style")) {
setPaginateStyle(formElement.getAttribute("paginate-style"));
}
+ if (this.paginate == null || formElement.hasAttribute("paginate")) {
+ this.paginate = FlexibleStringExpander.getInstance(formElement.getAttribute("paginate"));
+ }
- this.paginate = "true".equals(formElement.getAttribute("paginate"));
this.skipStart = "true".equals(formElement.getAttribute("skip-start"));
this.skipEnd = "true".equals(formElement.getAttribute("skip-end"));
this.hideHeader = "true".equals(formElement.getAttribute("hide-header"));
@@ -789,6 +791,12 @@
if ("list".equals(this.type) || "multi".equals(this.type)) {
this.incrementPaginatorNumber(context);
}
+
+ //if pagination is disabled, update the defualt view size
+ if (!getPaginate(context)) {
+ setDefaultViewSize(this.MAX_PAGE_SIZE);
+ }
+
// Populate the viewSize and viewIndex so they are available for use during form actions
context.put("viewIndex", this.getViewIndex(context));
context.put("viewSize", this.getViewSize(context));
@@ -2359,8 +2367,12 @@
return this.separateColumns;
}
- public boolean getPaginate() {
- return this.paginate;
+ public boolean getPaginate(Map<String, Object> context) {
+ if (this.paginate != null && !this.paginate.isEmpty() && UtilValidate.isNotEmpty(this.paginate.expandString(context))) {
+ return Boolean.valueOf(this.paginate.expandString(context)).booleanValue();
+ } else {
+ return true;
+ }
}
public boolean getSkipStart() {
@@ -2390,11 +2402,11 @@
public boolean getClientAutocompleteFields() {
return this.clientAutocompleteFields;
}
-
+
public void setPaginate(boolean val) {
- paginate = val;
+ this.paginate = FlexibleStringExpander.getInstance(Boolean.valueOf(val).toString());
}
-
+
public void setOverridenListSize(boolean overridenListSize) {
this.overridenListSize = overridenListSize;
}
@@ -2463,13 +2475,14 @@
private int getOverrideListSize(Map<String, Object> context) {
int listSize = 0;
String size = this.overrideListSize.expandString(context);
- if (!UtilValidate.isEmpty(size)) {
+ if (UtilValidate.isNotEmpty(size)) {
try {
listSize = Integer.parseInt(size);
} catch (NumberFormatException e) {
Debug.logError(e, "Error getting override list size from value " + size, module);
}
}
+
return listSize;
}
@@ -2496,10 +2509,9 @@
listSize = items.size();
}
- if (paginate) {
+ if (getPaginate(context)) {
viewIndex = this.getPaginateIndex(context);
viewSize = this.getPaginateSize(context);
-
lowIndex = viewIndex * viewSize;
highIndex = (viewIndex + 1) * viewSize;
} else {
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java?rev=892371&r1=892370&r2=892371&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Fri Dec 18 20:25:20 2009
@@ -59,7 +59,7 @@
protected FlexibleStringExpander entryNameExdr;
protected FlexibleStringExpander keyNameExdr;
protected FlexibleStringExpander paginateTarget;
- protected boolean paginate = true;
+ protected FlexibleStringExpander paginate;
public static int DEFAULT_PAGE_SIZE = 5;
public static int MAX_PAGE_SIZE = 10000;
@@ -84,7 +84,10 @@
this.paginateTarget = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("paginate-target"));
}
- paginate = "true".equals(iterateSectionElement.getAttribute("paginate"));
+ if (this.paginate == null || iterateSectionElement.hasAttribute("paginate")) {
+ this.paginate = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("paginate"));
+ }
+
if (iterateSectionElement.hasAttribute("view-size")) {
setViewSize(iterateSectionElement.getAttribute("view-size"));
}
@@ -161,7 +164,7 @@
setHighIndex(itemIndex + 1);
}
setActualPageSize(highIndex - lowIndex);
- if (paginate) {
+ if (getPaginate(context)) {
try {
Integer lastPageNumber = null;
Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
@@ -188,13 +191,17 @@
public String getPaginateTarget(Map<String, Object> context) {
return this.paginateTarget.expandString(context);
}
-
- public boolean getPaginate() {
- return this.paginate;
+
+ public boolean getPaginate(Map<String, Object> context) {
+ if (this.paginate != null && !this.paginate.isEmpty() && UtilValidate.isNotEmpty(this.paginate.expandString(context))) {
+ return Boolean.valueOf(this.paginate.expandString(context)).booleanValue();
+ } else {
+ return true;
+ }
}
public void setPaginate(boolean val) {
- paginate = val;
+ this.paginate = FlexibleStringExpander.getInstance(Boolean.valueOf(val).toString());
}
public void setViewIndex(int val) {
@@ -255,7 +262,7 @@
public <X> void getListLimits(Map<String, Object> context, List<X> items) {
listSize = items.size();
- if (paginate) {
+ if (getPaginate(context)) {
try {
Map<String, String> params = UtilGenerics.cast(context.get("parameters"));
String viewIndexString = params.get("VIEW_INDEX" + "_" + getPaginatorNumber(context));