summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/GUI/EingabeSystemDaten.java
blob: 9e370328c644e97d4213eb64e15fa6257a263380 (plain) (blame)
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
package GUI;

import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextPane;
import java.awt.SystemColor;
import javax.swing.JTextField;
import sql.sql;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import java.awt.Choice;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import Models.vm;

import com.toedter.calendar.JDateChooser;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;

@SuppressWarnings("serial")
public class EingabeSystemDaten extends JDialog {

	private final JPanel contentPanel = new JPanel();
	String[] result;
	sql sql=new sql();
	private JTextField Laborname;
	JDateChooser dateChooser;
	JDateChooser dateChooser_1;
	Choice choiceOS;
	JTextArea comment;
	JTextArea shortDesc;
	JTextArea longDesc;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			EingabeSystemDaten dialog = new EingabeSystemDaten();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public EingabeSystemDaten() {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setTitle("Dozentenmodul");
		setBounds(100, 100, 583, 648);
		getContentPane().setLayout(null);
		{
			JPanel panel = new JPanel();
			panel.setBounds(0, 0, 567, 71);
			getContentPane().add(panel);
			panel.setLayout(null);
			{
				JLabel lblNewLabel = new JLabel("Eingabe der systembezogenen Daten (Schritt 4 von 5)");
				lblNewLabel.setBounds(10, 11, 509, 22);
				panel.add(lblNewLabel);
				lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18));
			}
			
			JTextPane txtpnBitteWhlenSie = new JTextPane();
			txtpnBitteWhlenSie.setEditable(false);
			txtpnBitteWhlenSie.setBackground(SystemColor.menu);
			txtpnBitteWhlenSie.setText("Bitte geben Sie nun die notwendigen Daten Ihres Systems ein.");
			txtpnBitteWhlenSie.setBounds(10, 36, 509, 42);
			panel.add(txtpnBitteWhlenSie);
		}
		contentPanel.setBounds(10, 95, 547, 441);
		contentPanel.setBackground(Color.WHITE);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel);
		contentPanel.setLayout(null);
		
		JLabel lblSysteminformationen = new JLabel("Systeminformationen");
		lblSysteminformationen.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblSysteminformationen.setBounds(10, 11, 162, 14);
		contentPanel.add(lblSysteminformationen);
		
		JLabel lblLabornameanzeigename = new JLabel("Laborname (Anzeigename): *");
		lblLabornameanzeigename.setBounds(10, 36, 150, 20);
		contentPanel.add(lblLabornameanzeigename);
		
		Laborname = new JTextField();
		Laborname.setText(vm.vl.getLaborname());
		Laborname.setBounds(170, 36, 150, 20);
		contentPanel.add(Laborname);
		Laborname.setColumns(10);
		
		JLabel lblKurzbeschreibung = new JLabel("Kurzbeschreibung: *");
		lblKurzbeschreibung.setBounds(10, 67, 150, 20);
		contentPanel.add(lblKurzbeschreibung);
		
		JLabel lblLangbeschreibung = new JLabel("Langbeschreibung: *");
		lblLangbeschreibung.setBounds(10, 139, 150, 20);
		contentPanel.add(lblLangbeschreibung);
		
		JLabel lblKommentar = new JLabel("Kommentar:");
		lblKommentar.setBounds(10, 308, 150, 20);
		contentPanel.add(lblKommentar);
		
		JLabel lblBetriebssystem = new JLabel("Betriebssystem: *");
		lblBetriebssystem.setBounds(10, 373, 150, 20);
		contentPanel.add(lblBetriebssystem);
		
		choiceOS = new Choice();
		
		choiceOS.setBounds(170, 373, 150, 20);
		
		Connection con=sql.getConnection();
		ResultSet rs=sql.getAllOS(con);
		
		try {
			while(rs.next())
			{
				choiceOS.addItem(rs.getString("Produktname")+" "+rs.getString("Version")+" "+rs.getString("Architektur"));
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		choiceOS.select(vm.vl.getOS());
		
		contentPanel.add(choiceOS);
		
		JLabel lblGltigkeitsdatumVon = new JLabel("G\u00FCltigkeitsdatum: *");
		lblGltigkeitsdatumVon.setBounds(10, 404, 150, 20);
		contentPanel.add(lblGltigkeitsdatumVon);
		
		JLabel lblVon = new JLabel("von");
		lblVon.setBounds(170, 407, 24, 14);
		contentPanel.add(lblVon);
		
		dateChooser = new JDateChooser();
		dateChooser.setDateFormatString("dd.MM.yyyy HH:mm:ss");
		dateChooser.setDate(vm.vl.getBegin());
		dateChooser.setBounds(204, 404, 140, 20);
		contentPanel.add(dateChooser);
		
		JLabel lblNewLabel_1 = new JLabel("bis");
		lblNewLabel_1.setBounds(354, 407, 24, 14);
		contentPanel.add(lblNewLabel_1);
		
		dateChooser_1 = new JDateChooser();
		dateChooser_1.setDateFormatString("dd.MM.yyyy HH:mm:ss");
		dateChooser_1.setDate(vm.vl.getEnd());
		dateChooser_1.setBounds(388, 404, 140, 20);
		contentPanel.add(dateChooser_1);
		
		JButton btnHinzufgen = new JButton("Hinzuf\u00FCgen");
		btnHinzufgen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				AddOS os=new AddOS();
				os.setVisible(true);
			}
		});
		btnHinzufgen.setBounds(326, 372, 118, 23);
		contentPanel.add(btnHinzufgen);
		shortDesc=new JTextArea();
		shortDesc.setText(vm.vl.getShortDesc());
		JScrollPane scrollPane = new JScrollPane(shortDesc);
		scrollPane.setBounds(170, 67, 274, 63);
		contentPanel.add(scrollPane);
		longDesc=new JTextArea();
		longDesc.setText(vm.vl.getLongDesc());
		JScrollPane scrollPane_1 = new JScrollPane(longDesc);
		scrollPane_1.setBounds(170, 139, 274, 158);
		contentPanel.add(scrollPane_1);
		comment=new JTextArea();
		comment.setText(vm.vl.getComment());
		JScrollPane scrollPane_2 = new JScrollPane(comment);
		scrollPane_2.setBounds(170, 308, 274, 59);
		contentPanel.add(scrollPane_2);
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setBounds(0, 554, 567, 33);
			buttonPane.setBackground(SystemColor.menu);
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane);
			{
				JButton okButton = new JButton("Zur\u00FCck");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						vm.vl.setBegin(dateChooser.getDate());
						vm.vl.setComment(comment.getText());
						vm.vl.setEnd(dateChooser_1.getDate());
						vm.vl.setLaborname(Laborname.getText());
						vm.vl.setLongDesc(longDesc.getText());
						vm.vl.setOS(choiceOS.getSelectedItem());
						vm.vl.setShortDesc(shortDesc.getText());
						EingabeAllgemein ea= new EingabeAllgemein();
						ea.setVisible(true);
						dispose();
					}
				});
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Weiter");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						vm.vl.setBegin(dateChooser.getDate());
						vm.vl.setComment(comment.getText());
						vm.vl.setEnd(dateChooser_1.getDate());
						vm.vl.setLaborname(Laborname.getText());
						vm.vl.setLongDesc(longDesc.getText());
						vm.vl.setOS(choiceOS.getSelectedItem());
						vm.vl.setShortDesc(shortDesc.getText());
						if(Laborname.getText().isEmpty()==false&&shortDesc.getText().isEmpty()==false&&longDesc.getText().isEmpty()==false&&dateChooser.getDate()!=null&&dateChooser_1.getDate()!=null)
						{
						EingabeSoftwareDaten ea=new EingabeSoftwareDaten();
						ea.setVisible(true);
						dispose();
						}
						else
						{
							JOptionPane.showMessageDialog(null, "Bitte geben Sie alle notwendigen Daten an!",
									"Error", JOptionPane.ERROR_MESSAGE);
						}
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		
		JSeparator separator = new JSeparator();
		separator.setBounds(0, 547, 567, 2);
		getContentPane().add(separator);
		
		JSeparator separator_1 = new JSeparator();
		separator_1.setBounds(0, 82, 567, 2);
		getContentPane().add(separator_1);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnSuchen = new JMenu("Suchen");
		menuBar.add(mnSuchen);
		
		JMenuItem mntmVlSuche = new JMenuItem("VL Suche");
		mnSuchen.add(mntmVlSuche);
		
		JMenu mnHilfe = new JMenu("Hilfe");
		menuBar.add(mnHilfe);
		
		JMenuItem mntmFaq = new JMenuItem("FAQ");
		mnHilfe.add(mntmFaq);
		
		JMenuItem mntmOtrs = new JMenuItem("OTRS");
		mnHilfe.add(mntmOtrs);
		
	}
}