Skip to content

Commit 21bcad0

Browse files
committed
Print dingen
Print dingen veranderd acc manager dele functie gemaakt pdf uitgebreid
1 parent dcaf38b commit 21bcad0

File tree

7 files changed

+196
-132
lines changed

7 files changed

+196
-132
lines changed

LuggageTrackerTool2/src/utility/PDFGenerator.java

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package utility;
66

77

8+
import com.sun.servicetag.RegistrationData;
89
import model.*;
910

1011
import java.io.IOException;
@@ -37,10 +38,10 @@ public PDFGenerator() {
3738
}
3839
}
3940

40-
public void generate(Passenger passenger, Address HomeAddress, Address TempAddress){
41+
public void generate(Passenger passenger, Luggage luggage){
4142

42-
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
43-
String basicInformationOutput[] = {"Basic information", "Name: ", "Surname: ", "Date of birth: ", "Gender: ", "Home phone number: ", "Mobile phone number:", "Home address", "Country: ", "City: ", "Street: ", "Postal code: ", "Temporary address", "Country: ", "City: ", "Street: ", "Postal code: ", "Luggage", "Description: ", "Storage location: ", "Otherwise: "};
43+
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
44+
String basicInformationOutput[] = {"Personal information", "Name: ", "Surname: ", "Date of birth: ", "Gender: ", "Home phone number: ", "Mobile phone number:", "Home address", "Country: ", "City: ", "Street: ", "Postal code: ", "Temporary address", "Country: ", "City: ", "Street: ", "Postal code: ", "Luggage", "Label Id: " ,"Label number: " ,"Description: ", "Storage location: ", "Status: ", " " , "Employee information: " , "Employee: ", "Date: "};
4445
String gegevens = null;
4546
try {
4647
int x = 75;
@@ -70,11 +71,11 @@ public void generate(Passenger passenger, Address HomeAddress, Address TempAddre
7071
}
7172
if (i == 17) {
7273
this.contentStream.setFont(PDType1Font.HELVETICA_BOLD, 16);
73-
74-
}
75-
if (i == 22) {
74+
}
75+
if (i == 23) {
7676
this.contentStream.setFont(PDType1Font.HELVETICA_BOLD, 16);
77-
77+
78+
7879
}else {
7980
this.contentStream.drawString(basicInformationOutput[i]);
8081

@@ -97,32 +98,44 @@ public void generate(Passenger passenger, Address HomeAddress, Address TempAddre
9798
break;
9899
case 7: gegevens = "";
99100
break;
100-
case 8: gegevens = HomeAddress.getCountry();
101+
case 8: gegevens = passenger.getHomeaddress().getCountry();
101102
break;
102-
case 9: gegevens = HomeAddress.getCity();
103+
case 9: gegevens = passenger.getHomeaddress().getCity();
103104
break;
104-
case 10: gegevens = HomeAddress.getStreetname();
105+
case 10: gegevens = passenger.getHomeaddress().getStreetname();
105106
break;
106-
case 11: gegevens = TempAddress.getZipcode();
107+
case 11: gegevens = passenger.getHomeaddress().getZipcode();
107108
break;
108109
case 12: gegevens = "";
109110
break;
110-
case 13: gegevens = TempAddress.getCountry();
111+
case 13: gegevens = passenger.getTempaddress().getCountry();
111112
break;
112-
case 14: gegevens = TempAddress.getCity();
113+
case 14: gegevens = passenger.getTempaddress().getCity();
113114
break;
114-
case 15: gegevens = TempAddress.getStreetname();
115+
case 15: gegevens = passenger.getTempaddress().getStreetname();
115116
break;
116-
case 16: gegevens = TempAddress.getZipcode();
117+
case 16: gegevens = passenger.getTempaddress().getZipcode();
117118
break;
118119
case 17: gegevens = "";
119120
break;
120-
case 18: gegevens = "";
121+
case 18: gegevens = luggage.getLuggageid().toString();
121122
break;
122-
case 19: gegevens = "";
123+
case 19: gegevens = luggage.getLuggageLabel();
123124
break;
124-
case 20: gegevens = "";
125+
case 20: gegevens = luggage.getDescription();
125126
break;
127+
case 21: gegevens = luggage.getStoragelocation();
128+
break;
129+
case 22: gegevens = luggage.getLuggagestatus().name();
130+
break;
131+
case 23: gegevens = "Employee information: ";
132+
break;
133+
case 24: gegevens = "";
134+
break;
135+
case 25: gegevens = User.getAdmin().getUsername();
136+
break;
137+
case 26: gegevens = luggage.getDateAdded().toString();
138+
break;
126139
default:
127140
break;
128141

LuggageTrackerTool2/src/view/AccountManagement.form

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@
8181
</Group>
8282
</Group>
8383
</Group>
84+
<<<<<<< HEAD
8485
<EmptySpace pref="123" max="32767" attributes="0"/>
86+
=======
87+
<EmptySpace pref="191" max="32767" attributes="0"/>
88+
>>>>>>> origin/PrintZooi
8589
</Group>
8690
</Group>
8791
</DimensionLayout>
@@ -235,15 +239,13 @@
235239
</Component>
236240
<Component class="javax.swing.JComboBox" name="jComboBox1">
237241
<Properties>
238-
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
239-
<StringArray count="4">
240-
<StringItem index="0" value="User 1"/>
241-
<StringItem index="1" value="User 2"/>
242-
<StringItem index="2" value="User 3"/>
243-
<StringItem index="3" value="User 4"/>
244-
</StringArray>
242+
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
243+
<Connection code="new javax.swing.DefaultComboBoxModel(usernames)" type="code"/>
245244
</Property>
246245
</Properties>
246+
<Events>
247+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox1ActionPerformed"/>
248+
</Events>
247249
</Component>
248250
<Component class="javax.swing.JLabel" name="jLabel2">
249251
<Properties>

LuggageTrackerTool2/src/view/AccountManagement.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
155155
}
156156
});
157157

158-
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "User 1", "User 2", "User 3", "User 4" }));
158+
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(usernames));
159+
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
160+
public void actionPerformed(java.awt.event.ActionEvent evt) {
161+
jComboBox1ActionPerformed(evt);
162+
}
163+
});
159164

160165
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
161166
jLabel2.setText("Delete user");
@@ -211,7 +216,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
211216
.addComponent(USER, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
212217
.addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
213218
.addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
219+
<<<<<<< HEAD
214220
.addContainerGap(123, Short.MAX_VALUE))
221+
=======
222+
.addContainerGap(191, Short.MAX_VALUE))
223+
>>>>>>> origin/PrintZooi
215224
);
216225
ACCOUNT_MANAGEMENTLayout.setVerticalGroup(
217226
ACCOUNT_MANAGEMENTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -383,15 +392,25 @@ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
383392
"Are you sure you want to delete the user?", "Question",
384393
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
385394
if (result == JOptionPane.YES_OPTION) {
386-
// Actually delete the user in here
387-
//
388-
//
395+
try {
396+
model.User user = model.UserDAO.readByUsername(USER.getSelectedItem().toString());
397+
user.getUserid();
398+
model.UserDAO.delete(user.getUserid());
399+
} catch (SQLException ex) {
400+
Logger.getLogger(AccountManagement.class.getName()).log(Level.SEVERE, null, ex);
401+
}
389402
}
390403
}//GEN-LAST:event_jButton2ActionPerformed
391404

405+
<<<<<<< HEAD
392406
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
393407
// TODO add your handling code here:
394408
}//GEN-LAST:event_jCheckBox1ActionPerformed
409+
=======
410+
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
411+
// TODO add your handling code here:
412+
}//GEN-LAST:event_jComboBox1ActionPerformed
413+
>>>>>>> origin/PrintZooi
395414

396415
// Variables declaration - do not modify//GEN-BEGIN:variables
397416
private javax.swing.JPanel ACCOUNT_MANAGEMENT;

LuggageTrackerTool2/src/view/RegistrationLuggage.form

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@
3939
<Component id="STORAGE_LOCATION" min="-2" max="-2" attributes="0"/>
4040
<Component id="DESCRIPTION" min="-2" max="-2" attributes="0"/>
4141
<Component id="LUGGAGEID_LABEL" alignment="0" min="-2" max="-2" attributes="0"/>
42-
<Component id="PRINT_ON_REGISTER_INPUT" min="-2" max="-2" attributes="0"/>
4342
<Component id="ANDERS" alignment="0" min="-2" pref="41" max="-2" attributes="0"/>
4443
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
45-
<Component id="PRINT_BUTTON" alignment="0" min="-2" max="-2" attributes="0"/>
4644
</Group>
47-
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
45+
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
4846
<Group type="103" groupAlignment="0" attributes="0">
4947
<Component id="SUBMIT_BUTTON" min="-2" max="-2" attributes="0"/>
5048
<Component id="STATUS_COMBOBOX" min="-2" max="-2" attributes="0"/>
@@ -89,13 +87,8 @@
8987
<Component id="STATUS_COMBOBOX" alignment="0" min="-2" max="-2" attributes="0"/>
9088
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
9189
</Group>
92-
<EmptySpace max="-2" attributes="0"/>
93-
<Component id="PRINT_ON_REGISTER_INPUT" min="-2" max="-2" attributes="0"/>
94-
<EmptySpace max="-2" attributes="0"/>
95-
<Group type="103" groupAlignment="3" attributes="0">
96-
<Component id="PRINT_BUTTON" alignment="3" min="-2" max="-2" attributes="0"/>
97-
<Component id="SUBMIT_BUTTON" alignment="3" min="-2" max="-2" attributes="0"/>
98-
</Group>
90+
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
91+
<Component id="SUBMIT_BUTTON" min="-2" max="-2" attributes="0"/>
9992
<EmptySpace pref="19" max="32767" attributes="0"/>
10093
</Group>
10194
</Group>
@@ -142,12 +135,6 @@
142135
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="STORAGE_LOCATION_INPUTActionPerformed"/>
143136
</Events>
144137
</Component>
145-
<Component class="javax.swing.JCheckBox" name="PRINT_ON_REGISTER_INPUT">
146-
<Properties>
147-
<Property name="selected" type="boolean" value="true"/>
148-
<Property name="text" type="java.lang.String" value="Print on register"/>
149-
</Properties>
150-
</Component>
151138
<Component class="javax.swing.JLabel" name="ANDERS">
152139
<Properties>
153140
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
@@ -175,11 +162,6 @@
175162
</Component>
176163
</SubComponents>
177164
</Container>
178-
<Component class="javax.swing.JButton" name="PRINT_BUTTON">
179-
<Properties>
180-
<Property name="text" type="java.lang.String" value="Print"/>
181-
</Properties>
182-
</Component>
183165
<Component class="javax.swing.JButton" name="SUBMIT_BUTTON">
184166
<Properties>
185167
<Property name="text" type="java.lang.String" value="Submit"/>

LuggageTrackerTool2/src/view/RegistrationLuggage.java

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@ private void initComponents() {
9797
DESCRIPTION_INPUT1 = new javax.swing.JTextArea();
9898
STORAGE_LOCATION = new javax.swing.JLabel();
9999
STORAGE_LOCATION_INPUT = new javax.swing.JComboBox();
100-
PRINT_ON_REGISTER_INPUT = new javax.swing.JCheckBox();
101100
ANDERS = new javax.swing.JLabel();
102101
ANDERS_INPUT_FRAME = new javax.swing.JScrollPane();
103102
ANDERS_INPUT = new javax.swing.JTextArea();
104-
PRINT_BUTTON = new javax.swing.JButton();
105103
SUBMIT_BUTTON = new javax.swing.JButton();
106104
LUGGAGEID_LABEL = new javax.swing.JLabel();
107105
LUGGAGEID_INPUT = new javax.swing.JTextField();
@@ -129,9 +127,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
129127
}
130128
});
131129

132-
PRINT_ON_REGISTER_INPUT.setSelected(true);
133-
PRINT_ON_REGISTER_INPUT.setText("Print on register");
134-
135130
ANDERS.setFont(new java.awt.Font("Tahoma", 2, 13)); // NOI18N
136131
ANDERS.setText("Other");
137132

@@ -141,8 +136,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
141136
ANDERS_INPUT.setEnabled(false);
142137
ANDERS_INPUT_FRAME.setViewportView(ANDERS_INPUT);
143138

144-
PRINT_BUTTON.setText("Print");
145-
146139
SUBMIT_BUTTON.setText("Submit");
147140
SUBMIT_BUTTON.addActionListener(new java.awt.event.ActionListener() {
148141
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -172,11 +165,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
172165
.addComponent(STORAGE_LOCATION)
173166
.addComponent(DESCRIPTION)
174167
.addComponent(LUGGAGEID_LABEL)
175-
.addComponent(PRINT_ON_REGISTER_INPUT)
176168
.addComponent(ANDERS, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
177-
.addComponent(jLabel1)
178-
.addComponent(PRINT_BUTTON))
179-
.addGap(13, 13, 13)
169+
.addComponent(jLabel1))
170+
.addGap(35, 35, 35)
180171
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
181172
.addComponent(SUBMIT_BUTTON)
182173
.addComponent(STATUS_COMBOBOX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -211,12 +202,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
211202
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
212203
.addComponent(STATUS_COMBOBOX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
213204
.addComponent(jLabel1))
214-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
215-
.addComponent(PRINT_ON_REGISTER_INPUT)
216-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
217-
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
218-
.addComponent(PRINT_BUTTON)
219-
.addComponent(SUBMIT_BUTTON))
205+
.addGap(27, 27, 27)
206+
.addComponent(SUBMIT_BUTTON)
220207
.addContainerGap(19, Short.MAX_VALUE))
221208
);
222209
}// </editor-fold>//GEN-END:initComponents
@@ -269,8 +256,6 @@ private void LUGGAGEID_INPUTActionPerformed(java.awt.event.ActionEvent evt) {//G
269256
private javax.swing.JScrollPane DESCRIPTION_INPUT_FRAME;
270257
private javax.swing.JTextField LUGGAGEID_INPUT;
271258
private javax.swing.JLabel LUGGAGEID_LABEL;
272-
private javax.swing.JButton PRINT_BUTTON;
273-
private javax.swing.JCheckBox PRINT_ON_REGISTER_INPUT;
274259
private javax.swing.JComboBox STATUS_COMBOBOX;
275260
private javax.swing.JLabel STORAGE_LOCATION;
276261
private javax.swing.JComboBox STORAGE_LOCATION_INPUT;

0 commit comments

Comments
 (0)