svn commit: r671316 - in /ofbiz/trunk/specialpurpose/pos: screens/default/dialog/keyboard.xml src/org/ofbiz/pos/screen/Keyboard.java src/org/ofbiz/pos/screen/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: r671316 - in /ofbiz/trunk/specialpurpose/pos: screens/default/dialog/keyboard.xml src/org/ofbiz/pos/screen/Keyboard.java src/org/ofbiz/pos/screen/SaveSale.java

jleroux@apache.org
Author: jleroux
Date: Tue Jun 24 12:40:34 2008
New Revision: 671316

URL: http://svn.apache.org/viewvc?rev=671316&view=rev
Log:
A patch from Chris Lombardi & Branden Strickland  "Modal windows require keyboard and mouse" (https://issues.apache.org/jira/browse/OFBIZ-1427) - OFBIZ-1427

Added:
    ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml   (with props)
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java   (with props)
Modified:
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java

Added: ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml?rev=671316&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml (added)
+++ ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml Tue Jun 24 12:40:34 2008
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<XPage class="net.xoetrope.swing.XDialog">
+    <Components>
+        <Panel x="0" y="0" w="760" h="50" style="numButton">
+            <Edit name="keyboard_input" x="2" y="2" w="600" h="42" style="editAndList" border="1" alignment="Left"/>
+            <Button name="charDel" x="659" y="2" w="100" h="42" style="numButton" content="Backspace" alignment="Center"/>
+        </Panel>
+        <Panel x="0" y="50" w="760" h="282" style="numButton">
+            <Button name="charQ" x="0" y="0" w="75" h="68" style="numButton" content="q" alignment="Center"/>
+            <Button name="charW" x="76" y="0" w="75" h="68" style="numButton" content="w" alignment="Center"/>
+            <Button name="charE" x="152" y="0" w="75" h="68" style="numButton" content="e" alignment="Center"/>
+            <Button name="charR" x="228" y="0" w="75" h="68" style="numButton" content="r" alignment="Center"/>
+            <Button name="charT" x="304" y="0" w="75" h="68" style="numButton" content="t" alignment="Center"/>
+            <Button name="charY" x="380" y="0" w="75" h="68" style="numButton" content="y" alignment="Center"/>
+            <Button name="charU" x="456" y="0" w="75" h="68" style="numButton" content="u" alignment="Center"/>
+            <Button name="charI" x="532" y="0" w="75" h="68" style="numButton" content="i" alignment="Center"/>
+            <Button name="charO" x="608" y="0" w="75" h="68" style="numButton" content="o" alignment="Center"/>
+            <Button name="charP" x="684" y="0" w="75" h="68" style="numButton" content="p" alignment="Center"/>
+            <Button name="charA" x="10" y="69" w="75" h="68" style="numButton" content="a" alignment="Center"/>
+            <Button name="charS" x="86" y="69" w="75" h="68" style="numButton" content="s" alignment="Center"/>
+            <Button name="charD" x="162" y="69" w="75" h="68" style="numButton" content="d" alignment="Center"/>
+            <Button name="charF" x="238" y="69" w="75" h="68" style="numButton" content="f" alignment="Center"/>
+            <Button name="charG" x="314" y="69" w="75" h="68" style="numButton" content="g" alignment="Center"/>
+            <Button name="charH" x="390" y="69" w="75" h="68" style="numButton" content="h" alignment="Center"/>
+            <Button name="charJ" x="466" y="69" w="75" h="68" style="numButton" content="j" alignment="Center"/>
+            <Button name="charK" x="542" y="69" w="75" h="68" style="numButton" content="k" alignment="Center"/>
+            <Button name="charL" x="618" y="69" w="75" h="68" style="numButton" content="l" alignment="Center"/>
+            <Button name="menuEnter" x="694" y="69" w="65" h="136" style="numButton" content="Enter" alignment="Center"/>
+            <Button name="charZ" x="40" y="138" w="75" h="68" style="numButton" content="z" alignment="Center"/>
+            <Button name="charX" x="116" y="138" w="75" h="68" style="numButton" content="x" alignment="Center"/>
+            <Button name="charC" x="192" y="138" w="75" h="68" style="numButton" content="c" alignment="Center"/>
+            <Button name="charV" x="268" y="138" w="75" h="68" style="numButton" content="v" alignment="Center"/>
+            <Button name="charB" x="344" y="138" w="75" h="68" style="numButton" content="b" alignment="Center"/>
+            <Button name="charN" x="420" y="138" w="75" h="68" style="numButton" content="n" alignment="Center"/>
+            <Button name="charM" x="496" y="138" w="75" h="68" style="numButton" content="m" alignment="Center"/>
+            <Button name="menuClear" x="0" y="207" w="75" h="68" style="numButton" content="Clear" alignment="Center"/>
+            <Button name="menuShift" x="76" y="207" w="75" h="68" style="numButton" content="Shift" alignment="Center"/>
+            <Button name="menuShiftLock" x="152" y="207" w="75" h="68" style="numButton" content="Lock" alignment="Center"/>
+            <Button name="charSpace" x="228" y="207" w="300" h="68" style="numButton" content="Space Bar" alignment="Center"/>
+            <Button name="menuCancel" x="684" y="207" w="75" h="68" style="numButton" content="Cancel" alignment="Center"/>
+        </Panel>
+    </Components>    
+</XPage>

Propchange: ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/pos/screens/default/dialog/keyboard.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java?rev=671316&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java (added)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java Tue Jun 24 12:40:34 2008
@@ -0,0 +1,511 @@
+package org.ofbiz.pos.screen;
+
+import java.awt.Color;
+import net.xoetrope.swing.XButton;
+import net.xoetrope.swing.XDialog;
+import net.xoetrope.swing.XEdit;
+import net.xoetrope.xui.PageSupport;
+import net.xoetrope.xui.XPage;
+import net.xoetrope.xui.events.XEventHelper;
+
+public class Keyboard extends XPage
+{
+    public static final String module = Keyboard.class.getName();
+
+    XEdit m_edit = null;
+    XDialog m_dialog = null;
+    PosScreen m_pos = null;
+    PageSupport m_pageSupport = null;
+    
+    String originalText;
+    boolean m_shift = false;
+    boolean m_shiftLock = false;
+
+    public Keyboard(PosScreen pos){
+        m_pos = pos;
+        
+        m_pageSupport = pageMgr.loadPage(
+                m_pos.getScreenLocation() + "/dialog/keyboard");        
+        m_dialog = (XDialog)m_pageSupport;
+        
+        m_edit = (XEdit) m_pageSupport.findComponent("keyboard_input");
+        m_edit.setText("");
+
+        return;
+    }
+            
+    public String openDlg() {
+
+        setupEvents();
+        
+        originalText = getText();
+        m_dialog.pack();
+        m_dialog.showDialog(this);
+        
+        return m_edit.getText();
+    }
+
+    //call before openDlg
+    public void setText(String text){
+        clear();
+        m_edit.setText(text);
+    }
+    
+    public String getText(){
+        return m_edit.getText();
+    }
+    
+    private void reverseButtonColors(String button){
+        XButton xbutton = (XButton) m_dialog.findComponent(button);
+        Color fore = xbutton.getForeground();
+        Color back = xbutton.getBackground();
+        xbutton.setForeground(back);
+        xbutton.setBackground(fore);
+        return;
+    }
+
+    private void setupEvents(){
+        XButton button = (XButton) m_dialog.findComponent("charA");
+        XEventHelper.addMouseHandler(this, button, "triggerA");
+        button = (XButton) m_dialog.findComponent("charB");
+        XEventHelper.addMouseHandler(this, button, "triggerB");
+        button = (XButton) m_dialog.findComponent("charC");
+        XEventHelper.addMouseHandler(this, button, "triggerC");
+        button = (XButton) m_dialog.findComponent("charD");
+        XEventHelper.addMouseHandler(this, button, "triggerD");
+        button = (XButton) m_dialog.findComponent("charE");
+        XEventHelper.addMouseHandler(this, button, "triggerE");
+        button = (XButton) m_dialog.findComponent("charF");
+        XEventHelper.addMouseHandler(this, button, "triggerF");
+        button = (XButton) m_dialog.findComponent("charG");
+        XEventHelper.addMouseHandler(this, button, "triggerG");
+        button = (XButton) m_dialog.findComponent("charH");
+        XEventHelper.addMouseHandler(this, button, "triggerH");
+        button = (XButton) m_dialog.findComponent("charI");
+        XEventHelper.addMouseHandler(this, button, "triggerI");
+        button = (XButton) m_dialog.findComponent("charJ");
+        XEventHelper.addMouseHandler(this, button, "triggerJ");
+        button = (XButton) m_dialog.findComponent("charK");
+        XEventHelper.addMouseHandler(this, button, "triggerK");
+        button = (XButton) m_dialog.findComponent("charL");
+        XEventHelper.addMouseHandler(this, button, "triggerL");
+        button = (XButton) m_dialog.findComponent("charM");
+        XEventHelper.addMouseHandler(this, button, "triggerM");
+        button = (XButton) m_dialog.findComponent("charN");
+        XEventHelper.addMouseHandler(this, button, "triggerN");
+        button = (XButton) m_dialog.findComponent("charO");
+        XEventHelper.addMouseHandler(this, button, "triggerO");
+        button = (XButton) m_dialog.findComponent("charP");
+        XEventHelper.addMouseHandler(this, button, "triggerP");
+        button = (XButton) m_dialog.findComponent("charQ");
+        XEventHelper.addMouseHandler(this, button, "triggerQ");
+        button = (XButton) m_dialog.findComponent("charR");
+        XEventHelper.addMouseHandler(this, button, "triggerR");
+        button = (XButton) m_dialog.findComponent("charS");
+        XEventHelper.addMouseHandler(this, button, "triggerS");
+        button = (XButton) m_dialog.findComponent("charT");
+        XEventHelper.addMouseHandler(this, button, "triggerT");
+        button = (XButton) m_dialog.findComponent("charU");
+        XEventHelper.addMouseHandler(this, button, "triggerU");
+        button = (XButton) m_dialog.findComponent("charV");
+        XEventHelper.addMouseHandler(this, button, "triggerV");
+        button = (XButton) m_dialog.findComponent("charW");
+        XEventHelper.addMouseHandler(this, button, "triggerW");
+        button = (XButton) m_dialog.findComponent("charX");
+        XEventHelper.addMouseHandler(this, button, "triggerX");
+        button = (XButton) m_dialog.findComponent("charY");
+        XEventHelper.addMouseHandler(this, button, "triggerY");
+        button = (XButton) m_dialog.findComponent("charZ");
+        XEventHelper.addMouseHandler(this, button, "triggerZ");
+        button = (XButton) m_dialog.findComponent("charDel");
+        XEventHelper.addMouseHandler(this, button, "triggerDel");
+        button = (XButton) m_dialog.findComponent("charSpace");
+        XEventHelper.addMouseHandler(this, button, "triggerSpace");
+        button = (XButton) m_dialog.findComponent("menuClear");
+        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");
+ button = (XButton) m_dialog.findComponent("menuShift");
+ XEventHelper.addMouseHandler(this, button, "triggerShift");
+ button = (XButton) m_dialog.findComponent("menuShiftLock");
+ XEventHelper.addMouseHandler(this, button, "triggerShiftLock");
+
+        return;
+    }
+    
+    private void setButtonText(String buttonName, String newText){
+        XButton button = (XButton) m_dialog.findComponent(buttonName);
+        button.setText(newText);
+        return;
+    }
+    
+    private void setUppercase(){
+        setButtonText("charA", "A");
+        setButtonText("charB", "B");
+        setButtonText("charC", "C");
+        setButtonText("charD", "D");
+        setButtonText("charE", "E");
+        setButtonText("charF", "F");
+        setButtonText("charG", "G");
+        setButtonText("charH", "H");
+        setButtonText("charI", "I");
+        setButtonText("charJ", "J");
+        setButtonText("charK", "K");
+        setButtonText("charL", "L");
+        setButtonText("charM", "M");
+        setButtonText("charN", "N");
+        setButtonText("charO", "O");
+        setButtonText("charP", "P");
+        setButtonText("charQ", "Q");
+        setButtonText("charR", "R");
+        setButtonText("charS", "S");
+        setButtonText("charT", "T");
+        setButtonText("charU", "U");
+        setButtonText("charV", "V");
+        setButtonText("charW", "W");
+        setButtonText("charX", "X");
+        setButtonText("charY", "Y");
+        setButtonText("charZ", "Z");        
+        
+        return;
+    }
+
+    private void setLowercase(){
+        setButtonText("charA", "a");
+        setButtonText("charB", "b");
+        setButtonText("charC", "c");
+        setButtonText("charD", "d");
+        setButtonText("charE", "e");
+        setButtonText("charF", "f");
+        setButtonText("charG", "g");
+        setButtonText("charH", "h");
+        setButtonText("charI", "i");
+        setButtonText("charJ", "j");
+        setButtonText("charK", "k");
+        setButtonText("charL", "l");
+        setButtonText("charM", "m");
+        setButtonText("charN", "n");
+        setButtonText("charO", "o");
+        setButtonText("charP", "p");
+        setButtonText("charQ", "q");
+        setButtonText("charR", "r");
+        setButtonText("charS", "s");
+        setButtonText("charT", "t");
+        setButtonText("charU", "u");
+        setButtonText("charV", "v");
+        setButtonText("charW", "w");
+        setButtonText("charX", "x");
+        setButtonText("charY", "y");
+        setButtonText("charZ", "z");
+        
+        return;
+    }
+
+    public void triggerA()
+    {
+        keypress('a','A');
+    }
+
+    public void triggerB()
+    {
+        keypress('b','B');
+    }
+
+    public void triggerC()
+    {
+        keypress('c', 'C');
+    }
+
+    public void triggerD()
+    {
+        keypress('d', 'D');
+    }
+
+    public void triggerE()
+    {
+        keypress('e','E');
+    }
+
+    public void triggerF()
+    {
+        keypress('f','F');
+    }
+
+    public void triggerG()
+    {
+        keypress('g','G');
+    }
+
+    public void triggerH()
+    {
+        keypress('h','H');
+    }
+
+    public void triggerI()
+    {
+        keypress('i','I');
+    }
+
+    public void triggerJ()
+    {
+        keypress('j','J');
+    }
+
+    public void triggerK()
+    {
+        keypress('k','K');
+    }
+
+    public void triggerL()
+    {
+        keypress('l','L');
+    }
+
+    public void triggerM()
+    {
+        keypress('m','M');
+    }
+
+    public void triggerN()
+    {
+        keypress('n','N');
+    }
+
+    public void triggerO()
+    {
+        keypress('o','O');
+    }
+
+    public void triggerP()
+    {
+        keypress('p','P');
+    }
+
+    public void triggerQ()
+    {
+        keypress('q','Q');
+    }
+
+    public void triggerR()
+    {
+        keypress('r','R');
+    }
+
+    public void triggerS()
+    {
+        keypress('s','S');
+    }
+
+    public void triggerT()
+    {
+        keypress('t','T');
+    }
+
+    public void triggerU()
+    {
+        keypress('u','U');
+    }
+
+    public void triggerV()
+    {
+        keypress('v','V');
+    }
+
+    public void triggerW()
+    {
+        keypress('w','W');
+    }
+
+    public void triggerX()
+    {
+        keypress('x','X');
+    }
+
+    public void triggerY()
+    {
+        keypress('y','Y');
+    }
+
+    public void triggerZ()
+    {
+        keypress('z','Z');
+    }
+
+    public void triggerClear()
+    {
+        clear();
+    }
+
+    public void triggerSpace()
+    {
+        keypress(' ', ' ');
+    }
+    
+    public void triggerDel()
+    {
+ delete();
+    }
+  
+    public void triggerEnter()
+    {
+        close();
+    }
+
+    public void triggerCancel()
+    {
+        cancel();
+    }
+
+    public void triggerShift()
+    {
+        if(wasMouseClicked()){
+            shift();        
+        }
+    }
+    
+    public void triggerShiftLock()
+    {
+        if(wasMouseClicked()){
+            shiftLock();
+        }
+    }
+
+    private synchronized void keypress(char lower, char upper){
+        if(wasMouseClicked()){
+            if(m_shiftLock){
+                if(m_shift){
+                    append(lower);
+                    shift();
+                }else{
+                    append(upper);
+                }
+            }else{
+                if(m_shift){
+                    append(upper);
+                    shift();
+                }else{
+                    append(lower);
+                }
+            }
+        }
+    }
+    
+    private synchronized void shiftLock(){
+        if(m_shiftLock){
+            m_shiftLock = false;
+            this.setLowercase();
+        }else{
+            m_shiftLock = true;
+            this.setUppercase();
+        }
+        if(m_shift){  // turn off shift button
+            m_shift = false;
+            reverseButtonColors("menuShift");
+        }
+
+        reverseButtonColors("menuShiftLock");
+        m_dialog.repaint();
+        return;
+    }
+
+    private synchronized void shift(){
+        if(m_shiftLock){
+            if(m_shift){
+                m_shift = false;
+                this.setUppercase();
+            }else{
+                m_shift = true;
+                this.setLowercase();
+            }
+        }else{
+            if(m_shift){
+                m_shift = false;
+                this.setLowercase();
+            }else{
+                m_shift = true;
+                this.setUppercase();
+            }
+        }
+        
+        reverseButtonColors("menuShift");
+        m_dialog.repaint();
+        return;
+    }
+    
+    private synchronized void close(){
+        if(wasMouseClicked()){
+            m_dialog.closeDlg();
+            return;
+        }
+    }
+    
+    private synchronized void clear(){
+        if(wasMouseClicked()){
+            String text = "";
+            m_edit.setText(text);            
+            m_dialog.repaint();
+            return;
+        }
+    }
+
+    private synchronized void cancel(){
+        if(wasMouseClicked()){
+            this.setText(originalText);
+            m_dialog.closeDlg();
+            return;
+        }
+    }
+
+    private synchronized void append(char c){
+        String text = "";
+        try{
+            text = m_edit.getText();            
+        }catch (NullPointerException e){
+            // getText throws exception if no text
+            text = "";
+        }finally{
+            m_edit.setText(text + c);            
+        }      
+        m_dialog.repaint();
+        return;
+    }
+
+    private synchronized void append(String c){
+        String text = "";
+        try{
+            text = m_edit.getText();            
+        }catch (NullPointerException e){
+            // getText throws exception if no text
+            text = "";
+        }finally{
+            m_edit.setText(text + c);            
+        }      
+        m_dialog.repaint();
+        return;
+    }
+
+    private synchronized void delete(){
+        if(wasMouseClicked()){
+            String text = "";
+            try{
+                text = m_edit.getText();            
+            }catch (NullPointerException e){
+                // getText throws exception if no text
+                text = "";
+            }finally{
+ if (text.length() > 1)
+ {
+                m_edit.setText(text.substring(0,text.length()-1));            
+ }
+ else
+ {
+  m_edit.setText("");
+ }
+            }      
+            m_dialog.repaint();
+            return;
+        }
+    }
+}

Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java?rev=671316&r1=671315&r2=671316&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java Tue Jun 24 12:40:34 2008
@@ -33,6 +33,8 @@
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.pos.PosTransaction;
 
+//PATCH - importing DeviceLoader for pop.drawer - BSTRICKLAND
+import org.ofbiz.pos.device.DeviceLoader;
 
 public class SaveSale extends XPage {
 
@@ -46,6 +48,8 @@
     protected XButton m_cancel = null;
     protected XButton m_save = null;
     protected XButton m_saveAndClear = null;
+ //PATCH - New button for Save and Print funtion - BSTRICKLAND
+    protected XButton m_saveAndPrint = null;
     protected static PosTransaction m_trans = null;
     public static SimpleDateFormat sdf = new SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
 
@@ -66,11 +70,15 @@
         m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
         m_save = (XButton) m_dialog.findComponent("BtnSave");
         m_saveAndClear = (XButton) m_dialog.findComponent("BtnSaveAndClear");
-
+ //PATCH - Save and Print - BSTRICKLAND
+ m_saveAndPrint = (XButton) m_dialog.findComponent("BtnSaveAndPrint");
         
         XEventHelper.addMouseHandler(this, m_cancel, "cancel");
         XEventHelper.addMouseHandler(this, m_save, "save");
         XEventHelper.addMouseHandler(this, m_saveAndClear, "saveAndClear");
+        //PATCH - Save and Print - BSTRICKLAND
+ XEventHelper.addMouseHandler(this, m_saveAndPrint, "saveAndPrint");
+        XEventHelper.addMouseHandler(this, m_saleName, "editSaleName");
 
         m_dialog.pack();
         m_dialog.showDialog(this);
@@ -102,6 +110,34 @@
             }
         }
     }
+    
+//PATCH - function for save and print - BSTRICKLAND
+    public synchronized void saveAndPrint() {
+        if (wasMouseClicked()) {
+            String sale = m_saleName.getText();
+            if (null != sale) {
+                saveSale(sale);
+//DO PRINT HERE
+ DeviceLoader.receipt.printReceipt(m_trans, true);
+                m_trans.voidSale();
+                m_pos.refresh();
+            }
+        }
+    }
+    
+    public synchronized void editSaleName(){
+        if (wasMouseClicked()) {
+            try {
+                Keyboard keyboard = new Keyboard(m_pos);
+                keyboard.setText(m_saleName.getText());                
+                m_saleName.setText(keyboard.openDlg());
+            }catch(Exception e){
+                Debug.logError(e, module);
+            }
+            m_dialog.repaint();
+        }
+        return;
+    }
 
     private void saveSale(String sale) {
         final ClassLoader cl = this.getClassLoader(m_pos);
@@ -128,4 +164,4 @@
         }
         return cl;
     }    
-}
\ No newline at end of file
+}