Revision: 570
http://posper.svn.sourceforge.net/posper/?rev=570&view=rev
Author: hans_artmann
Date: 2008-08-23 19:20:53 +0000 (Sat, 23 Aug 2008)
Log Message:
-----------
Main features
- Payments panel
revised UI with number keypad
text field for payment reason (comment)
virtual keyboard support for comment field
store user and host in associated ticket record
- Modifiers list in products editor and user panel
- added cashout booking to close cash
Minor features:
- cash difference between counted amount and expected amount
stored in cashregister
- new customer display Jarltech 8034 (USB) with EURO sign
- /dev/usb/lp0-3 for devices (must use file since lpx works like a lpt port)
- option closePaymentDialog.delay: the PaymentSelect panel remains open until
explicitely closed
- option printTicket.default chooses if a ticket is printed by default
- new format DOUBLE2 shoes two digits after deciaml pint, like 10,00
- printPaidNoCur() and printChangeNoCur() in PaymentInfoCash
Bugfixes:
- getCashCarryForward must return 0 when null
- people view and product view: delete image didn't work
Caveats:
- user modifiers are not yet correctly evaluated!
Modified Paths:
--------------
0.601ha/src/main/java/net/adrianromero/data/user/DirtyManager.java
0.601ha/src/main/java/net/adrianromero/data/user/EditorRecordBasic.java
0.601ha/src/main/java/net/adrianromero/format/Formats.java
0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.form
0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.java
0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.form
0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.java
0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.form
0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.java
0.601ha/src/main/java/net/adrianromero/tpv/modifier/Modifiers.java
0.601ha/src/main/java/net/adrianromero/tpv/panels/JDialogCountCash.form
0.601ha/src/main/java/net/adrianromero/tpv/panels/JDialogCountCash.java
0.601ha/src/main/java/net/adrianromero/tpv/panels/JPanelCloseMoney.form
0.601ha/src/main/java/net/adrianromero/tpv/panels/JPanelCloseMoney.java
0.601ha/src/main/java/net/adrianromero/tpv/panels/JPanelPayments.java
0.601ha/src/main/java/net/adrianromero/tpv/panels/PaymentsEditor.form
0.601ha/src/main/java/net/adrianromero/tpv/panels/PaymentsEditor.java
0.601ha/src/main/java/net/adrianromero/tpv/payment/JPaymentCashPos.form
0.601ha/src/main/java/net/adrianromero/tpv/payment/JPaymentSelect.form
0.601ha/src/main/java/net/adrianromero/tpv/payment/JPaymentSelect.java
0.601ha/src/main/java/net/adrianromero/tpv/payment/PaymentInfoCash.java
0.601ha/src/main/java/net/adrianromero/tpv/printer/DeviceTicket.java
0.601ha/src/main/java/net/adrianromero/tpv/printer/escpos/UnicodeTranslatorInt.java
0.601ha/src/main/java/org/posper/gui/AppViewConnection.java
0.601ha/src/main/java/org/posper/hibernate/CashRegister.java
0.601ha/src/main/java/org/posper/hibernate/Payment.java
0.601ha/src/main/resources/net/adrianromero/brotraum.templ/Printer.Ticket2.xml
0.601ha/src/main/resources/net/adrianromero/brotraum.templ/Printer.TicketPreview.xml
0.601ha/src/main/resources/net/adrianromero/images/windowlogo.png
0.601ha/src/main/resources/net/adrianromero/reports/einnahmen.jasper
0.601ha/src/main/resources/net/adrianromero/reports/einnahmen.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.CloseCash.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.Inventory.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.OpenDrawer.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.Start.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.Ticket.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.Ticket2.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.TicketLine.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.TicketPreview.xml
0.601ha/src/main/resources/net/adrianromero/templates/Printer.TicketTotal.xml
0.601ha/src/main/resources/net/adrianromero/templates/Ticket.Buttons.xml
0.601ha/src/main/resources/net/adrianromero/templates/Ticket.Line.xml
0.601ha/src/main/resources/net/adrianromero/templates/Ticket.Modifiers.xml
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_ca.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_da.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_de.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_es.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_gl.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_it.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_nl.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_pt.properties
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_ro.properties
0.601ha/src/main/resources/org/posper/images/main.png
Added Paths:
-----------
0.601ha/customer_logo_report.gif
0.601ha/src/main/java/net/adrianromero/data/user/EditorItemList.java
0.601ha/src/main/java/net/adrianromero/tpv/printer/escpos/UnicodeTranslatorIntJarltech.java
0.601ha/src/main/java/net/adrianromero/tpv/util/ShowSystemProperties.java
Removed Paths:
-------------
0.601ha/.settings/
0.601ha/src/main/java/net/adrianromero/tpv/panels/CashCountEuroUI.form
0.601ha/src/main/java/net/adrianromero/tpv/panels/CashCountEuroUI.java
0.601ha/src/main/java/net/opentrends/
0.601ha/src/main/java/org/posper/gui/dialog/MainMenuDialog.form
0.601ha/src/main/java/org/posper/gui/dialog/MainMenuDialog.java
0.601ha/src/main/resources/com/
0.601ha/src/main/resources/net/adrianromero/images/Thumbs.db
0.601ha/src/main/resources/net/adrianromero/tpv/i18n/messages_de_DE.properties
0.601ha/src/main/resources/org/posper/images/splash.png
0.601ha/src/main/resources/org/posper/images/splash1.png
Property changes on: 0.601ha/customer_logo_report.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: 0.601ha/src/main/java/net/adrianromero/data/user/DirtyManager.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/data/user/DirtyManager.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/data/user/DirtyManager.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -33,7 +33,7 @@
*
* @author adrian
*/
-public class DirtyManager implements DocumentListener, ChangeListener, ActionListener, PropertyChangeListener {
+public class DirtyManager implements DocumentListener, ChangeListener, ActionListener, PropertyChangeListener, ListSelectionListener {
private boolean m_bDirty;
protected Vector listeners = new Vector();
@@ -92,5 +92,10 @@
setDirty(true);
//}
}
+
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ setDirty(true);
+ }
}
Added: 0.601ha/src/main/java/net/adrianromero/data/user/EditorItemList.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/data/user/EditorItemList.java (rev 0)
+++ 0.601ha/src/main/java/net/adrianromero/data/user/EditorItemList.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -0,0 +1,44 @@
+// Tina POS is a point of sales application designed for touch screens.
+// Copyright (C) 2005 Adrian Romero Corchado.
+// http://sourceforge.net/projects/tinapos
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+package net.adrianromero.data.user;
+
+
+import javax.swing.JList;
+
+public class EditorItemList implements EditorItem {
+
+ private JList m_c;
+ private int m_ieditable;
+
+ /** Creates a new instance of EditorItemComboBox */
+ public EditorItemList(JList c, int ieditable) {
+ m_c = c;
+ m_ieditable = ieditable;
+ }
+ public void setValueNull() {
+ m_c.clearSelection();
+ }
+ public void setValue(Object value) {
+ m_c.setSelectedValue(null, false);
+ }
+ public void setEnabled(int ieditable) {
+ m_c.setEnabled((ieditable & m_ieditable) != 0);
+ }
+
+}
Modified: 0.601ha/src/main/java/net/adrianromero/data/user/EditorRecordBasic.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/data/user/EditorRecordBasic.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/data/user/EditorRecordBasic.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -22,6 +22,7 @@
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
+import javax.swing.JList;
import javax.swing.JTree;
import javax.swing.text.JTextComponent;
@@ -58,6 +59,12 @@
m_aitems.add(new EditorItemComboBox(c, iEditable));
c.addActionListener(m_Dirty);
}
+
+ public void addList(JList c, int iEditable) {
+ m_aitems.add(new EditorItemList(c, iEditable));
+ c.addListSelectionListener(m_Dirty);
+ }
+
public void addCheckBox(JCheckBox c, int iEditable) {
m_aitems.add(new EditorItemCheckBox(c, iEditable));
c.addActionListener(m_Dirty);
Modified: 0.601ha/src/main/java/net/adrianromero/format/Formats.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/format/Formats.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/format/Formats.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -27,6 +27,7 @@
public final static FormatsINT INT = new FormatsINT();
public final static FormatsSTRING STRING = new FormatsSTRING();
public final static FormatsDOUBLE DOUBLE = new FormatsDOUBLE();
+ public final static FormatsDOUBLE2 DOUBLE2 = new FormatsDOUBLE2();
public final static FormatsCURRENCY CURRENCY = new FormatsCURRENCY();
public final static FormatsPERCENT PERCENT = new FormatsPERCENT();
public final static FormatsBOOLEAN BOOLEAN = new FormatsBOOLEAN();
@@ -38,6 +39,7 @@
private static NumberFormat m_doubleformat = NumberFormat.getNumberInstance();
private static NumberFormat m_currencyformat = NumberFormat.getCurrencyInstance();
private static NumberFormat m_percentformat = new DecimalFormat("#,##0.##%");
+ private static DecimalFormat m_doubleformat2 = new DecimalFormat("#,##0.00");
private static DateFormat m_dateformat = DateFormat.getDateInstance();
private static DateFormat m_timeformat = DateFormat.getTimeInstance();
@@ -105,6 +107,17 @@
return javax.swing.SwingConstants.RIGHT;
}
}
+ public static final class FormatsDOUBLE2 extends Formats<Double> {
+ protected String formatValueInt(Double value) {
+ return m_doubleformat2.format(value.doubleValue());
+ }
+ protected Double parseValueInt(String value) throws ParseException {
+ return new Double(m_doubleformat2.parse(value).doubleValue());
+ }
+ public int getAlignment() {
+ return javax.swing.SwingConstants.RIGHT;
+ }
+ }
public static final class FormatsPERCENT extends Formats<Double> {
protected String formatValueInt(Double value) {
return m_percentformat.format(value.doubleValue());
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.form
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.form 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.form 2008-08-23 19:20:53 UTC (rev 570)
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<?xml version="1.0" encoding="UTF-8" ?>
-<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_formBundle" type="java.lang.String" value="net/adrianromero/tpv/i18n/messages"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
- <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,85,0,0,1,-25"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-67,0,0,1,-25"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
@@ -17,7 +21,7 @@
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peoplename" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="label.peoplename_1" replaceFormat="AppLocal.getIntString("{key}")"/>
</Property>
</Properties>
<Constraints>
@@ -43,7 +47,7 @@
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peoplevisible" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="label.peoplevisible_1" replaceFormat="AppLocal.getIntString("{key}")"/>
</Property>
</Properties>
<Constraints>
@@ -55,19 +59,19 @@
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peopleimage" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="label.peopleimage_1" replaceFormat="AppLocal.getIntString("{key}")"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="110" width="90" height="-1"/>
+ <AbsoluteConstraints x="305" y="160" width="115" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="button.peoplepassword" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="button.peoplepassword_1" replaceFormat="AppLocal.getIntString("{key}")"/>
</Property>
</Properties>
<Events>
@@ -75,7 +79,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="300" y="20" width="150" height="-1"/>
+ <AbsoluteConstraints x="115" y="115" width="150" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -89,7 +93,7 @@
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.role" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="label.role_1" replaceFormat="AppLocal.getIntString("{key}")"/>
</Property>
</Properties>
<Constraints>
@@ -98,105 +102,45 @@
</Constraint>
</Constraints>
</Component>
- </SubComponents>
-</Form>
-
-<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
- <AuxValues>
- <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
- <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
- <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,85,0,0,1,-25"/>
- </AuxValues>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
- <Property name="useNullLayout" type="boolean" value="true"/>
- </Layout>
- <SubComponents>
- <Component class="javax.swing.JLabel" name="jLabel1">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peoplename" replaceFormat="AppLocal.getIntString("{key}")"/>
- </Property>
- </Properties>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="20" width="80" height="-1"/>
+ <AbsoluteConstraints x="110" y="180" width="185" height="195"/>
</Constraint>
</Constraints>
- </Component>
- <Component class="javax.swing.JTextField" name="m_jName">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="110" y="20" width="180" height="-1"/>
- </Constraint>
- </Constraints>
- </Component>
- <Component class="javax.swing.JCheckBox" name="m_jVisible">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="110" y="80" width="140" height="20"/>
- </Constraint>
- </Constraints>
- </Component>
- <Component class="javax.swing.JLabel" name="jLabel3">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JList" name="m_jModifierList">
+ <Properties>
+ <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+ <StringArray count="0"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peoplevisible" replaceFormat="AppLocal.getIntString("{key}")"/>
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="PeopleView.jLabel5.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="80" width="90" height="-1"/>
+ <AbsoluteConstraints x="20" y="160" width="200" height="-1"/>
</Constraint>
</Constraints>
</Component>
- <Component class="javax.swing.JLabel" name="jLabel4">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.peopleimage" replaceFormat="AppLocal.getIntString("{key}")"/>
- </Property>
- </Properties>
+ <Component class="net.adrianromero.data.gui.JImageEditor" name="m_jImage">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="110" width="90" height="-1"/>
+ <AbsoluteConstraints x="305" y="180" width="170" height="155"/>
</Constraint>
</Constraints>
</Component>
- <Component class="javax.swing.JButton" name="jButton1">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="button.peoplepassword" replaceFormat="AppLocal.getIntString("{key}")"/>
- </Property>
- </Properties>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
- </Events>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="300" y="20" width="150" height="-1"/>
- </Constraint>
- </Constraints>
- </Component>
- <Component class="javax.swing.JComboBox" name="m_jRole">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="110" y="50" width="180" height="20"/>
- </Constraint>
- </Constraints>
- </Component>
- <Component class="javax.swing.JLabel" name="jLabel2">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="net/adrianromero/templates/messages.properties" key="label.role" replaceFormat="AppLocal.getIntString("{key}")"/>
- </Property>
- </Properties>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="50" width="90" height="-1"/>
- </Constraint>
- </Constraints>
- </Component>
</SubComponents>
</Form>
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/admin/PeopleView.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -30,6 +30,7 @@
import net.adrianromero.data.user.EditorView;
import net.adrianromero.data.user.ObjectContainer;
import net.adrianromero.tpv.forms.AppLocal;
+import net.adrianromero.tpv.modifier.Modifiers;
import net.adrianromero.tpv.util.Hashcypher;
import org.posper.gui.AppView;
@@ -42,7 +43,9 @@
* Shows the panel for user management
*
* Changes:<p>
- * - Password change without having to enter the old password
+ * - Password change without having to enter the old password<p>
+ * - bug fix: image can now be removed
+ * - modifier list added
*
* @author Hans
* @author adrian
@@ -53,6 +56,7 @@
private static final long serialVersionUID = 6735533908375152288L;
private ObjectContainer<String> m_sPassword;
private ComboBoxHibernateModel<Role> m_RoleModel;
+ private Modifiers m_modifiers;
/** Creates new form PeopleEditor */
public PeopleView(AppView app) {
@@ -68,6 +72,7 @@
editor.addComboBox(m_jRole, EditorItem.EDITABLE_NORMAL);
editor.addCheckBox(m_jVisible, EditorItem.EDITABLE_NORMAL);
editor.addImageEditor(m_jImage, EditorItem.EDITABLE_NORMAL);
+ editor.addList(m_jModifierList,EditorItem.EDITABLE_NORMAL);
}
public void writeValue(User user) {
@@ -75,6 +80,7 @@
m_sPassword.setObject(user.getPassword());
m_jRole.setSelectedItem(user.getRole());
m_jVisible.setSelected(user.getVisible());
+ m_jModifierList.setSelectedIndices(m_modifiers.getModifierIndices(user.getModifiers()));
Image img = user.getImage();
if (img != null) {
m_jImage.setImage(img.getBufferedImage());
@@ -84,7 +90,7 @@
}
m_jName.setEnabled(false);
m_jRole.setEnabled(true);
- m_jVisible.setEnabled(true);
+ m_jVisible.setEnabled(true);
m_jImage.setEnabled(true);
}
@@ -104,13 +110,17 @@
}
user.setRole(m_RoleModel.getSelectedItem());
user.setVisible(m_jVisible.isSelected());
-
+ user.setModifiers(m_modifiers.indicesToMask(m_jModifierList.getSelectedIndices()));
+
BufferedImage img = m_jImage.getImage();
if (img != null) {
Image prodImg = new Image();
prodImg.setBufferedImage(img);
user.setImage(prodImg);
}
+ else {
+ user.setImage(null);
+ }
return true;
}
@@ -123,6 +133,9 @@
m_RoleModel = new ComboBoxHibernateModel<Role>(HibDAOFactory.getRoleDAO().list());
m_jRole.setModel(m_RoleModel);
+
+ m_modifiers = new Modifiers();
+ m_jModifierList.setListData(m_modifiers.getModifierNames());
}
/**
@@ -130,63 +143,67 @@
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
- // <editor-fold defaultstate="collapsed" desc=" Generated Code
- // ">//GEN-BEGIN:initComponents
- private void initComponents() {
- jLabel1 = new javax.swing.JLabel();
- m_jName = new javax.swing.JTextField();
- m_jVisible = new javax.swing.JCheckBox();
- jLabel3 = new javax.swing.JLabel();
- jLabel4 = new javax.swing.JLabel();
- m_jImage = new net.adrianromero.data.gui.JImageEditor();
- jButton1 = new javax.swing.JButton();
- m_jRole = new javax.swing.JComboBox();
- jLabel2 = new javax.swing.JLabel();
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
- setLayout(null);
+ jLabel1 = new javax.swing.JLabel();
+ m_jName = new javax.swing.JTextField();
+ m_jVisible = new javax.swing.JCheckBox();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
+ m_jRole = new javax.swing.JComboBox();
+ jLabel2 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ m_jModifierList = new javax.swing.JList();
+ jLabel5 = new javax.swing.JLabel();
+ m_jImage = new net.adrianromero.data.gui.JImageEditor();
- jLabel1.setText(AppLocal.getIntString("label.peoplename"));
- add(jLabel1);
- jLabel1.setBounds(20, 20, 80, 14);
+ setLayout(null);
- add(m_jName);
- m_jName.setBounds(110, 20, 180, 19);
+ jLabel1.setText(AppLocal.getIntString("label.peoplename_1")); // NOI18N
+ add(jLabel1);
+ jLabel1.setBounds(20, 20, 80, 14);
+ add(m_jName);
+ m_jName.setBounds(110, 20, 180, 20);
+ add(m_jVisible);
+ m_jVisible.setBounds(110, 80, 140, 20);
- add(m_jVisible);
- m_jVisible.setBounds(110, 80, 140, 20);
+ jLabel3.setText(AppLocal.getIntString("label.peoplevisible_1")); // NOI18N
+ add(jLabel3);
+ jLabel3.setBounds(20, 80, 90, 14);
- jLabel3.setText(AppLocal.getIntString("label.peoplevisible"));
- add(jLabel3);
- jLabel3.setBounds(20, 80, 90, 14);
+ jLabel4.setText(AppLocal.getIntString("label.peopleimage_1")); // NOI18N
+ add(jLabel4);
+ jLabel4.setBounds(305, 160, 115, 14);
- jLabel4.setText(AppLocal.getIntString("label.peopleimage"));
- add(jLabel4);
- jLabel4.setBounds(20, 110, 90, 14);
+ jButton1.setText(AppLocal.getIntString("button.peoplepassword_1")); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ add(jButton1);
+ jButton1.setBounds(115, 115, 150, 23);
+ add(m_jRole);
+ m_jRole.setBounds(110, 50, 180, 20);
- m_jImage.setMaxDimensions(new java.awt.Dimension(32, 32));
- add(m_jImage);
- m_jImage.setBounds(110, 110, 250, 180);
+ jLabel2.setText(AppLocal.getIntString("label.role_1")); // NOI18N
+ add(jLabel2);
+ jLabel2.setBounds(20, 50, 90, 14);
- jButton1.setText(AppLocal.getIntString("button.peoplepassword"));
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
+ jScrollPane1.setViewportView(m_jModifierList);
- add(jButton1);
- jButton1.setBounds(300, 20, 150, 23);
+ add(jScrollPane1);
+ jScrollPane1.setBounds(110, 180, 185, 195);
- add(m_jRole);
- m_jRole.setBounds(110, 50, 180, 20);
-
- jLabel2.setText(AppLocal.getIntString("label.role"));
- add(jLabel2);
- jLabel2.setBounds(20, 50, 90, 14);
-
- }
-
- // </editor-fold>//GEN-END:initComponents
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("net/adrianromero/tpv/i18n/messages"); // NOI18N
+ jLabel5.setText(bundle.getString("PeopleView.jLabel5.text")); // NOI18N
+ add(jLabel5);
+ jLabel5.setBounds(20, 160, 200, 14);
+ add(m_jImage);
+ m_jImage.setBounds(305, 180, 170, 155);
+ }// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton1ActionPerformed
String sNewPassword = Hashcypher.changePassword(this);
@@ -196,23 +213,18 @@
}// GEN-LAST:event_jButton1ActionPerformed
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton jButton1;
-
- private javax.swing.JLabel jLabel1;
-
- private javax.swing.JLabel jLabel2;
-
- private javax.swing.JLabel jLabel3;
-
- private javax.swing.JLabel jLabel4;
-
- private net.adrianromero.data.gui.JImageEditor m_jImage;
-
- private javax.swing.JTextField m_jName;
-
- private javax.swing.JComboBox m_jRole;
-
- private javax.swing.JCheckBox m_jVisible;
- // End of variables declaration//GEN-END:variables
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JScrollPane jScrollPane1;
+ private net.adrianromero.data.gui.JImageEditor m_jImage;
+ private javax.swing.JList m_jModifierList;
+ private javax.swing.JTextField m_jName;
+ private javax.swing.JComboBox m_jRole;
+ private javax.swing.JCheckBox m_jVisible;
+ // End of variables declaration//GEN-END:variables
}
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.form
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.form 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.form 2008-08-23 19:20:53 UTC (rev 570)
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[680, 310]"/>
</Property>
</Properties>
<AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/config/JPanelConfigGeneral.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -68,6 +68,10 @@
jcboSerialPrinter.addItem("/dev/ttyUSB1");
jcboSerialPrinter.addItem("/dev/ttyUSB2");
jcboSerialPrinter.addItem("/dev/ttyUSB3");
+ jcboSerialPrinter.addItem("/dev/usb/lp0");
+ jcboSerialPrinter.addItem("/dev/usb/lp1");
+ jcboSerialPrinter.addItem("/dev/usb/lp2");
+ jcboSerialPrinter.addItem("/dev/usb/lp3");
// Printer 2
jcboMachinePrinter2.addItem("screen");
@@ -97,6 +101,10 @@
jcboSerialPrinter2.addItem("/dev/ttyUSB1");
jcboSerialPrinter2.addItem("/dev/ttyUSB2");
jcboSerialPrinter2.addItem("/dev/ttyUSB3");
+ jcboSerialPrinter2.addItem("/dev/usb/lp0");
+ jcboSerialPrinter2.addItem("/dev/usb/lp1");
+ jcboSerialPrinter2.addItem("/dev/usb/lp2");
+ jcboSerialPrinter2.addItem("/dev/usb/lp3");
// Printer 3
jcboMachinePrinter3.addItem("screen");
@@ -126,12 +134,18 @@
jcboSerialPrinter3.addItem("/dev/ttyUSB1");
jcboSerialPrinter3.addItem("/dev/ttyUSB2");
jcboSerialPrinter3.addItem("/dev/ttyUSB3");
+ jcboSerialPrinter3.addItem("/dev/usb/lp0");
+ jcboSerialPrinter3.addItem("/dev/usb/lp1");
+ jcboSerialPrinter3.addItem("/dev/usb/lp2");
+ jcboSerialPrinter3.addItem("/dev/usb/lp3");
// Display
jcboMachineDisplay.addItem("screen");
jcboMachineDisplay.addItem("window");
+
jcboMachineDisplay.addItem("javapos");
jcboMachineDisplay.addItem("epson");
+ jcboMachineDisplay.addItem("jarltech");
jcboMachineDisplay.addItem("ld200");
jcboMachineDisplay.addItem("Not defined");
@@ -156,6 +170,10 @@
jcboSerialDisplay.addItem("/dev/ttyUSB1");
jcboSerialDisplay.addItem("/dev/ttyUSB2");
jcboSerialDisplay.addItem("/dev/ttyUSB3");
+ jcboSerialDisplay.addItem("/dev/usb/lp0");
+ jcboSerialDisplay.addItem("/dev/usb/lp1");
+ jcboSerialDisplay.addItem("/dev/usb/lp2");
+ jcboSerialDisplay.addItem("/dev/usb/lp3");
// Scale
jcboMachineScale.addItem("dialog1");
@@ -171,6 +189,10 @@
jcboSerialScale.addItem("/dev/ttyUSB1");
jcboSerialScale.addItem("/dev/ttyUSB2");
jcboSerialScale.addItem("/dev/ttyUSB3");
+ jcboSerialScale.addItem("/dev/usb/lp0");
+ jcboSerialScale.addItem("/dev/usb/lp1");
+ jcboSerialScale.addItem("/dev/usb/lp2");
+ jcboSerialScale.addItem("/dev/usb/lp3");
// Scanner
jcboMachineScanner.addItem("scanpal2");
@@ -188,8 +210,11 @@
jcboSerialScanner.addItem("/dev/ttyUSB0");
jcboSerialScanner.addItem("/dev/ttyUSB1");
jcboSerialScanner.addItem("/dev/ttyUSB2");
- jcboSerialScanner.addItem("/dev/ttyUSB3");
-
+ jcboSerialScanner.addItem("/dev/ttyUSB3");
+ jcboSerialScanner.addItem("/dev/usb/lp0");
+ jcboSerialScanner.addItem("/dev/usb/lp1");
+ jcboSerialScanner.addItem("/dev/usb/lp2");
+ jcboSerialScanner.addItem("/dev/usb/lp3");
}
public Component getConfigComponent() {
@@ -258,7 +283,9 @@
jcboSerialDisplay.setSelectedItem(p.nextToken(','));
} else {
jcboMachineDisplay.setSelectedItem(sparam);
- if ("epson".equals(sparam) || "ld200".equals(sparam)) {
+ if ("epson".equals(sparam) ||
+ "ld200".equals(sparam) ||
+ "jarltech".equals(sparam) ) {
jcboConnDisplay.setSelectedItem(p.nextToken(','));
jcboSerialDisplay.setSelectedItem(p.nextToken(','));
} else if ("javapos".equals(sparam)) {
@@ -288,7 +315,11 @@
config.setProperty("machine.ticketsbag", comboValue(jcboTicketsBag.getSelectedItem()));
String sMachinePrinter = comboValue(jcboMachinePrinter.getSelectedItem());
- if ("epson".equals(sMachinePrinter) || "tmu220".equals(sMachinePrinter) || "star".equals(sMachinePrinter) || "ithaca".equals(sMachinePrinter) || "codeless".equals(sMachinePrinter)) {
+ if ("epson".equals(sMachinePrinter) ||
+ "tmu220".equals(sMachinePrinter) ||
+ "star".equals(sMachinePrinter) ||
+ "ithaca".equals(sMachinePrinter) ||
+ "codeless".equals(sMachinePrinter)) {
config.setProperty("machine.printer", sMachinePrinter + ":" + comboValue(jcboConnPrinter.getSelectedItem()) + "," + comboValue(jcboSerialPrinter.getSelectedItem()));
} else if ("javapos".equals(sMachinePrinter)) {
config.setProperty("machine.printer", sMachinePrinter + ":" + m_jtxtJPOSPrinter.getText() + "," + m_jtxtJPOSDrawer.getText());
@@ -297,7 +328,11 @@
}
String sMachinePrinter2 = comboValue(jcboMachinePrinter2.getSelectedItem());
- if ("epson".equals(sMachinePrinter2) || "tmu220".equals(sMachinePrinter2) || "star".equals(sMachinePrinter2) || "ithaca".equals(sMachinePrinter2) || "codeless".equals(sMachinePrinter2)) {
+ if ("epson".equals(sMachinePrinter2) ||
+ "tmu220".equals(sMachinePrinter2) ||
+ "star".equals(sMachinePrinter2) ||
+ "ithaca".equals(sMachinePrinter2) ||
+ "codeless".equals(sMachinePrinter2)) {
config.setProperty("machine.printer.2", sMachinePrinter2 + ":" + comboValue(jcboConnPrinter2.getSelectedItem()) + "," + comboValue(jcboSerialPrinter2.getSelectedItem()));
} else if ("javapos".equals(sMachinePrinter2)) {
config.setProperty("machine.printer.2", sMachinePrinter2 + ":" + m_jtxtJPOSPrinter2.getText() + "," + m_jtxtJPOSDrawer2.getText());
@@ -307,7 +342,11 @@
String sMachinePrinter3 = comboValue(jcboMachinePrinter3.getSelectedItem());
- if ("epson".equals(sMachinePrinter3) || "tmu220".equals(sMachinePrinter3) || "star".equals(sMachinePrinter3) || "ithaca".equals(sMachinePrinter3) || "codeless".equals(sMachinePrinter3)) {
+ if ("epson".equals(sMachinePrinter3) ||
+ "tmu220".equals(sMachinePrinter3) ||
+ "star".equals(sMachinePrinter3) ||
+ "ithaca".equals(sMachinePrinter3) ||
+ "codeless".equals(sMachinePrinter3)) {
config.setProperty("machine.printer.3", sMachinePrinter3 + ":" + comboValue(jcboConnPrinter3.getSelectedItem()) + "," + comboValue(jcboSerialPrinter3.getSelectedItem()));
} else if ("javapos".equals(sMachinePrinter3)) {
config.setProperty("machine.printer.3", sMachinePrinter3 + ":" + m_jtxtJPOSPrinter3.getText() + "," + m_jtxtJPOSDrawer3.getText());
@@ -316,7 +355,9 @@
}
String sMachineDisplay = comboValue(jcboMachineDisplay.getSelectedItem());
- if ("epson".equals(sMachineDisplay) || "ld200".equals(sMachineDisplay)) {
+ if ("epson".equals(sMachineDisplay) ||
+ "ld200".equals(sMachineDisplay) ||
+ "jarltech".equals(sMachineDisplay)) {
config.setProperty("machine.display", sMachineDisplay + ":" + comboValue(jcboConnDisplay.getSelectedItem()) + "," + comboValue(jcboSerialDisplay.getSelectedItem()));
} else if ("javapos".equals(sMachineDisplay)) {
config.setProperty("machine.display", sMachineDisplay + ":" + m_jtxtJPOSName.getText());
@@ -755,7 +796,8 @@
private void jcboMachineScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachineScaleActionPerformed
CardLayout cl = (CardLayout)(m_jScaleParams.getLayout());
- if ("dialog1".equals(jcboMachineScale.getSelectedItem()) || "samsungesp".equals(jcboMachineScale.getSelectedItem())) {
+ if ("dialog1".equals(jcboMachineScale.getSelectedItem()) ||
+ "samsungesp".equals(jcboMachineScale.getSelectedItem())) {
cl.show(m_jScaleParams, "comm");
} else {
cl.show(m_jScaleParams, "empty");
@@ -765,7 +807,11 @@
private void jcboMachinePrinter3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachinePrinter3ActionPerformed
CardLayout cl = (CardLayout)(m_jPrinterParams3.getLayout());
- if ("epson".equals(jcboMachinePrinter3.getSelectedItem()) || "tmu220".equals(jcboMachinePrinter3.getSelectedItem()) || "star".equals(jcboMachinePrinter3.getSelectedItem()) || "ithaca".equals(jcboMachinePrinter3.getSelectedItem()) || "codeless".equals(jcboMachinePrinter3.getSelectedItem())) {
+ if ("epson".equals(jcboMachinePrinter3.getSelectedItem()) ||
+ "tmu220".equals(jcboMachinePrinter3.getSelectedItem()) ||
+ "star".equals(jcboMachinePrinter3.getSelectedItem()) ||
+ "ithaca".equals(jcboMachinePrinter3.getSelectedItem()) ||
+ "codeless".equals(jcboMachinePrinter3.getSelectedItem())) {
cl.show(m_jPrinterParams3, "comm");
} else if ("javapos".equals(jcboMachinePrinter3.getSelectedItem())) {
cl.show(m_jPrinterParams3, "javapos");
@@ -777,7 +823,11 @@
private void jcboMachinePrinter2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachinePrinter2ActionPerformed
CardLayout cl = (CardLayout)(m_jPrinterParams2.getLayout());
- if ("epson".equals(jcboMachinePrinter2.getSelectedItem()) || "tmu220".equals(jcboMachinePrinter2.getSelectedItem()) || "star".equals(jcboMachinePrinter2.getSelectedItem()) || "ithaca".equals(jcboMachinePrinter2.getSelectedItem()) || "codeless".equals(jcboMachinePrinter2.getSelectedItem()) ) {
+ if ("epson".equals(jcboMachinePrinter2.getSelectedItem()) ||
+ "tmu220".equals(jcboMachinePrinter2.getSelectedItem()) ||
+ "star".equals(jcboMachinePrinter2.getSelectedItem()) ||
+ "ithaca".equals(jcboMachinePrinter2.getSelectedItem()) ||
+ "codeless".equals(jcboMachinePrinter2.getSelectedItem()) ) {
cl.show(m_jPrinterParams2, "comm");
} else if ("javapos".equals(jcboMachinePrinter2.getSelectedItem())) {
cl.show(m_jPrinterParams2, "javapos");
@@ -789,7 +839,9 @@
private void jcboMachineDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachineDisplayActionPerformed
CardLayout cl = (CardLayout)(m_jDisplayParams.getLayout());
- if ("epson".equals(jcboMachineDisplay.getSelectedItem()) || "ld200".equals(jcboMachineDisplay.getSelectedItem())) {
+ if ("epson".equals(jcboMachineDisplay.getSelectedItem()) ||
+ "ld200".equals(jcboMachineDisplay.getSelectedItem()) ||
+ "jarltech".equals(jcboMachineDisplay.getSelectedItem())) {
cl.show(m_jDisplayParams, "comm");
} else if ("javapos".equals(jcboMachineDisplay.getSelectedItem())) {
cl.show(m_jDisplayParams, "javapos");
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.form
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.form 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.form 2008-08-23 19:20:53 UTC (rev 570)
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_formBundle" type="java.lang.String" value="net/adrianromero/tpv/i18n/messages"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
@@ -33,7 +38,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="180" y="50" width="70" height="-1"/>
+ <AbsoluteConstraints x="200" y="50" width="70" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -47,7 +52,7 @@
<Component class="javax.swing.JTextField" name="m_jName">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="250" y="50" width="220" height="-1"/>
+ <AbsoluteConstraints x="270" y="50" width="255" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -325,7 +330,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="80" width="140" height="-1"/>
+ <AbsoluteConstraints x="20" y="130" width="140" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -337,7 +342,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="20" y="110" width="140" height="-1"/>
+ <AbsoluteConstraints x="20" y="160" width="140" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -364,7 +369,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="50" y="50" width="60" height="-1"/>
+ <AbsoluteConstraints x="25" y="50" width="130" height="-1"/>
</Constraint>
</Constraints>
</Component>
@@ -374,10 +379,43 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
- <AbsoluteConstraints x="110" y="50" width="80" height="-1"/>
+ <AbsoluteConstraints x="155" y="50" width="85" height="-1"/>
</Constraint>
</Constraints>
</Component>
+ <Component class="javax.swing.JLabel" name="jLabelModifiers">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="net/adrianromero/tpv/i18n/messages.properties" key="ProductsEditor.jLabelModifiers.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
+ <AbsoluteConstraints x="265" y="10" width="160" height="-1"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
+ <AbsoluteConstraints x="260" y="30" width="255" height="180"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JList" name="m_jModifierList">
+ <Properties>
+ <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+ <StringArray count="0"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
</SubComponents>
</Container>
</SubComponents>
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/inventory/ProductsEditor.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -16,13 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
package net.adrianromero.tpv.inventory;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
+import java.util.HashMap;
+import java.util.Vector;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -37,6 +38,7 @@
import net.adrianromero.format.Formats;
import net.adrianromero.tpv.forms.AppLocal;
+import net.adrianromero.tpv.modifier.Modifiers;
import org.posper.gui.AppView;
import org.posper.hibernate.Category;
import org.posper.hibernate.HibDAOFactory;
@@ -45,34 +47,41 @@
import org.posper.hibernate.Tax;
/**
+ * Form to maintain product entries.
+ *
+ * Changes:<p>
+ * - Modifier list with multiple selection added. Selected
+ * Modifiers are DISABLED for the product.<p>
+ * - bug fix: image can now be removed
+ *
+ * @author Hans
* @author adrian
* @author Aaron Luchko <aaron.luchko@...>
*
*/
public class ProductsEditor extends JPanel implements EditorRecord<Product> {
- private static final long serialVersionUID = 9053694562650108884L;
-
- private DirtyManager m_Dirty = new DirtyManager();
-
- private ComboBoxHibernateModel<Category> m_CategoryModel;
-
- private ComboBoxHibernateModel<Tax> m_TaxModel;
+ private static final long serialVersionUID = 9053694562650108884L;
+ private DirtyManager m_Dirty = new DirtyManager();
+ private ComboBoxHibernateModel<Category> m_CategoryModel;
+ private ComboBoxHibernateModel<Tax> m_TaxModel;
private ComboBoxValModel<CodeType> m_CodetypeModel;
+ private Double m_dPriceSell;
+ private Modifiers m_modifiers;
- private Double m_dPriceSell;
+ /** Creates new form JEditProduct
+ * @param app
+ */
+ public ProductsEditor(AppView app) {
+ initComponents();
- /** Creates new form JEditProduct */
- public ProductsEditor(AppView app) {
- initComponents();
+ // El modelo de categorias
+ m_CategoryModel = new ComboBoxHibernateModel<Category>();
- // El modelo de categorias
- m_CategoryModel = new ComboBoxHibernateModel<Category>();
+ // El modelo de impuestos
+ m_TaxModel = new ComboBoxHibernateModel<Tax>();
- // El modelo de impuestos
- m_TaxModel = new ComboBoxHibernateModel<Tax>();
-
- m_CodetypeModel = new ComboBoxValModel<CodeType>();
+ m_CodetypeModel = new ComboBoxValModel<CodeType>();
m_CodetypeModel.add(null);
m_CodetypeModel.add(CodeType.EAN13);
m_CodetypeModel.add(CodeType.CODE128);
@@ -80,352 +89,373 @@
m_jCodetype.setVisible(false);
- m_jRef.getDocument().addDocumentListener(m_Dirty);
- m_jCode.getDocument().addDocumentListener(m_Dirty);
- m_jName.getDocument().addDocumentListener(m_Dirty);
- m_jComment.addActionListener(m_Dirty);
- m_jScale.addActionListener(m_Dirty);
- m_jCategory.addActionListener(m_Dirty);
- m_jTax.addActionListener(m_Dirty);
- m_jPriceBuy.getDocument().addDocumentListener(m_Dirty);
- m_jPriceSell.getDocument().addDocumentListener(m_Dirty);
- m_jImage.addPropertyChangeListener("image", m_Dirty);
- m_jstockcost.getDocument().addDocumentListener(m_Dirty);
- m_jstockvolume.getDocument().addDocumentListener(m_Dirty);
- m_jInCatalog.addActionListener(m_Dirty);
- m_jCatalogOrder.getDocument().addDocumentListener(m_Dirty);
+ m_jRef.getDocument().addDocumentListener(m_Dirty);
+ m_jCode.getDocument().addDocumentListener(m_Dirty);
+ m_jName.getDocument().addDocumentListener(m_Dirty);
+ m_jComment.addActionListener(m_Dirty);
+ m_jScale.addActionListener(m_Dirty);
+ m_jCategory.addActionListener(m_Dirty);
+ m_jTax.addActionListener(m_Dirty);
+ m_jPriceBuy.getDocument().addDocumentListener(m_Dirty);
+ m_jPriceSell.getDocument().addDocumentListener(m_Dirty);
+ m_jImage.addPropertyChangeListener("image", m_Dirty);
+ m_jstockcost.getDocument().addDocumentListener(m_Dirty);
+ m_jstockvolume.getDocument().addDocumentListener(m_Dirty);
+ m_jInCatalog.addActionListener(m_Dirty);
+ m_jCatalogOrder.getDocument().addDocumentListener(m_Dirty);
+ m_jModifierList.addListSelectionListener(m_Dirty);
- // el informe de stock
- ReportManager rm = new ReportManager();
- m_jPriceBuy.getDocument().addDocumentListener(rm);
- m_jTax.addActionListener(rm);
- m_jstockcost.getDocument().addDocumentListener(rm);
- m_jstockvolume.getDocument().addDocumentListener(rm);
- m_jPriceSell.getDocument().addDocumentListener(new PriceManager());
- m_jPriceSellTax.getDocument()
- .addDocumentListener(new PriceTaxManager());
- m_jmargin.getDocument().addDocumentListener(new MarginManager());
+ // el informe de stock
+ ReportManager rm = new ReportManager();
+ m_jPriceBuy.getDocument().addDocumentListener(rm);
+ m_jTax.addActionListener(rm);
+ m_jstockcost.getDocument().addDocumentListener(rm);
+ m_jstockvolume.getDocument().addDocumentListener(rm);
- writeValueEOF();
- }
+ m_jPriceSell.getDocument().addDocumentListener(new PriceManager());
+ m_jPriceSellTax.getDocument().addDocumentListener(new PriceTaxManager());
+ m_jmargin.getDocument().addDocumentListener(new MarginManager());
- public void activate() {
- m_CategoryModel = new ComboBoxHibernateModel<Category>(HibDAOFactory.getCategoryDAO().list());
- m_jCategory.setModel(m_CategoryModel);
- m_TaxModel = new ComboBoxHibernateModel<Tax>(HibDAOFactory.getTaxDAO().list());
- m_jTax.setModel(m_TaxModel);
- }
+ writeValueEOF();
+ }
+
+ public void activate() {
+ m_CategoryModel = new ComboBoxHibernateModel<Category>(HibDAOFactory.getCategoryDAO().list());
+ m_jCategory.setModel(m_CategoryModel);
+ m_TaxModel = new ComboBoxHibernateModel<Tax>(HibDAOFactory.getTaxDAO().list());
+ m_jTax.setModel(m_TaxModel);
+
+ m_modifiers = new Modifiers();
+ m_jModifierList.setListData(m_modifiers.getModifierNames());
+ }
- public void writeValueEOF() {
+ public void writeValueEOF() {
- // Los valores
- m_jTitle.setText(AppLocal.getIntString("label.recordeof"));
- m_jRef.setText(null);
- m_jCode.setText(null);
- m_jName.setText(null);
- m_jComment.setSelected(false);
- m_jScale.setSelected(false);
- m_CategoryModel.setSelectedKey(null);
- m_TaxModel.setSelectedKey(null);
- m_jPriceBuy.setText(null);
- m_bPriceSellLock = true;
- m_jPriceSell.setText(null);
- m_bPriceSellLock = false;
- m_jImage.setImage(null);
- m_jstockcost.setText(null);
- m_jstockvolume.setText(null);
- m_jInCatalog.setSelected(false);
- m_jCatalogOrder.setText(null);
+ // Los valores
+ m_jTitle.setText(AppLocal.getIntString("label.recordeof"));
+ m_jRef.setText(null);
+ m_jCode.setText(null);
+ m_jName.setText(null);
+ m_jComment.setSelected(false);
+ m_jScale.setSelected(false);
+ m_CategoryModel.setSelectedKey(null);
+ m_TaxModel.setSelectedKey(null);
+ m_jPriceBuy.setText(null);
+ m_bPriceSellLock = true;
+ m_jPriceSell.setText(null);
+ m_bPriceSellLock = false;
+ m_jImage.setImage(null);
+ m_jstockcost.setText(null);
+ m_jstockvolume.setText(null);
+ m_jInCatalog.setSelected(false);
+ m_jCatalogOrder.setText(null);
+ m_jModifierList.clearSelection();
- // Los habilitados
- m_jRef.setEnabled(false);
- m_jCode.setEnabled(false);
- m_jName.setEnabled(false);
- m_jComment.setEnabled(false);
- m_jScale.setEnabled(false);
- m_jCategory.setEnabled(false);
- m_jTax.setEnabled(false);
- m_jPriceBuy.setEnabled(false);
- m_jPriceSell.setEnabled(false);
- m_jPriceSellTax.setEnabled(false);
- m_jmargin.setEnabled(false);
- m_jImage.setEnabled(false);
- m_jstockcost.setEnabled(false);
- m_jstockvolume.setEnabled(false);
- m_jInCatalog.setEnabled(false);
- m_jCatalogOrder.setEnabled(false);
+ // Los habilitados
+ m_jRef.setEnabled(false);
+ m_jCode.setEnabled(false);
+ m_jName.setEnabled(false);
+ m_jComment.setEnabled(false);
+ m_jScale.setEnabled(false);
+ m_jCategory.setEnabled(false);
+ m_jTax.setEnabled(false);
+ m_jPriceBuy.setEnabled(false);
+ m_jPriceSell.setEnabled(false);
+ m_jPriceSellTax.setEnabled(false);
+ m_jmargin.setEnabled(false);
+ m_jImage.setEnabled(false);
+ m_jstockcost.setEnabled(false);
+ m_jstockvolume.setEnabled(false);
+ m_jInCatalog.setEnabled(false);
+ m_jCatalogOrder.setEnabled(false);
+ m_jModifierList.setEnabled(false);
- writeReport(null, 0.0);
- }
+ writeReport(null, 0.0);
+ }
- public void writeValueInsert() {
+ public void writeValueInsert() {
- // Los valores
- m_jTitle.setText(AppLocal.getIntString("label.recordnew"));
- m_jRef.setText(null);
- m_jCode.setText(null);
- m_jName.setText(null);
- m_jComment.setSelected(false);
- m_jScale.setSelected(false);
- m_CategoryModel.setSelectedKey(null);
- m_TaxModel.setSelectedKey(null);
- m_jPriceBuy.setText(null);
- m_dPriceSell = null;
- m_bPriceSellLock = true;
- m_jPriceSell.setText(null);
- m_bPriceSellLock = false;
- m_jImage.setImage(null);
- m_jstockcost.setText(null);
- m_jstockvolume.setText(null);
- m_jInCatalog.setSelected(false);
- m_jCatalogOrder.setText(null);
+ // Los valores
+ m_jTitle.setText(AppLocal.getIntString("label.recordnew"));
+ m_jRef.setText(null);
+ m_jCode.setText(null);
+ m_jName.setText(null);
+ m_jComment.setSelected(false);
+ m_jScale.setSelected(false);
+ m_CategoryModel.setSelectedKey(null);
+ m_TaxModel.setSelectedKey(null);
+ m_jPriceBuy.setText(null);
+ m_dPriceSell = null;
+ m_bPriceSellLock = true;
+ m_jPriceSell.setText(null);
+ m_bPriceSellLock = false;
+ m_jImage.setImage(null);
+ m_jstockcost.setText(null);
+ m_jstockvolume.setText(null);
+ m_jInCatalog.setSelected(false);
+ m_jCatalogOrder.setText(null);
+ m_jModifierList.clearSelection();
- // Los habilitados
- m_jRef.setEnabled(true);
- m_jCode.setEnabled(true);
- m_jName.setEnabled(true);
- m_jComment.setEnabled(true);
- m_jScale.setEnabled(true);
- m_jCategory.setEnabled(true);
- m_jTax.setEnabled(true);
- m_jPriceBuy.setEnabled(true);
- m_jPriceSell.setEnabled(true);
- m_jPriceSellTax.setEnabled(true);
- m_jmargin.setEnabled(true);
- m_jImage.setEnabled(true);
- m_jstockcost.setEnabled(true);
- m_jstockvolume.setEnabled(true);
- m_jInCatalog.setEnabled(true);
- m_jCatalogOrder.setEnabled(false);
+ // Los habilitados
+ m_jRef.setEnabled(true);
+ m_jCode.setEnabled(true);
+ m_jName.setEnabled(true);
+ m_jComment.setEnabled(true);
+ m_jScale.setEnabled(true);
+ m_jCategory.setEnabled(true);
+ m_jTax.setEnabled(true);
+ m_jPriceBuy.setEnabled(true);
+ m_jPriceSell.setEnabled(true);
+ m_jPriceSellTax.setEnabled(true);
+ m_jmargin.setEnabled(true);
+ m_jImage.setEnabled(true);
+ m_jstockcost.setEnabled(true);
+ m_jstockvolume.setEnabled(true);
+ m_jInCatalog.setEnabled(true);
+ m_jCatalogOrder.setEnabled(false);
+ m_jModifierList.setEnabled(true);
- writeReport(null, 0.0);
- }
+ writeReport(null, 0.0);
+ }
- public void writeValueDelete(Product myprod) {
- m_jTitle.setText(myprod.getReference() + " - " + myprod.getName() + " "
- + AppLocal.getIntString("label.recorddeleted"));
- m_jRef.setText(myprod.getReference());
- m_jCode.setText(myprod.getCode());
- m_jName.setText(myprod.getName());
- m_jComment.setSelected(myprod.isCom());
- m_jScale.setSelected(myprod.isScale());
- m_jPriceBuy.setText(Formats.CURRENCY.formatValue(myprod.getPriceBuy()));
- m_dPriceSell = (Double) myprod.getPriceSell();
- m_bPriceSellLock = true;
- m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
- m_bPriceSellLock = false;
- m_CategoryModel.setSelectedItem(myprod.getCategory());
- m_TaxModel.setSelectedItem(myprod.getTax());
- Image img = myprod.getImage();
- if (img != null)
- m_jImage.setImage(img.getBufferedImage());
- else
- m_jImage.setImage(null);
- m_jstockcost.setText(Formats.CURRENCY
- .formatValue(myprod.getStockCost()));
- m_jstockvolume.setText(Formats.DOUBLE.formatValue(myprod.getVolume()));
- // m_jInCatalog.setSelected(((Boolean)myprod.get[13]).booleanValue());
- // m_jCatalogOrder.setText(Formats.INT.formatValue(myprod.[14]));
+ public void writeValueDelete(Product myprod) {
+ m_jTitle.setText(myprod.getReference() + " - " + myprod.getName() + " " + AppLocal.getIntString("label.recorddeleted"));
+ m_jRef.setText(myprod.getReference());
+ m_jCode.setText(myprod.getCode());
+ m_jName.setText(myprod.getName());
+ m_jComment.setSelected(myprod.isCom());
+ m_jScale.setSelected(myprod.isScale());
+ m_jPriceBuy.setText(Formats.CURRENCY.formatValue(myprod.getPriceBuy()));
+ m_dPriceSell = (Double) myprod.getPriceSell();
+ m_bPriceSellLock = true;
+ m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
+ m_bPriceSellLock = false;
+ m_CategoryModel.setSelectedItem(myprod.getCategory());
+ m_TaxModel.setSelectedItem(myprod.getTax());
+ Image img = myprod.getImage();
+ if (img != null) {
+ m_jImage.setImage(img.getBufferedImage());
+ }
+ else {
+ m_jImage.setImage(null);
+ }
+ m_jstockcost.setText(Formats.CURRENCY.formatValue(myprod.getStockCost()));
+ m_jstockvolume.setText(Formats.DOUBLE.formatValue(myprod.getVolume()));
+ // m_jInCatalog.setSelected(((Boolean)myprod.get[13]).booleanValue());
+ // m_jCatalogOrder.setText(Formats.INT.formatValue(myprod.[14]));
+
+ m_jModifierList.setSelectedIndices(m_modifiers.getModifierIndices(myprod.getModifiers()));
- // Los habilitados
- m_jRef.setEnabled(false);
- m_jCode.setEnabled(false);
- m_jName.setEnabled(false);
- m_jComment.setEnabled(false);
- m_jScale.setEnabled(false);
- m_jCategory.setEnabled(false);
- m_jTax.setEnabled(false);
- m_jPriceBuy.setEnabled(false);
- m_jPriceSell.setEnabled(false);
- m_jPriceSellTax.setEnabled(false);
- m_jmargin.setEnabled(false);
- m_jImage.setEnabled(false);
- m_jstockcost.setEnabled(false);
- m_jstockvolume.setEnabled(false);
- m_jInCatalog.setEnabled(false);
- m_jCatalogOrder.setEnabled(false);
+ // Los habilitados
+ m_jRef.setEnabled(false);
+ m_jCode.setEnabled(false);
+ m_jName.setEnabled(false);
+ m_jComment.setEnabled(false);
+ m_jScale.setEnabled(false);
+ m_jCategory.setEnabled(false);
+ m_jTax.setEnabled(false);
+ m_jPriceBuy.setEnabled(false);
+ m_jPriceSell.setEnabled(false);
+ m_jPriceSellTax.setEnabled(false);
+ m_jmargin.setEnabled(false);
+ m_jImage.setEnabled(false);
+ m_jstockcost.setEnabled(false);
+ m_jstockvolume.setEnabled(false);
+ m_jInCatalog.setEnabled(false);
+ m_jCatalogOrder.setEnabled(false);
+ m_jModifierList.setEnabled(true);
- double dTaxRate = (myprod.getTax() == null) ? 0.0 : myprod.getTax().getRate();
- writeReport(myprod.getPriceBuy(), dTaxRate);
- }
+ double dTaxRate = (myprod.getTax() == null) ? 0.0 : myprod.getTax().getRate();
+ writeReport(myprod.getPriceBuy(), dTaxRate);
+ }
- public void writeValueEdit(Product myprod) {
- m_jTitle.setText(myprod.getReference() + " - " + myprod.getName());
- m_jRef.setText(myprod.getReference());
- m_jCode.setText(myprod.getCode());
- m_jName.setText(myprod.getName());
- m_jComment.setSelected(myprod.isCom());
- m_jScale.setSelected(myprod.isScale());
- m_jPriceBuy.setText(Formats.CURRENCY.formatValue(myprod.getPriceBuy()));
- m_dPriceSell = myprod.getPriceSell();
- m_bPriceSellLock = true;
- m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
- m_bPriceSellLock = false;
- m_CategoryModel.setSelectedItem(myprod.getCategory());
- m_TaxModel.setSelectedItem(myprod.getTax());
- if (myprod.getImage()!= null)
- m_jImage.setImage(myprod.getImage().getBufferedImage());
- else
- m_jImage.setImage(null);
- m_jstockcost.setText(Formats.CURRENCY
- .formatValue(myprod.getStockCost()));
- m_jstockvolume.setText(Formats.DOUBLE.formatValue(myprod.getVolume()));
- m_jInCatalog.setSelected(myprod.isInStock());
- if (myprod.isInStock())
- m_jCatalogOrder.setText(Formats.INT.formatValue(myprod.getDisplayOrder()));
- else
- m_jCatalogOrder.setText(null);
- // Los habilitados
- m_jRef.setEnabled(true);
- m_jCode.setEnabled(true);
- m_jName.setEnabled(true);
- m_jComment.setEnabled(true);
- m_jScale.setEnabled(true);
- m_jCategory.setEnabled(true);
- m_jTax.setEnabled(true);
- m_jPriceBuy.setEnabled(true);
- m_jPriceSell.setEnabled(true);
- m_jPriceSellTax.setEnabled(true);
- m_jmargin.setEnabled(true);
- m_jImage.setEnabled(true);
- m_jstockcost.setEnabled(true);
- m_jstockvolume.setEnabled(true);
- m_jInCatalog.setEnabled(true);
- m_jCatalogOrder.setEnabled(m_jInCatalog.isSelected());
+ public void writeValueEdit(Product myprod) {
+ m_jTitle.setText(myprod.getReference() + " - " + myprod.getName());
+ m_jRef.setText(myprod.getReference());
+ m_jCode.setText(myprod.getCode());
+ m_jName.setText(myprod.getName());
+ m_jComment.setSelected(myprod.isCom());
+ m_jScale.setSelected(myprod.isScale());
+ m_jPriceBuy.setText(Formats.CURRENCY.formatValue(myprod.getPriceBuy()));
+ m_dPriceSell = myprod.getPriceSell();
+ m_bPriceSellLock = true;
+ m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
+ m_bPriceSellLock = false;
+ m_CategoryModel.setSelectedItem(myprod.getCategory());
+ m_TaxModel.setSelectedItem(myprod.getTax());
+ if (myprod.getImage() != null) {
+ m_jImage.setImage(myprod.getImage().getBufferedImage());
+ }
+ else {
+ m_jImage.setImage(null);
+ }
+ m_jstockcost.setText(Formats.CURRENCY.formatValue(myprod.getStockCost()));
+ m_jstockvolume.setText(Formats.DOUBLE.formatValue(myprod.getVolume()));
+ m_jInCatalog.setSelected(myprod.isInStock());
+ if (myprod.isInStock()) {
+ m_jCatalogOrder.setText(Formats.INT.formatValue(myprod.getDisplayOrder()));
+ }
+ else {
+ m_jCatalogOrder.setText(null);
+ }
+
+ m_jModifierList.setSelectedIndices(m_modifiers.getModifierIndices(myprod.getModifiers()));
- double dTaxRate = (myprod.getTax() == null) ? 0.0 : myprod.getTax().getRate();
- writeReport((Double) myprod.getPriceBuy(), dTaxRate);
- }
+ // Los habilitados
+
+ m_jRef.setEnabled(true);
+ m_jCode.setEnabled(true);
+ m_jName.setEnabled(true);
+ m_jComment.setEnabled(true);
+ m_jScale.setEnabled(true);
+ m_jCategory.setEnabled(true);
+ m_jTax.setEnabled(true);
+ m_jPriceBuy.setEnabled(true);
+ m_jPriceSell.setEnabled(true);
+ m_jPriceSellTax.setEnabled(true);
+ m_jmargin.setEnabled(true);
+ m_jImage.setEnabled(true);
+ m_jstockcost.setEnabled(true);
+ m_jstockvolume.setEnabled(true);
+ m_jInCatalog.setEnabled(true);
+ m_jCatalogOrder.setEnabled(m_jInCatalog.isSelected());
+ m_jModifierList.setEnabled(true);
- public Product createValue() throws BasicException {
- Product myprod = new Product();
- return (writeValueUpdate(myprod))? myprod: null;
- }
+ double dTaxRate = (myprod.getTax() == null) ? 0.0 : myprod.getTax().getRate();
+ writeReport((Double) myprod.getPriceBuy(), dTaxRate);
+ }
- /*
- * (non-Javadoc)
- *
- * @see net.adrianromero.data.user.EditorRecord#writeValueUpdate(org.posper.hibernate.AbstractHibernateProduct)
- */
- public boolean writeValueUpdate(Product value) {
- Product myprod = (Product) value;
- try {
- myprod.setReference(m_jRef.getText());
- myprod.setCode(m_jCode.getText());
- myprod.setName(m_jName.getText());
- myprod.setCom(m_jComment.isSelected());
- myprod.setScale(m_jScale.isSelected());
- myprod.setPriceBuy((Double) Formats.CURRENCY.parseValue(m_jPriceBuy
- .getText()));
- myprod.setPriceSell(m_dPriceSell);
- myprod.setCategory((Category) m_CategoryModel.getSelectedItem());
- myprod.setTax((Tax) m_TaxModel.getSelectedItem());
- BufferedImage img = m_jImage.getImage();
- if (img != null)
- {
- Image prodImg = new Image();
- prodImg.setBufferedImage(img);
- myprod.setImage(prodImg);
- }
- if (m_jstockcost.getText().length() != 0)
- myprod.setStockCost((Double) Formats.CURRENCY
- .parseValue(m_jstockcost.getText()));
- if (m_jstockvolume.getText().length() != 0)
- myprod.setVolume((Double) Formats.DOUBLE
- .parseValue(m_jstockvolume.getText()));
- myprod.setInStock(new Boolean(m_jInCatalog.isSelected()));
- myprod.setDisplayOrder((Integer) Formats.INT.parseValue(m_jCatalogOrder.getText()));
- } catch (BasicException e) {
- MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, LocalRes.getIntString("message.nosave"), e);
- msg.show(this);
- return false;
- }
- return true;
- }
+ public Product createValue() throws BasicException {
+ Product myprod = new Product();
+ return (writeValueUpdate(myprod)) ? myprod : null;
+ }
- public DirtyManager getDirtyManager() {
- return m_Dirty;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.adrianromero.data.user.EditorRecord#writeValueUpdate(org.posper.hibernate.AbstractHibernateProduct)
+ */
+ public boolean writeValueUpdate(Product value) {
+ Product myprod = (Product) value;
+ try {
+ myprod.setReference(m_jRef.getText());
+ myprod.setCode(m_jCode.getText());
+ myprod.setName(m_jName.getText());
+ myprod.setCom(m_jComment.isSelected());
+ myprod.setScale(m_jScale.isSelected());
+ myprod.setPriceBuy((Double) Formats.CURRENCY.parseValue(m_jPriceBuy.getText()));
+ myprod.setPriceSell(m_dPriceSell);
+ myprod.setCategory((Category) m_CategoryModel.getSelectedItem());
+ myprod.setTax((Tax) m_TaxModel.getSelectedItem());
+ BufferedImage img = m_jImage.getImage();
+ if (img != null) {
+ Image prodImg = new Image();
+ prodImg.setBufferedImage(img);
+ myprod.setImage(prodImg);
+ }
+ else {
+ myprod.setImage(null);
+ }
+ if (m_jstockcost.getText().length() != 0) {
+ myprod.setStockCost((Double) Formats.CURRENCY.parseValue(m_jstockcost.getText()));
+ }
+ if (m_jstockvolume.getText().length() != 0) {
+ myprod.setVolume((Double) Formats.DOUBLE.parseValue(m_jstockvolume.getText()));
+ }
+ myprod.setInStock(new Boolean(m_jInCatalog.isSelected()));
+ myprod.setDisplayOrder((Integer) Formats.INT.parseValue(m_jCatalogOrder.getText()));
+ myprod.setModifiers(m_modifiers.indicesToMask(m_jModifierList.getSelectedIndices()));
+ }
+ catch (BasicException e) {
+ MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, LocalRes.getIntString("message.nosave"), e);
+ msg.show(this);
+ return false;
+ }
+ return true;
+ }
+ public DirtyManager getDirtyManager() {
+ return m_Dirty;
+ }
+
private void writeReport() {
Double dPriceBuy = readCurrency(m_jPriceBuy.getText());
Tax tax = (Tax) m_TaxModel.getSelectedItem();
- double dTaxRate = (tax == null) ? 0.0 : tax.getRate();
+ double dTaxRate = (tax == null) ? 0.0 : tax.getRate();
writeReport(dPriceBuy, dTaxRate);
}
private void writePriceTax() {
- Double dPriceSellTax = readCurrency(m_jPriceSellTax.getText());
- Tax tax = (Tax) m_TaxModel.getSelectedItem();
- double dTaxRate = (tax == null) ? 0.0 : tax.getRate();
- if (dPriceSellTax == null) {
- m_dPriceSell = null;
- } else {
- m_dPriceSell = new Double(dPriceSellTax.doubleValue()
- / (1.0 + dTaxRate));
- }
+ Double dPriceSellTax = readCurrency(m_jPriceSellTax.getText());
+ Tax tax = (Tax) m_TaxModel.getSelectedItem();
+ double dTaxRate = (tax == null) ? 0.0 : tax.getRate();
+ if (dPriceSellTax == null) {
+ m_dPriceSell = null;
+ }
+ else {
+ m_dPriceSell = new Double(dPriceSellTax.doubleValue() / (1.0 + dTaxRate));
+ }
- m_bPriceSellLock = true;
- m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
- m_bPriceSellLock = false;
+ m_bPriceSellLock = true;
+ m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
+ m_bPriceSellLock = false;
- m_bPriceSellTaxWriteLock = true;
- writeReport();
- m_bPriceSellTaxWriteLock = false;
- }
+ m_bPriceSellTaxWriteLock = true;
+ writeReport();
+ m_bPriceSellTaxWriteLock = false;
+ }
private void writeMargin() {
Double dPriceBuy = readCurrency(m_jPriceBuy.getText());
- Double dMargin = readPercent(m_jmargin.getText());
+ Double dMargin = readPercent(m_jmargin.getText());
if (dMargin == null || dPriceBuy == null) {
m_dPriceSell = dPriceBuy;
- } else {
+ }
+ else {
m_dPriceSell = new Double(dPriceBuy.doubleValue() * (1.0 + dMargin.doubleValue()));
}
m_bPriceSellLock = true;
- m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
+ m_jPriceSell.setText(Formats.CURRENCY.formatValue(m_dPriceSell));
m_bPriceSellLock = false;
m_bMarginWriteLock = true;
writeReport();
m_bMarginWriteLock = false;
}
-
private boolean m_bPriceSellLock = false;
private boolean m_bMarginLock = false;
private boolean m_bPriceSellTaxLock = false;
-
private boolean m_bMarginWriteLock = false;
private boolean m_bPriceSellTaxWriteLock = false;
-
-
// private void writeReport(Double dPriceBuy, double dTaxRate, Double dStockSecurity, Double dStockCost, Double dStockVolume) {
private void writeReport(Double dPriceBuy, double dTaxRate) {
-
- if (!m_bPriceSellTaxWriteLock) {
+
+ if (!m_bPriceSellTaxWriteLock) {
m_bPriceSellTaxLock = true;
if (m_dPriceSell == null) {
m_jPriceSellTax.setText(null);
- } else {
+ }
+ else {
m_jPriceSellTax.setText(Formats.CURRENCY.formatValue(new Double(m_dPriceSell.doubleValue() * (1.0 + dTaxRate))));
- }
+ }
m_bPriceSellTaxLock = false;
}
if (!m_bMarginWriteLock) {
m_bMarginLock = true;
if (dPriceBuy == null || m_dPriceSell == null) {
m_jmargin.setText(null);
- } else {
+ }
+ else {
m_jmargin.setText(Formats.PERCENT.formatValue(new Double(m_dPriceSell.doubleValue() / dPriceBuy.doubleValue() - 1.0)));
}
m_bMarginLock = false;
}
-
+
// if (m_dUnits == null) {
// m_junits.setText(null);
// m_junits.setForeground(UIManager.getDefaults().getColor("TextField.foreground"));
@@ -448,81 +478,95 @@
}
private class ReportManager implements DocumentListener, ActionListener {
+
public void changedUpdate(DocumentEvent e) {
writeReport();
}
+
public void insertUpdate(DocumentEvent e) {
writeReport();
- }
+ }
+
public void removeUpdate(DocumentEvent e) {
writeReport();
- }
+ }
+
public void actionPerformed(ActionEvent e) {
writeReport();
}
}
- private class PriceManager implements DocumentListener {
+ private class PriceManager implements DocumentListener {
+
public void changedUpdate(DocumentEvent e) {
if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell
m_dPriceSell = readCurrency(m_jPriceSell.getText());
writeReport();
}
}
+
public void insertUpdate(DocumentEvent e) {
if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell
m_dPriceSell = readCurrency(m_jPriceSell.getText());
writeReport();
}
- }
+ }
+
public void removeUpdate(DocumentEvent e) {
if (!m_bPriceSellLock) { // veo si puedo tocar m_jPriceSell
m_dPriceSell = readCurrency(m_jPriceSell.getText());
writeReport();
}
- }
+ }
}
private class PriceTaxManager implements DocumentListener {
+
public void changedUpdate(DocumentEvent e) {
if (!m_bPriceSellTaxLock) {
writePriceTax();
}
}
+
public void insertUpdate(DocumentEvent e) {
if (!m_bPriceSellTaxLock) {
writePriceTax();
}
- }
+ }
+
public void removeUpdate(DocumentEvent e) {
if (!m_bPriceSellTaxLock) {
writePriceTax();
}
- }
+ }
}
- private class MarginManager implements DocumentListener {
+ private class MarginManager implements DocumentListener {
+
public void changedUpdate(DocumentEvent e) {
if (!m_bMarginLock) {
writeMargin();
}
}
+
public void insertUpdate(DocumentEvent e) {
if (!m_bMarginLock) {
writeMargin();
}
- }
+ }
+
public void removeUpdate(DocumentEvent e) {
if (!m_bMarginLock) {
writeMargin();
}
- }
+ }
}
private final static Double readCurrency(String sValue) {
try {
return (Double) Formats.CURRENCY.parseValue(sValue);
- } catch (BasicException e) {
+ }
+ catch (BasicException e) {
return null;
}
}
@@ -530,18 +574,20 @@
private final static Double readPercent(String sValue) {
try {
return (Double) Formats.PERCENT.parseValue(sValue);
- } catch (BasicException e) {
+ }
+ catch (BasicException e) {
return null;
}
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
- // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
+
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
m_jRef = new javax.swing.JTextField();
@@ -575,154 +621,158 @@
m_jInCatalog = new javax.swing.JCheckBox();
jLabel18 = new javax.swing.JLabel();
m_jCatalogOrder = new javax.swing.JTextField();
+ jLabelModifiers = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ m_jModifierList = new javax.swing.JList();
setLayout(null);
- jLabel1.setText(AppLocal.getIntString("label.prodref"));
+ jLabel1.setText(AppLocal.getIntString("label.prodref")); // NOI18N
add(jLabel1);
- jLabel1.setBounds(10, 50, 80, 15);
+ jLabel1.setBounds(10, 50, 80, 14);
- jLabel2.setText(AppLocal.getIntString("label.prodname"));
+ jLabel2.setText(AppLocal.getIntString("label.prodname")); // NOI18N
add(jLabel2);
- jLabel2.setBounds(180, 50, 70, 15);
-
+ jLabel2.setBounds(200, 50, 70, 14);
add(m_jRef);
- m_jRef.setBounds(90, 50, 70, 19);
-
+ m_jRef.setBounds(90, 50, 70, 20);
add(m_jName);
- m_jName.setBounds(250, 50, 220, 19);
+ m_jName.setBounds(270, 50, 255, 20);
- m_jTitle.setFont(new java.awt.Font("SansSerif", 3, 18));
+ m_jTitle.setFont(new java.awt.Font("SansSerif", 3, 18)); // NOI18N
add(m_jTitle);
m_jTitle.setBounds(10, 10, 320, 30);
jPanel1.setLayout(null);
- jLabel6.setText(AppLocal.getIntString("label.prodbarcode"));
+ jLabel6.setText(AppLocal.getIntString("label.prodbarcode")); // NOI18N
jPanel1.add(jLabel6);
- jLabel6.setBounds(10, 20, 150, 15);
-
+ jLabel6.setBounds(10, 20, 150, 14);
jPanel1.add(m_jCode);
- m_jCode.setBounds(160, 20, 170, 19);
+ m_jCode.setBounds(160, 20, 170, 20);
m_jImage.setMaxDimensions(new java.awt.Dimension(64, 32));
jPanel1.add(m_jImage);
m_jImage.setBounds(340, 20, 200, 180);
- jLabel3.setText(AppLocal.getIntString("label.prodpricebuy"));
+ jLabel3.setText(AppLocal.getIntString("label.prodpricebuy")); // NOI18N
jPanel1.add(jLabel3);
- jLabel3.setBounds(10, 50, 150, 15);
+ jLabel3.setBounds(10, 50, 150, 14);
m_jPriceBuy.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel1.add(m_jPriceBuy);
- m_jPriceBuy.setBounds(160, 50, 80, 19);
+ m_jPriceBuy.setBounds(160, 50, 80, 20);
- jLabel4.setText(AppLocal.getIntString("label.prodpricesell"));
+ jLabel4.setText(AppLocal.getIntString("label.prodpricesell")); // NOI18N
jPanel1.add(jLabel4);
- jLabel4.setBounds(10, 80, 150, 15);
+ jLabel4.setBounds(10, 80, 150, 14);
m_jPriceSell.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel1.add(m_jPriceSell);
- m_jPriceSell.setBounds(160, 80, 80, 19);
+ m_jPriceSell.setBounds(160, 80, 80, 20);
- jLabel5.setText(AppLocal.getIntString("label.prodcategory"));
+ jLabel5.setText(AppLocal.getIntString("label.prodcategory")); // NOI18N
jPanel1.add(jLabel5);
- jLabel5.setBounds(10, 170, 150, 15);
-
+ jLabel5.setBounds(10, 170, 150, 14);
jPanel1.add(m_jCategory);
m_jCategory.setBounds(160, 170, 170, 20);
- jLabel7.setText(AppLocal.getIntString("label.prodtax"));
+ jLabel7.setText(AppLocal.getIntString("label.prodtax")); // NOI18N
jPanel1.add(jLabel7);
- jLabel7.setBounds(10, 140, 150, 15);
-
+ jLabel7.setBounds(10, 140, 150, 14);
jPanel1.add(m_jTax);
m_jTax.setBounds(160, 140, 170, 20);
m_jmargin.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel1.add(m_jmargin);
- m_jmargin.setBounds(250, 80, 80, 19);
+ m_jmargin.setBounds(250, 80, 80, 20);
m_jPriceSellTax.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel1.add(m_jPriceSellTax);
- m_jPriceSellTax.setBounds(160, 110, 80, 19);
+ m_jPriceSellTax.setBounds(160, 110, 80, 20);
- jLabel16.setText(AppLocal.getIntString("label.prodpriceselltax"));
+ jLabel16.setText(AppLocal.getIntString("label.prodpriceselltax")); // NOI18N
jPanel1.add(jLabel16);
- jLabel16.setBounds(10, 110, 150, 15);
-
+ jLabel16.setBounds(10, 110, 150, 14);
jPanel1.add(m_jCodetype);
- m_jCodetype.setBounds(300, 0, 80, 24);
+ m_jCodetype.setBounds(300, 0, 80, 20);
- jTabbedPane1.addTab(AppLocal.getIntString("label.prodgeneral"), jPanel1);
+ jTabbedPane1.addTab(AppLocal.getIntString("label.prodgeneral"), jPanel1); // NOI18N
jPanel2.setLayout(null);
- jLabel9.setText(AppLocal.getIntString("label.prodstockcost"));
+ jLabel9.setText(AppLocal.getIntString("label.prodstockcost")); // NOI18N
jPanel2.add(jLabel9);
- jLabel9.setBounds(10, 10, 150, 15);
+ jLabel9.setBounds(10, 10, 150, 14);
m_jstockcost.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel2.add(m_jstockcost);
- m_jstockcost.setBounds(160, 10, 80, 19);
+ m_jstockcost.setBounds(160, 10, 80, 20);
- jLabel10.setText(AppLocal.getIntString("label.prodstockvol"));
+ jLabel10.setText(AppLocal.getIntString("label.prodstockvol")); // NOI18N
jPanel2.add(jLabel10);
- jLabel10.setBounds(10, 40, 150, 15);
+ jLabel10.setBounds(10, 40, 150, 14);
m_jstockvolume.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel2.add(m_jstockvolume);
- m_jstockvolume.setBounds(160, 40, 80, 19);
+ m_jstockvolume.setBounds(160, 40, 80, 20);
- jTabbedPane1.addTab(AppLocal.getIntString("label.prodstock"), jPanel2);
+ jTabbedPane1.addTab(AppLocal.getIntString("label.prodstock"), jPanel2); // NOI18N
jPanel4.setLayout(null);
- m_jComment.setText(AppLocal.getIntString("label.prodaux"));
+ m_jComment.setText(AppLocal.getIntString("label.prodaux")); // NOI18N
jPanel4.add(m_jComment);
- m_jComment.setBounds(20, 80, 140, 23);
+ m_jComment.setBounds(20, 130, 140, 23);
- m_jScale.setText(AppLocal.getIntString("label.prodscale"));
+ m_jScale.setText(AppLocal.getIntString("label.prodscale")); // NOI18N
jPanel4.add(m_jScale);
- m_jScale.setBounds(20, 110, 140, 23);
+ m_jScale.setBounds(20, 160, 140, 23);
- m_jInCatalog.setText(AppLocal.getIntString("label.prodincatalog"));
+ m_jInCatalog.setText(AppLocal.getIntString("label.prodincatalog")); // NOI18N
m_jInCatalog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jInCatalogActionPerformed(evt);
}
});
-
jPanel4.add(m_jInCatalog);
m_jInCatalog.setBounds(20, 20, 180, 23);
- jLabel18.setText(AppLocal.getIntString("label.prodorder"));
+ jLabel18.setText(AppLocal.getIntString("label.prodorder")); // NOI18N
jPanel4.add(jLabel18);
- jLabel18.setBounds(50, 50, 60, 15);
+ jLabel18.setBounds(25, 50, 130, 14);
m_jCatalogOrder.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jPanel4.add(m_jCatalogOrder);
- m_jCatalogOrder.setBounds(110, 50, 80, 19);
+ m_jCatalogOrder.setBounds(155, 50, 85, 20);
- jTabbedPane1.addTab(AppLocal.getIntString("label.prodproperties"), jPanel4);
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("net/adrianromero/tpv/i18n/messages"); // NOI18N
+ jLabelModifiers.setText(bundle.getString("ProductsEditor.jLabelModifiers.text")); // NOI18N
+ jPanel4.add(jLabelModifiers);
+ jLabelModifiers.setBounds(265, 10, 160, 14);
+ jScrollPane1.setViewportView(m_jModifierList);
+
+ jPanel4.add(jScrollPane1);
+ jScrollPane1.setBounds(260, 30, 255, 180);
+
+ jTabbedPane1.addTab(AppLocal.getIntString("label.prodproperties"), jPanel4); // NOI18N
+
add(jTabbedPane1);
jTabbedPane1.setBounds(10, 90, 560, 250);
-
}// </editor-fold>//GEN-END:initComponents
private void m_jInCatalogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jInCatalogActionPerformed
-
+
if (m_jInCatalog.isSelected()) {
- m_jCatalogOrder.setEnabled(true);
- } else {
- m_jCatalogOrder.setEnabled(false);
- m_jCatalogOrder.setText(null);
+ m_jCatalogOrder.setEnabled(true);
}
+ else {
+ m_jCatalogOrder.setEnabled(false);
+ m_jCatalogOrder.setText(null);
+ }
}//GEN-LAST:event_m_jInCatalogActionPerformed
-
-
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
@@ -735,9 +785,11 @@
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel9;
+ private javax.swing.JLabel jLabelModifiers;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
+ private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField m_jCatalogOrder;
private javax.swing.JComboBox m_jCategory;
@@ -746,6 +798,7 @@
private javax.swing.JCheckBox m_jComment;
private net.adrianromero.data.gui.JImageEditor m_jImage;
private javax.swing.JCheckBox m_jInCatalog;
+ private javax.swing.JList m_jModifierList;
private javax.swing.JTextField m_jName;
private javax.swing.JTextField m_jPriceBuy;
private javax.swing.JTextField m_jPriceSell;
@@ -758,5 +811,4 @@
private javax.swing.JTextField m_jstockcost;
private javax.swing.JTextField m_jstockvolume;
// End of variables declaration//GEN-END:variables
-
}
Modified: 0.601ha/src/main/java/net/adrianromero/tpv/modifier/Modifiers.java
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/modifier/Modifiers.java 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/modifier/Modifiers.java 2008-08-23 19:20:53 UTC (rev 570)
@@ -20,18 +20,23 @@
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import net.adrianromero.data.gui.JMessageDialog;
+import net.adrianromero.data.gui.MessageInf;
import net.adrianromero.scripting.ScriptEngine;
import net.adrianromero.scripting.ScriptException;
import net.adrianromero.scripting.ScriptFactory;
import net.adrianromero.tpv.forms.AppLocal;
+import org.posper.gui.forms.JPrincipalApp;
import org.posper.gui.forms.UserView;
import org.posper.hibernate.HibDAOFactory;
import org.posper.hibernate.Product;
@@ -75,20 +80,80 @@
/**
* Creates a new Modifiers object retrieving the modifier definitions from
* the resource 'Tickets.Modifiers'.
+ * This constructor is used where we don't have a UserView and don't need
+ * the userMask anyway.
*
+ */
+ public Modifiers() {
+ mMod = new ArrayList<Modifier>();
+ readModifiers("Ticket.Modifiers");
+ }
+
+ /**
+ * Creates a new Modifiers object and sets the user mask. This constructor
+ * should be used for modifier evaluation.
+ *
* @param oUser
*/
public Modifiers(UserView oUser) {
-
+ this();
m_Usr = oUser.getUser();
- mMod = new ArrayList<Modifier>();
- readModifiers("Ticket.Modifiers");
// we have deny=1 and allow=0, so we take the complement
userMask = ~m_Usr.getModifiers();
//TODO global
}
/**
+ * Returns a list of all modifiers defined
+ * @return the list of all modifiers defined
+ */
+ public HashMap<Integer, String> getModifierMap() {
+ HashMap<Integer, String> modMap = new HashMap<Integer, String>();
+ Modifier mod;
+ for (Iterator<Modifier> i = mMod.iterator(); i.hasNext();) {
+ mod = i.next();
+ modMap.put(mod.getId(), mod.getName());
+ }
+ return modMap;
+ }
+
+ public String[] getModifierNames() {
+ String[] names = new String[mMod.size()];
+ for (int i = 0; i < mMod.size(); i++) {
+ names[i] = mMod.get(i).getName();
+ if (i != mMod.get(i).getId()) {
+ //TODO throw an exception
+ return null;
+ }
+ }
+ return names;
+ }
+
+
+ public int indicesToMask(int[] indices) {
+ int mask = 0;
+ for (int i = 0; i < indices.length; i++) {
+ mask += Math.pow(2, indices[i]);
+ }
+ return mask;
+ }
+
+ public int[] getModifierIndices(int mask) {
+ Vector<Integer> indices = new Vector<Integer>();
+ // cycle through modifiers and return function calls
+ for (int i = 0; i < mMod.size(); i++) {
+ if ((mMod.get(i).getMask() & mask) > 0) {
+ indices.add(mMod.get(i).getId());
+ }
+ }
+ int[] indexArray = new int[indices.size()];
+ for (int i = 0; i < indices.size(); i++) {
+ indexArray[i] = indices.get(i);
+ }
+ return indexArray;
+ }
+
+ /**
*
* Activates the modifiers in mask. set checks which modifiers are excluded
* by those in mask and deactivates them. Only those modifiers in mask are
@@ -297,7 +362,7 @@
oTicketline.getProduct());
ModifierFunctions modFunc = new ModifierFunctions(oTicketline);
-
+
modFunc.resetTicketline();
Iterator<String> itr = functionCalls.iterator();
@@ -309,7 +374,8 @@
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
script.put("modfuncs", modFunc);
oTicketline = (TicketLine) script.eval(function);
- } catch (ScriptException e) {
+ }
+ catch (ScriptException e) {
e.printStackTrace();
}
}
@@ -333,7 +399,6 @@
// }
// return oTicketline;
// }
-
/**
* Retrieves the modifier mask for a product
*
@@ -345,7 +410,8 @@
if (prod == null) // no product can have no restrictions
{
return ~0;
- } else {
+ }
+ else {
return ~prod.getModifiers();
}
}
@@ -437,16 +503,20 @@
// parse the xml string using Modhandler
m_sp.parse(new InputSource(new StringReader(xmlResource)),
new ModHandler());
- } catch (ParserConfigurationException ePC) {
+ }
+ catch (ParserConfigurationException ePC) {
System.out.println(AppLocal.getIntString("message.xmlanalyzeerror"));
ePC.printStackTrace();
- } catch (SAXException eSAX) {
+ }
+ catch (SAXException eSAX) {
System.out.println(AppLocal.getIntString("message.invalidxml"));
eSAX.printStackTrace();
- } catch (IOException eIO) {
+ }
+ catch (IOException eIO) {
System.out.println(AppLocal.getIntString("message.xmlreaderror"));
eIO.printStackTrace();
- } catch (Exception e) {
+ }
+ catch (Exception e) {
e.printStackTrace();
}
}
@@ -495,6 +565,15 @@
*/
private class Modifier {
+ private Integer Id;
+
+ public Integer getId() {
+ return Id;
+ }
+
+ public void setId(Integer Id) {
+ this.Id = Id;
+ }
private String name;
public String getName() {
@@ -548,59 +627,71 @@
Attributes attributes) throws SAXException {
if ("modifier".equals(qName)) {
- // The id is currently not needed but maybe useful in the xml
- // text.
- // int id;
- // try {
- // id = Integer.valueOf(attributes.getValue("id"));
- // } catch (NumberFormatException e) {
- // id = 0;
- // }
+ int id;
+ try {
+ id = Integer.valueOf(attributes.getValue("id"));
+ }
+ catch (NumberFormatException e) {
+ id = 0;
+ }
Modifier oMod = new Modifier();
+ oMod.Id = id;
oMod.name = attributes.getValue("name");
oMod.displayName = attributes.getValue("display");
oMod.function = attributes.getValue("function");
try {
oMod.mask = Integer.valueOf(attributes.getValue("mask"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
// default if mask is invalid
oMod.mask = 0;
}
try {
oMod.excludeMask = Integer.valueOf(attributes.getValue("exclude"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
// default if exclude is invalid
oMod.excludeMask = 0;
}
mMod.add(oMod);
- } else if ("globalMask".equals(qName)) {
+ }
+ else if ("globalMask".equals(qName)) {
try {
globalMask = Integer.valueOf(attributes.getValue("value"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
globalMask = 0;
}
- } else if ("defaultUserMask".equals(qName)) {
+ }
+ else if ("defaultUserMask".equals(qName)) {
try {
defaultUserMask = ~Integer.valueOf(attributes.getValue("value"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
defaultProductMask = ~0;
}
- } else if ("defaultProductMask".equals(qName)) {
+ }
+ else if ("defaultProductMask".equals(qName)) {
try {
defaultProductMask = ~Integer.valueOf(attributes.getValue("value"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
defaultProductMask = ~0;
}
- } else if ("gastroMask".equals(qName)) {
+ }
+ else if ("gastroMask".equals(qName)) {
try {
gastroMask = Integer.valueOf(attributes.getValue("value"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
gastroMask = 0;
}
- } else if ("retailMask".equals(qName)) {
+ }
+ else if ("retailMask".equals(qName)) {
try {
retailMask = Integer.valueOf(attributes.getValue("value"));
- } catch (NumberFormatException e) {
+ }
+ catch (NumberFormatException e) {
retailMask = 0;
}
}
Deleted: 0.601ha/src/main/java/net/adrianromero/tpv/panels/CashCountEuroUI.form
===================================================================
--- 0.601ha/src/main/java/net/adrianromero/tpv/panels/CashCountEuroUI.form 2008-08-19 04:55:29 UTC (rev 569)
+++ 0.601ha/src/main/java/net/adrianromero/tpv/panels/CashCountEuroUI.form 2008-08-23 19:20:53 UTC (rev 570)
@@ -1,1151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
- <Properties>
- <Property name="defaultCloseOperation" type="int" value="3"/>
- </Properties>
- <SyntheticProperties>
- <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
- </SyntheticProperties>
- <AuxValues>
- <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_formBundle" type="java.lang.String" value="net/adrianromero/tpv/i18n/messages"/>
- <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|