001 package videoautomat.contentcreator; 002 //<&/LogOnSTFSCC0> 003 004 import sale.FormSheet; 005 import sale.FormSheetContentCreator; 006 import users.ActionCapability; 007 import users.User; 008 import videoautomat.AutomatUser; 009 import videoautomat.SaleProcessHandBack; 010 import videoautomat.SaleProcessLogOn; 011 import videoautomat.SaleProcessRent; 012 import videoautomat.contentcreator.stdactions.LogOutAction; 013 import videoautomat.contentcreator.stdactions.RunProcessAction; 014 import data.ooimpl.DataBasketImpl; 015 016 /** 017 * Content creator to add the four main buttons to the FormSheet 018 * @author Alexander Herrmann 019 * 020 */ 021 public class LogOnSTFSContentCreator extends FormSheetContentCreator { 022 023 private User user; 024 /** 025 * ID for Serialization. 026 */ 027 private static final long serialVersionUID = 6150685570383575134L; 028 029 /** 030 * Constructor for referencing the <code>User</code> 031 * @param process - <code>SaleProcessLogOn</code> from where to get the user 032 */ 033 public LogOnSTFSContentCreator(SaleProcessLogOn process) 034 { 035 user = (User) process.getContext().getCurrentUser(process); 036 } 037 038 /** 039 * Generates the content and adds the four main buttons. 040 * @param fs - <code>FormSheet</code> to be changed 041 */ 042 protected void createFormSheetContent(FormSheet fs) { 043 fs.removeAllButtons(); 044 fs.addButton("Rent", 1, new RunProcessAction(new SaleProcessRent(), new DataBasketImpl())); 045 fs.addButton("Hand back", 2, 046 new RunProcessAction(new SaleProcessHandBack(), new DataBasketImpl())); 047 048 fs.addButton("Administrate", 3, 049 (ActionCapability) user.getCapability(AutomatUser.CAPABILITY_ADMIN)); 050 fs.addButton("Logout", 4, new LogOutAction()); 051 } 052 }