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 /**
026 * Constructor for referencing the <code>User</code>
027 * @param process - <code>SaleProcessLogOn</code> from where to get the user
028 */
029 public LogOnSTFSContentCreator(SaleProcessLogOn process)
030 {
031 user = (User) process.getContext().getCurrentUser(process);
032 }
033
034 /**
035 * Generates the content and adds the four main buttons.
036 * @param fs - <code>FormSheet</code> to be changed
037 */
038 protected void createFormSheetContent(FormSheet fs) {
039 fs.removeAllButtons();
040 fs.addButton("Rent", 1, new RunProcessAction(new SaleProcessRent(), new DataBasketImpl()));
041
042 fs.addButton("Hand back", 2,
043 new RunProcessAction(new SaleProcessHandBack(), new DataBasketImpl()));
044 fs.addButton("Administrate", 3,
045 (ActionCapability) user.getCapability(AutomatUser.CAPABILITY_ADMIN));
046 fs.addButton("Logout", 4, new LogOutAction());
047 }
048 }