-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDeleteListner.java
More file actions
250 lines (226 loc) · 14.4 KB
/
Copy pathDeleteListner.java
File metadata and controls
250 lines (226 loc) · 14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
package DBMS;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by Pawan on 14-04-2017.
*/
public class DeleteListner implements ActionListener {
private DataBase sql;
private JPanel panel;
private JButton delete,cancel;
private AMSsystem ui;
DeleteListner(DataBase sql,JPanel jp,AMSsystem ui)
{
super();
this.sql=sql;
this.panel=jp;
this.ui=ui;
}
@Override
public void actionPerformed(ActionEvent e)
{
panel.removeAll();
panel.repaint();
switch (e.getActionCommand())
{
case "Airports":
deleteAirport();
break;
case "Employees":
deleteEmployees();
break;
case "Passengers":
deletePassenger();
break;
case "Flights":
deleteFlight();
break;
case "Tickets":
deleteTicket();
break;
case "Routes":
deleteRoute();
break;
case "Flight follows Route":
deleteFollows();
break;
case "Airport has Flight":
deleteHas();
break;
case "Employee serve Passenger":
deleteServe();
break;
case "Managers":
deleteManager();
break;
}
}
private void deleteAirport()
{
ui.getMessageLabel().setText("Enter Airport ID !! ");
JTextField A_ID = UIrequired.setupTextField(new JTextField(20),new Dimension(200,30));
JPanel AID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Airport ID : "),new Dimension(200,40)),A_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, Color.red, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteAirport(A_ID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(AID);;panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteEmployees()
{
ui.getMessageLabel().setText("Enter Employee ID !! ");
JTextField E_ID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel ID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("ID : "),new Dimension(200,40)),E_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, Color.red, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteEmployee(E_ID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(ID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deletePassenger()
{
ui.getMessageLabel().setText("Enter Passenger ID !! ");
JTextField P_ID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel ID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("ID : "),new Dimension(200,40)),P_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deletePassenger(P_ID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(ID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteFlight()
{
ui.getMessageLabel().setText("Enter Flight details !! ");
JTextField F_ID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel ID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Flight ID : "),new Dimension(200,40)),F_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteFlight(F_ID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null),"Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(ID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteTicket()
{
ui.getMessageLabel().setText("Enter Ticket ID !! ");
JTextField T_ID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel ID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Ticket ID : "),new Dimension(200,40)),T_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteTicket(T_ID.getText());
new Message("SuccessFully Stored !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(ID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteRoute()
{
ui.getMessageLabel().setText("Enter Route details !! ");
JTextField R_ID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel ID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Route ID : "),new Dimension(200,40)),R_ID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteRoute(R_ID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(ID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteFollows()
{
ui.getMessageLabel().setText("Enter Follows details !! ");
JTextField F_RID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JTextField F_FID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel RID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Route ID : "),new Dimension(200,40)),F_RID});
JPanel FID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Flight ID : "),new Dimension(200,40)),F_FID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteFollows(F_RID.getText(),F_FID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(RID);panel.add(FID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteHas()
{
ui.getMessageLabel().setText("Enter Has details !! ");
JTextField H_AID = UIrequired.setupTextField(new JTextField(20),new Dimension(200,30));
JTextField H_FID = UIrequired.setupTextField(new JTextField(20),new Dimension(200,30));
JPanel AID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Airport ID : "),new Dimension(200,40)),H_AID});
JPanel FID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Flight ID : "),new Dimension(200,40)),H_FID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteHas(H_AID.getText(),H_FID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(AID);panel.add(FID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteServe()
{
ui.getMessageLabel().setText("Enter Serve details !! ");
JTextField S_EID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JTextField S_PID = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel EID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Employee ID : "),new Dimension(200,40)),S_EID});
JPanel PID = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Passenger ID : "),new Dimension(200,40)),S_PID});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteServe(S_EID.getText(),S_PID.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null),"Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(EID);panel.add(PID);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
private void deleteManager()
{
ui.getMessageLabel().setText("Enter Manager details !! ");
JTextField user = UIrequired.setupTextField(new JTextField(),new Dimension(200,30));
JPanel username = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel("Username : "),new Dimension(200,40)),user});
delete=UIrequired.setupButton(new JButton("Delete"), null, null, new Dimension(100, 30), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sql.deleteManager(user.getText());
new Message("SuccessFully Deleted !!",ui,sql);
}
}, "Delete");
cancel=UIrequired.setupButton(new JButton("Cancel"), null, new Color(0xff7777), new Dimension(100, 30), new ActionListner(ui,sql,null), "Insert");
JPanel b = UIrequired.setupPanel(new JPanel(),new Dimension(500,40),Color.white,new JComponent[]{UIrequired.setupLabel(new JLabel(""),new Dimension(200,40)),delete,cancel});
panel.add(username);panel.add(UIrequired.setupPanel(new JPanel(),new Dimension(500,40),null,null));panel.add(b);
}
}