Author: jleroux
Date: Fri Jan 25 10:22:36 2008 New Revision: 615296 URL: http://svn.apache.org/viewvc?rev=615296&view=rev Log: A supplemental patch to synchronize the remaining events from Chris Lombardi "Methods in MenuEvents.java need to be synchronized (probably to do for all the events)" (https://issues.apache.org/jira/browse/OFBIZ-1598) - OFBIZ-1598 Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/NavagationEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java Fri Jan 25 10:22:36 2008 @@ -158,10 +158,10 @@ } public void appendChar(char c) { - input.setText(this.input.getText() + c); + appendString(String.valueOf(c)); } - public void appendString(String str) { + public synchronized void appendString(String str) { input.setText(this.input.getText() + str); } @@ -178,7 +178,7 @@ } // KeyListener - public void keyPressed(KeyEvent event) { + public synchronized void keyPressed(KeyEvent event) { // implements to handle backspacing only if (event.getKeyCode() == 8 && this.value().length() > 0) { this.input.setText(this.value().substring(0, this.value().length() - 1)); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java Fri Jan 25 10:22:36 2008 @@ -61,7 +61,7 @@ public static boolean mgrLoggedIn = false; static DecimalFormat priceDecimalFormat = new DecimalFormat("#,##0.00"); - public static void modifyPrice(PosScreen pos) { + public static synchronized void modifyPrice(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); String sku = null; try { @@ -99,7 +99,7 @@ pos.refresh(); } - public static void openTerminal(PosScreen pos) { + public static synchronized void openTerminal(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -152,7 +152,7 @@ } } - public static void closeTerminal(PosScreen pos) { + public static synchronized void closeTerminal(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -270,7 +270,7 @@ } } - public static void voidOrder(PosScreen pos) { + public static synchronized void voidOrder(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -346,7 +346,7 @@ } } - public static void reprintLastTx(PosScreen pos) { + public static synchronized void reprintLastTx(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -355,7 +355,7 @@ pos.refresh(); } - public static void popDrawer(PosScreen pos) { + public static synchronized void popDrawer(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); } else { @@ -365,7 +365,7 @@ } } - public static void clearCache(PosScreen pos) { + public static synchronized void clearCache(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); } else { @@ -374,7 +374,7 @@ } } - public static void resetXui(PosScreen pos) { + public static synchronized void resetXui(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); } else { @@ -383,7 +383,7 @@ } } - public static void shutdown(PosScreen pos) { + public static synchronized void shutdown(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); } else { @@ -393,7 +393,7 @@ } } - public static void totalsReport(PosScreen pos) { + public static synchronized void totalsReport(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -401,15 +401,15 @@ printTotals(pos, null, false); } - public static void paidOut(PosScreen pos) { + public static synchronized void paidOut(PosScreen pos) { paidOutAndIn(pos, "OUT"); } - public static void paidIn(PosScreen pos) { + public static synchronized void paidIn(PosScreen pos) { paidOutAndIn(pos, "IN"); } - public static void paidOutAndIn(PosScreen pos, String type) { + public static synchronized void paidOutAndIn(PosScreen pos, String type) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); return; @@ -457,7 +457,7 @@ } } - private static void printTotals(PosScreen pos, GenericValue state, boolean runBalance) { + private static synchronized void printTotals(PosScreen pos, GenericValue state, boolean runBalance) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); if (!trans.isOpen()) { pos.showDialog("dialog/error/terminalclosed"); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/NavagationEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/NavagationEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/NavagationEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/NavagationEvents.java Fri Jan 25 10:22:36 2008 @@ -23,12 +23,12 @@ public class NavagationEvents { - public static void showPosScreen(PosScreen pos) { + public static synchronized void showPosScreen(PosScreen pos) { ManagerEvents.mgrLoggedIn = false; pos.showPage("pospanel"); } - public static void showPayScreen(PosScreen pos) { + public static synchronized void showPayScreen(PosScreen pos) { ManagerEvents.mgrLoggedIn = false; PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); if (trans.isEmpty()) { @@ -40,9 +40,10 @@ } } - public static void showPromoScreen(PosScreen pos) { + public static synchronized void showPromoScreen(PosScreen pos) { ManagerEvents.mgrLoggedIn = false; pos.showPage("promopanel"); } } + Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PaymentEvents.java Fri Jan 25 10:22:36 2008 @@ -192,7 +192,7 @@ } } - private static void processNoPayment(PosScreen pos, String paymentMethodTypeId) { + private static synchronized void processNoPayment(PosScreen pos, String paymentMethodTypeId) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); try { @@ -208,7 +208,7 @@ pos.refresh(); } - private static void processExternalPayment(PosScreen pos, String paymentMethodTypeId, String amountStr) { + private static synchronized void processExternalPayment(PosScreen pos, String paymentMethodTypeId, String amountStr) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); Input input = pos.getInput(); String refNum = input.value(); @@ -231,7 +231,7 @@ pos.refresh(); } - public static void clearPayment(PosScreen pos) { + public static synchronized void clearPayment(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); Journal journal = pos.getJournal(); String sku = journal.getSelectedSku(); @@ -250,14 +250,14 @@ pos.refresh(); } - public static void clearAllPayments(PosScreen pos) { + public static synchronized void clearAllPayments(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); trans.clearPayments(); clearInputPaymentFunctions(pos); pos.refresh(); } - public static void setRefNum(PosScreen pos) { + public static synchronized void setRefNum(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); Journal journal = pos.getJournal(); String sku = journal.getSelectedSku(); @@ -316,7 +316,7 @@ } } - private static double processAmount(PosTransaction trans, PosScreen pos, String amountStr) throws GeneralException { + private static synchronized double processAmount(PosTransaction trans, PosScreen pos, String amountStr) throws GeneralException { Input input = pos.getInput(); if (input.isFunctionSet("TOTAL")) { @@ -350,7 +350,7 @@ // Removes all payment functions from the input function stack // Useful for clearing redundant data after a payment has been // processed or if an error occurred - public static void clearInputPaymentFunctions(PosScreen pos) { + public static synchronized void clearInputPaymentFunctions(PosScreen pos) { String[] paymentFuncs = {"CHECK", "CHECKINFO", "CREDIT", "GIFTCARD", "MSRINFO", "REFNUM"}; Input input = pos.getInput(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java Fri Jan 25 10:22:36 2008 @@ -31,7 +31,7 @@ public static final String module = PromoEvents.class.getName(); - public static void addPromoCode(PosScreen pos) { + public static synchronized void addPromoCode(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); if (!trans.isOpen()) { pos.showDialog("dialog/error/terminalclosed"); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java Fri Jan 25 10:22:36 2008 @@ -34,7 +34,7 @@ public static final String module = SecurityEvents.class.getName(); - public static void login(PosScreen pos) { + public static synchronized void login(PosScreen pos) { pos.setWaitCursor(); String[] func = pos.getInput().getFunction("LOGIN"); if (func == null) { @@ -44,7 +44,7 @@ pos.setNormalCursor(); } - public static void logout(PosScreen pos) { + public static synchronized void logout(PosScreen pos) { pos.setWaitCursor(); PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); XuiSession session = pos.getSession(); @@ -55,7 +55,7 @@ pos.setNormalCursor(); } - public static void mgrLogin(PosScreen pos) { + public static synchronized void mgrLogin(PosScreen pos) { pos.setWaitCursor(); XuiSession session = pos.getSession(); if (session.hasRole(session.getUserLogin(), "MANAGER")) { @@ -72,11 +72,11 @@ pos.setNormalCursor(); } - public static void lock(PosScreen pos) { + public static synchronized void lock(PosScreen pos) { pos.setLock(true); } - private static void baseLogin(PosScreen pos, boolean mgr) { + private static synchronized void baseLogin(PosScreen pos, boolean mgr) { XuiSession session = pos.getSession(); Output output = pos.getOutput(); InputWithPassword input = pos.getInput(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java?rev=615296&r1=615295&r2=615296&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java Fri Jan 25 10:22:36 2008 @@ -27,16 +27,16 @@ public static final String module = TestEvents.class.getName(); - public static void testAlert(PosScreen pos) { + public static synchronized void testAlert(PosScreen pos) { pos.showDialog("dialog/error/testerror"); } - public static void logSelectedIndex(PosScreen pos) { + public static synchronized void logSelectedIndex(PosScreen pos) { Journal journal = pos.getJournal(); Debug.log("Selected IDX - " + journal.getSelectedIdx(), module); } - public static void testMsr(PosScreen pos) { + public static synchronized void testMsr(PosScreen pos) { try { org.ofbiz.pos.jpos.service.MsrTestService.sendTest(); } catch (GeneralException e) { |
Free forum by Nabble | Edit this page |