Revision: 1208
http://ggc.svn.sourceforge.net/ggc/?rev=1208&view=rev
Author: andyrozman
Date: 2011-12-11 10:39:24 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
Stocks
Modified Paths:
--------------
trunk/ggc-desktop/src/ggc/gui/dialogs/defs/StockListDef.java
Added Paths:
-----------
trunk/ggc-desktop/src/ggc/gui/dialogs/stock/
trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockDialog.java
trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSelectorDialog.java
trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSubTypeDialog.java
trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockTypeDialog.java
Removed Paths:
-------------
trunk/ggc-desktop/src/ggc/gui/dialogs/StockDialog.java
trunk/ggc-desktop/src/ggc/gui/dialogs/StockTypeDialog.java
Deleted: trunk/ggc-desktop/src/ggc/gui/dialogs/StockDialog.java
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/StockDialog.java 2011-12-10 12:58:40 UTC (rev 1207)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/StockDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -1,457 +0,0 @@
-package ggc.gui.dialogs;
-
-import ggc.core.data.DailyValues;
-import ggc.core.data.DailyValuesRow;
-import ggc.core.util.DataAccess;
-import ggc.core.util.GGCProperties;
-
-import java.awt.Container;
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import com.atech.graphics.components.DateTimeComponent;
-import com.atech.i18n.I18nControlAbstract;
-
-/**
- * Application: GGC - GNU Gluco Control
- *
- * See AUTHORS for copyright information.
- *
- * 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
- *
- * Filename: zzz
- * Description: zzz
- *
- * Author: andyrozman {andy@...}
- */
-
-// fix this
-//for defining stock entry
-
-public class StockDialog extends JDialog implements ActionListener
-{
-
-
- private static final long serialVersionUID = -8276157027834968535L;
- private DataAccess m_da = DataAccess.getInstance();
- private I18nControlAbstract m_ic = m_da.getI18nControlInstance();
- private GGCProperties props = m_da.getSettings();
-
- private boolean m_actionDone = false;
-
- //private long last_change = 0;
-
-// static AddRowFrame singleton = null;
-
-
-
- JTextField DateField, TimeField, BGField, Ins1Field, Ins2Field, BUField,
- ActField, CommentField, UrineField;
-
- JComboBox cob_bg_type; //= new JComboBox();
-
-
- JLabel label_title = new JLabel();
- JLabel label_food;
- JCheckBox cb_food_set;
-
- DateTimeComponent dtc;
-
- JButton AddButton;
-
- String sDate = null;
-
- DailyValues dV = null;
- DailyValuesRow m_dailyValuesRow = null;
-
- //AbstractTableModel mod = null;
-
- //GGCProperties props = GGCProperties.getInstance();
- JComponent components[] = new JComponent[9];
-/*
- public AddRowFrame(AbstractTableModel m, DailyValues ndV, DailyStatsFrame dialog)
- {
- super(dialog, "", true);
- setTitle(m_ic.getMessage("ADD_NEW_ROW"));
- dV = ndV;
- mod = m;
- init();
- }
- */
-
- Font f_normal = m_da.getFont(DataAccess.FONT_NORMAL);
- Font f_bold = m_da.getFont(DataAccess.FONT_NORMAL);
- boolean in_process;
- boolean debug = false;
-
-
-
-
- //private boolean m_add_action = true;
- private Container m_parent = null;
-
-
-
-
- /**
- * Constructor
- *
- * @param ndV
- * @param nDate
- * @param dialog
- */
- public StockDialog(DailyValues ndV, String nDate, JDialog dialog)
- {
- super(dialog, "", true);
- m_parent = dialog;
- //initParameters(ndV,nDate);
- init();
- }
-
-
-
-
-
-
- @SuppressWarnings("unused")
- private void load()
- {
- this.dtc.setDateTime(this.m_dailyValuesRow.getDateTime());
-
- System.out.println(props.getBG_unit());
-
- // which format
- this.cob_bg_type.setSelectedIndex(props.getBG_unit()-1);
- this.BGField.setText(""+ this.m_dailyValuesRow.getBGAsString());
-
- if (debug)
- {
- System.out.println("Db value (cuurent): " + this.m_dailyValuesRow.getBG());
- System.out.println("Db value (mg/dL): " + this.m_dailyValuesRow.getBG(1));
- System.out.println("Display value (" + props.getBG_unitString() + "): " + this.m_dailyValuesRow.getBG(props.getBG_unit()));
- }
-
- Ins1Field.setText(""+this.m_dailyValuesRow.getIns1AsString());
- Ins2Field.setText(""+this.m_dailyValuesRow.getIns2AsString());
- BUField.setText(""+this.m_dailyValuesRow.getCHAsString());
-
- ActField.setText(this.m_dailyValuesRow.getActivity());
- UrineField.setText(this.m_dailyValuesRow.getUrine());
-
- this.cb_food_set.setEnabled(false);
- this.cb_food_set.setSelected(this.m_dailyValuesRow.areMealsSet());
- this.cb_food_set.setEnabled(true);
-
- CommentField.setText(this.m_dailyValuesRow.getComment());
-
-/*
- addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 240, 200, panel);
- addComponent(UrineField = new JTextField(), 110, 268, 220, panel);
- addComponent(ActField = new JTextField(), 110, 298, 220, panel);
-*/
-
-/*
- this.dtc = new DateTimeComponent(this.m_ic, DateTimeComponent.ALIGN_VERTICAL, 5);
- dtc.setBounds(160, 55, 100, 35);
- panel.add(dtc);
-
- addComponent(BGField = new JTextField(), 160, 118, 35, panel);
- addComponent(Ins2Field = new JTextField(), 160, 148, 35, panel);
- addComponent(Ins2Field = new JTextField(), 160, 178, 35, panel);
- addComponent(BUField = new JTextField(), 160, 208, 35, panel);
- addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 240, 200, panel);
- addComponent(UrineField = new JTextField(), 110, 268, 220, panel);
- addComponent(ActField = new JTextField(), 110, 298, 220, panel);
- addComponent(CommentField = new JTextField(), 110, 328, 220, panel);
-*/
- }
-
- /*
- private void save()
- {
-
- }
-*/
-
- private void init()
- {
- int x = 0;
- int y = 0;
- int width = 400;
- int height = 480;
-
- Rectangle bnd = m_parent.getBounds();
-
- x = (bnd.width/2) + bnd.x - (width/2);
- y = (bnd.height/2) + bnd.y - (height/2);
-
- this.setBounds(x, y, width, height);
-
- JPanel panel = new JPanel();
- panel.setBounds(0, 0, width, height);
- panel.setLayout(null);
-
- this.getContentPane().add(panel);
-
- label_title.setFont(m_da.getFont(DataAccess.FONT_BIG_BOLD));
- label_title.setHorizontalAlignment(JLabel.CENTER);
- label_title.setBounds(0, 15, 400, 35);
- panel.add(label_title);
-
- addLabel(m_ic.getMessage("DATE") + ":", 78, panel);
- addLabel(m_ic.getMessage("TIME") + ":", 108, panel);
- addLabel(m_ic.getMessage("BLOOD_GLUCOSE") + ":", 138, panel);
- addLabel(props.getIns1Name() + " (" + props.getIns1Abbr() + ") :", 168, panel);
- addLabel(props.getIns2Name() + " (" + props.getIns2Abbr() + "):", 198, panel);
- addLabel(m_ic.getMessage("CH_LONG") + ":", 228, panel);
- addLabel(m_ic.getMessage("FOOD") + ":", 258, panel);
- addLabel(m_ic.getMessage("URINE") + ":", 288, panel);
- addLabel(m_ic.getMessage("ACTIVITY") + ":", 318, panel);
- addLabel(m_ic.getMessage("COMMENT") + ":", 348, panel);
-
- this.dtc = new DateTimeComponent(this.m_da, DateTimeComponent.ALIGN_VERTICAL, 5);
- dtc.setBounds(140, 75, 100, 35);
- panel.add(dtc);
-
- addComponent(cob_bg_type = new JComboBox(this.m_da.bg_units), 220, 138, 80, panel);
- addComponent(BGField = new JTextField(), 140, 138, 55, panel);
- addComponent(Ins1Field = new JTextField(), 140, 168, 55, panel);
- addComponent(Ins2Field = new JTextField(), 140, 198, 55, panel);
- addComponent(BUField = new JTextField(), 140, 228, 55, panel);
- addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 260, 200, panel);
- addComponent(UrineField = new JTextField(), 110, 288, 220, panel);
- addComponent(ActField = new JTextField(), 110, 318, 220, panel);
- addComponent(CommentField = new JTextField(), 110, 348, 220, panel);
-
- this.cob_bg_type.setSelectedIndex(props.getBG_unit()-1);
-
- cb_food_set.setMultiClickThreshhold(500);
-
- //System.out.println(cb_food_set.get
-
-
- //cb_food_set.setEnabled(false);
- cb_food_set.addChangeListener(new ChangeListener(){
- /**
- * Invoked when the target of the listener has changed its state.
- *
- * @param e a ChangeEvent object
- */
- public void stateChanged(ChangeEvent e)
- {
- if (in_process)
- return;
-
- in_process = true;
- System.out.println("State: " + cb_food_set.isSelected());
- cb_food_set.setSelected(!cb_food_set.isSelected());
- in_process = false;
- }
- });
-
- String button_command[] = { "update_ch", m_ic.getMessage("UPDATE_FROM_FOOD"),
- "edit", m_ic.getMessage("EDIT"),
- "ok", m_ic.getMessage("OK"),
- "cancel", m_ic.getMessage("CANCEL"),
- "help", m_ic.getMessage("HELP")
- };
-
- int button_coord[] = { 210, 228, 120, 0,
- 230, 258, 100, 0,
- 50, 390, 80, 1,
- 140, 390, 80, 1,
- 250, 390, 80, 0
- };
-
- JButton button;
- //int j=0;
- for (int i=0, j=0; i<button_coord.length; i+=4, j+=2)
- {
- button = new JButton(button_command[j+1]);
- button.setActionCommand(button_command[j]);
- button.addActionListener(this);
-
- if (button_coord[i+3]==0)
- {
- button.setEnabled(false);
- }
-
- addComponent(button, button_coord[i], button_coord[i+1], button_coord[i+2], panel);
-
-
- }
-
- }
-
-
- private void addLabel(String text, int posY, JPanel parent)
- {
- JLabel label = new JLabel(text);
- label.setBounds(30, posY, 100, 25);
- label.setFont(f_bold);
- parent.add(label);
- //a.add(new JLabel(m_ic.getMessage("DATE") + ":", SwingConstants.RIGHT));
-
- }
-
- private void addComponent(JComponent comp, int posX, int posY, int width, JPanel parent)
- {
- //JLabel label = new JLabel(text);
- comp.setBounds(posX, posY, width, 23);
- comp.setFont(f_normal);
- parent.add(comp);
- }
-
-
- /*
- private void init_old()
- {
- this.setBounds(150, 150, 300, 150);
-
- JPanel a = new JPanel(new GridLayout(0, 1));
- a.add(new JLabel(m_ic.getMessage("DATE") + ":", SwingConstants.RIGHT));
- a.add(new JLabel(m_ic.getMessage("BG") + ":", SwingConstants.RIGHT));
- a.add(new JLabel(m_da.getSettings().getIns1Abbr() + ":", SwingConstants.RIGHT));
- a.add(new JLabel(m_ic.getMessage("ACT") + ":", SwingConstants.RIGHT));
-
- JPanel b = new JPanel(new GridLayout(0, 1));
- DateField = new JTextField(10);
- if (sDate != null)
- {
- DateField.setText(sDate);
- DateField.setEditable(false);
- }
- b.add(DateField);
-
-
- b.add(BGField = new JTextField());
- components[1] = BGField;
- BGField.addKeyListener(this);
-
- b.add(Ins1Field = new JTextField());
- components[3] = Ins1Field;
- Ins1Field.addKeyListener(this);
-
-
- b.add(ActField = new JTextField());
- components[5] = ActField;
- ActField.addKeyListener(this);
-
-
- JPanel c = new JPanel(new GridLayout(0, 1));
- c.add(new JLabel(m_ic.getMessage("TIME") + ":", SwingConstants.RIGHT));
- c.add(new JLabel(m_ic.getMessage("BU") + ":", SwingConstants.RIGHT));
- c.add(new JLabel(m_da.getSettings().getIns2Abbr() + ":", SwingConstants.RIGHT));
- c.add(new JLabel(m_ic.getMessage("COMMENT") + ":", SwingConstants.RIGHT));
-
- JPanel d = new JPanel(new GridLayout(0, 1));
- d.add(TimeField = new JTextField(10));
- components[0] = TimeField;
- TimeField.addKeyListener(this);
-
-
- d.add(BUField = new JTextField());
- components[2] = BUField;
- BUField.addKeyListener(this);
-
-
- d.add(Ins2Field = new JTextField());
- components[4] = Ins2Field;
- Ins2Field.addKeyListener(this);
-
-
- d.add(CommentField = new JTextField());
- components[6] = CommentField;
- CommentField.addKeyListener(this);
-
-
- Box e = Box.createHorizontalBox();
- e.add(a);
- e.add(b);
- e.add(c);
- e.add(d);
-
- Box g = Box.createHorizontalBox();
- AddButton = new JButton(m_ic.getMessage("OK"));
- components[7] = AddButton;
- AddButton.addKeyListener(this);
- AddButton.setActionCommand("ok");
- AddButton.addActionListener(this);
-
- g.add(Box.createHorizontalGlue());
- getRootPane().setDefaultButton(AddButton);
-
- g.add(AddButton);
- JButton CloseButton = new JButton(m_ic.getMessage("CANCEL"));
- components[8] = CloseButton;
- CloseButton.addKeyListener(this);
- CloseButton.setActionCommand("close");
- CloseButton.addActionListener(this);
-
-
- g.add(Box.createHorizontalStrut(10));
- g.add(CloseButton);
- g.add(Box.createHorizontalGlue());
- this.getContentPane().add(g, BorderLayout.SOUTH);
-
- getContentPane().add(e, BorderLayout.NORTH);
- getContentPane().add(g, BorderLayout.SOUTH);
-
- }
-*/
-
- /**
- * Invoked when an action occurs.
- */
- public void actionPerformed(ActionEvent e)
- {
- String action = e.getActionCommand();
-
- if (action.equals("cancel"))
- {
- this.dispose();
- }
- else if (action.equals("ok"))
- {
- }
-
- }
-
- /**
- * Was Action Successful
- *
- * @return true if action was succesful (dialog closed with OK)
- */
- public boolean actionSuccessful()
- {
- return m_actionDone;
- }
-
-
-
-}
Deleted: trunk/ggc-desktop/src/ggc/gui/dialogs/StockTypeDialog.java
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/StockTypeDialog.java 2011-12-10 12:58:40 UTC (rev 1207)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/StockTypeDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -1,67 +0,0 @@
-package ggc.gui.dialogs;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Font;
-
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JTextField;
-
-/**
- *
- * @author andy
- *
- */
-public class StockTypeDialog extends JDialog
-{
-
- private JRadioButton jRadioButton0;
- private JTextField jTextField0;
- private JPanel jPanel0;
-
-
-
-
-
-
-
- private void initComponents() {
- setFont(new Font("Dialog", Font.PLAIN, 12));
- setBackground(Color.white);
- setForeground(Color.black);
-
- jPanel0 = new JPanel();
- jPanel0.setLayout(null);
-
- jRadioButton0 = new JRadioButton();
- jRadioButton0.setText("jRadioButton0");
- jRadioButton0.setBounds(59, 48, 104, 24);
-
-
- jTextField0 = new JTextField();
- jTextField0.setText("jTextField0");
- jTextField0.setBounds(132, 115, 63, 20);
-
- jPanel0.add(jRadioButton0);
- jPanel0.add(jTextField0);
-
-
- add(jPanel0, BorderLayout.CENTER);
- setSize(320, 240);
-
-
-
-
- }
-
- public StockTypeDialog() {
- initComponents();
- }
-
-
-
-
-
-}
Modified: trunk/ggc-desktop/src/ggc/gui/dialogs/defs/StockListDef.java
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/defs/StockListDef.java 2011-12-10 12:58:40 UTC (rev 1207)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/defs/StockListDef.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -1,7 +1,8 @@
package ggc.gui.dialogs.defs;
-import ggc.core.db.hibernate.DoctorH;
+import ggc.core.db.hibernate.StocksH;
import ggc.core.util.DataAccess;
+import ggc.gui.dialogs.stock.StockSelectorDialog;
import java.awt.Dimension;
import java.awt.Rectangle;
@@ -41,8 +42,12 @@
public class StockListDef extends GUIListDefAbstract
{
+ DataAccess m_da = DataAccess.getInstance();
- private ArrayList<DoctorH> active_list= null;
+ //private ArrayList<DoctorH> active_list= null;
+
+ private ArrayList<StocksH> active_list = null;
+
/**
* Constructor
@@ -56,6 +61,12 @@
@Override
public void doTableAction(String action)
{
+ if (action.equals("add"))
+ {
+ StockSelectorDialog ssd = new StockSelectorDialog(this.parent_dialog, m_da, 1);
+ ssd.showDialog();
+ }
+
System.out.println(this.getDefName() + " has not implemented action " + action);
}
@@ -83,15 +94,16 @@
public Object getValueAt(int row, int column)
{
// TODO Auto-generated method stub
- DoctorH dh = (DoctorH)active_list.get(row);
+ StocksH se = (StocksH)active_list.get(row);
switch(column)
{
case 0:
- return dh.getName();
+ return se.getDt_stock(); //dh.getName();
case 1:
- return ic.getMessage(dh.getDoctor_type().getName());
+ return se.getDescription();
+ //return ic.getMessage(dh.getDoctor_type().getName());
}
return null;
@@ -143,7 +155,21 @@
this.button_defs.add(new ButtonDef(this.ic.getMessage("EDIT"), "edit", "STOCKS_TABLE_EDIT_DESC", "table_edit.png"));
this.button_defs.add(new ButtonDef(this.ic.getMessage("VIEW"), "view", "STOCKS_TABLE_VIEW_DESC", "table_view.png"));
+ this.def_parameters = new String[2];
+ this.def_parameters[0] = "Test 1";
+ this.def_parameters[1] = "Test 2";
+
+ loadData();
+
}
+
+
+ public void loadData()
+ {
+ this.active_list = m_da.getDb().getStocks(-1, -1);
+ }
+
+
@Override
public String getDefName()
Copied: trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockDialog.java (from rev 1207, trunk/ggc-desktop/src/ggc/gui/dialogs/StockDialog.java)
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockDialog.java (rev 0)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -0,0 +1,575 @@
+package ggc.gui.dialogs.stock;
+
+import ggc.core.data.DailyValues;
+import ggc.core.data.DailyValuesRow;
+import ggc.core.util.DataAccess;
+import ggc.core.util.GGCProperties;
+
+import java.awt.Container;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import com.atech.graphics.components.DateTimeComponent;
+import com.atech.i18n.I18nControlAbstract;
+import java.awt.BorderLayout;
+import javax.swing.JFormattedTextField;
+
+/**
+ * Application: GGC - GNU Gluco Control
+ *
+ * See AUTHORS for copyright information.
+ *
+ * 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
+ *
+ * Filename: zzz
+ * Description: zzz
+ *
+ * Author: andyrozman {andy@...}
+ */
+
+// fix this
+//for defining stock entry
+
+public class StockDialog extends JDialog implements ActionListener
+{
+
+
+ private static final long serialVersionUID = -8276157027834968535L;
+ private DataAccess m_da = DataAccess.getInstance();
+ private I18nControlAbstract m_ic = m_da.getI18nControlInstance();
+ private GGCProperties props = m_da.getSettings();
+
+ private boolean m_actionDone = false;
+
+ //private long last_change = 0;
+
+// static AddRowFrame singleton = null;
+
+
+
+ JTextField DateField, TimeField, BGField, Ins1Field, Ins2Field, BUField,
+ ActField, CommentField, UrineField;
+
+ JComboBox cob_bg_type; //= new JComboBox();
+
+
+ JLabel label_title = new JLabel();
+ JLabel label_food;
+ JCheckBox cb_food_set;
+
+ DateTimeComponent dtc;
+
+ JButton AddButton;
+
+ String sDate = null;
+
+ DailyValues dV = null;
+ DailyValuesRow m_dailyValuesRow = null;
+
+ //AbstractTableModel mod = null;
+
+ //GGCProperties props = GGCProperties.getInstance();
+ JComponent components[] = new JComponent[9];
+/*
+ public AddRowFrame(AbstractTableModel m, DailyValues ndV, DailyStatsFrame dialog)
+ {
+ super(dialog, "", true);
+ setTitle(m_ic.getMessage("ADD_NEW_ROW"));
+ dV = ndV;
+ mod = m;
+ init();
+ }
+ */
+
+ Font f_normal = m_da.getFont(DataAccess.FONT_NORMAL);
+ Font f_bold = m_da.getFont(DataAccess.FONT_NORMAL);
+ boolean in_process;
+ boolean debug = false;
+
+
+
+
+ //private boolean m_add_action = true;
+ private Container m_parent = null;
+ private JLabel lblNewLabel;
+ private JLabel lblNewLabel_1;
+ private JLabel lblNewLabel_2;
+ private JLabel lblAmount;
+ private JLabel lblDescription;
+ private JLabel lblUsagePerDay;
+ private JLabel lblMin;
+ private JComboBox comboBox;
+ private JLabel lblEntryType;
+ private JButton btnOk;
+ private JButton btnCancel;
+ private JTextField textField;
+ private JLabel lblMax;
+ private JTextField textField_1;
+ private JFormattedTextField formattedTextField;
+ private JLabel lblStockType;
+ private JLabel lblStockSubType;
+ private JButton btnSelectstocktype;
+ private JTextField txtDescription;
+ private JButton btnHelp;
+
+
+
+
+ /**
+ * Constructor
+ *
+ * @param ndV
+ * @param nDate
+ * @param dialog
+ */
+ public StockDialog(DailyValues ndV, String nDate, JDialog dialog)
+ {
+ super(dialog, "", true);
+ m_parent = dialog;
+ //initParameters(ndV,nDate);
+ initGUI();
+ }
+
+
+
+
+
+
+ @SuppressWarnings("unused")
+ private void load()
+ {
+ this.dtc.setDateTime(this.m_dailyValuesRow.getDateTime());
+
+ System.out.println(props.getBG_unit());
+
+ // which format
+ this.cob_bg_type.setSelectedIndex(props.getBG_unit()-1);
+ this.BGField.setText(""+ this.m_dailyValuesRow.getBGAsString());
+
+ if (debug)
+ {
+ System.out.println("Db value (cuurent): " + this.m_dailyValuesRow.getBG());
+ System.out.println("Db value (mg/dL): " + this.m_dailyValuesRow.getBG(1));
+ System.out.println("Display value (" + props.getBG_unitString() + "): " + this.m_dailyValuesRow.getBG(props.getBG_unit()));
+ }
+
+ Ins1Field.setText(""+this.m_dailyValuesRow.getIns1AsString());
+ Ins2Field.setText(""+this.m_dailyValuesRow.getIns2AsString());
+ BUField.setText(""+this.m_dailyValuesRow.getCHAsString());
+
+ ActField.setText(this.m_dailyValuesRow.getActivity());
+ UrineField.setText(this.m_dailyValuesRow.getUrine());
+
+ this.cb_food_set.setEnabled(false);
+ this.cb_food_set.setSelected(this.m_dailyValuesRow.areMealsSet());
+ this.cb_food_set.setEnabled(true);
+
+ CommentField.setText(this.m_dailyValuesRow.getComment());
+
+/*
+ addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 240, 200, panel);
+ addComponent(UrineField = new JTextField(), 110, 268, 220, panel);
+ addComponent(ActField = new JTextField(), 110, 298, 220, panel);
+*/
+
+/*
+ this.dtc = new DateTimeComponent(this.m_ic, DateTimeComponent.ALIGN_VERTICAL, 5);
+ dtc.setBounds(160, 55, 100, 35);
+ panel.add(dtc);
+
+ addComponent(BGField = new JTextField(), 160, 118, 35, panel);
+ addComponent(Ins2Field = new JTextField(), 160, 148, 35, panel);
+ addComponent(Ins2Field = new JTextField(), 160, 178, 35, panel);
+ addComponent(BUField = new JTextField(), 160, 208, 35, panel);
+ addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 240, 200, panel);
+ addComponent(UrineField = new JTextField(), 110, 268, 220, panel);
+ addComponent(ActField = new JTextField(), 110, 298, 220, panel);
+ addComponent(CommentField = new JTextField(), 110, 328, 220, panel);
+*/
+ }
+
+ /*
+ private void save()
+ {
+
+ }
+*/
+
+ private void initGUI()
+ {
+ int x = 0;
+ int y = 0;
+ int width = 400;
+ int height = 480;
+
+ Rectangle bnd = m_parent.getBounds();
+
+ x = (bnd.width/2) + bnd.x - (width/2);
+ y = (bnd.height/2) + bnd.y - (height/2);
+
+ this.setBounds(x, y, width, height);
+
+ JPanel panel = new JPanel();
+ panel.setBounds(0, 0, 392, 446);
+ panel.setLayout(null);
+
+ getContentPane().setLayout(null);
+
+ this.getContentPane().add(panel);
+
+ label_title.setFont(m_da.getFont(DataAccess.FONT_BIG_BOLD));
+ label_title.setHorizontalAlignment(JLabel.CENTER);
+ label_title.setBounds(0, 15, 400, 35);
+ label_title.setText("TITLE");
+ panel.add(label_title);
+
+ this.lblNewLabel = new JLabel("Stock subtype");
+ this.lblNewLabel.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblNewLabel.setBounds(39, 109, 91, 14);
+ panel.add(this.lblNewLabel);
+
+ this.lblNewLabel_1 = new JLabel("Date Time");
+ this.lblNewLabel_1.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblNewLabel_1.setBounds(39, 148, 91, 14);
+ panel.add(this.lblNewLabel_1);
+
+ this.lblNewLabel_2 = new JLabel("Stock Type");
+ this.lblNewLabel_2.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblNewLabel_2.setBounds(39, 73, 93, 14);
+ panel.add(this.lblNewLabel_2);
+
+ this.lblAmount = new JLabel("Amount:");
+ this.lblAmount.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblAmount.setBounds(39, 197, 91, 14);
+ panel.add(this.lblAmount);
+
+ this.lblDescription = new JLabel("Description:");
+ this.lblDescription.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblDescription.setBounds(39, 239, 91, 14);
+ panel.add(this.lblDescription);
+
+ this.lblUsagePerDay = new JLabel("Usage per day:");
+ this.lblUsagePerDay.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblUsagePerDay.setBounds(39, 281, 91, 14);
+ panel.add(this.lblUsagePerDay);
+
+ this.lblMin = new JLabel("Min:");
+ this.lblMin.setBounds(156, 282, 35, 14);
+ panel.add(this.lblMin);
+
+ this.comboBox = new JComboBox();
+ this.comboBox.setBounds(156, 328, 93, 20);
+ panel.add(this.comboBox);
+
+ this.lblEntryType = new JLabel("Entry type:");
+ this.lblEntryType.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblEntryType.setBounds(39, 330, 91, 14);
+ panel.add(this.lblEntryType);
+
+ this.btnOk = new JButton("OK");
+ this.btnOk.setBounds(76, 381, 89, 23);
+ panel.add(this.btnOk);
+
+ this.btnCancel = new JButton("Cancel");
+ this.btnCancel.setBounds(175, 381, 89, 23);
+ panel.add(this.btnCancel);
+
+ this.textField = new JTextField();
+ this.textField.setBounds(190, 279, 46, 20);
+ panel.add(this.textField);
+ this.textField.setColumns(10);
+
+ this.lblMax = new JLabel("Max:");
+ this.lblMax.setBounds(260, 282, 35, 14);
+ panel.add(this.lblMax);
+
+ this.textField_1 = new JTextField();
+ this.textField_1.setBounds(305, 279, 56, 20);
+ panel.add(this.textField_1);
+ this.textField_1.setColumns(10);
+
+ this.formattedTextField = new JFormattedTextField();
+ this.formattedTextField.setBounds(156, 195, 103, 20);
+ panel.add(this.formattedTextField);
+
+ this.lblStockType = new JLabel("Stock Type");
+ this.lblStockType.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.lblStockType.setBounds(156, 73, 144, 14);
+ panel.add(this.lblStockType);
+
+ this.lblStockSubType = new JLabel("stock sub type");
+ this.lblStockSubType.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.lblStockSubType.setBounds(156, 110, 140, 14);
+ panel.add(this.lblStockSubType);
+
+ this.btnSelectstocktype = new JButton("selectStockType");
+ this.btnSelectstocktype.setBounds(315, 73, 46, 53);
+ panel.add(this.btnSelectstocktype);
+
+ this.txtDescription = new JTextField();
+ this.txtDescription.setText("description");
+ this.txtDescription.setBounds(156, 237, 205, 20);
+ panel.add(this.txtDescription);
+ this.txtDescription.setColumns(10);
+
+ this.btnHelp = new JButton("Help");
+ this.btnHelp.setBounds(274, 381, 89, 23);
+ panel.add(this.btnHelp);
+
+
+
+ /*
+ addLabel(m_ic.getMessage("DATE") + ":", 78, panel);
+ addLabel(m_ic.getMessage("TIME") + ":", 108, panel);
+ addLabel(m_ic.getMessage("BLOOD_GLUCOSE") + ":", 138, panel);
+ addLabel(props.getIns1Name() + " (" + props.getIns1Abbr() + ") :", 168, panel);
+ addLabel(props.getIns2Name() + " (" + props.getIns2Abbr() + "):", 198, panel);
+ addLabel(m_ic.getMessage("CH_LONG") + ":", 228, panel);
+ addLabel(m_ic.getMessage("FOOD") + ":", 258, panel);
+ addLabel(m_ic.getMessage("URINE") + ":", 288, panel);
+ addLabel(m_ic.getMessage("ACTIVITY") + ":", 318, panel);
+ addLabel(m_ic.getMessage("COMMENT") + ":", 348, panel);
+
+ this.dtc = new DateTimeComponent(this.m_da, DateTimeComponent.ALIGN_VERTICAL, 5);
+ dtc.setBounds(140, 75, 100, 35);
+ panel.add(dtc);
+
+ addComponent(cob_bg_type = new JComboBox(this.m_da.bg_units), 220, 138, 80, panel);
+ addComponent(BGField = new JTextField(), 140, 138, 55, panel);
+ addComponent(Ins1Field = new JTextField(), 140, 168, 55, panel);
+ addComponent(Ins2Field = new JTextField(), 140, 198, 55, panel);
+ addComponent(BUField = new JTextField(), 140, 228, 55, panel);
+ addComponent(cb_food_set = new JCheckBox(" " + m_ic.getMessage("FOOD_SET")), 110, 260, 200, panel);
+ addComponent(UrineField = new JTextField(), 110, 288, 220, panel);
+ addComponent(ActField = new JTextField(), 110, 318, 220, panel);
+ addComponent(CommentField = new JTextField(), 110, 348, 220, panel);
+
+ this.cob_bg_type.setSelectedIndex(props.getBG_unit()-1);
+
+ cb_food_set.setMultiClickThreshhold(500);
+
+ //System.out.println(cb_food_set.get
+
+
+ //cb_food_set.setEnabled(false);
+ cb_food_set.addChangeListener(new ChangeListener(){
+ /**
+ * Invoked when the target of the listener has changed its state.
+ *
+ * @param e a ChangeEvent object
+ */
+/* public void stateChanged(ChangeEvent e)
+ {
+ if (in_process)
+ return;
+
+ in_process = true;
+ System.out.println("State: " + cb_food_set.isSelected());
+ cb_food_set.setSelected(!cb_food_set.isSelected());
+ in_process = false;
+ }
+ });
+
+ String button_command[] = { "update_ch", m_ic.getMessage("UPDATE_FROM_FOOD"),
+ "edit", m_ic.getMessage("EDIT"),
+ "ok", m_ic.getMessage("OK"),
+ "cancel", m_ic.getMessage("CANCEL"),
+ "help", m_ic.getMessage("HELP")
+ };
+
+ int button_coord[] = { 210, 228, 120, 0,
+ 230, 258, 100, 0,
+ 50, 390, 80, 1,
+ 140, 390, 80, 1,
+ 250, 390, 80, 0
+ };
+
+ JButton button;
+ //int j=0;
+ for (int i=0, j=0; i<button_coord.length; i+=4, j+=2)
+ {
+ button = new JButton(button_command[j+1]);
+ button.setActionCommand(button_command[j]);
+ button.addActionListener(this);
+
+ if (button_coord[i+3]==0)
+ {
+ button.setEnabled(false);
+ }
+
+ addComponent(button, button_coord[i], button_coord[i+1], button_coord[i+2], panel);
+
+
+ }
+ */
+ }
+
+
+ private void addLabel(String text, int posY, JPanel parent)
+ {
+ JLabel label = new JLabel(text);
+ label.setBounds(30, posY, 100, 25);
+ label.setFont(f_bold);
+ parent.add(label);
+ //a.add(new JLabel(m_ic.getMessage("DATE") + ":", SwingConstants.RIGHT));
+
+ }
+
+ private void addComponent(JComponent comp, int posX, int posY, int width, JPanel parent)
+ {
+ //JLabel label = new JLabel(text);
+ comp.setBounds(posX, posY, width, 23);
+ comp.setFont(f_normal);
+ parent.add(comp);
+ }
+
+
+ /*
+ private void init_old()
+ {
+ this.setBounds(150, 150, 300, 150);
+
+ JPanel a = new JPanel(new GridLayout(0, 1));
+ a.add(new JLabel(m_ic.getMessage("DATE") + ":", SwingConstants.RIGHT));
+ a.add(new JLabel(m_ic.getMessage("BG") + ":", SwingConstants.RIGHT));
+ a.add(new JLabel(m_da.getSettings().getIns1Abbr() + ":", SwingConstants.RIGHT));
+ a.add(new JLabel(m_ic.getMessage("ACT") + ":", SwingConstants.RIGHT));
+
+ JPanel b = new JPanel(new GridLayout(0, 1));
+ DateField = new JTextField(10);
+ if (sDate != null)
+ {
+ DateField.setText(sDate);
+ DateField.setEditable(false);
+ }
+ b.add(DateField);
+
+
+ b.add(BGField = new JTextField());
+ components[1] = BGField;
+ BGField.addKeyListener(this);
+
+ b.add(Ins1Field = new JTextField());
+ components[3] = Ins1Field;
+ Ins1Field.addKeyListener(this);
+
+
+ b.add(ActField = new JTextField());
+ components[5] = ActField;
+ ActField.addKeyListener(this);
+
+
+ JPanel c = new JPanel(new GridLayout(0, 1));
+ c.add(new JLabel(m_ic.getMessage("TIME") + ":", SwingConstants.RIGHT));
+ c.add(new JLabel(m_ic.getMessage("BU") + ":", SwingConstants.RIGHT));
+ c.add(new JLabel(m_da.getSettings().getIns2Abbr() + ":", SwingConstants.RIGHT));
+ c.add(new JLabel(m_ic.getMessage("COMMENT") + ":", SwingConstants.RIGHT));
+
+ JPanel d = new JPanel(new GridLayout(0, 1));
+ d.add(TimeField = new JTextField(10));
+ components[0] = TimeField;
+ TimeField.addKeyListener(this);
+
+
+ d.add(BUField = new JTextField());
+ components[2] = BUField;
+ BUField.addKeyListener(this);
+
+
+ d.add(Ins2Field = new JTextField());
+ components[4] = Ins2Field;
+ Ins2Field.addKeyListener(this);
+
+
+ d.add(CommentField = new JTextField());
+ components[6] = CommentField;
+ CommentField.addKeyListener(this);
+
+
+ Box e = Box.createHorizontalBox();
+ e.add(a);
+ e.add(b);
+ e.add(c);
+ e.add(d);
+
+ Box g = Box.createHorizontalBox();
+ AddButton = new JButton(m_ic.getMessage("OK"));
+ components[7] = AddButton;
+ AddButton.addKeyListener(this);
+ AddButton.setActionCommand("ok");
+ AddButton.addActionListener(this);
+
+ g.add(Box.createHorizontalGlue());
+ getRootPane().setDefaultButton(AddButton);
+
+ g.add(AddButton);
+ JButton CloseButton = new JButton(m_ic.getMessage("CANCEL"));
+ components[8] = CloseButton;
+ CloseButton.addKeyListener(this);
+ CloseButton.setActionCommand("close");
+ CloseButton.addActionListener(this);
+
+
+ g.add(Box.createHorizontalStrut(10));
+ g.add(CloseButton);
+ g.add(Box.createHorizontalGlue());
+ this.getContentPane().add(g, BorderLayout.SOUTH);
+
+ getContentPane().add(e, BorderLayout.NORTH);
+ getContentPane().add(g, BorderLayout.SOUTH);
+
+ }
+*/
+
+ /**
+ * Invoked when an action occurs.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ String action = e.getActionCommand();
+
+ if (action.equals("cancel"))
+ {
+ this.dispose();
+ }
+ else if (action.equals("ok"))
+ {
+ }
+
+ }
+
+ /**
+ * Was Action Successful
+ *
+ * @return true if action was succesful (dialog closed with OK)
+ */
+ public boolean actionSuccessful()
+ {
+ return m_actionDone;
+ }
+}
Added: trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSelectorDialog.java
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSelectorDialog.java (rev 0)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSelectorDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -0,0 +1,117 @@
+package ggc.gui.dialogs.stock;
+
+import ggc.core.db.datalayer.StockBaseType;
+import ggc.core.util.DataAccess;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+
+import javax.swing.JDialog;
+
+import com.atech.graphics.dialogs.selector.SelectableInterface;
+import com.atech.graphics.dialogs.selector.SelectorAbstractDialog;
+import com.atech.utils.ATDataAccessAbstract;
+
+public class StockSelectorDialog extends SelectorAbstractDialog
+{
+
+ DataAccess da_local = null;
+ int m_data_type = 0;
+
+ public StockSelectorDialog(JDialog parent, ATDataAccessAbstract da, int data_type)
+ {
+ super(parent, da, 1, false);
+ da_local = (DataAccess)da;
+
+ this.m_data_type = data_type;
+ //this.initSelectorValuesForType();
+ this.init();
+ }
+
+ @Override
+ public void initSelectorValuesForType()
+ {
+ if (this.m_data_type == 1)
+ {
+
+
+ setSelectorObject(new StockBaseType());
+ setSelectorName(ic.getMessage("STOCK_BASE_TYPE_SELECTOR"));
+
+ setAllowedActions(SelectorAbstractDialog.SELECTOR_ACTION_SELECT|SelectorAbstractDialog.SELECTOR_ACTION_CANCEL|SelectorAbstractDialog.SELECTOR_ACTION_NEW|SelectorAbstractDialog.SELECTOR_ACTION_EDIT);
+ this.use_generic_select = true;
+
+ //this.se
+ this.setColumnSortingEnabled(false);
+ this.setFilterType(SelectorAbstractDialog.SELECTOR_FILTER_TEXT);
+ this.setHelpStringId("PumpTool_Profile_Selector");
+ this.setHelpEnabled(false);
+ setNewItemString(ic.getMessage("NEW__STOCK_TYPE"));
+
+ this.descriptions = new Hashtable<String,String>();
+ this.descriptions.put("DESC_1", ic.getMessage("STOCK_BASE_TYPE"));
+
+
+ }
+ else
+ System.out.println("Unknown dialog type");
+ }
+
+ @Override
+ public void getFullData()
+ {
+ this.full = new ArrayList<SelectableInterface>();
+
+ if (this.m_data_type == 1)
+ {
+ this.full.addAll((Collection<? extends SelectableInterface>) da_local.getDb().getStockBaseTypes());
+ }
+
+ }
+
+ @Override
+ public void checkAndExecuteActionNew()
+ {
+ if (this.m_data_type == 1)
+ {
+ StockTypeDialog std = new StockTypeDialog(this);
+ std.setVisible(true);
+
+ if (std.actionSuccessful())
+ {
+ this.getFullData();
+ this.filterEntries();
+ }
+ }
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void checkAndExecuteActionEdit(SelectableInterface si)
+ {
+ if (this.m_data_type == 1)
+ {
+ StockTypeDialog std = new StockTypeDialog(this, (StockBaseType)si);
+ std.setVisible(true);
+
+ if (std.actionSuccessful())
+ {
+ //this.getFullData();
+ this.filterEntries();
+ }
+ }
+
+ }
+
+ @Override
+ public void checkAndExecuteActionSelect()
+ {
+ }
+
+
+
+
+
+}
Added: trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSubTypeDialog.java
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSubTypeDialog.java (rev 0)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockSubTypeDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -0,0 +1,166 @@
+package ggc.gui.dialogs.stock;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.JFormattedTextField;
+
+/**
+ *
+ * @author andy
+ *
+ */
+public class StockSubTypeDialog extends JDialog
+{
+
+ private JTextField jTextField0;
+ private JPanel panel;
+ private JLabel lblId;
+ private JLabel lblIdValue;
+ private JLabel lblName;
+ private JLabel lblDescription;
+ private JLabel lblTitle;
+ private JTextField txtNamelocdata;
+ private JButton btnOk;
+ private JButton btnCancel;
+ private JButton btnHelp;
+ private JLabel lblStockType;
+ private JLabel lblStockTypeId;
+ private JLabel lblContentamount;
+ private JFormattedTextField ftf_content;
+ private JButton btnSelstocktype;
+
+
+
+
+
+
+
+ public StockSubTypeDialog()
+ {
+ initGUI();
+ }
+
+
+ private void initGUI()
+ {
+ setFont(new Font("Dialog", Font.PLAIN, 12));
+ setBackground(Color.white);
+ setForeground(Color.black);
+
+ getContentPane().setLayout(null);
+
+
+ panel = new JPanel();
+ panel.setLayout(null);
+ panel.setBounds(0, 0, 403, 294);
+
+
+ this.getContentPane().add(panel, null);
+
+
+ jTextField0 = new JTextField();
+ this.jTextField0.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ jTextField0.setText("jTextField0");
+ jTextField0.setBounds(160, 127, 205, 20);
+
+ panel.add(jTextField0);
+
+
+ setSize(411, 328);
+
+
+
+
+
+ this.lblId = new JLabel("ID");
+ this.lblId.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblId.setBounds(38, 60, 78, 14);
+ this.panel.add(this.lblId);
+
+ this.lblIdValue = new JLabel("ID Value");
+ this.lblIdValue.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.lblIdValue.setBounds(160, 60, 46, 14);
+ this.panel.add(this.lblIdValue);
+
+ this.lblName = new JLabel("NAME");
+ this.lblName.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblName.setBounds(38, 130, 101, 14);
+ this.panel.add(this.lblName);
+
+ this.lblDescription = new JLabel("DESCRIPTION");
+ this.lblDescription.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblDescription.setBounds(38, 165, 101, 14);
+ this.panel.add(this.lblDescription);
+
+ this.lblTitle = new JLabel("Title");
+ this.lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
+ this.lblTitle.setFont(new Font("SansSerif", Font.BOLD, 14));
+ this.lblTitle.setBounds(10, 22, 355, 20);
+ this.panel.add(this.lblTitle);
+
+ this.txtNamelocdata = new JTextField();
+ this.txtNamelocdata.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.txtNamelocdata.setText("nameLocData");
+ this.txtNamelocdata.setBounds(161, 162, 204, 20);
+ this.panel.add(this.txtNamelocdata);
+
+ this.btnOk = new JButton("OK");
+ this.btnOk.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.btnOk.setBounds(62, 248, 89, 23);
+ this.panel.add(this.btnOk);
+
+ this.btnCancel = new JButton("Cancel");
+ this.btnCancel.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.btnCancel.setBounds(177, 248, 89, 23);
+ this.panel.add(this.btnCancel);
+
+ this.btnHelp = new JButton("Help");
+ this.btnHelp.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.btnHelp.setBounds(276, 248, 89, 23);
+ this.panel.add(this.btnHelp);
+
+ this.lblStockType = new JLabel("Stock Type");
+ this.lblStockType.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblStockType.setBounds(38, 95, 101, 14);
+ this.panel.add(this.lblStockType);
+
+ this.lblStockTypeId = new JLabel("Stock Type ID");
+ this.lblStockTypeId.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.lblStockTypeId.setBounds(160, 95, 158, 14);
+ this.panel.add(this.lblStockTypeId);
+
+ this.lblContentamount = new JLabel("Content (Amount)");
+ this.lblContentamount.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblContentamount.setBounds(38, 200, 101, 14);
+ this.panel.add(this.lblContentamount);
+
+ this.ftf_content = new JFormattedTextField();
+ this.ftf_content.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ this.ftf_content.setBounds(160, 197, 89, 20);
+ this.panel.add(this.ftf_content);
+
+ this.btnSelstocktype = new JButton("?");
+ this.btnSelstocktype.setBounds(328, 91, 37, 23);
+ this.panel.add(this.btnSelstocktype);
+// getContentPane().add(this.lblId);
+ }
+
+ /**
+ * Was Action Successful
+ *
+ * @return true if action was successful (dialog closed with OK)
+ */
+ public boolean actionSuccessful()
+ {
+ return false; //m_actionDone;
+ }
+
+
+}
Copied: trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockTypeDialog.java (from rev 1207, trunk/ggc-desktop/src/ggc/gui/dialogs/StockTypeDialog.java)
===================================================================
--- trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockTypeDialog.java (rev 0)
+++ trunk/ggc-desktop/src/ggc/gui/dialogs/stock/StockTypeDialog.java 2011-12-11 10:39:24 UTC (rev 1208)
@@ -0,0 +1,182 @@
+package ggc.gui.dialogs.stock;
+
+import ggc.core.db.datalayer.StockBaseType;
+import ggc.core.util.DataAccess;
+
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+
+import com.atech.i18n.I18nControlAbstract;
+import com.atech.utils.ATSwingUtils;
+
+/**
+ *
+ * @author andy
+ *
+ */
+public class StockTypeDialog extends JDialog implements ActionListener
+{
+ //private JTextField jTextField0;
+ private JPanel panel;
+ //private JLabel lblIdValue;
+
+ private JLabel lbl_title;
+ private JLabel lbl_id_data;
+
+ private JTextField tf_name;
+ private JTextField tf_name_i18n;
+
+ //private JTextField txtNamelocdata;
+
+ private JButton btnOk;
+ private JButton btnCancel;
+ private JButton btnHelp;
+
+ DataAccess m_da = DataAccess.getInstance();
+ I18nControlAbstract m_ic = m_da.getI18nControlInstance();
+
+
+
+
+
+
+ public StockTypeDialog(JDialog parent)
+ {
+ super(parent, "", true);
+ initGUI();
+ }
+
+
+ public StockTypeDialog(JDialog parent, StockBaseType si)
+ {
+ super(parent, "", true);
+ initGUI();
+ }
+
+
+
+
+
+ private void initGUI()
+ {
+
+ panel = new JPanel();
+ panel.setLayout(null);
+ panel.setBounds(0, 0, 450, 350);
+
+ getContentPane().setLayout(null);
+ this.getContentPane().add(panel, null);
+
+
+
+ setSize(450, 350);
+
+
+ ATSwingUtils.initLibrary();
+
+ //JLabel label = null;
+
+
+ JLabel label = ATSwingUtils.getTitleLabel(m_ic.getMessage("NAME"), 0, 20, 350, 34, panel, ATSwingUtils.FONT_BIG_BOLD);
+
+
+ // ID
+ ATSwingUtils.getLabel(m_ic.getMessage("STOCK_ID"), 40, 90, 100, 24, panel, ATSwingUtils.FONT_NORMAL_BOLD);
+
+ this.lbl_id_data = ATSwingUtils.getLabel("", 160, 90, 100, 24, panel, ATSwingUtils.FONT_NORMAL_BOLD);
+
+
+ // Name
+ ATSwingUtils.getLabel(m_ic.getMessage("NAME"), 40, 130, 100, 24, panel, ATSwingUtils.FONT_NORMAL_BOLD);
+
+ this.tf_name = ATSwingUtils.getTextField("", 160, 130, 140, 20, panel, ATSwingUtils.FONT_NORMAL);
+
+
+ // Name Localized
+ ATSwingUtils.getLabel(m_ic.getMessage("NAME_LOCALIZED"), 40, 170, 100, 24, panel, ATSwingUtils.FONT_NORMAL_BOLD);
+
+ this.tf_name_i18n = ATSwingUtils.getTextField("", 160, 170, 140, 20, panel, ATSwingUtils.FONT_NORMAL);
+
+ /*
+ this.lblNameLocalized = new JLabel("Name Localized");
+ this.lblNameLocalized.setFont(new Font("SansSerif", Font.BOLD, 12));
+ this.lblNameLocalized.setBounds(38, 133, 103, 14);
+ this.jPanel0.add(this.lblNameLocalized);
+ */
+
+
+
+// ATSwingUtils.getLabel(m_ic.getMessage("NAME"), 40, 100, 100, 24, panel, ATSwingUtils.FONT_NORMAL_BOLD);
+
+
+ /*
+ this.txtNamelocdata = new JTextField();
+ this.txtNamelocdata.setText("nameLocData");
+ this.txtNamelocdata.setBounds(160, 130, 140, 20);
+ this.jPanel0.add(this.txtNamelocdata);
+ */
+
+
+
+ int[] s = { 16, 16};
+
+ ATSwingUtils.getButton(" " + m_ic.getMessage("OK"), 36, 220, 110, 25, panel, ATSwingUtils.FONT_NORMAL, "ok.png", "ok", this, m_da, s);
+
+ ATSwingUtils.getButton(" " + m_ic.getMessage("CANCEL"), 135, 220, 110, 25, panel, ATSwingUtils.FONT_NORMAL, "cancel.png", "ok", this, m_da, s);
+
+ ATSwingUtils.getButton(" " + m_ic.getMessage("HELP"), 220, 220, 110, 25, panel, ATSwingUtils.FONT_NORMAL, "help.png", "ok", this, m_da, s);
+
+
+ /*
+ this.btnOk = new JButton("OK");
+ this.btnOk.setBounds(36, 175, 89, 23);
+ this.jPanel0.add(this.btnOk);
+
+ this.btnCancel = new JButton("Cancel");
+ this.btnCancel.setBounds(135, 175, 89, 23);
+ this.jPanel0.add(this.btnCancel);
+
+ this.btnHelp = new JButton("Help");
+ this.btnHelp.setBounds(225, 175, 89, 23);
+ this.jPanel0.add(this.btnHelp);
+// getContentPane().add(this.lblId);*/
+ }
+
+
+ /**
+ * Was Action Successful
+ *
+ * @return true if action was successful (dialog closed with OK)
+ */
+ public boolean actionSuccessful()
+ {
+ return false; //m_actionDone;
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent ae)
+ {
+ if (ae.getActionCommand().equals("ok"))
+ {
+ this.dispose();
+ }
+ else if (ae.getActionCommand().equals("cancel"))
+ {
+ this.dispose();
+ }
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|