KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > pos > component > Output


1 /*
2  * $Id: Output.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2004 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.pos.component;
26
27 import net.xoetrope.swing.XEdit;
28 import net.xoetrope.xui.XProjectManager;
29
30 import org.ofbiz.pos.screen.PosScreen;
31 import org.ofbiz.pos.PosTransaction;
32 import org.ofbiz.base.util.UtilProperties;
33 import org.ofbiz.guiapp.xui.XuiSession;
34
35 import java.util.Locale JavaDoc;
36
37 /**
38  *
39  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
40  * @version $Rev: 5462 $
41  * @since 3.1
42  */

43 public class Output {
44
45     public static final String JavaDoc module = Output.class.getName();
46
47     // login labels
48

49     private Locale JavaDoc defaultLocale = Locale.getDefault();
50     /* Useless since i18n, see pos.properties
51     public static final String ULOGIN = "Enter User ID:";
52     public static final String UPASSW = "Enter Password:";
53
54     // open/close labels
55     public static final String OPDRAM = "Starting Drawer Amount:";
56     public static final String ENTCAS = "Enter Cash Amount:";
57     public static final String ENTCHK = "Enter Check Amount:";
58     public static final String ENTCRC = "Enter Credit Card Amount:";
59     public static final String ENTGFC = "Enter Gift Card Amount:";
60     public static final String ENTOTH = "Enter Other Payment Amount:";
61
62     // complete sale labels
63     public static final String PAYFIN = "Press Finish To Complete Sale";
64     public static final String TOTALD = "Total Due: ";
65     public static final String CHANGE = "Change Due: ";
66
67     // payment (credit/check/gc) labels
68     public static final String CREDNO = "Enter Card Number:";
69     public static final String CREDEX = "Enter Expiration Date (MMYY):";
70     public static final String CREDCF = "Enter Last 4 Digits:";
71     public static final String CREDZP = "Enter Billing ZipCode:";
72     public static final String REFNUM = "Enter Reference Number:";
73     public static final String AUTHCD = "Enter Auth Code:";
74
75     // standard messages
76     public static final String ISCLOSED = "Register Is Closed";
77     public static final String ISOPEN = "Register Is Open";*/

78
79     protected XuiSession session = null;
80     protected XEdit output = null;
81
82     public Output(PosScreen page) {
83         this.output = (XEdit) page.findComponent("pos_output");
84         this.session = page.getSession();
85         this.output.setFocusable(false);
86         this.clear();
87     }
88
89     public void setLock(boolean lock) {
90         if (lock) {
91             this.print(UtilProperties.getMessage("pos","ULOGIN",defaultLocale));
92         } else {
93             if (PosTransaction.getCurrentTx(session).isOpen()) {
94                 this.print(UtilProperties.getMessage("pos","ISOPEN",defaultLocale));
95             } else {
96                 this.print(UtilProperties.getMessage("pos","ISCLOSED",defaultLocale));
97             }
98         }
99     }
100
101     public void print(String JavaDoc message) {
102         this.output.setText(message);
103     }
104
105     public void clear() {
106         output.setText("");
107     }
108 }
Popular Tags