1 16 package org.apache.myfaces.bug925693; 17 import java.util.ArrayList ; 18 import java.util.List ; 19 20 public class Invoice 21 { 22 private String invoiceNumber; 23 private String purchaser; 24 private List lineItems = new ArrayList (); 25 26 public Invoice() 27 { 28 setInvoiceNumber("34324234"); 29 setPurchaser("Arthur"); 30 31 LineItem firstItem = new LineItem(); 32 firstItem.setProduct("Product 1"); 33 firstItem.setQuantity("10"); 34 35 lineItems.add(firstItem); 36 } 37 38 41 public String getInvoiceNumber() 42 { 43 return invoiceNumber; 44 } 45 46 49 public String getPurchaser() 50 { 51 return purchaser; 52 } 53 54 57 public void setInvoiceNumber(String string) 58 { 59 invoiceNumber = string; 60 } 61 62 65 public void setPurchaser(String string) 66 { 67 purchaser = string; 68 } 69 70 71 72 public void addLineItem() 73 { 74 LineItem newItem = new LineItem(); 75 newItem.setProduct("New!"); 76 77 lineItems.add(newItem); 78 } 79 public void removeLineItem() 80 { 81 lineItems.remove(lineItems.size() - 1); 83 } 84 87 public List getLineItems() 88 { 89 return lineItems; 90 } 91 92 95 public void setLineItems(List list) 96 { 97 lineItems = list; 98 } 99 100 } 101 | Popular Tags |