svn commit: r474258 - in /incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen: LoadSale.java SaveSale.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r474258 - in /incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen: LoadSale.java SaveSale.java

jleroux@apache.org
Author: jleroux
Date: Mon Nov 13 03:32:02 2006
New Revision: 474258

URL: http://svn.apache.org/viewvc?view=rev&rev=474258
Log:
Formatting and getting rid of tabs and spaces at end of lines

Modified:
    incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/LoadSale.java
    incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/SaveSale.java

Modified: incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/LoadSale.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/LoadSale.java?view=diff&rev=474258&r1=474257&r2=474258
==============================================================================
--- incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/LoadSale.java (original)
+++ incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/LoadSale.java Mon Nov 13 03:32:02 2006
@@ -35,189 +35,188 @@
 
 public class LoadSale extends XPage {
 
- /**
- * To load a sale from a shopping list. 2 modes : add to or replace the current sale. Also a button to delete a sale (aka shopping list)
- */
- public static final String module = LoadSale.class.getName();
- protected static PosScreen m_pos = null;
- protected XDialog m_dialog = null;
- static protected Hashtable m_saleMap = new Hashtable();
- protected XList m_salesList = null;
- protected XButton m_cancel = null;
- protected XButton m_add = null;
- protected XButton m_replace = null;
- protected XButton m_delete = null;
- protected XButton m_replaceAndDelete = null;
- protected DefaultListModel m_listModel = null;
- protected static PosTransaction m_trans = null;
-
- //TODO : make getter and setter for members (ie m_*) if needed (extern calls)
-
- public LoadSale(Hashtable saleMap, PosTransaction trans, PosScreen page) {
- m_saleMap.putAll(saleMap);
- m_trans = trans;
- m_pos = page;
- }
+    /**
+     * To load a sale from a shopping list. 2 modes : add to or replace the current sale. Also a button to delete a sale (aka shopping list)
+     */
+    public static final String module = LoadSale.class.getName();
+    protected static PosScreen m_pos = null;
+    protected XDialog m_dialog = null;
+    static protected Hashtable m_saleMap = new Hashtable();
+    protected XList m_salesList = null;
+    protected XButton m_cancel = null;
+    protected XButton m_add = null;
+    protected XButton m_replace = null;
+    protected XButton m_delete = null;
+    protected XButton m_replaceAndDelete = null;
+    protected DefaultListModel m_listModel = null;
+    protected static PosTransaction m_trans = null;
+
+    //TODO : make getter and setter for members (ie m_*) if needed (extern calls)
+
+    public LoadSale(Hashtable saleMap, PosTransaction trans, PosScreen page) {
+        m_saleMap.putAll(saleMap);
+        m_trans = trans;
+        m_pos = page;
+    }
 
     public void openDlg() {
-     XDialog dlg = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
-     m_dialog = dlg;
-     dlg.setCaption(UtilProperties.getMessage("pos", "LoadASale", Locale.getDefault()));
-     //dlg.setModal(true);
-     m_salesList = (XList) dlg.findComponent("salesList");
-     addMouseHandler(m_salesList, "SaleDoubleClick");
-
-     m_cancel = (XButton) dlg.findComponent("BtnCancel");    
-     m_add = (XButton) dlg.findComponent("BtnAdd");
-     m_replace = (XButton) dlg.findComponent("BtnReplace");
-     m_delete = (XButton) dlg.findComponent("BtnDelete");
-     m_replaceAndDelete = (XButton) dlg.findComponent("BtnReplaceAndDelete");
-     addMouseHandler(m_cancel, "cancel");    
-     addMouseHandler(m_add, "addSale");
-     addMouseHandler(m_replace, "replaceSale");
-     addMouseHandler(m_delete, "deleteShoppingList");
-     addMouseHandler(m_replaceAndDelete, "replaceSaleAndDeleteShoppingList");
-    
-     m_listModel = new DefaultListModel();
-     for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
-     Object o = i.next();
-     Map.Entry entry = (Map.Entry)o;
-     String val = entry.getValue().toString();    
-     m_listModel.addElement(val);
-     }
-     m_salesList.setModel(m_listModel);
-       m_salesList.setVisibleRowCount(-1);
-       m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());    
-       m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-       m_salesList.setToolTipText(UtilProperties.getMessage("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
-      
-     dlg.pack();
-     dlg.showDialog(this);
+        XDialog dlg = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
+        m_dialog = dlg;
+        dlg.setCaption(UtilProperties.getMessage("pos", "LoadASale", Locale.getDefault()));
+        //dlg.setModal(true);
+        m_salesList = (XList) dlg.findComponent("salesList");
+        addMouseHandler(m_salesList, "SaleDoubleClick");
+
+        m_cancel = (XButton) dlg.findComponent("BtnCancel");
+        m_add = (XButton) dlg.findComponent("BtnAdd");
+        m_replace = (XButton) dlg.findComponent("BtnReplace");
+        m_delete = (XButton) dlg.findComponent("BtnDelete");
+        m_replaceAndDelete = (XButton) dlg.findComponent("BtnReplaceAndDelete");
+        addMouseHandler(m_cancel, "cancel");
+        addMouseHandler(m_add, "addSale");
+        addMouseHandler(m_replace, "replaceSale");
+        addMouseHandler(m_delete, "deleteShoppingList");
+        addMouseHandler(m_replaceAndDelete, "replaceSaleAndDeleteShoppingList");
+
+        m_listModel = new DefaultListModel();
+        for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
+            Object o = i.next();
+            Map.Entry entry = (Map.Entry)o;
+            String val = entry.getValue().toString();
+            m_listModel.addElement(val);
+        }
+        m_salesList.setModel(m_listModel);
+        m_salesList.setVisibleRowCount(-1);
+        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());    
+        m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        m_salesList.setToolTipText(UtilProperties.getMessage("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
+
+        dlg.pack();
+        dlg.showDialog(this);
     }
-    
+
     public synchronized void SaleDoubleClick() {
-     if (wasMouseDoubleClicked()) {
-     String sale = selectedSale();
-     if (null != sale) {
-     replaceSaleAndDeleteShoppingList_();
-     }
-     }
+        if (wasMouseDoubleClicked()) {
+            String sale = selectedSale();
+            if (null != sale) {
+                replaceSaleAndDeleteShoppingList_();
+            }
+        }
     }
-    
+
     public synchronized void cancel() {
-     if (wasMouseClicked()) {
-     closeDlg();
-     }
+        if (wasMouseClicked()) {
+            closeDlg();
+        }
     }
 
     public synchronized void addSale() {
-     if (wasMouseClicked()) {
-     addSale_();
-     }
+        if (wasMouseClicked()) {
+            addSale_();
+        }
     }
 
     private synchronized void addSale_() {
- String sale = selectedSale();
- if (null != sale) {
- addListToCart(sale, true);
- }
+        String sale = selectedSale();
+        if (null != sale) {
+            addListToCart(sale, true);
+        }
     }
-        
+
     public synchronized void replaceSale() {
-     if (wasMouseClicked()) {
-     replaceSale_();
-     }
+        if (wasMouseClicked()) {
+            replaceSale_();
+        }
     }
-    
+
     private synchronized void replaceSale_() {
- String sale = selectedSale();
- if (null != sale) {
- addListToCart(sale, false);
- }
+        String sale = selectedSale();
+        if (null != sale) {
+            addListToCart(sale, false);
+        }
     }
-    
+
     public synchronized void deleteShoppingList() {
-     if (wasMouseClicked()) {
-     deleteShoppingList_();
-     }
+        if (wasMouseClicked()) {
+            deleteShoppingList_();
+        }
     }
-    
+
     private synchronized void deleteShoppingList_() {
- String sale= (String) m_salesList.getSelectedValue();
- if (null != sale) {
-     String shoppingListId = selectedSale();
+        String sale= (String) m_salesList.getSelectedValue();
+        if (null != sale) {
+            String shoppingListId = selectedSale();
             final ClassLoader cl = this.getClassLoader(m_pos);
-            Thread.currentThread().setContextClassLoader(cl);    
- if (m_trans.clearList(shoppingListId, m_pos)) {
- int index = m_salesList.getSelectedIndex();
- m_saleMap.remove(shoppingListId);
-     m_listModel = new DefaultListModel();
-     for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
-     Object o = i.next();
-     Map.Entry entry = (Map.Entry)o;
-     String val = entry.getValue().toString();    
-     m_listModel.addElement(val);
-     }        
- m_salesList.setModel(m_listModel);
- int size = m_listModel.getSize();
-    if (size == 0) { //Nobody's left, nothing to do here
-     closeDlg();
-    } else { //Select an index.
-        if (index == size) {
-            //removed item in last position
-            index--;
-        }
-    }
-        m_salesList.setSelectedIndex(index);
-        m_salesList.ensureIndexIsVisible(index);        
-         m_salesList.repaint();
-         repaint();    
-    }
- }
+            Thread.currentThread().setContextClassLoader(cl);
+            if (m_trans.clearList(shoppingListId, m_pos)) {
+                int index = m_salesList.getSelectedIndex();
+                m_saleMap.remove(shoppingListId);
+                m_listModel = new DefaultListModel();
+                for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
+                    Object o = i.next();
+                    Map.Entry entry = (Map.Entry)o;
+                    String val = entry.getValue().toString();
+                    m_listModel.addElement(val);
+                }
+                m_salesList.setModel(m_listModel);
+                int size = m_listModel.getSize();
+                if (size == 0) { //Nobody's left, nothing to do here
+                    closeDlg();
+                } else { //Select an index.
+                    if (index == size) {
+                        //removed item in last position
+                        index--;
+                    }
+                }
+                m_salesList.setSelectedIndex(index);
+                m_salesList.ensureIndexIsVisible(index);
+                m_salesList.repaint();
+                repaint();
+            }
+        }
     }
-  
+
     public synchronized void replaceSaleAndDeleteShoppingList() {
-     if (wasMouseClicked()) {
-     replaceSaleAndDeleteShoppingList_();
-     }
+        if (wasMouseClicked()) {
+            replaceSaleAndDeleteShoppingList_();
+        }
     }
 
     public synchronized void replaceSaleAndDeleteShoppingList_() {
- replaceSale_();
- deleteShoppingList_();
+        replaceSale_();
+        deleteShoppingList_();
     }
-    
+
     private String selectedSale() {
- String saleSelected = null;
- if (null != m_salesList.getSelectedValue()) {
-     String sale = (String) m_salesList.getSelectedValue();
-     Iterator i = m_saleMap.entrySet().iterator();
-    while(i.hasNext()) {
-     Object o = i.next();
-     Map.Entry entry = (Map.Entry)o;
-     String val = entry.getValue().toString();
-     if (val == sale) {
-     saleSelected = entry.getKey().toString();
-     }
-    }
- }
- return saleSelected;
+        String saleSelected = null;
+        if (null != m_salesList.getSelectedValue()) {
+            String sale = (String) m_salesList.getSelectedValue();
+            Iterator i = m_saleMap.entrySet().iterator();
+            while(i.hasNext()) {
+                Object o = i.next();
+                Map.Entry entry = (Map.Entry)o;
+                String val = entry.getValue().toString();
+                if (val == sale) {
+                    saleSelected = entry.getKey().toString();
+                }
+            }
+        }
+        return saleSelected;
     }
-    
+
     private void addListToCart(String sale, boolean addToCart) {
         final ClassLoader cl = this.getClassLoader(m_pos);
-        Thread.currentThread().setContextClassLoader(cl);    
- if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
- Debug.logError("Error while loading cart from shopping list : " + sale, module);
- }
- else {
- m_trans.calcTax();
-        m_pos.refresh();
-        
- }  
- closeDlg();
+        Thread.currentThread().setContextClassLoader(cl);
+        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
+            Debug.logError("Error while loading cart from shopping list : " + sale, module);
+        }
+        else {
+            m_trans.calcTax();
+            m_pos.refresh();
+        }  
+        closeDlg();
     }
-    
+
     private ClassLoader getClassLoader(PosScreen pos) {
         ClassLoader cl = pos.getClassLoader();
         if (cl == null) {
@@ -236,8 +235,8 @@
         }
         return cl;
     }    
-    
+
     private void closeDlg() {
- m_dialog.closeDlg();
+        m_dialog.closeDlg();
     }
 }

Modified: incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/SaveSale.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/SaveSale.java?view=diff&rev=474258&r1=474257&r2=474258
==============================================================================
--- incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/SaveSale.java (original)
+++ incubator/ofbiz/trunk/applications/pos/src/org/ofbiz/pos/screen/SaveSale.java Mon Nov 13 03:32:02 2006
@@ -31,80 +31,80 @@
 
 public class SaveSale extends XPage {
 
- /**
- * To save a sale. 2 modes : save and keep the current sale or save and clear the current sale.  
- */
- public static final String module = SaveSale.class.getName();
- protected static PosScreen m_pos = null;
- protected XDialog m_dialog = null;
- protected XEdit m_saleName = null;
- protected XButton m_cancel = null;
- protected XButton m_save = null;
- protected XButton m_saveAndClear = null;
- protected static PosTransaction m_trans = null;
- public static SimpleDateFormat sdf = new SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
-
- //TODO : make getter and setter for members (ie m_*) if needed (extern calls)
-
- public SaveSale(PosTransaction trans, PosScreen page) {
- m_trans = trans;
- m_pos = page;
- }
+    /**
+     * To save a sale. 2 modes : save and keep the current sale or save and clear the current sale.  
+     */
+    public static final String module = SaveSale.class.getName();
+    protected static PosScreen m_pos = null;
+    protected XDialog m_dialog = null;
+    protected XEdit m_saleName = null;
+    protected XButton m_cancel = null;
+    protected XButton m_save = null;
+    protected XButton m_saveAndClear = null;
+    protected static PosTransaction m_trans = null;
+    public static SimpleDateFormat sdf = new SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
+
+    //TODO : make getter and setter for members (ie m_*) if needed (extern calls)
+
+    public SaveSale(PosTransaction trans, PosScreen page) {
+        m_trans = trans;
+        m_pos = page;
+    }
 
     public void openDlg() {
-     XDialog dlg = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
-     m_dialog = dlg;
-     dlg.setModal(true);
-     dlg.setCaption(UtilProperties.getMessage("pos", "SaveASale", Locale.getDefault()));
-     m_saleName = (XEdit) dlg.findComponent("saleName");
-     m_saleName.setText(m_pos.session.getUserId() + " " + sdf.format(new Date()));
-
-     m_cancel = (XButton) dlg.findComponent("BtnCancel");
-     m_save = (XButton) dlg.findComponent("BtnSave");        
-     m_saveAndClear = (XButton) dlg.findComponent("BtnSaveAndClear");
-
-     addMouseHandler(m_cancel, "cancel");
-     addMouseHandler(m_save, "save");
-     addMouseHandler(m_saveAndClear, "saveAndClear");
-    
-     dlg.pack();
-     dlg.showDialog(this);
+        XDialog dlg = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
+        m_dialog = dlg;
+        dlg.setModal(true);
+        dlg.setCaption(UtilProperties.getMessage("pos", "SaveASale", Locale.getDefault()));
+        m_saleName = (XEdit) dlg.findComponent("saleName");
+        m_saleName.setText(m_pos.session.getUserId() + " " + sdf.format(new Date()));
+
+        m_cancel = (XButton) dlg.findComponent("BtnCancel");
+        m_save = (XButton) dlg.findComponent("BtnSave");
+        m_saveAndClear = (XButton) dlg.findComponent("BtnSaveAndClear");
+
+        addMouseHandler(m_cancel, "cancel");
+        addMouseHandler(m_save, "save");
+        addMouseHandler(m_saveAndClear, "saveAndClear");
+
+        dlg.pack();
+        dlg.showDialog(this);
     }
 
     public synchronized void cancel()
     {
-     if (wasMouseClicked()) {
-     this.m_dialog.closeDlg();
-     }
+        if (wasMouseClicked()) {
+            this.m_dialog.closeDlg();
+        }
     }
 
     public synchronized void save() {
-     if (wasMouseClicked()) {
-     String sale = m_saleName.getText();
-     if (null != sale) {
-     saveSale(sale);
-     }
-     }
+        if (wasMouseClicked()) {
+            String sale = m_saleName.getText();
+            if (null != sale) {
+                saveSale(sale);
+            }
+        }
     }
 
     public synchronized void saveAndClear() {
-     if (wasMouseClicked()) {
-     String sale = m_saleName.getText();
-     if (null != sale) {
-     saveSale(sale);
-     m_trans.voidSale();
-     m_pos.refresh();
-     }
-     }
+        if (wasMouseClicked()) {
+            String sale = m_saleName.getText();
+            if (null != sale) {
+                saveSale(sale);
+                m_trans.voidSale();
+                m_pos.refresh();
+            }
+        }
     }
-      
+
     private void saveSale(String sale) {
         final ClassLoader cl = this.getClassLoader(m_pos);
-        Thread.currentThread().setContextClassLoader(cl);    
- m_trans.saveSale(sale, m_pos);
-     this.m_dialog.closeDlg();    
+        Thread.currentThread().setContextClassLoader(cl);
+        m_trans.saveSale(sale, m_pos);
+        this.m_dialog.closeDlg();
     }
-    
+
     private ClassLoader getClassLoader(PosScreen pos) {
         ClassLoader cl = pos.getClassLoader();
         if (cl == null) {