001 package market.stdform; 002 003 import market.SMarket; 004 import sale.GateChangeTransition; 005 import sale.MenuSheet; 006 import sale.MenuSheetItem; 007 import sale.SaleProcess; 008 import sale.SalesPoint; 009 import sale.Transition; 010 import sale.UIGate; 011 012 /** 013 * This MenuSheet class provides a simple log-off MenuSheet. 014 */ 015 public class MSLogOff extends MenuSheet{ 016 017 /** 018 * Creates a MenuSheet with one MenuSheetItem, which`s action closes the SalesPoint related to the MenuSheet. 019 * 020 * @param trans Transition that gets set in the MenuSheetItem`s action to the current Gate of a SaleProcess, 021 * if someone runs on the SalesPoint related to this MenuSheet. 022 */ 023 public MSLogOff(final Transition trans) { 024 super("System", null, 'S'); 025 this.add(new MenuSheetItem("Abmelden", "exit", new sale.Action() { 026 public void doAction(SaleProcess p, SalesPoint sp) throws Throwable { 027 if(p!=null){ 028 ((UIGate)p.getCurrentGate()).setNextTransition(trans); 029 } 030 if (sp != null) {//sp is only null if a JDDShowMessage is active 031 if(sp.getCurrentProcess()!=null) sp.processFinished(p); 032 SMarket.getTheMarket().removeSalesPoint(sp); 033 sp.quit(); 034 } 035 } 036 }, 'A')); 037 } 038 039 /** 040 * Overloads constructor with GateChangeTransition.CHANGE_TO_STOP_GATE as argument. 041 */ 042 public MSLogOff() { 043 this(GateChangeTransition.CHANGE_TO_STOP_GATE); 044 } 045 }