You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/10/23 14:24:56 UTC

svn commit: r829025 - in /ofbiz/trunk/specialpurpose/pos: screens/800x600/dialog/ screens/default/dialog/ src/org/ofbiz/pos/screen/

Author: jleroux
Date: Fri Oct 23 12:24:55 2009
New Revision: 829025

URL: http://svn.apache.org/viewvc?rev=829025&view=rev
Log:
Better virtual numpad : cancel button (when no % sign) and handle text

Modified:
    ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/numerickeypad.xml
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/numerickeypad.xml
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java

Modified: ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/numerickeypad.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/numerickeypad.xml?rev=829025&r1=829024&r2=829025&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/numerickeypad.xml (original)
+++ ofbiz/trunk/specialpurpose/pos/screens/800x600/dialog/numerickeypad.xml Fri Oct 23 12:24:55 2009
@@ -20,7 +20,7 @@
 <XPage class="net.xoetrope.swing.XDialog">
     <Components>
         <Panel x="0" y="0" w="306" h="50" style="numButton">
-            <Edit name="numeric_input" x="2" y="2" w="300" h="42" style="input" border="0" alignment="Left"/>
+            <Edit name="numeric_input" x="2" y="2" w="300" h="42" style="editAndList" border="0" alignment="Left"/>
         </Panel>
         <Panel x="0" y="50" w="306" h="282" style="numButton">
             <Button name="numSeven" x="0" y="0" w="75" h="68" style="numButton" content="7" alignment="Center"/>
@@ -30,7 +30,7 @@
             <Button name="numFour" x="0" y="69" w="75" h="68" style="numButton" content="4" alignment="Center"/>
             <Button name="numFive" x="76" y="69" w="75" h="68" style="numButton" content="5" alignment="Center"/>
             <Button name="numSix" x="152" y="69" w="75" h="68" style="numButton" content="6" alignment="Center"/>
-            <Button name="numMinus" x="228" y="69" w="75" h="68" style="numButton" content="-" alignment="Center"/>
+            <Button name="numMinus" x="228" y="0" w="75" h="68" style="numButton" content="-" alignment="Center"/>
             <Button name="numOne" x="0" y="138" w="75" h="68" style="numButton" content="1" alignment="Center"/>
             <Button name="numTwo" x="76" y="138" w="75" h="68" style="numButton" content="2" alignment="Center"/>
             <Button name="numThree" x="152" y="138" w="75" h="68" style="numButton" content="3" alignment="Center"/>
@@ -38,6 +38,9 @@
             <Button name="menuClear" x="0" y="207" w="75" h="68" style="posButton" content="CLR" alignment="Center"/>
             <Button name="numZero" x="76" y="207" w="75" h="68" style="numButton" content="0" alignment="Center"/>
             <Button name="numDZero" x="152" y="207" w="75" h="68" style="numButton" content="00" alignment="Center"/>
+
+            <Button name="menuCancel" x="228" y="0" w="75" h="68" style="numButton" content="Cancel" alignment="Center"/><!-- same place than %, cancel does not appear when % is shown -->            
+            
         </Panel>
     </Components>
 </XPage>

Modified: ofbiz/trunk/specialpurpose/pos/screens/default/dialog/numerickeypad.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/default/dialog/numerickeypad.xml?rev=829025&r1=829024&r2=829025&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/screens/default/dialog/numerickeypad.xml (original)
+++ ofbiz/trunk/specialpurpose/pos/screens/default/dialog/numerickeypad.xml Fri Oct 23 12:24:55 2009
@@ -20,7 +20,7 @@
 <XPage class="net.xoetrope.swing.XDialog">
     <Components>
         <Panel x="0" y="0" w="306" h="50" style="numButton">
-            <Edit name="numeric_input" x="2" y="2" w="300" h="42" style="input" border="0" alignment="Left"/>
+            <Edit name="numeric_input" x="2" y="2" w="300" h="42" style="editAndList" border="0" alignment="Left"/>
         </Panel>
         <Panel x="0" y="50" w="306" h="282" style="numButton">
             <Button name="numSeven" x="0" y="0" w="75" h="68" style="numButton" content="7" alignment="Center"/>
@@ -38,6 +38,8 @@
             <Button name="menuClear" x="0" y="207" w="75" h="68" style="posButton" content="CLR" alignment="Center"/>
             <Button name="numZero" x="76" y="207" w="75" h="68" style="numButton" content="0" alignment="Center"/>
             <Button name="numDZero" x="152" y="207" w="75" h="68" style="numButton" content="00" alignment="Center"/>
+            
+            <Button name="menuCancel" x="228" y="0" w="75" h="68" style="numButton" content="Cancel" alignment="Center"/><!-- same place than %, cancel does not appear when % is shown -->            
         </Panel>
     </Components>
 </XPage>

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java?rev=829025&r1=829024&r2=829025&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java Fri Oct 23 12:24:55 2009
@@ -195,8 +195,9 @@
         if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
             try {
                 NumericKeypad numericKeypad = new NumericKeypad(m_pos);
-                numericKeypad.setMinus(true);
+                numericKeypad.setMinus(false); // this order must be respected
                 numericKeypad.setPercent(false);
+                numericKeypad.setText(m_phoneEdit.getText());
                 m_phoneEdit.setText(numericKeypad.openDlg());
             } catch (Exception e) {
                 Debug.logError(e, module);
@@ -205,13 +206,16 @@
         }
         return;
     }
+    
+
 
     public synchronized void editCard() {
         if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y") && !SWIP_WITH_CARD) {
             try {
                 NumericKeypad numericKeypad = new NumericKeypad(m_pos);
-                numericKeypad.setMinus(true);
+                numericKeypad.setMinus(false); // this order must be respected
                 numericKeypad.setPercent(false);
+                numericKeypad.setText(m_cardEdit.getText());
                 m_cardEdit.setText(numericKeypad.openDlg());
             } catch (Exception e) {
                 Debug.logError(e, module);

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java?rev=829025&r1=829024&r2=829025&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java Fri Oct 23 12:24:55 2009
@@ -41,20 +41,21 @@
 
     boolean m_minus = false;
     boolean m_percent = false;
+    String originalText;
 
     public NumericKeypad(PosScreen pos) {
-        m_pos = pos;
-    }
-
-    public String openDlg() {
+        m_pos = pos;       
         m_pageSupport = pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/numerickeypad");
-        m_dialog = (XDialog)m_pageSupport;
-        m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PosVirtualNumPadTitle", Locale.getDefault()));
-
+        m_dialog = (XDialog) m_pageSupport;
         m_edit = (XEdit) m_pageSupport.findComponent("numeric_input");
         m_edit.setText("");
+        m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PosVirtualNumPadTitle", Locale.getDefault()));
+        
+    }
 
+    public String openDlg() {
         setupEvents();
+        originalText = getText();
 
         m_dialog.pack();
         m_dialog.showDialog(this);
@@ -62,6 +63,16 @@
         return m_edit.getText();
     }
 
+    // call before openDlg
+    public void setText(String text) {
+        clear();
+        m_edit.setText(text);
+    }
+
+    public String getText() {
+        return m_edit.getText();
+    }
+    
     //call before openDlg
     public void setMinus(boolean minus) {
         m_minus = minus;
@@ -73,6 +84,9 @@
 
     //call before openDlg
     public void setPercent(boolean percent) {
+        if (percent) {
+            disableButton("menuCancel");
+        }
         m_percent = percent;
     }
 
@@ -117,6 +131,8 @@
         XEventHelper.addMouseHandler(this, button, "triggerClear");
         button = (XButton) m_dialog.findComponent("menuEnter");
         XEventHelper.addMouseHandler(this, button, "triggerEnter");
+        button = (XButton) m_dialog.findComponent("menuCancel");
+        XEventHelper.addMouseHandler(this, button, "triggerCancel");
 
         if (getMinus()) {
             button = (XButton) m_dialog.findComponent("numMinus");
@@ -199,6 +215,11 @@
         close();
     }
 
+    public void triggerCancel()
+    {
+        cancel();
+    }
+    
     public void triggerMinus()
     {
         prependUnique('-');
@@ -284,6 +305,14 @@
         }
     }
 
+    private synchronized void cancel() {
+        if (wasMouseClicked()) {
+            this.setText(originalText);
+            m_dialog.closeDlg();
+            return;
+        }
+    }
+    
     private synchronized void append(String c) {
         if (wasMouseClicked()) {
             String text = "";

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java?rev=829025&r1=829024&r2=829025&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PaidInOut.java Fri Oct 23 12:24:55 2009
@@ -148,8 +148,9 @@
         if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
             try {
                 NumericKeypad numericKeypad = new NumericKeypad(m_pos);
-                numericKeypad.setMinus(true);
-                numericKeypad.setPercent(false);
+                numericKeypad.setMinus(true); // this order must be respected
+                numericKeypad.setPercent(true);
+                numericKeypad.setText(m_amountEdit.getText());
                 m_amountEdit.setText(numericKeypad.openDlg());
             } catch (Exception e) {
                 Debug.logError(e, module);