001 package videoautomat.gui;
002 import sale.FormSheet;
003 import sale.FormSheetContentCreator;
004 import sale.UIGate;
005 import sale.stdforms.MsgForm;
006 import util.swing.TableEntryDescriptor;
007 import data.CountingStock;
008 import data.stdforms.SingleTableFormSheet;
009
010 /**
011 * This class implements graphical-user-interface elements for the whole application, especially
012 * for the <code>VideoAutomat</code>
013 */
014 public class Global {
015 /**
016 * The Caption of the <code>VideoAutomat</code>
017 */
018 public static final String CAPTION_AUTOMAT =
019 "****** VIDEOAUTOMAT *** 24 H ******";
020 /**
021 * Label for the admin- <code>ActionCapability</code>, if it`s not granted.
022 */
023 public static final String MSG_ACCESS = "Acces denied!!!";
024 /**
025 * Label for the menusheet that contains self-defined items
026 */
027 public static final String MS_NEW = "Videoautomat";
028
029 /**
030 * Label for the button to start the automat
031 */
032 public static final String MSI_AUTOMAT = "Start automat";
033 /**
034 * Label for the time setter button
035 */
036 public static final String MSI_DAY = "+ 1 Day";
037 /**
038 * An ID to identify the <code>FormButton</code> log on
039 */
040 public static int FB_LOGON = 1;
041 /**
042 * @return the {@link videoautomat.VideoAutomat#getDefaultFormSheet()}which displays the
043 * video-offer and the possibility to start a {@link videoautomat.SaleProcessLogOn}
044 * @param cs
045 * the <Stock>containing the offer
046 * @param uigGate
047 * the <code>UIGate</code> this <code>FormSheet</code> should be diplayed at
048 * @param show_zeros
049 * if false, lines containing a '0' in the "Count" field will be hidden.
050 * @param ted
051 * the <code>TableEntryDescriptor</code> used to display the <Stock>
052 *
053 */
054
055 public static FormSheet getStartFormSheet(
056 CountingStock cs,
057 UIGate uigGate,
058 boolean show_zeros,
059 TableEntryDescriptor ted) {
060 SingleTableFormSheet stfs_log =
061 SingleTableFormSheet.create(
062 "Please log on!",
063 cs,
064 uigGate,
065 show_zeros,
066 ted);
067 stfs_log.addContentCreator(new FormSheetContentCreator() {
068 public void createFormSheetContent(FormSheet fs) {
069 fs.removeAllButtons();
070 fs.addButton("Login", FB_LOGON, null);
071 }
072 });
073 return stfs_log;
074 }
075
076 /**
077 * @return a <code>FormSheet</code> that informs the user that there isn`t the correct
078 * amount of money left, to hand back the change.
079 */
080 public static FormSheet getNoChangeFormSheet() {
081 return new MsgForm(
082 "No change!",
083 "There is not enough change in here.\n"
084 + "Please insert the correct amount of money\n"
085 + "or contact the hotline.");
086 }
087 }