Better virtual numpad : cancel button (when no % sign) and handle text
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@829025 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -20,7 +20,7 @@ under the License.
|
||||
<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 @@ under the License.
|
||||
<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 @@ under the License.
|
||||
<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>
|
||||
|
||||
@@ -20,7 +20,7 @@ under the License.
|
||||
<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 @@ under the License.
|
||||
<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>
|
||||
|
||||
@@ -195,8 +195,9 @@ public class ClientProfile extends XPage implements ActionListener {
|
||||
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 @@ public class ClientProfile extends XPage implements ActionListener {
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -41,20 +41,21 @@ public class NumericKeypad extends XPage
|
||||
|
||||
boolean m_minus = false;
|
||||
boolean m_percent = false;
|
||||
String originalText;
|
||||
|
||||
public NumericKeypad(PosScreen pos) {
|
||||
m_pos = pos;
|
||||
m_pos = pos;
|
||||
m_pageSupport = pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/numerickeypad");
|
||||
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() {
|
||||
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_edit = (XEdit) m_pageSupport.findComponent("numeric_input");
|
||||
m_edit.setText("");
|
||||
|
||||
setupEvents();
|
||||
originalText = getText();
|
||||
|
||||
m_dialog.pack();
|
||||
m_dialog.showDialog(this);
|
||||
@@ -62,6 +63,16 @@ public class NumericKeypad extends XPage
|
||||
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 @@ public class NumericKeypad extends XPage
|
||||
|
||||
//call before openDlg
|
||||
public void setPercent(boolean percent) {
|
||||
if (percent) {
|
||||
disableButton("menuCancel");
|
||||
}
|
||||
m_percent = percent;
|
||||
}
|
||||
|
||||
@@ -117,6 +131,8 @@ public class NumericKeypad extends XPage
|
||||
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 @@ public class NumericKeypad extends XPage
|
||||
close();
|
||||
}
|
||||
|
||||
public void triggerCancel()
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
|
||||
public void triggerMinus()
|
||||
{
|
||||
prependUnique('-');
|
||||
@@ -284,6 +305,14 @@ public class NumericKeypad extends XPage
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void cancel() {
|
||||
if (wasMouseClicked()) {
|
||||
this.setText(originalText);
|
||||
m_dialog.closeDlg();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void append(String c) {
|
||||
if (wasMouseClicked()) {
|
||||
String text = "";
|
||||
|
||||
@@ -148,8 +148,9 @@ public class PaidInOut extends XPage {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user