001: /**
002: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017: * USA
018: *
019: * Component of: Red Hat Application Server
020: *
021: * Initial Developers: Aizaz Ahmed
022: * Vivek Lakshmanan
023: * Andrew Overholt
024: * Matthew Wringe
025: *
026: */package olstore.form;
027:
028: import java.util.ArrayList;
029:
030: import olstore.dto.OrderEntry;
031:
032: //import org.apache.struts.action.ActionForm;
033: //import olstore.util.WebUtils;
034:
035: public class UpdateOrderStatusForm extends DemoBaseForm {
036:
037: private String submitType = null;
038: private ArrayList orders = new ArrayList();
039: private String numOrders = "0";
040:
041: /**
042: * This autoincrements the size of the vector, so will not return null
043: * . This is necessary as the struts auto-populater expects
044: * non-null to be retured, and we don't know how many it will
045: * request.
046: * TODO: CAN LIKELY NOW CHANGE THIS TO NOT HAVE TO RETURN
047: * A CUMBERSOME ARRAY
048: */
049: public OrderEntry getOrderEntry(int index) {
050: if (index >= orders.size()) {
051: int size = orders.size();
052: for (int i = 0; i < (index - size) + 1; i++) {
053: orders.add(new OrderEntry());
054: }
055: }
056: return (OrderEntry) orders.get(index);
057: }
058:
059: public void setOrderEntry(int index, OrderEntry order) {
060: orders.set(index, order);
061: }
062:
063: public void reset() {
064: orders.clear();
065: submitType = null;
066: numOrders = "0";
067: }
068:
069: public String getSubmitType() {
070: return submitType;
071:
072: }
073:
074: public void setSubmitType(String submitType) {
075: this .submitType = submitType;
076:
077: }
078:
079: public String getNumOrders() {
080: if (orders.size() == 0) {
081: return numOrders;
082: } else {
083: numOrders = Integer.toString(orders.size());
084: return numOrders;
085: }
086:
087: }
088:
089: public void setNumOrders(String numOrders) {
090: this .numOrders = numOrders;
091: }
092:
093: /**
094: * Returns a reference to the internal Properties, use wisely
095: */
096: public ArrayList getOrders() {
097: //if(orders.size() < Integer.parseInt(numOrders))
098: // getOrderEntry(Integer.parseInt(numOrders) - 1);
099: return orders;
100: }
101:
102: public void setOrders(ArrayList orders) {
103: this.orders = orders;
104: }
105:
106: }
|