From e13ddc3faa03b6dc40faac7ba50a94fbec7fa186 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Tue, 19 Dec 2006 21:52:44 +0000 Subject: [PATCH] First uses of new posScreen methods setWaitCursor and setNormalCursor : during login and processing sale. We will see later if other uses are needed (btw not sure during login si really useful)... git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk/specialpurpose@488821 13f79535-47bb-0310-9956-ffa450edef68 --- pos/src/org/ofbiz/pos/event/PaymentEvents.java | 2 ++ pos/src/org/ofbiz/pos/event/SecurityEvents.java | 6 ++++++ pos/src/org/ofbiz/pos/screen/PosDialog.java | 6 +++--- pos/src/org/ofbiz/pos/screen/PosScreen.java | 9 ++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/pos/src/org/ofbiz/pos/event/PaymentEvents.java b/pos/src/org/ofbiz/pos/event/PaymentEvents.java index 4462a316e..b843d0413 100644 --- a/pos/src/org/ofbiz/pos/event/PaymentEvents.java +++ b/pos/src/org/ofbiz/pos/event/PaymentEvents.java @@ -281,6 +281,7 @@ public class PaymentEvents { } public static synchronized void processSale(PosScreen pos) { + pos.setWaitCursor(); PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); PosScreen.currentScreen.getOutput().print(UtilProperties.getMessage("pos","Processing",Locale.getDefault())); @@ -305,6 +306,7 @@ public class PaymentEvents { pos.getButtons().setLock(false); pos.showDialog("dialog/error/exception", e.getMessage()); } + pos.setNormalCursor(); } } diff --git a/pos/src/org/ofbiz/pos/event/SecurityEvents.java b/pos/src/org/ofbiz/pos/event/SecurityEvents.java index b2fcb0352..83f74f665 100644 --- a/pos/src/org/ofbiz/pos/event/SecurityEvents.java +++ b/pos/src/org/ofbiz/pos/event/SecurityEvents.java @@ -32,23 +32,28 @@ public class SecurityEvents { public static final String module = SecurityEvents.class.getName(); public static void login(PosScreen pos) { + pos.setWaitCursor(); String[] func = pos.getInput().getFunction("LOGIN"); if (func == null) { pos.getInput().setFunction("LOGIN", ""); } baseLogin(pos, false); + pos.setNormalCursor(); } public static void logout(PosScreen pos) { + pos.setWaitCursor(); PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); XuiSession session = pos.getSession(); trans.closeTx(); session.logout(); pos.showPage("pospanel"); PosScreen.currentScreen.setLock(true); + pos.setNormalCursor(); } public static void mgrLogin(PosScreen pos) { + pos.setWaitCursor(); XuiSession session = pos.getSession(); if (session.hasRole(session.getUserLogin(), "MANAGER")) { ManagerEvents.mgrLoggedIn = true; @@ -61,6 +66,7 @@ public class SecurityEvents { } baseLogin(pos, true); } + pos.setNormalCursor(); } public static void lock(PosScreen pos) { diff --git a/pos/src/org/ofbiz/pos/screen/PosDialog.java b/pos/src/org/ofbiz/pos/screen/PosDialog.java index 1ff232f6e..a9ef3ed28 100644 --- a/pos/src/org/ofbiz/pos/screen/PosDialog.java +++ b/pos/src/org/ofbiz/pos/screen/PosDialog.java @@ -59,7 +59,7 @@ public class PosDialog { protected XPage page = null; protected boolean modal = true; protected int padding = 0; - protected boolean posVisible = false; + protected boolean posDialogVisible = false; public static PosDialog getInstance(XPage page) { return getInstance(page, true, 0); @@ -334,11 +334,11 @@ public class PosDialog { } public void posDialogSetVisible(boolean visible){ - posVisible = visible; + posDialogVisible = visible; SwingUtilities.invokeLater( new Runnable() { public void run(){ - dialog.setVisible(posVisible); + dialog.setVisible(posDialogVisible); } } ); diff --git a/pos/src/org/ofbiz/pos/screen/PosScreen.java b/pos/src/org/ofbiz/pos/screen/PosScreen.java index 2e2eadbd0..38eedaed2 100644 --- a/pos/src/org/ofbiz/pos/screen/PosScreen.java +++ b/pos/src/org/ofbiz/pos/screen/PosScreen.java @@ -207,7 +207,7 @@ public class PosScreen extends NavigationHelper implements Runnable, DialogCallb if (updateOutput) { if (input.isFunctionSet("PAID")) { output.print(UtilProperties.getMessage("pos","ULOGIN",defaultLocale) - + UtilFormatOut.formatPrice(trans.getTotalDue() * -1)); + + UtilFormatOut.formatPrice(trans.getTotalDue() * -1)); } else if (input.isFunctionSet("TOTAL")) { if (trans.getTotalDue() > 0) { output.print(UtilProperties.getMessage("pos","TOTALD",defaultLocale) + " " + UtilFormatOut.formatPrice(trans.getTotalDue())); @@ -382,4 +382,11 @@ public class PosScreen extends NavigationHelper implements Runnable, DialogCallb } return this.scrLocation; } + + public void setWaitCursor() { + setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); + } + public void setNormalCursor() { + setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); + } } \ No newline at end of file