001 import sale.*; 002 import data.ooimpl.*; 003 import data.stdforms.*; 004 005 006 /** 007 * Erzeugt eine Tabelle, sowie notwendige Buttons für die 008 * Angebotsanzeige. 009 */ 010 public class DefaultCounterFormCreator extends FormSheetContentCreator 011 { 012 013 //// constructor /////////////////////////////////////////////////////////// 014 015 /** 016 * Konstruktor. 017 */ 018 public DefaultCounterFormCreator() 019 { 020 super(); 021 } 022 023 024 //// public methods /////////////////////////////////////////////////////// 025 026 027 /** 028 * Erzeugt den <CODE>FormSheetContent</CODE>, also Tabelle(n) und 029 * Buttons. Als Parameter wird das zu bearbeitende <CODE>FormSheet</CODE> 030 * übergeben. 031 */ 032 public void createFormSheetContent(FormSheet map) 033 { 034 035 // heraussuchen des Videobestandes zur Darstellung in der Tabelle 036 CountingStockImpl cs = 037 (CountingStockImpl)Shop.getTheShop().getStock("Video-Countingstock"); 038 039 // erstellen des FormSheets mit der Tabelle des Bestandes als Inhalt 040 FormSheet fs = SingleTableFormSheet.create("Available Videocassettes", 041 cs, null, new OfferTED(false)); 042 043 // die Tabelle holen und dem uebergebenen FormSheet als Komponente zuweisen 044 map.setComponent(fs.getComponent()); 045 046 // alle Buttons entfernen 047 map.removeAllButtons(); 048 049 map.addButton ("rent", 1, 050 new sale.Action() 051 { 052 public void doAction(SaleProcess p, SalesPoint s) 053 { 054 // Code zum Ausfuehren des Verleihvorgangs 055 s.runProcess(new RentProcess()); 056 } 057 } 058 ); 059 060 map.addButton ("give back", 2, 061 new sale.Action() 062 { 063 public void doAction(SaleProcess p, SalesPoint s) 064 { 065 //Code zum Ausfuehren des Rueckgabevorgangs 066 s.runProcess(new GiveBackProcess()); 067 } 068 } 069 ); 070 } 071 072 }