Created
May 6, 2012 02:47
-
-
Save fffergal/2607180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/StockManager/src/stockmanager/AddItemScreen.form b/StockManager/src/stockmanager/AddItemScreen.form | |
index f9524b1..504b59a 100644 | |
--- a/StockManager/src/stockmanager/AddItemScreen.form | |
+++ b/StockManager/src/stockmanager/AddItemScreen.form | |
@@ -2,11 +2,16 @@ | |
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
<Properties> | |
- <Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[500, 300]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="componentHidden" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -17,160 +22,162 @@ | |
<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,95,0,0,2,29"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace min="-2" pref="22" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="QuantityTxtbx" min="-2" pref="55" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="UnitLabel" min="-2" pref="36" max="-2" attributes="0"/> | |
- </Group> | |
- <Component id="ErrorLabel2" min="-2" max="-2" attributes="0"/> | |
- <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> | |
- <Component id="ErrorLabel1" alignment="0" min="-2" max="-2" attributes="0"/> | |
- <Component id="NotesTxtbx" alignment="0" min="-2" pref="227" max="-2" attributes="0"/> | |
- <Component id="ErrorLabel3" alignment="0" min="-2" max="-2" attributes="0"/> | |
- <Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0"> | |
- <Component id="jLabel1" max="32767" attributes="0"/> | |
- <Component id="ItemComboBox" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace min="0" pref="25" max="32767" attributes="0"/> | |
- </Group> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="CancelButton" min="-2" pref="102" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- <Component id="OkButton" min="-2" pref="102" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace type="separate" max="-2" attributes="0"/> | |
- <Component id="ItemComboBox" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="-2" pref="3" max="-2" attributes="0"/> | |
- <Component id="ErrorLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="-2" pref="1" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="1" attributes="0"> | |
- <Component id="UnitLabel" min="-2" pref="20" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="3" attributes="0"> | |
- <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="QuantityTxtbx" alignment="3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="ErrorLabel2" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel3" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="NotesTxtbx" min="-2" pref="55" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="ErrorLabel3" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace pref="28" max="32767" attributes="0"/> | |
- <Group type="103" groupAlignment="3" attributes="0"> | |
- <Component id="CancelButton" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="OkButton" alignment="3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"> | |
+ <Property name="horizontalGap" type="int" value="10"/> | |
+ <Property name="verticalGap" type="int" value="10"/> | |
</Layout> | |
<SubComponents> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
- <Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="11" style="1"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Add Item To The Re-Order List"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JComboBox" name="ItemComboBox"> | |
- <Properties> | |
- <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> | |
- <StringArray count="4"> | |
- <StringItem index="0" value="Item 1"/> | |
- <StringItem index="1" value="Item 2"/> | |
- <StringItem index="2" value="Item 3"/> | |
- <StringItem index="3" value="Item 4"/> | |
- </StringArray> | |
- </Property> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="ItemComboBoxItemStateChanged"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel2"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Quantity"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="UnitLabel"> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel3"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Notes"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JTextField" name="NotesTxtbx"> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="CancelButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Cancel"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="OkButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="OK"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="OkButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="ErrorLabel1"> | |
- <Properties> | |
- <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
- <Color blue="0" green="0" red="ff" type="rgb"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Please select an item from the List"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="ErrorLabel2"> | |
- <Properties> | |
- <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
- <Color blue="0" green="0" red="ff" type="rgb"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Please enter the desired quantity of the selected item"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JTextField" name="QuantityTxtbx"> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="ErrorLabel3"> | |
- <Properties> | |
- <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
- <Color blue="0" green="0" red="ff" type="rgb"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Please enter some record of why this addition is needed i.e. initial order"/> | |
- </Properties> | |
- </Component> | |
+ <Container class="javax.swing.JPanel" name="paddingPanel"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card2"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JLabel" name="addItemHeading"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Add Item to Order List"/> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JPanel" name="itemPanel"> | |
+ <Properties> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 37]"/> | |
+ </Property> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> | |
+ <Property name="alignment" type="int" value="0"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JComboBox" name="itemComboBox"> | |
+ <Events> | |
+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="itemComboBoxItemStateChanged"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JLabel" name="itemErrorLabel"> | |
+ <Properties> | |
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
+ <Color blue="0" green="0" red="ff" type="rgb"/> | |
+ </Property> | |
+ <Property name="text" type="java.lang.String" value="Please select an item from the List"/> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JPanel" name="quantityPanel"> | |
+ <Properties> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 38]"/> | |
+ </Property> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> | |
+ <Property name="alignment" type="int" value="0"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JLabel" name="quantityLabel"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Quantity"/> | |
+ </Properties> | |
+ </Component> | |
+ <Component class="javax.swing.JTextField" name="quantityText"> | |
+ <Properties> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[42, 28]"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ <Component class="javax.swing.JLabel" name="unitLabel"> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JLabel" name="quantityErrorLabel"> | |
+ <Properties> | |
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
+ <Color blue="0" green="0" red="ff" type="rgb"/> | |
+ </Property> | |
+ <Property name="text" type="java.lang.String" value="Please enter the desired quantity of the selected item"/> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JPanel" name="notesPanel"> | |
+ <Properties> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JLabel" name="notesLabel"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Notes"/> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JScrollPane" name="notesScroll"> | |
+ <Properties> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ </Properties> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JTextArea" name="notesTextArea"> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JLabel" name="noteErrorLabel"> | |
+ <Properties> | |
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
+ <Color blue="0" green="0" red="ff" type="rgb"/> | |
+ </Property> | |
+ <Property name="text" type="java.lang.String" value="Please enter some record of why this addition is needed i.e. initial order"/> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JPanel" name="buttonsPanel"> | |
+ <Properties> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 39]"/> | |
+ </Property> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> | |
+ <Property name="alignment" type="int" value="2"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="cancelButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Cancel"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="okButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="OK"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Form> | |
diff --git a/StockManager/src/stockmanager/AddItemScreen.java b/StockManager/src/stockmanager/AddItemScreen.java | |
index 99d3f0e..2923f22 100644 | |
--- a/StockManager/src/stockmanager/AddItemScreen.java | |
+++ b/StockManager/src/stockmanager/AddItemScreen.java | |
@@ -37,21 +37,19 @@ public AddItemScreen(ManagerController control) throws SQLException { | |
*/ | |
private Boolean checkAllFieldsOK(){ | |
- System.out.println("in method"); | |
- String qty = QuantityTxtbx.getText(); | |
- String notes = NotesTxtbx.getText(); | |
+ String qty = quantityText.getText(); | |
+ String notes = notesTextArea.getText(); | |
int x; | |
- System.out.println("quantity: " + qty + " and notes: " + notes); | |
- if (ItemComboBox.getSelectedItem() == null){ | |
- ErrorLabel1.setVisible(true); | |
+ if (itemComboBox.getSelectedItem() == null){ | |
+ itemErrorLabel.setVisible(true); | |
return false; | |
} | |
if (qty.equals("")){ | |
- ErrorLabel2.setVisible(true); | |
+ quantityErrorLabel.setVisible(true); | |
return false; | |
} | |
if (notes.equals("")){ | |
- ErrorLabel3.setVisible(true); | |
+ noteErrorLabel.setVisible(true); | |
return false; | |
} | |
try{ | |
@@ -64,38 +62,37 @@ private Boolean checkAllFieldsOK(){ | |
showErrorMsgs(); | |
return false; | |
} | |
- System.out.println("owned the try and catch"); | |
return true; | |
} | |
private void showErrorMsgs(){ | |
- ErrorLabel1.setVisible(true); | |
- ErrorLabel2.setVisible(true); | |
- ErrorLabel3.setVisible(true); | |
+ itemErrorLabel.setVisible(true); | |
+ quantityErrorLabel.setVisible(true); | |
+ noteErrorLabel.setVisible(true); | |
this.repaint(); | |
} | |
private void hideErrorMsgs(){ | |
- ErrorLabel1.setVisible(false); | |
- ErrorLabel2.setVisible(false); | |
- ErrorLabel3.setVisible(false); | |
+ itemErrorLabel.setVisible(false); | |
+ quantityErrorLabel.setVisible(false); | |
+ noteErrorLabel.setVisible(false); | |
this.repaint(); | |
} | |
private void setUpItemList() throws SQLException{ | |
- DefaultComboBoxModel m = (DefaultComboBoxModel)ItemComboBox.getModel(); | |
+ DefaultComboBoxModel m = (DefaultComboBoxModel)itemComboBox.getModel(); | |
m.removeAllElements(); | |
ingredients = Ingredients.getAllIngredients(); | |
for (IngredientData ingrd: ingredients){ | |
m.addElement(ingrd); | |
} | |
- ItemComboBox.setModel(m); | |
+ itemComboBox.setModel(m); | |
} | |
public void clear(){ | |
- UnitLabel.setText(""); | |
+ unitLabel.setText(""); | |
hideErrorMsgs(); | |
- QuantityTxtbx.setText(""); | |
- NotesTxtbx.setText(""); | |
+ quantityText.setText(""); | |
+ notesTextArea.setText(""); | |
} | |
/** | |
@@ -107,150 +104,146 @@ public void clear(){ | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- jLabel1 = new javax.swing.JLabel(); | |
- ItemComboBox = new javax.swing.JComboBox(); | |
- jLabel2 = new javax.swing.JLabel(); | |
- UnitLabel = new javax.swing.JLabel(); | |
- jLabel3 = new javax.swing.JLabel(); | |
- NotesTxtbx = new javax.swing.JTextField(); | |
- CancelButton = new javax.swing.JButton(); | |
- OkButton = new javax.swing.JButton(); | |
- ErrorLabel1 = new javax.swing.JLabel(); | |
- ErrorLabel2 = new javax.swing.JLabel(); | |
- QuantityTxtbx = new javax.swing.JTextField(); | |
- ErrorLabel3 = new javax.swing.JLabel(); | |
- | |
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
- | |
- jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N | |
- jLabel1.setText("Add Item To The Re-Order List"); | |
- | |
- ItemComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); | |
- ItemComboBox.addItemListener(new java.awt.event.ItemListener() { | |
+ paddingPanel = new javax.swing.JPanel(); | |
+ addItemHeading = new javax.swing.JLabel(); | |
+ itemPanel = new javax.swing.JPanel(); | |
+ itemComboBox = new javax.swing.JComboBox(); | |
+ itemErrorLabel = new javax.swing.JLabel(); | |
+ quantityPanel = new javax.swing.JPanel(); | |
+ quantityLabel = new javax.swing.JLabel(); | |
+ quantityText = new javax.swing.JTextField(); | |
+ unitLabel = new javax.swing.JLabel(); | |
+ quantityErrorLabel = new javax.swing.JLabel(); | |
+ notesPanel = new javax.swing.JPanel(); | |
+ notesLabel = new javax.swing.JLabel(); | |
+ notesScroll = new javax.swing.JScrollPane(); | |
+ notesTextArea = new javax.swing.JTextArea(); | |
+ noteErrorLabel = new javax.swing.JLabel(); | |
+ buttonsPanel = new javax.swing.JPanel(); | |
+ cancelButton = new javax.swing.JButton(); | |
+ okButton = new javax.swing.JButton(); | |
+ | |
+ setMinimumSize(new java.awt.Dimension(500, 300)); | |
+ addComponentListener(new java.awt.event.ComponentAdapter() { | |
+ public void componentHidden(java.awt.event.ComponentEvent evt) { | |
+ formComponentHidden(evt); | |
+ } | |
+ }); | |
+ getContentPane().setLayout(new java.awt.CardLayout(10, 10)); | |
+ | |
+ paddingPanel.setLayout(new javax.swing.BoxLayout(paddingPanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
+ | |
+ addItemHeading.setText("Add Item to Order List"); | |
+ paddingPanel.add(addItemHeading); | |
+ | |
+ itemPanel.setAlignmentX(0.0F); | |
+ itemPanel.setMaximumSize(new java.awt.Dimension(32767, 37)); | |
+ itemPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); | |
+ | |
+ itemComboBox.addItemListener(new java.awt.event.ItemListener() { | |
public void itemStateChanged(java.awt.event.ItemEvent evt) { | |
- ItemComboBoxItemStateChanged(evt); | |
+ itemComboBoxItemStateChanged(evt); | |
} | |
}); | |
+ itemPanel.add(itemComboBox); | |
+ | |
+ paddingPanel.add(itemPanel); | |
+ | |
+ itemErrorLabel.setForeground(new java.awt.Color(255, 0, 0)); | |
+ itemErrorLabel.setText("Please select an item from the List"); | |
+ paddingPanel.add(itemErrorLabel); | |
+ | |
+ quantityPanel.setAlignmentX(0.0F); | |
+ quantityPanel.setMaximumSize(new java.awt.Dimension(32767, 38)); | |
+ quantityPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); | |
+ | |
+ quantityLabel.setText("Quantity"); | |
+ quantityPanel.add(quantityLabel); | |
+ | |
+ quantityText.setPreferredSize(new java.awt.Dimension(42, 28)); | |
+ quantityPanel.add(quantityText); | |
+ quantityPanel.add(unitLabel); | |
- jLabel2.setText("Quantity"); | |
+ paddingPanel.add(quantityPanel); | |
- jLabel3.setText("Notes"); | |
+ quantityErrorLabel.setForeground(new java.awt.Color(255, 0, 0)); | |
+ quantityErrorLabel.setText("Please enter the desired quantity of the selected item"); | |
+ paddingPanel.add(quantityErrorLabel); | |
- CancelButton.setText("Cancel"); | |
- CancelButton.addActionListener(new java.awt.event.ActionListener() { | |
+ notesPanel.setAlignmentX(0.0F); | |
+ notesPanel.setLayout(new javax.swing.BoxLayout(notesPanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
+ | |
+ notesLabel.setText("Notes"); | |
+ notesPanel.add(notesLabel); | |
+ | |
+ notesScroll.setAlignmentX(0.0F); | |
+ notesScroll.setViewportView(notesTextArea); | |
+ | |
+ notesPanel.add(notesScroll); | |
+ | |
+ paddingPanel.add(notesPanel); | |
+ | |
+ noteErrorLabel.setForeground(new java.awt.Color(255, 0, 0)); | |
+ noteErrorLabel.setText("Please enter some record of why this addition is needed i.e. initial order"); | |
+ paddingPanel.add(noteErrorLabel); | |
+ | |
+ buttonsPanel.setAlignmentX(0.0F); | |
+ buttonsPanel.setMaximumSize(new java.awt.Dimension(32767, 39)); | |
+ buttonsPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); | |
+ | |
+ cancelButton.setText("Cancel"); | |
+ cancelButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- CancelButtonActionPerformed(evt); | |
+ cancelButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(cancelButton); | |
- OkButton.setText("OK"); | |
- OkButton.addActionListener(new java.awt.event.ActionListener() { | |
+ okButton.setText("OK"); | |
+ okButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- OkButtonActionPerformed(evt); | |
+ okButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(okButton); | |
+ | |
+ paddingPanel.add(buttonsPanel); | |
- ErrorLabel1.setForeground(new java.awt.Color(255, 0, 0)); | |
- ErrorLabel1.setText("Please select an item from the List"); | |
- | |
- ErrorLabel2.setForeground(new java.awt.Color(255, 0, 0)); | |
- ErrorLabel2.setText("Please enter the desired quantity of the selected item"); | |
- | |
- ErrorLabel3.setForeground(new java.awt.Color(255, 0, 0)); | |
- ErrorLabel3.setText("Please enter some record of why this addition is needed i.e. initial order"); | |
- | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGap(22, 22, 22) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jLabel2) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(QuantityTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(UnitLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addComponent(ErrorLabel2) | |
- .addComponent(jLabel3) | |
- .addComponent(ErrorLabel1) | |
- .addComponent(NotesTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(ErrorLabel3) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |
- .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(ItemComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) | |
- .addGap(0, 25, Short.MAX_VALUE)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(CancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(OkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))) | |
- .addContainerGap()) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jLabel1) | |
- .addGap(18, 18, 18) | |
- .addComponent(ItemComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGap(3, 3, 3) | |
- .addComponent(ErrorLabel1) | |
- .addGap(1, 1, 1) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
- .addComponent(UnitLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
- .addComponent(jLabel2) | |
- .addComponent(QuantityTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(ErrorLabel2) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jLabel3) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(NotesTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(ErrorLabel3) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
- .addComponent(CancelButton) | |
- .addComponent(OkButton)) | |
- .addContainerGap()) | |
- ); | |
+ getContentPane().add(paddingPanel, "card2"); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
- private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed | |
- System.out.println("I hit the cancel button"); | |
+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed | |
this.setVisible(false); | |
hideErrorMsgs(); | |
MC.setMainScreenVisible(); | |
- }//GEN-LAST:event_CancelButtonActionPerformed | |
+ }//GEN-LAST:event_cancelButtonActionPerformed | |
- private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed | |
- System.out.println("CLICKED the OK button :D"); | |
+ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed | |
hideErrorMsgs(); | |
if(checkAllFieldsOK()){ | |
- System.out.println("inside iff"); | |
- MC.addManualUpdate((IngredientData) ItemComboBox.getSelectedItem(), Double.parseDouble(QuantityTxtbx.getText()), NotesTxtbx.getText()); | |
+ MC.addManualUpdate((IngredientData) itemComboBox.getSelectedItem(), Double.parseDouble(quantityText.getText()), notesTextArea.getText()); | |
this.setVisible(false); | |
clear(); | |
MC.setMainScreenVisible(); | |
} | |
- }//GEN-LAST:event_OkButtonActionPerformed | |
+ }//GEN-LAST:event_okButtonActionPerformed | |
- private void ItemComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItemComboBoxItemStateChanged | |
+ private void itemComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_itemComboBoxItemStateChanged | |
//so one is selected: | |
- int index = ItemComboBox.getSelectedIndex(); | |
+ int index = itemComboBox.getSelectedIndex(); | |
if (index >=0){ | |
IngredientData i = ingredients.get(index); | |
- UnitLabel.setText(i.getUnits()); | |
+ unitLabel.setText(i.getUnits()); | |
} | |
- }//GEN-LAST:event_ItemComboBoxItemStateChanged | |
+ }//GEN-LAST:event_itemComboBoxItemStateChanged | |
+ | |
+ private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden | |
+ hideErrorMsgs(); | |
+ MC.setMainScreenVisible(); | |
+ }//GEN-LAST:event_formComponentHidden | |
/** | |
* @param args the command line arguments | |
@@ -302,17 +295,23 @@ private void ItemComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-F | |
// }); | |
// } | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
- private javax.swing.JButton CancelButton; | |
- private javax.swing.JLabel ErrorLabel1; | |
- private javax.swing.JLabel ErrorLabel2; | |
- private javax.swing.JLabel ErrorLabel3; | |
- private javax.swing.JComboBox ItemComboBox; | |
- private javax.swing.JTextField NotesTxtbx; | |
- private javax.swing.JButton OkButton; | |
- private javax.swing.JTextField QuantityTxtbx; | |
- private javax.swing.JLabel UnitLabel; | |
- private javax.swing.JLabel jLabel1; | |
- private javax.swing.JLabel jLabel2; | |
- private javax.swing.JLabel jLabel3; | |
+ private javax.swing.JLabel addItemHeading; | |
+ private javax.swing.JPanel buttonsPanel; | |
+ private javax.swing.JButton cancelButton; | |
+ private javax.swing.JComboBox itemComboBox; | |
+ private javax.swing.JLabel itemErrorLabel; | |
+ private javax.swing.JPanel itemPanel; | |
+ private javax.swing.JLabel noteErrorLabel; | |
+ private javax.swing.JLabel notesLabel; | |
+ private javax.swing.JPanel notesPanel; | |
+ private javax.swing.JScrollPane notesScroll; | |
+ private javax.swing.JTextArea notesTextArea; | |
+ private javax.swing.JButton okButton; | |
+ private javax.swing.JPanel paddingPanel; | |
+ private javax.swing.JLabel quantityErrorLabel; | |
+ private javax.swing.JLabel quantityLabel; | |
+ private javax.swing.JPanel quantityPanel; | |
+ private javax.swing.JTextField quantityText; | |
+ private javax.swing.JLabel unitLabel; | |
// End of variables declaration//GEN-END:variables | |
} | |
diff --git a/StockManager/src/stockmanager/AdminController.java b/StockManager/src/stockmanager/AdminController.java | |
index 97ca332..273e1e9 100644 | |
--- a/StockManager/src/stockmanager/AdminController.java | |
+++ b/StockManager/src/stockmanager/AdminController.java | |
@@ -62,7 +62,6 @@ public void editMeal(MealData meal){ | |
adminScreen.setVisible(false); | |
//go fetch the right meal from the list and populate the | |
//mealscreen | |
- System.out.println(meal.getName()); | |
mealScreen.clear(); | |
mealScreen.setMeal(meal); | |
mealScreen.addIngredients(meal); | |
diff --git a/StockManager/src/stockmanager/AdminScreen.form b/StockManager/src/stockmanager/AdminScreen.form | |
index 12788db..36e2fee 100644 | |
--- a/StockManager/src/stockmanager/AdminScreen.form | |
+++ b/StockManager/src/stockmanager/AdminScreen.form | |
@@ -1,34 +1,18 @@ | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
- <NonVisualComponents> | |
- <Menu class="javax.swing.JMenuBar" name="jMenuBar1"> | |
- <SubComponents> | |
- <Menu class="javax.swing.JMenu" name="jMenu1"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="File"/> | |
- </Properties> | |
- <SubComponents> | |
- <MenuItem class="javax.swing.JMenuItem" name="logoffMenuItem"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Log off"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="logoffMenuItemActionPerformed"/> | |
- </Events> | |
- </MenuItem> | |
- </SubComponents> | |
- </Menu> | |
- </SubComponents> | |
- </Menu> | |
- </NonVisualComponents> | |
<Properties> | |
<Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[300, 160]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
- <SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -39,108 +23,116 @@ | |
<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,44,0,0,1,-112"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <Group type="102" attributes="0"> | |
- <Component id="jScrollPane1" min="-2" pref="286" max="-2" attributes="0"/> | |
- <EmptySpace type="unrelated" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" max="-2" attributes="0"> | |
- <Component id="RemoveButton" max="32767" attributes="0"/> | |
- <Component id="EditButton" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <Component id="AddButton" alignment="0" min="-2" pref="71" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace pref="23" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="-2" pref="3" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="RemoveButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace type="unrelated" max="-2" attributes="0"/> | |
- <Component id="EditButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |
- </Group> | |
- <Component id="jScrollPane1" pref="199" max="32767" attributes="0"/> | |
- </Group> | |
- <EmptySpace type="separate" max="-2" attributes="0"/> | |
- <Component id="AddButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"> | |
+ <Property name="horizontalGap" type="int" value="10"/> | |
+ <Property name="verticalGap" type="int" value="10"/> | |
</Layout> | |
<SubComponents> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JPanel" name="paddingPanel"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card2"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Component class="javax.swing.JList" name="MealList"> | |
+ <Component class="javax.swing.JLabel" name="headingLabel"> | |
<Properties> | |
- <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | |
- <StringArray count="5"> | |
- <StringItem index="0" value="Item 1"/> | |
- <StringItem index="1" value="Item 2"/> | |
- <StringItem index="2" value="Item 3"/> | |
- <StringItem index="3" value="Item 4"/> | |
- <StringItem index="4" value="Item 5"/> | |
- </StringArray> | |
+ <Property name="text" type="java.lang.String" value="Admin Meals"/> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
</Property> | |
</Properties> | |
- <Events> | |
- <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="MealListFocusGained"/> | |
- </Events> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="North"/> | |
+ </Constraint> | |
+ </Constraints> | |
</Component> | |
+ <Container class="javax.swing.JScrollPane" name="mealListScroll"> | |
+ <Properties> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[280, 250]"/> | |
+ </Property> | |
+ </Properties> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JList" name="mealList"> | |
+ <Events> | |
+ <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="mealListFocusGained"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="buttonsPanel"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="10" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="East"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="addButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Add"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="editButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Edit"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="removeButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Remove"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
- <Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="11" style="1"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Admin: Adding and Altering Meals"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="RemoveButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Remove"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RemoveButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="EditButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Edit"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="EditButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="AddButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Add"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AddButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
</SubComponents> | |
</Form> | |
diff --git a/StockManager/src/stockmanager/AdminScreen.java b/StockManager/src/stockmanager/AdminScreen.java | |
index 69201b9..f7f85ff 100644 | |
--- a/StockManager/src/stockmanager/AdminScreen.java | |
+++ b/StockManager/src/stockmanager/AdminScreen.java | |
@@ -24,7 +24,7 @@ | |
public AdminScreen(AdminController AC) { | |
super(new javax.swing.JFrame(), true); | |
initComponents(); | |
- RemoveButton.setEnabled(false); | |
+ removeButton.setEnabled(false); | |
this.AC = AC; | |
populateList(); | |
} | |
@@ -43,7 +43,7 @@ public void populateList(){ | |
for (MealData m: meals){ | |
lm.addElement(m); | |
} | |
- MealList.setModel(lm); | |
+ mealList.setModel(lm); | |
} catch (SQLException ex) { | |
Logger.getLogger(AdminScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
@@ -59,123 +59,94 @@ public void populateList(){ | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- jScrollPane1 = new javax.swing.JScrollPane(); | |
- MealList = new javax.swing.JList(); | |
- jLabel1 = new javax.swing.JLabel(); | |
- RemoveButton = new javax.swing.JButton(); | |
- EditButton = new javax.swing.JButton(); | |
- AddButton = new javax.swing.JButton(); | |
- jMenuBar1 = new javax.swing.JMenuBar(); | |
- jMenu1 = new javax.swing.JMenu(); | |
- logoffMenuItem = new javax.swing.JMenuItem(); | |
+ paddingPanel = new javax.swing.JPanel(); | |
+ headingLabel = new javax.swing.JLabel(); | |
+ mealListScroll = new javax.swing.JScrollPane(); | |
+ mealList = new javax.swing.JList(); | |
+ buttonsPanel = new javax.swing.JPanel(); | |
+ addButton = new javax.swing.JButton(); | |
+ editButton = new javax.swing.JButton(); | |
+ removeButton = new javax.swing.JButton(); | |
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
- | |
- MealList.setModel(new javax.swing.AbstractListModel() { | |
- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; | |
- public int getSize() { return strings.length; } | |
- public Object getElementAt(int i) { return strings[i]; } | |
+ setMinimumSize(new java.awt.Dimension(300, 160)); | |
+ addWindowListener(new java.awt.event.WindowAdapter() { | |
+ public void windowClosed(java.awt.event.WindowEvent evt) { | |
+ formWindowClosed(evt); | |
+ } | |
}); | |
- MealList.addFocusListener(new java.awt.event.FocusAdapter() { | |
+ getContentPane().setLayout(new java.awt.CardLayout(10, 10)); | |
+ | |
+ paddingPanel.setLayout(new java.awt.BorderLayout()); | |
+ | |
+ headingLabel.setText("Admin Meals"); | |
+ headingLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ paddingPanel.add(headingLabel, java.awt.BorderLayout.NORTH); | |
+ | |
+ mealListScroll.setPreferredSize(new java.awt.Dimension(280, 250)); | |
+ | |
+ mealList.addFocusListener(new java.awt.event.FocusAdapter() { | |
public void focusGained(java.awt.event.FocusEvent evt) { | |
- MealListFocusGained(evt); | |
+ mealListFocusGained(evt); | |
} | |
}); | |
- jScrollPane1.setViewportView(MealList); | |
+ mealListScroll.setViewportView(mealList); | |
+ | |
+ paddingPanel.add(mealListScroll, java.awt.BorderLayout.CENTER); | |
- jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N | |
- jLabel1.setText("Admin: Adding and Altering Meals"); | |
+ buttonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0)); | |
+ buttonsPanel.setLayout(new javax.swing.BoxLayout(buttonsPanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
- RemoveButton.setText("Remove"); | |
- RemoveButton.addActionListener(new java.awt.event.ActionListener() { | |
+ addButton.setText("Add"); | |
+ addButton.setMaximumSize(new java.awt.Dimension(32767, 29)); | |
+ addButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- RemoveButtonActionPerformed(evt); | |
+ addButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(addButton); | |
- EditButton.setText("Edit"); | |
- EditButton.addActionListener(new java.awt.event.ActionListener() { | |
+ editButton.setText("Edit"); | |
+ editButton.setMaximumSize(new java.awt.Dimension(32767, 29)); | |
+ editButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- EditButtonActionPerformed(evt); | |
+ editButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(editButton); | |
- AddButton.setText("Add"); | |
- AddButton.addActionListener(new java.awt.event.ActionListener() { | |
+ removeButton.setText("Remove"); | |
+ removeButton.setMaximumSize(new java.awt.Dimension(32767, 29)); | |
+ removeButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- AddButtonActionPerformed(evt); | |
+ removeButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(removeButton); | |
- jMenu1.setText("File"); | |
+ paddingPanel.add(buttonsPanel, java.awt.BorderLayout.EAST); | |
- logoffMenuItem.setText("Log off"); | |
- logoffMenuItem.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- logoffMenuItemActionPerformed(evt); | |
- } | |
- }); | |
- jMenu1.add(logoffMenuItem); | |
- | |
- jMenuBar1.add(jMenu1); | |
- | |
- setJMenuBar(jMenuBar1); | |
- | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addComponent(jLabel1) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |
- .addComponent(RemoveButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(EditButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) | |
- .addComponent(AddButton, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addContainerGap(23, Short.MAX_VALUE)) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jLabel1) | |
- .addGap(3, 3, 3) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(RemoveButton) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
- .addComponent(EditButton) | |
- .addGap(0, 0, Short.MAX_VALUE)) | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)) | |
- .addGap(18, 18, 18) | |
- .addComponent(AddButton) | |
- .addContainerGap()) | |
- ); | |
+ getContentPane().add(paddingPanel, "card2"); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
- private void MealListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_MealListFocusGained | |
- RemoveButton.setEnabled(true); | |
- }//GEN-LAST:event_MealListFocusGained | |
+ private void mealListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mealListFocusGained | |
+ removeButton.setEnabled(true); | |
+ }//GEN-LAST:event_mealListFocusGained | |
- private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddButtonActionPerformed | |
+ private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed | |
AC.addMeal(); | |
- }//GEN-LAST:event_AddButtonActionPerformed | |
+ }//GEN-LAST:event_addButtonActionPerformed | |
- private void RemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveButtonActionPerformed | |
+ private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed | |
//Are you sure you want to remove this meal and all its details from the db? | |
//yes: | |
int res = JOptionPane.showConfirmDialog(null, "Are you sure you want to remove Meal?"); | |
if (res == JOptionPane.OK_OPTION){ | |
- System.out.println("OK!!!! :D"); | |
- if (MealList.getSelectedIndex() != -1){ | |
+ if (mealList.getSelectedIndex() != -1){ | |
try { | |
- AC.removeMeal((MealData) MealList.getSelectedValue()); | |
+ AC.removeMeal((MealData) mealList.getSelectedValue()); | |
} catch (SQLException ex) { | |
Logger.getLogger(AdminScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
@@ -185,33 +156,31 @@ private void RemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- | |
//and remove from ac.remove ingrd(index)whatevs | |
//call populate list again | |
//no: do nothing :D | |
- }//GEN-LAST:event_RemoveButtonActionPerformed | |
+ }//GEN-LAST:event_removeButtonActionPerformed | |
- private void EditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditButtonActionPerformed | |
- if (MealList.getSelectedIndex() != -1){ | |
- System.out.println(MealList.getSelectedIndex()); | |
- AC.editMeal((MealData) MealList.getSelectedValue()); | |
+ private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed | |
+ if (mealList.getSelectedIndex() != -1){ | |
+ AC.editMeal((MealData) mealList.getSelectedValue()); | |
} | |
- }//GEN-LAST:event_EditButtonActionPerformed | |
+ }//GEN-LAST:event_editButtonActionPerformed | |
- private void logoffMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoffMenuItemActionPerformed | |
+ private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed | |
AC.logoff(); | |
- }//GEN-LAST:event_logoffMenuItemActionPerformed | |
+ }//GEN-LAST:event_formWindowClosed | |
/** | |
* @param args the command line arguments | |
*/ | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
- private javax.swing.JButton AddButton; | |
- private javax.swing.JButton EditButton; | |
- private javax.swing.JList MealList; | |
- private javax.swing.JButton RemoveButton; | |
- private javax.swing.JLabel jLabel1; | |
- private javax.swing.JMenu jMenu1; | |
- private javax.swing.JMenuBar jMenuBar1; | |
- private javax.swing.JScrollPane jScrollPane1; | |
- private javax.swing.JMenuItem logoffMenuItem; | |
+ private javax.swing.JButton addButton; | |
+ private javax.swing.JPanel buttonsPanel; | |
+ private javax.swing.JButton editButton; | |
+ private javax.swing.JLabel headingLabel; | |
+ private javax.swing.JList mealList; | |
+ private javax.swing.JScrollPane mealListScroll; | |
+ private javax.swing.JPanel paddingPanel; | |
+ private javax.swing.JButton removeButton; | |
// End of variables declaration//GEN-END:variables | |
} | |
diff --git a/StockManager/src/stockmanager/CancellationScreen.form b/StockManager/src/stockmanager/CancellationScreen.form | |
index bd252ab..f055667 100644 | |
--- a/StockManager/src/stockmanager/CancellationScreen.form | |
+++ b/StockManager/src/stockmanager/CancellationScreen.form | |
@@ -2,11 +2,16 @@ | |
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
<Properties> | |
- <Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[415, 217]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="componentHidden" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -17,88 +22,116 @@ | |
<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,40,0,0,2,91"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |
- </Group> | |
- <Group type="102" attributes="0"> | |
- <Component id="jScrollPane1" pref="326" max="32767" attributes="0"/> | |
- <EmptySpace type="separate" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Component id="DoneButton" alignment="1" min="-2" pref="87" max="-2" attributes="0"/> | |
- <Component id="DeleteButton" alignment="1" min="-2" pref="87" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="1" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="-2" pref="12" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="1" attributes="0"> | |
- <Component id="jScrollPane1" pref="233" max="32767" attributes="0"/> | |
- <Group type="102" attributes="0"> | |
- <Component id="DeleteButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- <Component id="DoneButton" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"> | |
+ <Property name="horizontalGap" type="int" value="10"/> | |
+ <Property name="verticalGap" type="int" value="10"/> | |
</Layout> | |
<SubComponents> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JPanel" name="paddingPanel"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card2"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Component class="javax.swing.JList" name="cancelList"> | |
- <Events> | |
- <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="cancelListValueChanged"/> | |
- </Events> | |
+ <Container class="javax.swing.JScrollPane" name="cancelListScroll"> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JList" name="cancelList"> | |
+ <Events> | |
+ <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="cancelListValueChanged"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JLabel" name="cancelOrdersHeading"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Cancellations"/> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="North"/> | |
+ </Constraint> | |
+ </Constraints> | |
</Component> | |
+ <Container class="javax.swing.JPanel" name="rightButtonsPanel"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="10" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="East"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="cancelOrderButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Cancel Order"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelOrderButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="bottomButtonsPanel"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="0" right="0" top="10"/> | |
+ </Border> | |
+ </Property> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="South"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> | |
+ <Property name="alignment" type="int" value="2"/> | |
+ <Property name="horizontalGap" type="int" value="0"/> | |
+ <Property name="verticalGap" type="int" value="0"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="doneButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Done"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="doneButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JButton" name="DeleteButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Delete"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DeleteButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="DoneButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Done"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="DoneButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
- <Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="14" style="0"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Cancellations"/> | |
- </Properties> | |
- </Component> | |
</SubComponents> | |
</Form> | |
diff --git a/StockManager/src/stockmanager/CancellationScreen.java b/StockManager/src/stockmanager/CancellationScreen.java | |
index e606b4b..8fa293a 100644 | |
--- a/StockManager/src/stockmanager/CancellationScreen.java | |
+++ b/StockManager/src/stockmanager/CancellationScreen.java | |
@@ -26,7 +26,7 @@ public CancellationScreen(StaffController SC) throws SQLException { | |
super(new javax.swing.JFrame(), true); | |
initComponents(); | |
this.SC = SC; | |
- DeleteButton.setEnabled(false); | |
+ cancelOrderButton.setEnabled(false); | |
populateList(); | |
} | |
@@ -51,79 +51,74 @@ public void populateList() throws SQLException{ | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- jScrollPane1 = new javax.swing.JScrollPane(); | |
+ paddingPanel = new javax.swing.JPanel(); | |
+ cancelListScroll = new javax.swing.JScrollPane(); | |
cancelList = new javax.swing.JList(); | |
- DeleteButton = new javax.swing.JButton(); | |
- DoneButton = new javax.swing.JButton(); | |
- jLabel1 = new javax.swing.JLabel(); | |
+ cancelOrdersHeading = new javax.swing.JLabel(); | |
+ rightButtonsPanel = new javax.swing.JPanel(); | |
+ cancelOrderButton = new javax.swing.JButton(); | |
+ bottomButtonsPanel = new javax.swing.JPanel(); | |
+ doneButton = new javax.swing.JButton(); | |
+ | |
+ setMinimumSize(new java.awt.Dimension(415, 217)); | |
+ addComponentListener(new java.awt.event.ComponentAdapter() { | |
+ public void componentHidden(java.awt.event.ComponentEvent evt) { | |
+ formComponentHidden(evt); | |
+ } | |
+ }); | |
+ getContentPane().setLayout(new java.awt.CardLayout(10, 10)); | |
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
+ paddingPanel.setLayout(new java.awt.BorderLayout()); | |
cancelList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { | |
public void valueChanged(javax.swing.event.ListSelectionEvent evt) { | |
cancelListValueChanged(evt); | |
} | |
}); | |
- jScrollPane1.setViewportView(cancelList); | |
+ cancelListScroll.setViewportView(cancelList); | |
+ | |
+ paddingPanel.add(cancelListScroll, java.awt.BorderLayout.CENTER); | |
+ | |
+ cancelOrdersHeading.setText("Cancellations"); | |
+ cancelOrdersHeading.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ paddingPanel.add(cancelOrdersHeading, java.awt.BorderLayout.NORTH); | |
+ | |
+ rightButtonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0)); | |
+ rightButtonsPanel.setLayout(new javax.swing.BoxLayout(rightButtonsPanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
- DeleteButton.setText("Delete"); | |
- DeleteButton.addActionListener(new java.awt.event.ActionListener() { | |
+ cancelOrderButton.setText("Cancel Order"); | |
+ cancelOrderButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- DeleteButtonActionPerformed(evt); | |
+ cancelOrderButtonActionPerformed(evt); | |
} | |
}); | |
+ rightButtonsPanel.add(cancelOrderButton); | |
- DoneButton.setText("Done"); | |
- DoneButton.addActionListener(new java.awt.event.ActionListener() { | |
+ paddingPanel.add(rightButtonsPanel, java.awt.BorderLayout.EAST); | |
+ | |
+ bottomButtonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 0, 0, 0)); | |
+ bottomButtonsPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 0, 0)); | |
+ | |
+ doneButton.setText("Done"); | |
+ doneButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- DoneButtonActionPerformed(evt); | |
+ doneButtonActionPerformed(evt); | |
} | |
}); | |
+ bottomButtonsPanel.add(doneButton); | |
+ | |
+ paddingPanel.add(bottomButtonsPanel, java.awt.BorderLayout.SOUTH); | |
- jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N | |
- jLabel1.setText("Cancellations"); | |
- | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGap(18, 18, 18) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jLabel1) | |
- .addGap(0, 0, Short.MAX_VALUE)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE) | |
- .addGap(18, 18, 18) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addComponent(DoneButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(DeleteButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))) | |
- .addContainerGap()) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jLabel1) | |
- .addGap(12, 12, 12) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(DeleteButton) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(DoneButton))) | |
- .addGap(28, 28, 28)) | |
- ); | |
+ getContentPane().add(paddingPanel, "card2"); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
- private void DoneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DoneButtonActionPerformed | |
+ private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed | |
SC.showStaffPage(); | |
- }//GEN-LAST:event_DoneButtonActionPerformed | |
+ }//GEN-LAST:event_doneButtonActionPerformed | |
- private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed | |
+ private void cancelOrderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelOrderButtonActionPerformed | |
int index = cancelList.getSelectedIndex(); | |
Transaction t = transactions.get(index); | |
SC.removeMealTransaction(t); | |
@@ -132,8 +127,8 @@ private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- | |
} catch (SQLException ex) { | |
Logger.getLogger(CancellationScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
- DeleteButton.setEnabled(false); | |
- }//GEN-LAST:event_DeleteButtonActionPerformed | |
+ cancelOrderButton.setEnabled(false); | |
+ }//GEN-LAST:event_cancelOrderButtonActionPerformed | |
private void cancelListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_cancelListValueChanged | |
if (evt.getValueIsAdjusting() == false) { | |
@@ -141,19 +136,26 @@ private void cancelListValueChanged(javax.swing.event.ListSelectionEvent evt) {/ | |
if (index == -1) { | |
//no selection | |
} else { | |
- DeleteButton.setEnabled(true); | |
+ cancelOrderButton.setEnabled(true); | |
} | |
} | |
}//GEN-LAST:event_cancelListValueChanged | |
+ private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden | |
+ SC.showStaffPage(); | |
+ }//GEN-LAST:event_formComponentHidden | |
+ | |
/** | |
* @param args the command line arguments | |
*/ | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
- private javax.swing.JButton DeleteButton; | |
- private javax.swing.JButton DoneButton; | |
+ private javax.swing.JPanel bottomButtonsPanel; | |
private javax.swing.JList cancelList; | |
- private javax.swing.JLabel jLabel1; | |
- private javax.swing.JScrollPane jScrollPane1; | |
+ private javax.swing.JScrollPane cancelListScroll; | |
+ private javax.swing.JButton cancelOrderButton; | |
+ private javax.swing.JLabel cancelOrdersHeading; | |
+ private javax.swing.JButton doneButton; | |
+ private javax.swing.JPanel paddingPanel; | |
+ private javax.swing.JPanel rightButtonsPanel; | |
// End of variables declaration//GEN-END:variables | |
} | |
diff --git a/StockManager/src/stockmanager/Controller.java b/StockManager/src/stockmanager/Controller.java | |
index c495733..2981e50 100644 | |
--- a/StockManager/src/stockmanager/Controller.java | |
+++ b/StockManager/src/stockmanager/Controller.java | |
@@ -33,7 +33,6 @@ public Controller(){ | |
public void verifyLogin(String login, char[] password) throws SQLException{ | |
String pw = new String(password); | |
- System.out.println("password: " + pw); | |
String s = null; | |
try { | |
s = user.returnAccess(login, pw); | |
diff --git a/StockManager/src/stockmanager/IngredientData.java b/StockManager/src/stockmanager/IngredientData.java | |
index a8e4dd5..a41dd3d 100644 | |
--- a/StockManager/src/stockmanager/IngredientData.java | |
+++ b/StockManager/src/stockmanager/IngredientData.java | |
@@ -16,8 +16,6 @@ | |
String unit; | |
double quantity; | |
- // int currentQuantity; | |
- | |
public IngredientData(int id, String name, String unit, double incrmtqty){ | |
this.id = id; | |
this.name = name; | |
@@ -54,8 +52,24 @@ public String toString() { | |
return getName(); | |
} | |
- /** | |
- public double getCurrentQuantity(){ | |
- return currentQuantity; | |
- } */ | |
+ @Override | |
+ public boolean equals(Object obj) { | |
+ if (obj == null) { | |
+ return false; | |
+ } | |
+ if (getClass() != obj.getClass()) { | |
+ return false; | |
+ } | |
+ final IngredientData other = (IngredientData) obj; | |
+ if (this.id != other.id) { | |
+ return false; | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ @Override | |
+ public int hashCode() { | |
+ int hash = 5; | |
+ return hash; | |
+ } | |
} | |
diff --git a/StockManager/src/stockmanager/ManagerController.java b/StockManager/src/stockmanager/ManagerController.java | |
index a52967f..c2cd7cb 100644 | |
--- a/StockManager/src/stockmanager/ManagerController.java | |
+++ b/StockManager/src/stockmanager/ManagerController.java | |
@@ -39,31 +39,19 @@ public void logoff(){ | |
control.logoff(); | |
} | |
- /* | |
- public ArrayList<ItemData> getOrderList(){ | |
- ArrayList<ItemData> a = new ArrayList<ItemData>(); | |
- a.add(new ItemData(200, "System", "Bacon", 500, "g")); | |
- a.add(new ItemData(201, "System", "Canned tomato", 2, "kg")); | |
- a.add(new ItemData(202, "System", "Nutmeg", 1, "piece")); | |
- a.add(new ItemData(203, "System", "Minced Beef", 5, "kg")); | |
- return a; | |
- }*/ | |
- | |
/** | |
* Returns the orders as an array list of Order | |
* | |
* @return orders ArrayList | |
* @throws SQLException | |
*/ | |
- public ArrayList<Order> getOrders() throws SQLException{ | |
+ public ArrayList<Order> getForecast() throws SQLException{ | |
//Forecast forecast = new Forecast(); | |
//this is where we get the forecast from mateusz | |
Forecast forecast = new Forecast(); | |
forecast.createNetwork(); | |
ArrayList<Order> orders = forecast.getForecast(); | |
- orders.addAll(Order.getManualUpdates()); | |
- | |
return orders; | |
} | |
@@ -97,7 +85,7 @@ public void addManualUpdate(IngredientData ingredient, double quantity, String n | |
//then add it to the arraylist | |
//then re-call populate Order Table to show this updated addition | |
ManualUpdates.addManualUpdate(ingredient.getID(), quantity, notes); | |
- managerScreen.populateOrderTable(); | |
+ managerScreen.populateManualUpdates(); | |
managerScreen.repaint(); | |
} catch (SQLException ex) { | |
Logger.getLogger(ManagerController.class.getName()). | |
diff --git a/StockManager/src/stockmanager/ManagerScreen.form b/StockManager/src/stockmanager/ManagerScreen.form | |
index ed0c9b4..1cbc577 100644 | |
--- a/StockManager/src/stockmanager/ManagerScreen.form | |
+++ b/StockManager/src/stockmanager/ManagerScreen.form | |
@@ -1,40 +1,18 @@ | |
<?xml version="1.0" encoding="UTF-8" ?> | |
-<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | |
- <NonVisualComponents> | |
- <Container class="javax.swing.JTabbedPane" name="jTabbedPane2"> | |
- | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> | |
- </Container> | |
- <Component class="javax.swing.JSeparator" name="jSeparator1"> | |
- </Component> | |
- <Menu class="javax.swing.JMenuBar" name="jMenuBar1"> | |
- <SubComponents> | |
- <Menu class="javax.swing.JMenu" name="jMenu1"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Options"/> | |
- </Properties> | |
- <SubComponents> | |
- <MenuItem class="javax.swing.JMenuItem" name="LogOff"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Log off"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="LogOffActionPerformed"/> | |
- </Events> | |
- </MenuItem> | |
- </SubComponents> | |
- </Menu> | |
- </SubComponents> | |
- </Menu> | |
- </NonVisualComponents> | |
+<Form version="1.8" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | |
<Properties> | |
- <Property name="defaultCloseOperation" type="int" value="3"/> | |
+ <Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[420, 199]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
- <SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -45,181 +23,219 @@ | |
<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,-20,0,0,3,12"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jTabbedPane1" min="-2" pref="799" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <Component id="jTabbedPane1" min="-2" pref="498" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="12" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- </Layout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Container class="javax.swing.JTabbedPane" name="jTabbedPane1"> | |
+ <Container class="javax.swing.JTabbedPane" name="tabs"> | |
+ <Properties> | |
+ <Property name="opaque" type="boolean" value="true"/> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> | |
<SubComponents> | |
- <Container class="javax.swing.JPanel" name="jPanel1"> | |
+ <Container class="javax.swing.JPanel" name="orderTab"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="10" right="10" top="10"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ </Properties> | |
<Constraints> | |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> | |
- <JTabbedPaneConstraints tabName="Re-OrderList"> | |
- <Property name="tabTitle" type="java.lang.String" value="Re-OrderList"/> | |
+ <JTabbedPaneConstraints tabName="Order List"> | |
+ <Property name="tabTitle" type="java.lang.String" value="Order List"/> | |
</JTabbedPaneConstraints> | |
</Constraint> | |
</Constraints> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="jScrollPane1" pref="509" max="32767" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="InspectButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" max="-2" attributes="0"> | |
- <Component id="ConfirmButton" max="32767" attributes="0"/> | |
- <Component id="AddButton" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <Group type="102" attributes="0"> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="AddButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- <Component id="ConfirmButton" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <Component id="jScrollPane1" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace min="-2" pref="48" max="-2" attributes="0"/> | |
- <Component id="InspectButton" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- </Layout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JPanel" name="orderButtons"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="10" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="East"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
<SubComponents> | |
- <Component class="javax.swing.JTable" name="orderTable"> | |
+ <Component class="javax.swing.JButton" name="inspectButton"> | |
<Properties> | |
- <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> | |
- <Table columnCount="4" rowCount="0"> | |
- <Column editable="false" title="From" type="java.lang.String"/> | |
- <Column editable="false" title="Item" type="java.lang.String"/> | |
- <Column editable="false" title="Quantity" type="java.lang.Double"/> | |
- <Column editable="false" title="Total" type="java.lang.Double"/> | |
- </Table> | |
+ <Property name="text" type="java.lang.String" value="Inspect"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[155, 29]"/> | |
</Property> | |
- <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> | |
- <TableColumnModel selectionModel="0"> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- </TableColumnModel> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="inspectButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="addButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Add Item to List"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[155, 29]"/> | |
</Property> | |
- <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> | |
- <TableHeader reorderingAllowed="false" resizingAllowed="true"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.Box$Filler" name="buttonSpacer"> | |
+ <Properties> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 29]"/> | |
</Property> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[0, 29]"/> | |
+ </Property> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[0, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <AuxValues> | |
+ <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/> | |
+ </AuxValues> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="confirmButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Confirm and Print"/> | |
</Properties> | |
<Events> | |
- <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="orderTableFocusGained"/> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="confirmButtonActionPerformed"/> | |
</Events> | |
</Component> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JButton" name="AddButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Add Item to List"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AddButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="InspectButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Inspect"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="InspectButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="ConfirmButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Confirm and Print"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ConfirmButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
+ <Container class="javax.swing.JPanel" name="orderContent"> | |
<Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="11" style="1"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Manager Recommended Re-order List "/> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
</Properties> | |
- </Component> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Container class="javax.swing.JScrollPane" name="orderScroll"> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JTable" name="orderTable"> | |
+ <Properties> | |
+ <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> | |
+ <Table columnCount="4" rowCount="0"> | |
+ <Column editable="false" title="From" type="java.lang.String"/> | |
+ <Column editable="false" title="Item" type="java.lang.String"/> | |
+ <Column editable="false" title="Quantity" type="java.lang.Double"/> | |
+ <Column editable="false" title="Total" type="java.lang.Double"/> | |
+ </Table> | |
+ </Property> | |
+ <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> | |
+ <TableColumnModel selectionModel="0"> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ </TableColumnModel> | |
+ </Property> | |
+ <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> | |
+ <TableHeader reorderingAllowed="false" resizingAllowed="true"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="orderTableFocusGained"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="progressPanel"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="0" right="0" top="10"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JLabel" name="progressLabel"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Generating forecast..."/> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="0" right="10" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[135, 16]"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ <Component class="javax.swing.JProgressBar" name="progressBar"> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Container> | |
- <Container class="javax.swing.JPanel" name="jPanel2"> | |
+ <Container class="javax.swing.JPanel" name="stockTab"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="10" right="10" top="10"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[200, 436]"/> | |
+ </Property> | |
+ </Properties> | |
<Constraints> | |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> | |
<JTabbedPaneConstraints tabName="Stock Levels"> | |
@@ -228,71 +244,17 @@ | |
</Constraint> | |
</Constraints> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="jScrollPane3" min="-2" pref="390" max="-2" attributes="0"/> | |
- <EmptySpace type="separate" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="1" max="-2" attributes="0"> | |
- <Component id="jLabel3" max="32767" attributes="0"/> | |
- <Component id="QuantityTxtbx" min="-2" pref="58" max="-2" attributes="0"/> | |
- <Component id="ConfirmChangeButton" min="-2" max="-2" attributes="0"/> | |
- <Component id="jScrollPane2" alignment="1" max="32767" attributes="0"/> | |
- </Group> | |
- <EmptySpace type="unrelated" max="-2" attributes="0"/> | |
- <Component id="jLabel4" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <Component id="jLabel6" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace pref="156" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel2" min="-2" pref="14" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jScrollPane3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace min="-2" pref="56" max="-2" attributes="0"/> | |
- <Component id="jLabel3" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="3" attributes="0"> | |
- <Component id="QuantityTxtbx" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace type="unrelated" max="-2" attributes="0"/> | |
- <Component id="jLabel6" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jScrollPane2" min="-2" pref="42" max="-2" attributes="0"/> | |
- <EmptySpace type="unrelated" max="-2" attributes="0"/> | |
- <Component id="ConfirmChangeButton" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- </Layout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> | |
<SubComponents> | |
<Container class="javax.swing.JScrollPane" name="jScrollPane3"> | |
<AuxValues> | |
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
</AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | |
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="10" anchor="17" weightX="1.0" weightY="1.0"/> | |
+ </Constraint> | |
+ </Constraints> | |
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
<SubComponents> | |
@@ -331,50 +293,100 @@ | |
</Component> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JLabel" name="jLabel2"> | |
+ <Container class="javax.swing.JPanel" name="changePanel"> | |
<Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="11" style="1"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[200, 116]"/> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[200, 113]"/> | |
</Property> | |
- <Property name="text" type="java.lang.String" value="Current Stock"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel3"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Edit Selected Item Quantity"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JTextField" name="QuantityTxtbx"> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel4"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Unit"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="ConfirmChangeButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Confirm Change"/> | |
</Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ConfirmChangeButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane2"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | |
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="1.0"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
<SubComponents> | |
- <Component class="javax.swing.JTextPane" name="NoteTxtPane"> | |
+ <Container class="javax.swing.JPanel" name="stockQuantityPanel"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 28]"/> | |
+ </Property> | |
+ <Property name="opaque" type="boolean" value="false"/> | |
+ </Properties> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JLabel" name="stockChangeLabel"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="New quantity:"/> | |
+ <Property name="alignmentX" type="float" value="0.5"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 16]"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ <Component class="javax.swing.JTextField" name="stockQuantityText"> | |
+ </Component> | |
+ <Component class="javax.swing.JLabel" name="stockUnitLabel"> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JLabel" name="stockReasonLabel"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Reason for change:"/> | |
+ <Property name="alignmentX" type="float" value="0.5"/> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
+ </Property> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 16]"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ <Container class="javax.swing.JScrollPane" name="stockNoteScroll"> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JTextPane" name="noteTextArea"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="null"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Component class="javax.swing.JButton" name="ConfirmChangeButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Confirm Change"/> | |
+ <Property name="alignmentX" type="float" value="0.5"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[32767, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ConfirmChangeButtonActionPerformed"/> | |
+ </Events> | |
</Component> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JLabel" name="jLabel6"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Reason for Change"/> | |
- </Properties> | |
- </Component> | |
</SubComponents> | |
</Container> | |
<Container class="javax.swing.JPanel" name="jPanel3"> | |
@@ -421,7 +433,7 @@ | |
<Component id="jLabel11" min="-2" max="-2" attributes="0"/> | |
<EmptySpace max="-2" attributes="0"/> | |
<Component id="daycbx" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace pref="25" max="32767" attributes="0"/> | |
+ <EmptySpace max="32767" attributes="0"/> | |
</Group> | |
<Group type="102" attributes="0"> | |
<Group type="103" groupAlignment="0" attributes="0"> | |
@@ -448,7 +460,7 @@ | |
<Component id="jLabel14" min="-2" max="-2" attributes="0"/> | |
<EmptySpace type="separate" max="-2" attributes="0"/> | |
<Component id="jLabel15" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace pref="12" max="32767" attributes="0"/> | |
+ <EmptySpace max="32767" attributes="0"/> | |
</Group> | |
<Group type="102" alignment="0" attributes="0"> | |
<EmptySpace min="-2" pref="58" max="-2" attributes="0"/> | |
diff --git a/StockManager/src/stockmanager/ManagerScreen.java b/StockManager/src/stockmanager/ManagerScreen.java | |
index 3f8cd23..77ddc72 100644 | |
--- a/StockManager/src/stockmanager/ManagerScreen.java | |
+++ b/StockManager/src/stockmanager/ManagerScreen.java | |
@@ -8,11 +8,17 @@ | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.HashMap; | |
+import java.util.concurrent.Executors; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.swing.ImageIcon; | |
import javax.swing.JLabel; | |
import javax.swing.JOptionPane; | |
+import javax.swing.ListSelectionModel; | |
+import javax.swing.event.ListSelectionEvent; | |
+import javax.swing.event.ListSelectionListener; | |
+import javax.swing.event.TableModelEvent; | |
+import javax.swing.event.TableModelListener; | |
import javax.swing.table.DefaultTableModel; | |
import javax.swing.table.TableModel; | |
@@ -29,15 +35,31 @@ | |
//then when the user ones need to be added, they're separate from the system ones. | |
ArrayList<IngredientData> stockList; | |
AddItemScreen additemscreen; | |
+ Runnable backgroundOrders = new Runnable() { | |
+ public void run() { | |
+ populateForecast(); | |
+ } | |
+ }; | |
public ManagerScreen(ManagerController MC) throws SQLException { | |
this.MC = MC; | |
initComponents(); | |
- InspectButton.setEnabled(false); | |
+ inspectButton.setEnabled(false); | |
additemscreen = new AddItemScreen(this.MC); | |
- populateOrderTable(); | |
+ backgroundPopulateForecast(); | |
+ populateManualUpdates(); | |
populateStockTable(); | |
setUpComboBoxes(); | |
+ stockTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { | |
+ | |
+ @Override | |
+ public void valueChanged(ListSelectionEvent lse) { | |
+ if (lse.getValueIsAdjusting()) return; | |
+ int row = stockTable.getSelectedRow(); | |
+ String unit = ((IngredientData) stockTable.getModel().getValueAt(row, 0)).getUnits(); | |
+ stockUnitLabel.setText(unit); | |
+ } | |
+ }); | |
this.setVisible(true); | |
repaint(); | |
} | |
@@ -46,30 +68,72 @@ public ManagerScreen(ManagerController MC) throws SQLException { | |
* Populates the table with orders | |
* recommended by the system | |
*/ | |
- public void populateOrderTable() { | |
+ public void populateForecast() { | |
+ progressLabel.setText("Generating forecast..."); | |
+ progressBar.setIndeterminate(true); | |
//so here we need to get the controller to go get the reccommendations | |
DefaultTableModel table = (DefaultTableModel) orderTable.getModel(); | |
- for (int i = 0; i < table.getRowCount(); i++){ | |
- table.removeRow(i); | |
+ int rowCount = table.getRowCount(); | |
+ for (int i = rowCount - 1; i >= 0; i--) { | |
+ if (((Order) table.getValueAt(i, 1)).getFrom() == Order.From.FORECAST) { | |
+ table.removeRow(i); | |
+ } | |
} | |
ArrayList<Order> orders = new ArrayList<Order>(); | |
try { | |
- orders.addAll(MC.getOrders()); | |
+ System.out.println("Generating orders..."); | |
+ orders.addAll(MC.getForecast()); | |
} catch (SQLException ex) { | |
Logger.getLogger(ManagerScreen.class.getName()).log(Level.SEVERE, | |
null, ex); | |
} | |
- HashMap<Integer, Double> totals = new HashMap<Integer, Double>(); | |
for (Order order : orders) { | |
- int id = order.getIngrId(); | |
- double quantity = order.getQuantity(); | |
- double total = (totals.containsKey(id) ? totals.get(id) : 0) + quantity; | |
- totals.put(id, total); | |
- table.addRow( | |
- new Object[]{order.getFrom(), order, quantity, total}); | |
+ table.addRow(new Object[]{order.getFrom(), order, order.getQuantity(), 0}); | |
+ } | |
+ calculateTotals(); | |
+ System.out.println("Finished generating orders."); | |
+ progressBar.setValue(100); | |
+ progressBar.setIndeterminate(false); | |
+ progressLabel.setText("Forecast generated"); | |
+ orderTable.setVisible(true); | |
+ } | |
+ | |
+ public void backgroundPopulateForecast() { | |
+ Executors.newSingleThreadExecutor().submit(backgroundOrders); | |
+ } | |
+ | |
+ public void populateManualUpdates() { | |
+ try { | |
+ ArrayList<Order> orders = Order.getManualUpdates(); | |
+ DefaultTableModel table = (DefaultTableModel) orderTable.getModel(); | |
+ int rowCount = table.getRowCount(); | |
+ for (int i = rowCount - 1; i >= 0; i--) { | |
+ if (((Order) table.getValueAt(i, 1)).getFrom() == Order.From.USER) { | |
+ table.removeRow(i); | |
+ } | |
+ } | |
+ for (Order order : orders) { | |
+ table.addRow(new Object[]{order.getFrom(), order, order.getQuantity(), 0}); | |
+ } | |
+ calculateTotals(); | |
+ } catch (SQLException ex) { | |
+ Logger.getLogger(ManagerScreen.class.getName()). | |
+ log(Level.SEVERE, null, ex); | |
+ } | |
+ } | |
+ | |
+ public void calculateTotals() { | |
+ DefaultTableModel table = (DefaultTableModel) orderTable.getModel(); | |
+ HashMap<Integer, Double> totals = new HashMap<Integer, Double>(); | |
+ int rowCount = table.getRowCount(); | |
+ for (int i = 0; i < rowCount; i++) { | |
+ Order order = (Order) table.getValueAt(i, 1); | |
+ int ingrId = order.getIngrId(); | |
+ totals.put(ingrId, (totals.containsKey(ingrId) ? totals.get(ingrId) : 0) + order.getQuantity()); | |
+ table.setValueAt(totals.get(ingrId), i, 3); | |
} | |
- orderTable.setModel(table); | |
} | |
+ | |
/* | |
* Populate the stock table | |
*/ | |
@@ -85,8 +149,7 @@ private void populateStockTable() throws SQLException { | |
} | |
stockList = MC.getStockList(); | |
for (IngredientData i : stockList) { | |
- table.addRow(new Object[]{i, i.getQuantity()}); | |
- System.out.println("stockitem:" + i.getName()); | |
+ table.addRow(new Object[]{i, i.getQuantity(), i.getUnits()}); | |
} | |
stockTable.repaint(); | |
} | |
@@ -126,28 +189,33 @@ private void setUpComboBoxes(){ | |
@SuppressWarnings("unchecked") | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- | |
- jTabbedPane2 = new javax.swing.JTabbedPane(); | |
- jSeparator1 = new javax.swing.JSeparator(); | |
- jTabbedPane1 = new javax.swing.JTabbedPane(); | |
- jPanel1 = new javax.swing.JPanel(); | |
- jScrollPane1 = new javax.swing.JScrollPane(); | |
+ java.awt.GridBagConstraints gridBagConstraints; | |
+ | |
+ tabs = new javax.swing.JTabbedPane(); | |
+ orderTab = new javax.swing.JPanel(); | |
+ orderButtons = new javax.swing.JPanel(); | |
+ inspectButton = new javax.swing.JButton(); | |
+ addButton = new javax.swing.JButton(); | |
+ buttonSpacer = new javax.swing.Box.Filler(new java.awt.Dimension(0, 29), new java.awt.Dimension(0, 29), new java.awt.Dimension(32767, 29)); | |
+ confirmButton = new javax.swing.JButton(); | |
+ orderContent = new javax.swing.JPanel(); | |
+ orderScroll = new javax.swing.JScrollPane(); | |
orderTable = new javax.swing.JTable(); | |
- AddButton = new javax.swing.JButton(); | |
- InspectButton = new javax.swing.JButton(); | |
- ConfirmButton = new javax.swing.JButton(); | |
- jLabel1 = new javax.swing.JLabel(); | |
- jPanel2 = new javax.swing.JPanel(); | |
+ progressPanel = new javax.swing.JPanel(); | |
+ progressLabel = new javax.swing.JLabel(); | |
+ progressBar = new javax.swing.JProgressBar(); | |
+ stockTab = new javax.swing.JPanel(); | |
jScrollPane3 = new javax.swing.JScrollPane(); | |
stockTable = new javax.swing.JTable(); | |
- jLabel2 = new javax.swing.JLabel(); | |
- jLabel3 = new javax.swing.JLabel(); | |
- QuantityTxtbx = new javax.swing.JTextField(); | |
- jLabel4 = new javax.swing.JLabel(); | |
+ changePanel = new javax.swing.JPanel(); | |
+ stockQuantityPanel = new javax.swing.JPanel(); | |
+ stockChangeLabel = new javax.swing.JLabel(); | |
+ stockQuantityText = new javax.swing.JTextField(); | |
+ stockUnitLabel = new javax.swing.JLabel(); | |
+ stockReasonLabel = new javax.swing.JLabel(); | |
+ stockNoteScroll = new javax.swing.JScrollPane(); | |
+ noteTextArea = new javax.swing.JTextPane(); | |
ConfirmChangeButton = new javax.swing.JButton(); | |
- jScrollPane2 = new javax.swing.JScrollPane(); | |
- NoteTxtPane = new javax.swing.JTextPane(); | |
- jLabel6 = new javax.swing.JLabel(); | |
jPanel3 = new javax.swing.JPanel(); | |
jLabel5 = new javax.swing.JLabel(); | |
mealGraphButton = new javax.swing.JButton(); | |
@@ -163,11 +231,56 @@ private void initComponents() { | |
jLabel11 = new javax.swing.JLabel(); | |
jLabel14 = new javax.swing.JLabel(); | |
jLabel15 = new javax.swing.JLabel(); | |
- jMenuBar1 = new javax.swing.JMenuBar(); | |
- jMenu1 = new javax.swing.JMenu(); | |
- LogOff = new javax.swing.JMenuItem(); | |
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
+ setMinimumSize(new java.awt.Dimension(420, 199)); | |
+ addWindowListener(new java.awt.event.WindowAdapter() { | |
+ public void windowClosed(java.awt.event.WindowEvent evt) { | |
+ formWindowClosed(evt); | |
+ } | |
+ }); | |
+ | |
+ tabs.setOpaque(true); | |
+ | |
+ orderTab.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); | |
+ orderTab.setOpaque(false); | |
+ orderTab.setLayout(new java.awt.BorderLayout()); | |
+ | |
+ orderButtons.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0)); | |
+ orderButtons.setOpaque(false); | |
+ orderButtons.setLayout(new javax.swing.BoxLayout(orderButtons, javax.swing.BoxLayout.PAGE_AXIS)); | |
+ | |
+ inspectButton.setText("Inspect"); | |
+ inspectButton.setMaximumSize(new java.awt.Dimension(155, 29)); | |
+ inspectButton.addActionListener(new java.awt.event.ActionListener() { | |
+ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
+ inspectButtonActionPerformed(evt); | |
+ } | |
+ }); | |
+ orderButtons.add(inspectButton); | |
+ | |
+ addButton.setText("Add Item to List"); | |
+ addButton.setMaximumSize(new java.awt.Dimension(155, 29)); | |
+ addButton.addActionListener(new java.awt.event.ActionListener() { | |
+ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
+ addButtonActionPerformed(evt); | |
+ } | |
+ }); | |
+ orderButtons.add(addButton); | |
+ orderButtons.add(buttonSpacer); | |
+ | |
+ confirmButton.setText("Confirm and Print"); | |
+ confirmButton.addActionListener(new java.awt.event.ActionListener() { | |
+ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
+ confirmButtonActionPerformed(evt); | |
+ } | |
+ }); | |
+ orderButtons.add(confirmButton); | |
+ | |
+ orderTab.add(orderButtons, java.awt.BorderLayout.EAST); | |
+ | |
+ orderContent.setOpaque(false); | |
+ orderContent.setLayout(new javax.swing.BoxLayout(orderContent, javax.swing.BoxLayout.PAGE_AXIS)); | |
orderTable.setModel(new javax.swing.table.DefaultTableModel( | |
new Object [][] { | |
@@ -198,74 +311,30 @@ public void focusGained(java.awt.event.FocusEvent evt) { | |
orderTableFocusGained(evt); | |
} | |
}); | |
- jScrollPane1.setViewportView(orderTable); | |
+ orderScroll.setViewportView(orderTable); | |
- AddButton.setText("Add Item to List"); | |
- AddButton.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- AddButtonActionPerformed(evt); | |
- } | |
- }); | |
+ orderContent.add(orderScroll); | |
- InspectButton.setText("Inspect"); | |
- InspectButton.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- InspectButtonActionPerformed(evt); | |
- } | |
- }); | |
+ progressPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 0, 0, 0)); | |
+ progressPanel.setOpaque(false); | |
+ progressPanel.setLayout(new javax.swing.BoxLayout(progressPanel, javax.swing.BoxLayout.LINE_AXIS)); | |
- ConfirmButton.setText("Confirm and Print"); | |
- ConfirmButton.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- ConfirmButtonActionPerformed(evt); | |
- } | |
- }); | |
+ progressLabel.setText("Generating forecast..."); | |
+ progressLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 10)); | |
+ progressLabel.setMinimumSize(new java.awt.Dimension(135, 16)); | |
+ progressPanel.add(progressLabel); | |
+ progressPanel.add(progressBar); | |
- jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N | |
- jLabel1.setText("Manager Recommended Re-order List "); | |
+ orderContent.add(progressPanel); | |
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
- jPanel1.setLayout(jPanel1Layout); | |
- jPanel1Layout.setHorizontalGroup( | |
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 509, Short.MAX_VALUE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(InspectButton) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |
- .addComponent(ConfirmButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(AddButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addComponent(jLabel1) | |
- .addGap(0, 0, Short.MAX_VALUE))) | |
- .addContainerGap()) | |
- ); | |
- jPanel1Layout.setVerticalGroup( | |
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addGap(6, 6, 6) | |
- .addComponent(jLabel1) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addComponent(AddButton) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(ConfirmButton)) | |
- .addComponent(jScrollPane1))) | |
- .addGroup(jPanel1Layout.createSequentialGroup() | |
- .addGap(48, 48, 48) | |
- .addComponent(InspectButton) | |
- .addGap(0, 0, Short.MAX_VALUE))) | |
- .addContainerGap()) | |
- ); | |
+ orderTab.add(orderContent, java.awt.BorderLayout.CENTER); | |
+ | |
+ tabs.addTab("Order List", orderTab); | |
- jTabbedPane1.addTab("Re-OrderList", jPanel1); | |
+ stockTab.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); | |
+ stockTab.setOpaque(false); | |
+ stockTab.setPreferredSize(new java.awt.Dimension(200, 436)); | |
+ stockTab.setLayout(new java.awt.GridBagLayout()); | |
stockTable.setModel(new javax.swing.table.DefaultTableModel( | |
new Object [][] { | |
@@ -293,73 +362,61 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { | |
stockTable.getTableHeader().setReorderingAllowed(false); | |
jScrollPane3.setViewportView(stockTable); | |
- jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N | |
- jLabel2.setText("Current Stock"); | |
+ gridBagConstraints = new java.awt.GridBagConstraints(); | |
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | |
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; | |
+ gridBagConstraints.weightx = 1.0; | |
+ gridBagConstraints.weighty = 1.0; | |
+ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); | |
+ stockTab.add(jScrollPane3, gridBagConstraints); | |
+ | |
+ changePanel.setMinimumSize(new java.awt.Dimension(200, 116)); | |
+ changePanel.setOpaque(false); | |
+ changePanel.setPreferredSize(new java.awt.Dimension(200, 113)); | |
+ changePanel.setLayout(new javax.swing.BoxLayout(changePanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
- jLabel3.setText("Edit Selected Item Quantity"); | |
+ stockQuantityPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ stockQuantityPanel.setMaximumSize(new java.awt.Dimension(32767, 28)); | |
+ stockQuantityPanel.setOpaque(false); | |
+ stockQuantityPanel.setLayout(new javax.swing.BoxLayout(stockQuantityPanel, javax.swing.BoxLayout.LINE_AXIS)); | |
- jLabel4.setText("Unit"); | |
+ stockChangeLabel.setText("New quantity:"); | |
+ stockChangeLabel.setAlignmentX(0.5F); | |
+ stockChangeLabel.setMaximumSize(new java.awt.Dimension(32767, 16)); | |
+ stockQuantityPanel.add(stockChangeLabel); | |
+ stockQuantityPanel.add(stockQuantityText); | |
+ stockQuantityPanel.add(stockUnitLabel); | |
+ | |
+ changePanel.add(stockQuantityPanel); | |
+ | |
+ stockReasonLabel.setText("Reason for change:"); | |
+ stockReasonLabel.setAlignmentX(0.5F); | |
+ stockReasonLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ stockReasonLabel.setMaximumSize(new java.awt.Dimension(32767, 16)); | |
+ changePanel.add(stockReasonLabel); | |
+ | |
+ noteTextArea.setBorder(null); | |
+ stockNoteScroll.setViewportView(noteTextArea); | |
+ | |
+ changePanel.add(stockNoteScroll); | |
ConfirmChangeButton.setText("Confirm Change"); | |
+ ConfirmChangeButton.setAlignmentX(0.5F); | |
+ ConfirmChangeButton.setMaximumSize(new java.awt.Dimension(32767, 29)); | |
ConfirmChangeButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
ConfirmChangeButtonActionPerformed(evt); | |
} | |
}); | |
+ changePanel.add(ConfirmChangeButton); | |
- jScrollPane2.setViewportView(NoteTxtPane); | |
+ gridBagConstraints = new java.awt.GridBagConstraints(); | |
+ gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; | |
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; | |
+ gridBagConstraints.weighty = 1.0; | |
+ stockTab.add(changePanel, gridBagConstraints); | |
- jLabel6.setText("Reason for Change"); | |
- | |
- javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); | |
- jPanel2.setLayout(jPanel2Layout); | |
- jPanel2Layout.setHorizontalGroup( | |
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 390, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGap(18, 18, 18) | |
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) | |
- .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(QuantityTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(ConfirmChangeButton) | |
- .addComponent(jScrollPane2)) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
- .addComponent(jLabel4)) | |
- .addComponent(jLabel6))) | |
- .addComponent(jLabel2)) | |
- .addContainerGap(156, Short.MAX_VALUE)) | |
- ); | |
- jPanel2Layout.setVerticalGroup( | |
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addGroup(jPanel2Layout.createSequentialGroup() | |
- .addGap(56, 56, 56) | |
- .addComponent(jLabel3) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
- .addComponent(QuantityTxtbx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(jLabel4)) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
- .addComponent(jLabel6) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
- .addComponent(ConfirmChangeButton))) | |
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
- ); | |
- | |
- jTabbedPane1.addTab("Stock Levels", jPanel2); | |
+ tabs.addTab("Stock Levels", stockTab); | |
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N | |
jLabel5.setText("Meal Usage Statistics"); | |
@@ -438,7 +495,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
.addComponent(jLabel11) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(daycbx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addContainerGap(25, Short.MAX_VALUE)) | |
+ .addContainerGap()) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(monthGraphButton, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) | |
@@ -457,7 +514,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
.addComponent(jLabel14) | |
.addGap(18, 18, 18) | |
.addComponent(jLabel15) | |
- .addContainerGap(12, Short.MAX_VALUE)) | |
+ .addContainerGap()) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addGap(58, 58, 58) | |
.addComponent(jLabel5) | |
@@ -482,51 +539,23 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
.addGap(90, 90, 90)) | |
); | |
- jTabbedPane1.addTab("Statistics", jPanel3); | |
- | |
- jMenu1.setText("Options"); | |
- | |
- LogOff.setText("Log off"); | |
- LogOff.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- LogOffActionPerformed(evt); | |
- } | |
- }); | |
- jMenu1.add(LogOff); | |
- | |
- jMenuBar1.add(jMenu1); | |
+ tabs.addTab("Statistics", jPanel3); | |
- setJMenuBar(jMenuBar1); | |
- | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 799, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 498, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGap(0, 12, Short.MAX_VALUE)) | |
- ); | |
+ getContentPane().add(tabs, java.awt.BorderLayout.CENTER); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
- private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddButtonActionPerformed | |
+ private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed | |
this.setVisible(false); | |
additemscreen.setVisible(true); | |
repaint(); | |
//okeydokey: hide this screen, pass it to the add item screen | |
//that we are going to create and set visible | |
- }//GEN-LAST:event_AddButtonActionPerformed | |
+ }//GEN-LAST:event_addButtonActionPerformed | |
- private void InspectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InspectButtonActionPerformed | |
+ private void inspectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inspectButtonActionPerformed | |
try { | |
//now we go and get the reasons (i.e. the past transactions ) | |
//by umm.. calling the controller yippee | |
@@ -548,9 +577,9 @@ private void InspectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN | |
Logger.getLogger(ManagerScreen.class.getName()).log(Level.SEVERE, | |
null, ex); | |
} | |
- }//GEN-LAST:event_InspectButtonActionPerformed | |
+ }//GEN-LAST:event_inspectButtonActionPerformed | |
- private void ConfirmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConfirmButtonActionPerformed | |
+ private void confirmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmButtonActionPerformed | |
try { | |
//for every total that is different from the quantity: pass this to controller | |
//call controller's RestockTransaction method | |
@@ -578,21 +607,17 @@ private void ConfirmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN | |
Logger.getLogger(ManagerScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
- }//GEN-LAST:event_ConfirmButtonActionPerformed | |
+ }//GEN-LAST:event_confirmButtonActionPerformed | |
private void orderTableFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_orderTableFocusGained | |
- InspectButton.setEnabled(true); | |
+ inspectButton.setEnabled(true); | |
}//GEN-LAST:event_orderTableFocusGained | |
- private void LogOffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogOffActionPerformed | |
- MC.logoff(); | |
- }//GEN-LAST:event_LogOffActionPerformed | |
- | |
private void ConfirmChangeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConfirmChangeButtonActionPerformed | |
try { | |
TableModel table = stockTable.getModel(); | |
- double newVal = Double.parseDouble(QuantityTxtbx.getText()); | |
- String note = NoteTxtPane.getText(); | |
+ double newVal = Double.parseDouble(stockQuantityText.getText()); | |
+ String note = noteTextArea.getText(); | |
int index = stockTable.getSelectedRow(); | |
IngredientData ingredient = (IngredientData) stockTable.getValueAt(index, 0); | |
table.setValueAt(newVal, index, 1); | |
@@ -604,6 +629,7 @@ private void ConfirmChangeButtonActionPerformed(java.awt.event.ActionEvent evt) | |
double quantity = newVal - Ingredients.getCurrentStock(ingrId); | |
RestockTransactions.addTransaction(ingredient.getID(), date, | |
quantity, note, Order.From.USER); | |
+ backgroundPopulateForecast(); | |
} catch (SQLException ex) { | |
Logger.getLogger(ManagerScreen.class.getName()). | |
log(Level.SEVERE, null, ex); | |
@@ -679,6 +705,10 @@ private void yearcbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST | |
} | |
} | |
}//GEN-LAST:event_yearcbxActionPerformed | |
+ | |
+ private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed | |
+ MC.logoff(); | |
+ }//GEN-LAST:event_formWindowClosed | |
/** | |
* @param args the command line arguments | |
*/ | |
@@ -721,43 +751,44 @@ private void yearcbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST | |
//// }); | |
// } | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
- private javax.swing.JButton AddButton; | |
- private javax.swing.JButton ConfirmButton; | |
private javax.swing.JButton ConfirmChangeButton; | |
- private javax.swing.JButton InspectButton; | |
- private javax.swing.JMenuItem LogOff; | |
- private javax.swing.JTextPane NoteTxtPane; | |
- private javax.swing.JTextField QuantityTxtbx; | |
+ private javax.swing.JButton addButton; | |
+ private javax.swing.Box.Filler buttonSpacer; | |
+ private javax.swing.JPanel changePanel; | |
+ private javax.swing.JButton confirmButton; | |
private javax.swing.JComboBox daycbx; | |
- private javax.swing.JLabel jLabel1; | |
+ private javax.swing.JButton inspectButton; | |
private javax.swing.JLabel jLabel10; | |
private javax.swing.JLabel jLabel11; | |
private javax.swing.JLabel jLabel14; | |
private javax.swing.JLabel jLabel15; | |
- private javax.swing.JLabel jLabel2; | |
- private javax.swing.JLabel jLabel3; | |
- private javax.swing.JLabel jLabel4; | |
private javax.swing.JLabel jLabel5; | |
- private javax.swing.JLabel jLabel6; | |
private javax.swing.JLabel jLabel7; | |
private javax.swing.JLabel jLabel8; | |
private javax.swing.JLabel jLabel9; | |
- private javax.swing.JMenu jMenu1; | |
- private javax.swing.JMenuBar jMenuBar1; | |
- private javax.swing.JPanel jPanel1; | |
- private javax.swing.JPanel jPanel2; | |
private javax.swing.JPanel jPanel3; | |
- private javax.swing.JScrollPane jScrollPane1; | |
- private javax.swing.JScrollPane jScrollPane2; | |
private javax.swing.JScrollPane jScrollPane3; | |
- private javax.swing.JSeparator jSeparator1; | |
- private javax.swing.JTabbedPane jTabbedPane1; | |
- private javax.swing.JTabbedPane jTabbedPane2; | |
private javax.swing.JButton mealGraphButton; | |
private javax.swing.JButton monthGraphButton; | |
private javax.swing.JComboBox monthcbx; | |
+ private javax.swing.JTextPane noteTextArea; | |
+ private javax.swing.JPanel orderButtons; | |
+ private javax.swing.JPanel orderContent; | |
+ private javax.swing.JScrollPane orderScroll; | |
+ private javax.swing.JPanel orderTab; | |
private javax.swing.JTable orderTable; | |
+ private javax.swing.JProgressBar progressBar; | |
+ private javax.swing.JLabel progressLabel; | |
+ private javax.swing.JPanel progressPanel; | |
+ private javax.swing.JLabel stockChangeLabel; | |
+ private javax.swing.JScrollPane stockNoteScroll; | |
+ private javax.swing.JPanel stockQuantityPanel; | |
+ private javax.swing.JTextField stockQuantityText; | |
+ private javax.swing.JLabel stockReasonLabel; | |
+ private javax.swing.JPanel stockTab; | |
private javax.swing.JTable stockTable; | |
+ private javax.swing.JLabel stockUnitLabel; | |
+ private javax.swing.JTabbedPane tabs; | |
private javax.swing.JComboBox yearcbx; | |
private javax.swing.JComboBox yearlySalescbx; | |
// End of variables declaration//GEN-END:variables | |
diff --git a/StockManager/src/stockmanager/MealScreen.form b/StockManager/src/stockmanager/MealScreen.form | |
index 409266f..90afbd3 100644 | |
--- a/StockManager/src/stockmanager/MealScreen.form | |
+++ b/StockManager/src/stockmanager/MealScreen.form | |
@@ -1,12 +1,17 @@ | |
<?xml version="1.0" encoding="UTF-8" ?> | |
-<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
+<Form version="1.8" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
<Properties> | |
- <Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[450, 200]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="componentHidden" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -17,170 +22,175 @@ | |
<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,119,0,0,2,43"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="1" attributes="0"> | |
- <Component id="addButton" min="-2" pref="73" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- <Component id="cancelButton" min="-2" pref="73" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="doneButton" min="-2" pref="73" max="-2" attributes="0"/> | |
- </Group> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="mealNameLable" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace type="separate" max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <Component id="jScrollPane1" min="-2" pref="296" max="-2" attributes="0"/> | |
- <EmptySpace min="-2" pref="68" max="-2" attributes="0"/> | |
- <Component id="removeButton" min="-2" pref="81" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="3" attributes="0"> | |
- <Component id="mealNameLable" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jScrollPane1" min="-2" pref="188" max="-2" attributes="0"/> | |
- </Group> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace min="-2" pref="57" max="-2" attributes="0"/> | |
- <Component id="removeButton" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace pref="15" max="32767" attributes="0"/> | |
- <Group type="103" groupAlignment="3" attributes="0"> | |
- <Component id="addButton" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="doneButton" alignment="3" min="-2" pref="23" max="-2" attributes="0"/> | |
- <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> | |
- <Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace min="-2" pref="22" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"> | |
+ <Property name="horizontalGap" type="int" value="10"/> | |
+ <Property name="verticalGap" type="int" value="10"/> | |
</Layout> | |
<SubComponents> | |
- <Component class="javax.swing.JLabel" name="mealNameLable"> | |
- <Properties> | |
- <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |
- <Font name="Tahoma" size="14" style="0"/> | |
- </Property> | |
- <Property name="text" type="java.lang.String" value="Meal Name"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mealNameLableMouseClicked"/> | |
- </Events> | |
- </Component> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JPanel" name="paddingPanel"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card6"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Component class="javax.swing.JTable" name="mealTable"> | |
+ <Container class="javax.swing.JPanel" name="mealNamePanel"> | |
<Properties> | |
- <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> | |
- <Table columnCount="3" rowCount="1"> | |
- <Column editable="true" title="Ingredients" type="java.lang.Object"/> | |
- <Column editable="true" title="Quantity" type="java.lang.Double"/> | |
- <Column editable="false" title="Unit" type="java.lang.String"> | |
- <Data value=""/> | |
- </Column> | |
- </Table> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
</Property> | |
- <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> | |
- <TableColumnModel selectionModel="0"> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
- <Title/> | |
- <Editor/> | |
- <Renderer/> | |
- </Column> | |
- </TableColumnModel> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="North"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JTextField" name="mealNameText"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card3"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JScrollPane" name="recipeScroll"> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JTable" name="recipeTable"> | |
+ <Properties> | |
+ <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> | |
+ <Table columnCount="3" rowCount="1"> | |
+ <Column editable="true" title="Ingredients" type="java.lang.Object"/> | |
+ <Column editable="true" title="Quantity" type="java.lang.Double"/> | |
+ <Column editable="false" title="Unit" type="java.lang.String"> | |
+ <Data value=""/> | |
+ </Column> | |
+ </Table> | |
+ </Property> | |
+ <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> | |
+ <TableColumnModel selectionModel="0"> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | |
+ <Title/> | |
+ <Editor/> | |
+ <Renderer/> | |
+ </Column> | |
+ </TableColumnModel> | |
+ </Property> | |
+ <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> | |
+ <TableHeader reorderingAllowed="true" resizingAllowed="true"/> | |
+ </Property> | |
+ </Properties> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="rightButtons"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="10" right="0" top="0"/> | |
+ </Border> | |
</Property> | |
- <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> | |
- <TableHeader reorderingAllowed="true" resizingAllowed="true"/> | |
+ </Properties> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="East"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="addButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Add Ingredient"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[156, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="removeButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Remove Ingedient"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="bottomButtons"> | |
+ <Properties> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="0" right="0" top="10"/> | |
+ </Border> | |
</Property> | |
</Properties> | |
- </Component> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="South"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> | |
+ <Property name="alignment" type="int" value="2"/> | |
+ <Property name="horizontalGap" type="int" value="0"/> | |
+ <Property name="verticalGap" type="int" value="0"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="cancelButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Cancel"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.JButton" name="doneButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Done"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="doneButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JButton" name="removeButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Remove"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="doneButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Done"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="doneButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="addButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Add"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="--click here to edit the name of the meal"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel2"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="--click here to add an Ingredient"/> | |
- </Properties> | |
- </Component> | |
- <Component class="javax.swing.JButton" name="cancelButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Cancel"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
</SubComponents> | |
</Form> | |
diff --git a/StockManager/src/stockmanager/MealScreen.java b/StockManager/src/stockmanager/MealScreen.java | |
index e985849..aabcfaa 100644 | |
--- a/StockManager/src/stockmanager/MealScreen.java | |
+++ b/StockManager/src/stockmanager/MealScreen.java | |
@@ -11,6 +11,9 @@ | |
import javax.swing.DefaultCellEditor; | |
import javax.swing.JComboBox; | |
import javax.swing.JOptionPane; | |
+import javax.swing.ListSelectionModel; | |
+import javax.swing.event.ListSelectionEvent; | |
+import javax.swing.event.ListSelectionListener; | |
import javax.swing.event.TableModelEvent; | |
import javax.swing.event.TableModelListener; | |
import javax.swing.table.DefaultTableModel; | |
@@ -24,6 +27,23 @@ | |
AdminController AC; | |
MealData meal = null; | |
+ private JComboBox ingrCombo = new JComboBox(); | |
+ private ListSelectionListener recipeTableSelectionListener = new ListSelectionListener() { | |
+ | |
+ @Override | |
+ public void valueChanged(ListSelectionEvent lse) { | |
+ if (lse.getValueIsAdjusting()) return; | |
+ int row = recipeTable.getSelectedRow(); | |
+ IngredientData ingredient = ((IngredientData) recipeTable.getModel().getValueAt(row, 0)); | |
+ int count = ingrCombo.getItemCount(); | |
+ for (int i = 0; i < count; i++) { | |
+ if (((IngredientData) ingrCombo.getItemAt(i)).equals(ingredient)) { | |
+ ingrCombo.setSelectedIndex(i); | |
+ break; | |
+ } | |
+ } | |
+ } | |
+ }; | |
public void setMeal(MealData meal) { | |
this.meal = meal; | |
@@ -35,7 +55,6 @@ public void setMeal(MealData meal) { | |
public MealScreen(AdminController AC) { | |
super(new javax.swing.JFrame(), true); | |
initComponents(); | |
- JComboBox ingrCombo = new JComboBox(); | |
ArrayList<IngredientData> ingredients = new ArrayList<IngredientData>(); | |
try { | |
ingredients = Ingredients.getAllIngredients(); | |
@@ -46,8 +65,8 @@ public MealScreen(AdminController AC) { | |
for (IngredientData ingredient : ingredients) { | |
ingrCombo.addItem(ingredient); | |
} | |
- mealTable.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(ingrCombo)); | |
- mealTable.getModel().addTableModelListener(new TableModelListener() { | |
+ recipeTable.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(ingrCombo)); | |
+ recipeTable.getModel().addTableModelListener(new TableModelListener() { | |
public void tableChanged(TableModelEvent e) { | |
if (e.getType() == TableModelEvent.UPDATE) { | |
TableModel table = (TableModel) e.getSource(); | |
@@ -68,16 +87,16 @@ public void tableChanged(TableModelEvent e) { | |
public void addIngredients(MealData m){ | |
try { | |
//create lines of the table for each ingredient in a meal | |
- DefaultTableModel mod = (DefaultTableModel) mealTable.getModel(); | |
+ DefaultTableModel mod = (DefaultTableModel) recipeTable.getModel(); | |
MealData meal = m; | |
ArrayList<RecipeItem> items = Recipes.getRecipe(m.getID()); | |
//set the lable to be the name of the meal | |
- mealNameLable.setText(meal.getName()); | |
+ mealNameText.setText(meal.getName()); | |
for(RecipeItem item : items){ | |
IngredientData ingr = Ingredients.getIngredient(item.getIngrId()); | |
mod.addRow(new Object[]{ingr, item.getQuantity(), ingr.getUnits()}); | |
} | |
- mealTable.setModel(mod); | |
+ recipeTable.getSelectionModel().addListSelectionListener(recipeTableSelectionListener); | |
} catch (SQLException ex) { | |
Logger.getLogger(MealScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
@@ -86,9 +105,10 @@ public void addIngredients(MealData m){ | |
* hide meal | |
*/ | |
public void clear(){ | |
- mealNameLable.setText("Meal Name"); | |
- DefaultTableModel mod = (DefaultTableModel)mealTable.getModel(); | |
+ mealNameText.setText("Meal Name"); | |
+ DefaultTableModel mod = (DefaultTableModel)recipeTable.getModel(); | |
int rowCount = mod.getRowCount(); | |
+ recipeTable.getSelectionModel().removeListSelectionListener(recipeTableSelectionListener); | |
for (int i = 0 ; i < rowCount; i++){ | |
mod.removeRow(0); | |
} | |
@@ -104,27 +124,35 @@ public void clear(){ | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- mealNameLable = new javax.swing.JLabel(); | |
- jScrollPane1 = new javax.swing.JScrollPane(); | |
- mealTable = new javax.swing.JTable(); | |
- removeButton = new javax.swing.JButton(); | |
- doneButton = new javax.swing.JButton(); | |
+ paddingPanel = new javax.swing.JPanel(); | |
+ mealNamePanel = new javax.swing.JPanel(); | |
+ mealNameText = new javax.swing.JTextField(); | |
+ recipeScroll = new javax.swing.JScrollPane(); | |
+ recipeTable = new javax.swing.JTable(); | |
+ rightButtons = new javax.swing.JPanel(); | |
addButton = new javax.swing.JButton(); | |
- jLabel1 = new javax.swing.JLabel(); | |
- jLabel2 = new javax.swing.JLabel(); | |
+ removeButton = new javax.swing.JButton(); | |
+ bottomButtons = new javax.swing.JPanel(); | |
cancelButton = new javax.swing.JButton(); | |
+ doneButton = new javax.swing.JButton(); | |
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
- | |
- mealNameLable.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N | |
- mealNameLable.setText("Meal Name"); | |
- mealNameLable.addMouseListener(new java.awt.event.MouseAdapter() { | |
- public void mouseClicked(java.awt.event.MouseEvent evt) { | |
- mealNameLableMouseClicked(evt); | |
+ setMinimumSize(new java.awt.Dimension(450, 200)); | |
+ addComponentListener(new java.awt.event.ComponentAdapter() { | |
+ public void componentHidden(java.awt.event.ComponentEvent evt) { | |
+ formComponentHidden(evt); | |
} | |
}); | |
+ getContentPane().setLayout(new java.awt.CardLayout(10, 10)); | |
+ | |
+ paddingPanel.setLayout(new java.awt.BorderLayout()); | |
- mealTable.setModel(new javax.swing.table.DefaultTableModel( | |
+ mealNamePanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ mealNamePanel.setLayout(new java.awt.CardLayout()); | |
+ mealNamePanel.add(mealNameText, "card3"); | |
+ | |
+ paddingPanel.add(mealNamePanel, java.awt.BorderLayout.NORTH); | |
+ | |
+ recipeTable.setModel(new javax.swing.table.DefaultTableModel( | |
new Object [][] { | |
{null, null, ""} | |
}, | |
@@ -147,32 +175,34 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { | |
return canEdit [columnIndex]; | |
} | |
}); | |
- jScrollPane1.setViewportView(mealTable); | |
+ recipeScroll.setViewportView(recipeTable); | |
- removeButton.setText("Remove"); | |
- removeButton.addActionListener(new java.awt.event.ActionListener() { | |
- public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- removeButtonActionPerformed(evt); | |
- } | |
- }); | |
+ paddingPanel.add(recipeScroll, java.awt.BorderLayout.CENTER); | |
- doneButton.setText("Done"); | |
- doneButton.addActionListener(new java.awt.event.ActionListener() { | |
+ rightButtons.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0)); | |
+ rightButtons.setLayout(new javax.swing.BoxLayout(rightButtons, javax.swing.BoxLayout.PAGE_AXIS)); | |
+ | |
+ addButton.setText("Add Ingredient"); | |
+ addButton.setMaximumSize(new java.awt.Dimension(156, 29)); | |
+ addButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- doneButtonActionPerformed(evt); | |
+ addButtonActionPerformed(evt); | |
} | |
}); | |
+ rightButtons.add(addButton); | |
- addButton.setText("Add"); | |
- addButton.addActionListener(new java.awt.event.ActionListener() { | |
+ removeButton.setText("Remove Ingedient"); | |
+ removeButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- addButtonActionPerformed(evt); | |
+ removeButtonActionPerformed(evt); | |
} | |
}); | |
+ rightButtons.add(removeButton); | |
- jLabel1.setText("--click here to edit the name of the meal"); | |
+ paddingPanel.add(rightButtons, java.awt.BorderLayout.EAST); | |
- jLabel2.setText("--click here to add an Ingredient"); | |
+ bottomButtons.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 0, 0, 0)); | |
+ bottomButtons.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 0, 0)); | |
cancelButton.setText("Cancel"); | |
cancelButton.addActionListener(new java.awt.event.ActionListener() { | |
@@ -180,57 +210,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
cancelButtonActionPerformed(evt); | |
} | |
}); | |
+ bottomButtons.add(cancelButton); | |
+ | |
+ doneButton.setText("Done"); | |
+ doneButton.addActionListener(new java.awt.event.ActionListener() { | |
+ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
+ doneButtonActionPerformed(evt); | |
+ } | |
+ }); | |
+ bottomButtons.add(doneButton); | |
+ | |
+ paddingPanel.add(bottomButtons, java.awt.BorderLayout.SOUTH); | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | |
- .addComponent(addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jLabel2) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(doneButton, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(mealNameLable) | |
- .addGap(18, 18, 18) | |
- .addComponent(jLabel1)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGap(68, 68, 68) | |
- .addComponent(removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))) | |
- .addGap(0, 0, Short.MAX_VALUE))) | |
- .addContainerGap()) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
- .addComponent(mealNameLable) | |
- .addComponent(jLabel1)) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGap(57, 57, 57) | |
- .addComponent(removeButton))) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
- .addComponent(addButton) | |
- .addComponent(doneButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(jLabel2) | |
- .addComponent(cancelButton)) | |
- .addGap(22, 22, 22)) | |
- ); | |
+ getContentPane().add(paddingPanel, "card6"); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
@@ -243,9 +235,9 @@ private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR | |
* i guess add another column to table. | |
* only on confirm will all the table data be read etc into the outport format | |
*/ | |
- DefaultTableModel mod = (DefaultTableModel)mealTable.getModel(); | |
+ DefaultTableModel mod = (DefaultTableModel)recipeTable.getModel(); | |
mod.addRow(new Object[]{"", 0, ""}); | |
- mealTable.setModel(mod); | |
+ recipeTable.setModel(mod); | |
}//GEN-LAST:event_addButtonActionPerformed | |
@@ -256,17 +248,15 @@ private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI | |
* before passing all those details to controller | |
* who will add a meal to the db | |
*/ | |
- String mealname = mealNameLable.getText(); | |
+ String mealname = mealNameText.getText(); | |
ArrayList<RecipeItem> recipe = new ArrayList<RecipeItem>(); | |
- DefaultTableModel mod = (DefaultTableModel)mealTable.getModel(); | |
+ DefaultTableModel mod = (DefaultTableModel)recipeTable.getModel(); | |
int rowmax = mod.getRowCount(); | |
- System.out.println("number of rows are: " + rowmax); | |
//int col = 0; | |
double quant; | |
for (int row = 0; row < rowmax; row++){ | |
IngredientData ingredient = (IngredientData) mod.getValueAt(row, 0); | |
- System.out.println(ingredient.toString()); | |
quant = Double.parseDouble( mod.getValueAt(row, 1).toString()); | |
//IngredientData(int id, String name, String unit, int incrmtqty,int treshold) | |
recipe.add(new RecipeItem((meal != null ? meal.getID() : 0), ingredient.getID(), quant)); | |
@@ -290,45 +280,39 @@ private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- | |
* ask for confirmation first? not so life or death | |
*/ | |
- int index = mealTable.getSelectedRow(); | |
+ int index = recipeTable.getSelectedRow(); | |
- DefaultTableModel mod = (DefaultTableModel)mealTable.getModel(); | |
+ DefaultTableModel mod = (DefaultTableModel)recipeTable.getModel(); | |
if (index != -1){ | |
mod.removeRow(index); | |
} | |
}//GEN-LAST:event_removeButtonActionPerformed | |
- private void mealNameLableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mealNameLableMouseClicked | |
- String str = JOptionPane.showInputDialog(null, "Change the Meal Name: ", | |
- "Meal Name Change", 1); | |
- while (AC.mealNameExists(str)){ | |
- str = JOptionPane.showInputDialog(null, "That Meal Name already exits, please enter another: ", | |
- "Meal Name Change", 1); | |
- } | |
- if (str != null && !str.equals("")){ | |
- mealNameLable.setText(str); | |
- } | |
- }//GEN-LAST:event_mealNameLableMouseClicked | |
- | |
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed | |
//this.setVisible(false); | |
AC.setMainVisible(); | |
}//GEN-LAST:event_cancelButtonActionPerformed | |
+ private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden | |
+ AC.setMainVisible(); | |
+ }//GEN-LAST:event_formComponentHidden | |
+ | |
/** | |
* @param args the command line arguments | |
*/ | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
private javax.swing.JButton addButton; | |
+ private javax.swing.JPanel bottomButtons; | |
private javax.swing.JButton cancelButton; | |
private javax.swing.JButton doneButton; | |
- private javax.swing.JLabel jLabel1; | |
- private javax.swing.JLabel jLabel2; | |
- private javax.swing.JScrollPane jScrollPane1; | |
- private javax.swing.JLabel mealNameLable; | |
- private javax.swing.JTable mealTable; | |
+ private javax.swing.JPanel mealNamePanel; | |
+ private javax.swing.JTextField mealNameText; | |
+ private javax.swing.JPanel paddingPanel; | |
+ private javax.swing.JScrollPane recipeScroll; | |
+ private javax.swing.JTable recipeTable; | |
private javax.swing.JButton removeButton; | |
+ private javax.swing.JPanel rightButtons; | |
// End of variables declaration//GEN-END:variables | |
} | |
diff --git a/StockManager/src/stockmanager/Meals.java b/StockManager/src/stockmanager/Meals.java | |
index 330b924..1d460e8 100644 | |
--- a/StockManager/src/stockmanager/Meals.java | |
+++ b/StockManager/src/stockmanager/Meals.java | |
@@ -170,8 +170,8 @@ public static void modify(int id, String mealName) | |
sql= "UPDATE meals SET name= ? WHERE mealid= ?"; | |
PreparedStatement pstmt= conn.prepareStatement(sql); | |
- pstmt.setInt(1,id); | |
- pstmt.setString(2,mealName); | |
+ pstmt.setString(1, mealName); | |
+ pstmt.setInt(2, id); | |
pstmt.executeUpdate(); | |
diff --git a/StockManager/src/stockmanager/StaffController.java b/StockManager/src/stockmanager/StaffController.java | |
index 74ae29d..311d8fd 100644 | |
--- a/StockManager/src/stockmanager/StaffController.java | |
+++ b/StockManager/src/stockmanager/StaffController.java | |
@@ -44,11 +44,11 @@ void showCancellationPage() throws SQLException { | |
void showStaffPage(){ | |
cancelscreen.setVisible(false); | |
- try { | |
+ /*try { | |
staffscreen.updateOrderedList(); | |
} catch (SQLException ex) { | |
Logger.getLogger(StaffController.class.getName()).log(Level.SEVERE, null, ex); | |
- } | |
+ } */ | |
staffscreen.setVisible(true); | |
} | |
@@ -61,7 +61,6 @@ void addMealTransaction(MealData m) throws SQLException { | |
TransactionMealOrders tm = new TransactionMealOrders(); | |
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); | |
Date date = new Date(); | |
- System.out.println(dateFormat.format(date)); | |
int id = m.getID(); | |
tm.addTransaction(id, dateFormat.format(date)); | |
} | |
diff --git a/StockManager/src/stockmanager/StaffScreen.form b/StockManager/src/stockmanager/StaffScreen.form | |
index b1964c2..9b254b6 100644 | |
--- a/StockManager/src/stockmanager/StaffScreen.form | |
+++ b/StockManager/src/stockmanager/StaffScreen.form | |
@@ -1,34 +1,18 @@ | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |
- <NonVisualComponents> | |
- <Menu class="javax.swing.JMenuBar" name="jMenuBar1"> | |
- <SubComponents> | |
- <Menu class="javax.swing.JMenu" name="jMenu1"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="File"/> | |
- </Properties> | |
- <SubComponents> | |
- <MenuItem class="javax.swing.JMenuItem" name="LogOffMenuItem"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Log Off"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="LogOffMenuItemActionPerformed"/> | |
- </Events> | |
- </MenuItem> | |
- </SubComponents> | |
- </Menu> | |
- </SubComponents> | |
- </Menu> | |
- </NonVisualComponents> | |
<Properties> | |
<Property name="defaultCloseOperation" type="int" value="2"/> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[400, 150]"/> | |
+ </Property> | |
</Properties> | |
<SyntheticProperties> | |
- <SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/> | |
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |
</SyntheticProperties> | |
+ <Events> | |
+ <EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/> | |
+ </Events> | |
<AuxValues> | |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |
@@ -39,133 +23,111 @@ | |
<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,24,0,0,1,-10"/> | |
</AuxValues> | |
- <Layout> | |
- <DimensionLayout dim="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" alignment="0" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="1" attributes="0"> | |
- <Component id="CancelButton" min="-2" max="-2" attributes="0"/> | |
- <Group type="102" attributes="0"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <Component id="jScrollPane2" min="-2" pref="316" max="-2" attributes="0"/> | |
- </Group> | |
- <EmptySpace min="-2" pref="29" max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="1" attributes="0"> | |
- <Component id="jScrollPane4" min="-2" pref="85" max="-2" attributes="0"/> | |
- <Component id="jLabel4" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </Group> | |
- <EmptySpace pref="21" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
- <DimensionLayout dim="1"> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Group type="103" groupAlignment="0" attributes="0"> | |
- <Group type="102" attributes="0"> | |
- <Component id="jLabel4" min="-2" max="-2" attributes="0"/> | |
- <EmptySpace max="-2" attributes="0"/> | |
- <Component id="jScrollPane4" min="-2" pref="119" max="-2" attributes="0"/> | |
- <EmptySpace max="32767" attributes="0"/> | |
- <Component id="CancelButton" min="-2" max="-2" attributes="0"/> | |
- </Group> | |
- <Group type="102" attributes="0"> | |
- <Component id="jScrollPane2" min="-2" pref="197" max="-2" attributes="0"/> | |
- <EmptySpace min="0" pref="27" max="32767" attributes="0"/> | |
- </Group> | |
- </Group> | |
- <EmptySpace max="-2" attributes="0"/> | |
- </Group> | |
- </Group> | |
- </DimensionLayout> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"> | |
+ <Property name="horizontalGap" type="int" value="10"/> | |
+ <Property name="verticalGap" type="int" value="10"/> | |
</Layout> | |
<SubComponents> | |
- <Component class="javax.swing.JLabel" name="jLabel1"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Meals"/> | |
- </Properties> | |
- </Component> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane2"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JPanel" name="paddingPanel"> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> | |
+ <CardConstraints cardName="card7"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | |
<SubComponents> | |
- <Component class="javax.swing.JList" name="MealList"> | |
+ <Component class="javax.swing.JLabel" name="staffHeading"> | |
<Properties> | |
- <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | |
- <StringArray count="5"> | |
- <StringItem index="0" value="Item 1"/> | |
- <StringItem index="1" value="Item 2"/> | |
- <StringItem index="2" value="Item 3"/> | |
- <StringItem index="3" value="Item 4"/> | |
- <StringItem index="4" value="Item 5"/> | |
- </StringArray> | |
+ <Property name="text" type="java.lang.String" value="Menu Items"/> | |
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="10" left="0" right="0" top="0"/> | |
+ </Border> | |
</Property> | |
</Properties> | |
- <Events> | |
- <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="MealListMouseClicked"/> | |
- <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="MealListValueChanged"/> | |
- </Events> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="North"/> | |
+ </Constraint> | |
+ </Constraints> | |
</Component> | |
- </SubComponents> | |
- </Container> | |
- <Container class="javax.swing.JScrollPane" name="jScrollPane4"> | |
- <AuxValues> | |
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
- </AuxValues> | |
+ <Container class="javax.swing.JScrollPane" name="mealsListScroll"> | |
+ <AuxValues> | |
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | |
+ </AuxValues> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="Center"/> | |
+ </Constraint> | |
+ </Constraints> | |
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
- <SubComponents> | |
- <Component class="javax.swing.JList" name="OrderList"> | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JList" name="mealsList"> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
+ <Container class="javax.swing.JPanel" name="buttonsPanel"> | |
<Properties> | |
- <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
- <Color blue="dd" green="de" red="de" type="rgb"/> | |
- </Property> | |
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> | |
- <Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo"> | |
- <BevelBorder bevelType="1"/> | |
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> | |
+ <EmptyBorder bottom="0" left="10" right="0" top="0"/> | |
</Border> | |
</Property> | |
- <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | |
- <StringArray count="5"> | |
- <StringItem index="0" value="Item 1"/> | |
- <StringItem index="1" value="Item 2"/> | |
- <StringItem index="2" value="Item 3"/> | |
- <StringItem index="3" value="Item 4"/> | |
- <StringItem index="4" value="Item 5"/> | |
- </StringArray> | |
- </Property> | |
- <Property name="enabled" type="boolean" value="false"/> | |
- <Property name="selectionBackground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> | |
- <Color blue="de" green="de" red="de" type="rgb"/> | |
- </Property> | |
</Properties> | |
- </Component> | |
+ <Constraints> | |
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | |
+ <BorderConstraints direction="East"/> | |
+ </Constraint> | |
+ </Constraints> | |
+ | |
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"> | |
+ <Property name="axis" type="int" value="3"/> | |
+ </Layout> | |
+ <SubComponents> | |
+ <Component class="javax.swing.JButton" name="orderButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Order"/> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[145, 29]"/> | |
+ </Property> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="orderButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ <Component class="javax.swing.Box$Filler" name="buttonSpacer"> | |
+ <Properties> | |
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[145, 29]"/> | |
+ </Property> | |
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[145, 29]"/> | |
+ </Property> | |
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | |
+ <Dimension value="[145, 29]"/> | |
+ </Property> | |
+ <Property name="alignmentX" type="float" value="0.0"/> | |
+ </Properties> | |
+ <AuxValues> | |
+ <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/> | |
+ </AuxValues> | |
+ </Component> | |
+ <Component class="javax.swing.JToggleButton" name="cancelButton"> | |
+ <Properties> | |
+ <Property name="text" type="java.lang.String" value="Cancel Orders…"/> | |
+ </Properties> | |
+ <Events> | |
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> | |
+ </Events> | |
+ </Component> | |
+ </SubComponents> | |
+ </Container> | |
</SubComponents> | |
</Container> | |
- <Component class="javax.swing.JToggleButton" name="CancelButton"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Cancellations"/> | |
- </Properties> | |
- <Events> | |
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="CancelButtonActionPerformed"/> | |
- </Events> | |
- </Component> | |
- <Component class="javax.swing.JLabel" name="jLabel4"> | |
- <Properties> | |
- <Property name="text" type="java.lang.String" value="Recently Ordered"/> | |
- </Properties> | |
- </Component> | |
</SubComponents> | |
</Form> | |
diff --git a/StockManager/src/stockmanager/StaffScreen.java b/StockManager/src/stockmanager/StaffScreen.java | |
index 22c42d9..8c977fd 100644 | |
--- a/StockManager/src/stockmanager/StaffScreen.java | |
+++ b/StockManager/src/stockmanager/StaffScreen.java | |
@@ -34,190 +34,116 @@ public StaffScreen(StaffController SC) throws SQLException { | |
public void populateLists() throws SQLException{ | |
//may have to make these arraylists global so can access the ids | |
DefaultListModel meal = new DefaultListModel(); | |
- DefaultListModel order = new DefaultListModel(); | |
meals = SC.getMeals(); | |
for (MealData m: meals){ | |
meal.addElement(m.getName()); | |
} | |
- order.addElement(""); | |
- MealList.setModel(meal); | |
- OrderList.setModel(order); | |
+ mealsList.setModel(meal); | |
repaint(); | |
} | |
@SuppressWarnings("unchecked") | |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
private void initComponents() { | |
- jLabel1 = new javax.swing.JLabel(); | |
- jScrollPane2 = new javax.swing.JScrollPane(); | |
- MealList = new javax.swing.JList(); | |
- jScrollPane4 = new javax.swing.JScrollPane(); | |
- OrderList = new javax.swing.JList(); | |
- CancelButton = new javax.swing.JToggleButton(); | |
- jLabel4 = new javax.swing.JLabel(); | |
- jMenuBar1 = new javax.swing.JMenuBar(); | |
- jMenu1 = new javax.swing.JMenu(); | |
- LogOffMenuItem = new javax.swing.JMenuItem(); | |
+ paddingPanel = new javax.swing.JPanel(); | |
+ staffHeading = new javax.swing.JLabel(); | |
+ mealsListScroll = new javax.swing.JScrollPane(); | |
+ mealsList = new javax.swing.JList(); | |
+ buttonsPanel = new javax.swing.JPanel(); | |
+ orderButton = new javax.swing.JButton(); | |
+ buttonSpacer = new javax.swing.Box.Filler(new java.awt.Dimension(145, 29), new java.awt.Dimension(145, 29), new java.awt.Dimension(145, 29)); | |
+ cancelButton = new javax.swing.JToggleButton(); | |
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
- | |
- jLabel1.setText("Meals"); | |
- | |
- MealList.setModel(new javax.swing.AbstractListModel() { | |
- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; | |
- public int getSize() { return strings.length; } | |
- public Object getElementAt(int i) { return strings[i]; } | |
- }); | |
- MealList.addMouseListener(new java.awt.event.MouseAdapter() { | |
- public void mouseClicked(java.awt.event.MouseEvent evt) { | |
- MealListMouseClicked(evt); | |
+ setMinimumSize(new java.awt.Dimension(400, 150)); | |
+ addWindowListener(new java.awt.event.WindowAdapter() { | |
+ public void windowClosed(java.awt.event.WindowEvent evt) { | |
+ formWindowClosed(evt); | |
} | |
}); | |
- MealList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { | |
- public void valueChanged(javax.swing.event.ListSelectionEvent evt) { | |
- MealListValueChanged(evt); | |
- } | |
- }); | |
- jScrollPane2.setViewportView(MealList); | |
- | |
- OrderList.setBackground(new java.awt.Color(222, 222, 221)); | |
- OrderList.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); | |
- OrderList.setModel(new javax.swing.AbstractListModel() { | |
- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; | |
- public int getSize() { return strings.length; } | |
- public Object getElementAt(int i) { return strings[i]; } | |
- }); | |
- OrderList.setEnabled(false); | |
- OrderList.setSelectionBackground(new java.awt.Color(222, 222, 222)); | |
- jScrollPane4.setViewportView(OrderList); | |
+ getContentPane().setLayout(new java.awt.CardLayout(10, 10)); | |
+ | |
+ paddingPanel.setLayout(new java.awt.BorderLayout()); | |
+ | |
+ staffHeading.setText("Menu Items"); | |
+ staffHeading.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 10, 0)); | |
+ paddingPanel.add(staffHeading, java.awt.BorderLayout.NORTH); | |
+ | |
+ mealsListScroll.setViewportView(mealsList); | |
+ | |
+ paddingPanel.add(mealsListScroll, java.awt.BorderLayout.CENTER); | |
+ | |
+ buttonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 10, 0, 0)); | |
+ buttonsPanel.setLayout(new javax.swing.BoxLayout(buttonsPanel, javax.swing.BoxLayout.PAGE_AXIS)); | |
- CancelButton.setText("Cancellations"); | |
- CancelButton.addActionListener(new java.awt.event.ActionListener() { | |
+ orderButton.setText("Order"); | |
+ orderButton.setMaximumSize(new java.awt.Dimension(145, 29)); | |
+ orderButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- CancelButtonActionPerformed(evt); | |
+ orderButtonActionPerformed(evt); | |
} | |
}); | |
+ buttonsPanel.add(orderButton); | |
- jLabel4.setText("Recently Ordered"); | |
+ buttonSpacer.setAlignmentX(0.0F); | |
+ buttonsPanel.add(buttonSpacer); | |
- jMenu1.setText("File"); | |
- | |
- LogOffMenuItem.setText("Log Off"); | |
- LogOffMenuItem.addActionListener(new java.awt.event.ActionListener() { | |
+ cancelButton.setText("Cancel Orders…"); | |
+ cancelButton.addActionListener(new java.awt.event.ActionListener() { | |
public void actionPerformed(java.awt.event.ActionEvent evt) { | |
- LogOffMenuItemActionPerformed(evt); | |
+ cancelButtonActionPerformed(evt); | |
} | |
}); | |
- jMenu1.add(LogOffMenuItem); | |
- | |
- jMenuBar1.add(jMenu1); | |
- | |
- setJMenuBar(jMenuBar1); | |
- | |
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
- getContentPane().setLayout(layout); | |
- layout.setHorizontalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
- .addComponent(CancelButton) | |
- .addGroup(layout.createSequentialGroup() | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addComponent(jLabel1) | |
- .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
- .addGap(29, 29, 29) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
- .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addComponent(jLabel4)))) | |
- .addContainerGap(21, Short.MAX_VALUE)) | |
- ); | |
- layout.setVerticalGroup( | |
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addContainerGap() | |
- .addComponent(jLabel1) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jLabel4) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
- .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
- .addComponent(CancelButton)) | |
- .addGroup(layout.createSequentialGroup() | |
- .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE) | |
- .addGap(0, 27, Short.MAX_VALUE))) | |
- .addContainerGap()) | |
- ); | |
+ buttonsPanel.add(cancelButton); | |
+ | |
+ paddingPanel.add(buttonsPanel, java.awt.BorderLayout.EAST); | |
+ | |
+ getContentPane().add(paddingPanel, "card7"); | |
pack(); | |
}// </editor-fold>//GEN-END:initComponents | |
- private void LogOffMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogOffMenuItemActionPerformed | |
- SC.logoff(); | |
- }//GEN-LAST:event_LogOffMenuItemActionPerformed | |
- | |
- private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed | |
+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed | |
try { | |
SC.showCancellationPage(); | |
} catch (SQLException ex) { | |
Logger.getLogger(StaffScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
- }//GEN-LAST:event_CancelButtonActionPerformed | |
+ }//GEN-LAST:event_cancelButtonActionPerformed | |
- private void MealListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MealListMouseClicked | |
- /* | |
- int starterIndex = MealList.getSelectedIndex(); | |
- if (starterIndex >=0){ | |
- MealData m = meals.get(starterIndex); | |
+ | |
+ private void orderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderButtonActionPerformed | |
+ int index = mealsList.getSelectedIndex(); | |
+ if (index != -1) { | |
+ MealData m = meals.get(index); | |
try { | |
SC.addMealTransaction(m); | |
- updateOrderedList(); | |
} catch (SQLException ex) { | |
Logger.getLogger(StaffScreen.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
+ | |
} | |
- */ | |
- }//GEN-LAST:event_MealListMouseClicked | |
+ }//GEN-LAST:event_orderButtonActionPerformed | |
- | |
- private void MealListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_MealListValueChanged | |
- if (evt.getValueIsAdjusting() == false) { | |
- int index = MealList.getSelectedIndex(); | |
- if (index == -1) { | |
- //no selection | |
- } else { | |
- System.out.println("hahahah get the indexed meal :D"); | |
- MealData m = meals.get(index); | |
- try { | |
- SC.addMealTransaction(m); | |
- updateOrderedList(); | |
- System.out.println("adding meal transaction"); | |
- } catch (SQLException ex) { | |
- Logger.getLogger(StaffScreen.class.getName()).log(Level.SEVERE, null, ex); | |
- } | |
- } | |
- } | |
- }//GEN-LAST:event_MealListValueChanged | |
+ private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed | |
+ SC.logoff(); | |
+ }//GEN-LAST:event_formWindowClosed | |
/** | |
* @param args the command line arguments | |
*/ | |
// Variables declaration - do not modify//GEN-BEGIN:variables | |
- private javax.swing.JToggleButton CancelButton; | |
- private javax.swing.JMenuItem LogOffMenuItem; | |
- private javax.swing.JList MealList; | |
- private javax.swing.JList OrderList; | |
- private javax.swing.JLabel jLabel1; | |
- private javax.swing.JLabel jLabel4; | |
- private javax.swing.JMenu jMenu1; | |
- private javax.swing.JMenuBar jMenuBar1; | |
- private javax.swing.JScrollPane jScrollPane2; | |
- private javax.swing.JScrollPane jScrollPane4; | |
+ private javax.swing.Box.Filler buttonSpacer; | |
+ private javax.swing.JPanel buttonsPanel; | |
+ private javax.swing.JToggleButton cancelButton; | |
+ private javax.swing.JList mealsList; | |
+ private javax.swing.JScrollPane mealsListScroll; | |
+ private javax.swing.JButton orderButton; | |
+ private javax.swing.JPanel paddingPanel; | |
+ private javax.swing.JLabel staffHeading; | |
// End of variables declaration//GEN-END:variables | |
- public void updateOrderedList() throws SQLException { | |
+/* public void updateOrderedList() throws SQLException { | |
// DefaultListModel order = new DefaultListModel(); | |
// //TransactionMealOrders tmo = new TransactionMealOrders(); | |
// Date date = new Date(); | |
@@ -237,5 +163,5 @@ public void updateOrderedList() throws SQLException { | |
tlist.addElement(t.getMealName()); | |
} | |
OrderList.setModel(tlist); | |
- } | |
-} | |
+ } */ | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment