Author: jacopoc
Date: Wed Jun 20 21:45:46 2007
New Revision: 549364
URL: http://svn.apache.org/viewvc?view=rev&rev=549364
Log:
Better handling of pagination in the search inventory items by labels screen.
Modified:
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh
ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl
Modified:
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh?view=diff&rev=549364&r1=549363&r2=549364
==============================================================================
---
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh
(original)
+++
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/findInventoryItemsByLabels.bsh
Wed Jun 20 21:45:46 2007
@@ -26,6 +26,7 @@
import org.ofbiz.entity.model.DynamicViewEntity;
import org.ofbiz.entity.model.ModelKeyMap;
import org.ofbiz.entity.transaction.*;
+import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
String facilityId = parameters.get("facilityId");
@@ -61,9 +62,31 @@
List inventoryItems = null;
if (andCondition.size() > 1) {
try {
+ EntityFindOptions findOpts = new EntityFindOptions(true,
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY,
true);
beganTransaction = TransactionUtil.begin();
- inventoryItemsEli =
delegator.findListIteratorByCondition(inventoryItemAndLabelsView, new
EntityConditionList(andCondition, EntityOperator.AND), null, null, null, null);
- inventoryItems = inventoryItemsEli.getCompleteList();
+ inventoryItemsEli =
delegator.findListIteratorByCondition(inventoryItemAndLabelsView, new
EntityConditionList(andCondition, EntityOperator.AND), null, null, null,
findOpts);
+
+ // get the indexes for the partial list
+ lowIndex = ((viewIndex * viewSize) + 1);
+ highIndex = (viewIndex - 1) * viewSize;
+
+ // attempt to get the full size
+ inventoryItemsEli.last();
+ inventoryItemsSize = inventoryItemsEli.currentIndex();
+ context.put("inventoryItemsSize", inventoryItemsSize);
+ if (highIndex > inventoryItemsSize) {
+ highIndex = inventoryItemsSize;
+ }
+
+ // get the partial list for this page
+ inventoryItemsEli.beforeFirst();
+ if (inventoryItemsSize > 0) {
+ inventoryItems = inventoryItemsEli.getPartialList(lowIndex,
viewSize);
+ } else {
+ inventoryItems = new ArrayList();
+ }
+
+ // close the list iterator
inventoryItemsEli.close();
} catch (GenericEntityException e) {
String errMsg = "Failure in operation, rolling back transaction";
Modified:
ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml?view=diff&rev=549364&r1=549363&r2=549364
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
(original)
+++ ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
Wed Jun 20 21:45:46 2007
@@ -95,8 +95,8 @@
<hyperlink
target="TransferInventoryItem?facilityId=${facilityId}&inventoryItemId=${inventoryItemId}"
description="${uiLabelMap.ProductTransfer}"/>
</field>
</form>
- <form name="ListFacilityInventoryItemsNoLocations" type="list" target=""
title="" list-name="inventoryItems"
- paginate-target="SearchInventoryItemsByLabels">
+ <form name="ListFacilityInventoryItemsNoLocations" type="list" target=""
title="" list-name="inventoryItems"
+ override-list-size="${inventoryItemsSize}"
paginate-target="SearchInventoryItemsByLabels">
<field name="inventoryItemId" widget-style="buttontext">
<hyperlink
target="EditInventoryItem?inventoryItemId=${inventoryItemId}&facilityId=${facilityId}"
description="${inventoryItemId}"/>
</field>
Modified:
ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl?view=diff&rev=549364&r1=549363&r2=549364
==============================================================================
---
ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl
(original)
+++
ofbiz/trunk/applications/product/webapp/facility/facility/searchInventoryItemsByLabelsForm.ftl
Wed Jun 20 21:45:46 2007
@@ -30,7 +30,7 @@
<select name="inventoryItemLabelId_${index}">
<option></option>
<#list labels as label>
- <option value="${label.inventoryItemLabelId}" <#if
parameters["inventoryItemLabelId_" +
index]?has_content>selected</#if>>${label.description?if_exists}
[${label.inventoryItemLabelId}]</option>
+ <option value="${label.inventoryItemLabelId}" <#if
parameters["inventoryItemLabelId_" + index]?has_content &&
parameters["inventoryItemLabelId_" + index] ==
label.inventoryItemLabelId>selected</#if>>${label.description?if_exists}
[${label.inventoryItemLabelId}]</option>
</#list>
</select>
</td>