summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/intro/Login_GUI.java
blob: 75d600510392561dc5448a130c4658162506c1ec (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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
package gui.intro;

import java.awt.Color;
import java.awt.Component;
import java.awt.Image;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
import java.util.concurrent.ExecutionException;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;

import models.SessionData;
import models.person;

import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.imagemaster.thrift.iface.ImageServer.Client;
import org.openslx.imagemaster.thrift.iface.UserInfo;

//import server.generated.Server.Client;
import thrift.MasterThriftConnection;
import thrift.ThriftConnection;
import util.GuiOrganizer;
import util.ResourceLoader;
import util.ShibbolethECP;
import config.Config;

@SuppressWarnings("serial")
public class Login_GUI extends JFrame {

	/**
	 * Logger instance for this class.
	 */
	private final static Logger LOGGER = Logger.getLogger(Login_GUI.class);
	String authToken = null;
	
	// String constants representing the different login methods
	private final static String LOGIN_TYPE_BWIDM = "bwidm";
	private final static String LOGIN_TYPE_BWLEHRPOOL = "bwlp";
	private final static String LOGIN_TYPE_SATELLITE = "sat";
	
	private JPanel contentPane;
	private JTextField lblusername;
	private JPasswordField lblpass;
	JLabel lblConnectionInfo = new JLabel("");
	boolean isClientReturnedCorrectly = false;
	JCheckBox chckbxBenutzernameSpeichern;
	private static final String HELP_MESSAGE = "";
	Component c = null;
	String[] args = null;

	private JPanel panel;
	private JPanel panel_1;
	private JLabel LabelUser;
	private JLabel LabelPass;
	
	// radio button and group for login types.
	private ButtonGroup bgLoginType;
	private JRadioButton rdbtnBwIDM;
	private JRadioButton rdbtnDirekteVerbindung;
	private JRadioButton rdbtnMasterserver;
	// its action listener
	private ActionListener loginTypeActionListener;
	
	// bwIDM label and dropdown
	private JComboBox<String> choice;
	private JLabel lblIdp;
	
	// Satellite IP label and text field
	private JLabel lblSatellitenIp;
	private JTextField lblSatIP;

	/**
	 * Create the frame.
	 */
	public Login_GUI(String[] args) {
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});

		this.args = args;
		// Fenster darf nicht vergroessert werden
		setResizable(false);

		try {
			// Setzt das Look and Feel auf System
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			
			e.printStackTrace();
		}
		// Titel des Fensters setzen
		setTitle("bwLehrpool Suite");
		// Aktion die beim Schliessen durchgefuehrt werden soll
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Größe setzen und mittig ausrichten
		setBounds(0, 0, 785, 430);

		// Erzeugen eines Panels
		contentPane = new JPanel();
		// Hintergrund Farbe des Panels setzen
		contentPane.setBackground(SystemColor.menu);
		// Rahmen des Fensters setzen
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		// Layout setzen
		contentPane.setLayout(null);
		// Label fuer das Logo erzeugen
		JLabel imgLabel = new JLabel();
		// Groesse und Position des Logos festelegen
		imgLabel.setBounds(231, 11, 350, 142);
		// Pfadangabe des Logos

		ImageIcon icon = ResourceLoader.getIcon("/img/Logo_bwLehrpool.png",
				"Logo");
		// Skalierung des Logos
		Image scaled = icon.getImage().getScaledInstance(270, 64, 0);
		imgLabel.setIcon(new ImageIcon(scaled));
		// Hinzufuegen des Logos in das Fenster
		contentPane.add(imgLabel);

		lblConnectionInfo.setHorizontalAlignment(SwingConstants.LEFT);
		lblConnectionInfo.setBounds(10, 359, 449, 20);
		lblConnectionInfo.setEnabled(true);
		lblConnectionInfo.setText("Info: Bereit für Login");

		contentPane.add(lblConnectionInfo);

		// Erzeugen, Hinzufuegen und definierung der Aktion des Buttons
		JButton BtnLogin = new JButton("Login");
		BtnLogin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				performLogin(bgLoginType.getSelection().getActionCommand());
			}// end actionPerformed
		});

		BtnLogin.setBounds(488, 358, 239, 23);
		contentPane.add(BtnLogin);
		
		// Start of the actual content of the right panel
		panel = new JPanel();
		panel.setLayout(null);
		panel.setBorder(new TitledBorder(null, "Zugangsdaten",
						TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.setBackground(SystemColor.menu);
		panel.setBounds(354, 143, 400, 181);
		contentPane.add(panel);
		
		chckbxBenutzernameSpeichern = new JCheckBox("Benutzername speichern");
		chckbxBenutzernameSpeichern.setBounds(135, 137, 237, 23);
		chckbxBenutzernameSpeichern.setSelected(Config.getSaveUsername());
		panel.add(chckbxBenutzernameSpeichern);
				
		// Erzeugen und Hinzufuegen des Labels
		LabelUser = new JLabel("Benutzername:");
		LabelUser.setBounds(25, 60, 82, 20);
		panel.add(LabelUser);
		
		// Erzeugen und Hinzufuegen des Textfeldes
		lblusername = new JTextField();
		lblusername.setBounds(135, 60, 237, 20);
		lblusername.setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein.");
		lblusername.setColumns(10);
		// Lese Benutzername aus der Konfigurationsdatei
		lblusername.setText(Config.getUsername());
		lblusername.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				performLogin(bgLoginType.getSelection().getActionCommand());
			}
		});
		panel.add(lblusername);
		
		// Erzeugen und Hinzufuegen des Labels
		LabelPass = new JLabel("Passwort:");
		LabelPass.setBounds(25, 85, 82, 20);
		panel.add(LabelPass);
		
		// Erzeugen und Hinzufuegen des Passwortfeldes
		lblpass = new JPasswordField();
		lblpass.setBounds(135, 85, 237, 20);
		lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein.");
		lblpass.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				performLogin(bgLoginType.getSelection().getActionCommand());
			}
		});
		panel.add(lblpass);
		
		lblSatellitenIp = new JLabel("Satelliten IP:");
		lblSatellitenIp.setBounds(25, 105, 82, 20);
		//panel.add(lblSatellitenIp);
		
		lblSatIP = new JTextField();
		lblSatIP.setBounds(135, 110, 237, 20);
		lblSatIP.setToolTipText("Bitte geben Sie die IP-Adresse des Satelliten ein.");
		//panel.add(lblSatIP);

		String organisations[] = { "https://testidp3-dev.aai.dfn.de/idp/profile/SAML2/SOAP/ECP" };
		choice = new JComboBox<String>(organisations);
		choice.setBounds(135, 35, 237, 20);
		//panel.add(choice);
		
		lblIdp = new JLabel("IDP:");
		lblIdp.setBounds(25, 35, 82, 20);
		//panel.add(lblIdp);
	
		// action listener for the radio buttons to
		// toggle the gui elements depending on the login type
		loginTypeActionListener = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				toggleLoginType(e.getActionCommand());
			}
		};
				
		panel_1 = new JPanel();
		panel_1.setLayout(null);
		panel_1.setBorder(new TitledBorder(
				UIManager.getBorder("TitledBorder.border"), "Authentifizierungsart",
				TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		panel_1.setBackground(SystemColor.menu);
		panel_1.setBounds(10, 143, 334, 181);
		contentPane.add(panel_1);
		
		// group radio button for the login type together
		bgLoginType = new ButtonGroup();
		
		rdbtnBwIDM = new JRadioButton("Authentifizierung über bwIDM");
		rdbtnBwIDM.setBounds(32, 35, 244, 23);
		rdbtnBwIDM.setActionCommand(LOGIN_TYPE_BWIDM);
		rdbtnBwIDM.addActionListener(loginTypeActionListener);
		bgLoginType.add(rdbtnBwIDM);
		panel_1.add(rdbtnBwIDM);
		
		rdbtnMasterserver = new JRadioButton("Test-Zugang mit festem Benutzer");
		rdbtnMasterserver.setSelected(true);
		rdbtnMasterserver.setActionCommand(LOGIN_TYPE_BWLEHRPOOL);
		rdbtnMasterserver.addActionListener(loginTypeActionListener);
		rdbtnMasterserver.setBounds(32, 60, 244, 23);
		bgLoginType.add(rdbtnMasterserver);
		panel_1.add(rdbtnMasterserver);
		
		rdbtnDirekteVerbindung = new JRadioButton("Direkte Verbindung zum Satelliten");
		rdbtnDirekteVerbindung.setBounds(32, 85, 244, 23);
		rdbtnDirekteVerbindung.setActionCommand(LOGIN_TYPE_SATELLITE);
		rdbtnDirekteVerbindung.addActionListener(loginTypeActionListener);
		bgLoginType.add(rdbtnDirekteVerbindung);
		panel_1.add(rdbtnDirekteVerbindung);
		
		panel.setVisible(true);
		panel_1.setVisible(true);
		contentPane.setVisible(true);
		
		GuiOrganizer.centerGUI(this);
		c = this;
		
	}// end LoginGUI()

	// Versuche den Benutzer einzuloggen
	public void performLogin(final String loginType) {
		LOGGER.info("Trying login of type: " + loginType);

		
		if (loginType == LOGIN_TYPE_BWLEHRPOOL) {
			
			
			// start the authentication process against the masterserver
			org.openslx.imagemaster.thrift.iface.SessionData result = null;
			// Connect to Master
			MasterThriftConnection thrift = new MasterThriftConnection();
			Client client = thrift.getMasterThriftConnection();

			if (client == null) {
				// Thrift connection to master could not be established
				setStatus(Color.red, "Fehler: Masterserver nicht erreichbar.", null);
				LOGGER.info("Thrift client could not be initialized, is the masterserver up and running?");
				return;
			}

			String passText = new String(lblpass.getPassword());
			UserInfo user = null;
			// Log user in
			try {
				setStatus(Color.black,
						"Authentifiziere - warte auf Antwort von Server...", null);

				result = client.authenticate(lblusername.getText(), passText);

				// Sanity checks
				if (result.authToken == null || result.sessionId == null) {
					setStatus(Color.red, "Antwort des Masterservers korrupt.", null);
					LOGGER.info("Antwort des Masterservers korrupt");
					return;
				}

				// User-Info
				LOGGER.info("Authentifizierung von '" + lblusername.getText() + "' erfolgreich.");
				user = client.getUserFromToken(result.authToken);
				authToken = result.authToken;

			} catch (org.openslx.imagemaster.thrift.iface.AuthenticationException e) {
				setStatus(
						Color.red,
						"Fehler: Zugangsdaten nicht akzeptiert.",
						"Benutzeranmeldung fehlgeschlagen: Bitte Benutzername und Passwort überprüfen.\n"
								+ e.message);
				e.printStackTrace();
				return;
			} catch (TException e) {
				e.printStackTrace();
				setStatus(Color.red,
						"Kommunikation mit Masterserver fehlgeschlagen.",
						null);
				LOGGER.error("Thrift-communication to the masterserver failed, see trace: ", e);
				return;
			}

			// set Information
			SessionData.session.setAuthToken(result.authToken);
			SessionData.session.setSessionID(result.sessionId);
			SessionData.session.setServerAdress(result.serverAddress);

			// Satellite-Connection
			setStatus(Color.black, "Hole Verbindungsdaten von Server...", null);
			// set connection to bwLehrpoolSuiteServer
			ThriftConnection bwthrift = new ThriftConnection();
			server.generated.Server.Client bwClient = bwthrift.getThriftConnection();
			models.Client.clientcon.setClient(bwClient);

			// User-Info
			//LOGGER.debug("Session-ID: " + result.sessionId);
			//LOGGER.debug("Token: " + result.authToken);
			setStatus(Color.green, "Daten erhalten.", null);
			
			String hochschule = user.eMail.substring(user.eMail.indexOf("@") + 1);

			person.verantwortlicher.setUsername(lblusername.getText().trim());
			person.verantwortlicher.setUserID(lblusername.getText().trim());
			person.verantwortlicher.setName(user.lastName);
			person.verantwortlicher.setVorname(user.firstName);
			person.verantwortlicher.setEMail(user.eMail);
			person.verantwortlicher.setHochschule(hochschule);

			// Spaeter ueber result.getRole zum Beispiel die Rolle holen
			if(lblusername.getText().trim().startsWith("admin@")){
				person.verantwortlicher.setRole("Admin");
			} else { 
			person.verantwortlicher.setRole("Dozent");
			//person.verantwortlicher.setRole("Student");
			}
			
			showMainMenu();
			 
		//}
		} // end bwLehrpool-Login
		
		if (loginType == LOGIN_TYPE_BWIDM) {
			// try the shibbo login in its own SwingWorker to avoid GUI lockups
			SwingWorker<Boolean, String> worker = new SwingWorker<Boolean, String>(){
				@Override
				protected Boolean doInBackground() throws Exception {
					publish("Info: Initialisiere Shibboleth-Client ...");
					ShibbolethECP.init(choice.getSelectedItem().toString());
					publish("Info: Überprüfe Zugangdaten über bwIDM ...");
					return ShibbolethECP.doLogin(lblusername.getText().trim(), String.valueOf(lblpass.getPassword()));
				}
				protected void done() {
					try {
						if (get()) {
							setStatus(Color.green, "Info: bwIDM-Login erfolgreich.", null);
							// TODO: call showNextStep()
							//showMainMenu();
							JOptionPane.showMessageDialog(c, "Der Shibboleth-Login war erfolgreich! Der Rest ist noch in Entwicklung :)",
									"bwIDM-Login erfolgreich", JOptionPane.PLAIN_MESSAGE);
							// all done, show main menu
							showMainMenu();
						} else {
							setStatus(Color.red, "Fehler: bwIDM-Login fehlgeschlagen!", null);
						}
					} catch (InterruptedException e) {
						LOGGER.error("SwingWorker for ShibbolethECP got interrupted, see trace: ", e);
					} catch (ExecutionException e) {
						LOGGER.error("Execution of SwingWorker for ShibbolethECP failed, see trace: ", e);
					}
				}
				@Override
				protected void process(List<String> msgs) {
					String currentMessage = msgs.get(msgs.size()-1);
					setStatus(Color.black, currentMessage, null);
				}
			};
			worker.execute();

			// now we fake the user information for testing purposes.
			// TODO parse the response from the SP and set the correct user info
			person.verantwortlicher.setUsername(lblusername.getText().trim());
			person.verantwortlicher.setUserID(lblusername.getText().trim());
			person.verantwortlicher.setName("Joe");
			person.verantwortlicher.setVorname("B");
			person.verantwortlicher.setEMail("spam@aol.com");
			person.verantwortlicher.setHochschule("fr-test.de");
			person.verantwortlicher.setRole("Dozent");
			SessionData.session.setServerAdress("132.230.8.199");

		}

		// always save to user's config file.
		if (chckbxBenutzernameSpeichern.isSelected()) {
			Config.setUsername(lblusername.getText());
			Config.setSaveUsername(true);
		} else {
			Config.setUsername("");
			Config.setSaveUsername(false);
		}
		// save it to local disk
		Config.store();


	}// end performLogin

	/**
	 * Shows the next GUI's til the main menu.
	 * It checks if the user has already seen the bill of rights
	 * and/or the vmware license windows and shows them before
	 * continuing to the main menu.
	 *
	 * This function should be called on a successful login.
	 */
	private void showMainMenu() {

		/*
		 * TODO check if user has already been regisistered. if not, do so
		 * 
		 * 
		 */
		//import server.generated.Server.Client;
		server.generated.Server.Client client_2 = models.Client.clientcon.getClient();
		try 
		{
			client_2.setTokenForSession(authToken);
		
		} catch (TException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		try {
			String pk_institution = client_2.setInstitution(person.verantwortlicher.getHochschule());
			//LOGGER.info("Institution of user is: "+pk_institution);
			client_2.setPerson(person.verantwortlicher.getUserID(), person.verantwortlicher.getName(), person.verantwortlicher.getVorname(), person.verantwortlicher.getEMail(), pk_institution);
			//LOGGER.info("user data, ID="+person.verantwortlicher.getUserID()+" , Name="+person.verantwortlicher.getName()+" , Vorname="+ person.verantwortlicher.getVorname()+" , E-Mail="+ person.verantwortlicher.getEMail()+" , Institution="+ pk_institution);
		} catch (TException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		// Pruefe ob Bills Of Rights schon akzeptiert wurden,
		// wenn nicht zeige diese an
		if (!Config.getBillOfRights()) {
			// Erstellen einer Instanz der Aktionsauswahl
			BillOfRights_GUI re = new BillOfRights_GUI();
			re.setVisible(true);
			// Schliessen des Fensters nach erfolgreichen Login
			setVisible(false);
		} else {
			// Pruefe ob die Links zu vmware angezeigt werden
			// sollen
			if (!Config.getVmwareLicense()) {
				VmWareLink_GUI vm = new VmWareLink_GUI();
				vm.setVisible(true);
				setVisible(false);
			} else {

				// oeffne das Hauptmenue
				MainMenue_GUI main = new MainMenue_GUI(c);
				main.setVisible(true);
				setVisible(false);
			}
		}
	}

	/**
	 * Set connection status message, optionally show message box.
	 * 
	 * @param color
	 *            Color to display status message in.
	 * @param shortMessage
	 *            The message to display.
	 * @param longMessage
	 *            Optional message to show in a message box. null means don't
	 *            show.
	 */
	private void setStatus(Color color, String shortMessage, String longMessage) {
		LOGGER.info(shortMessage);
		lblConnectionInfo.setForeground(color);
		lblConnectionInfo.setText(shortMessage);
		if (longMessage != null)
			JOptionPane.showMessageDialog(c, longMessage,
					"Anmeldung fehlgeschlagen", JOptionPane.ERROR_MESSAGE);
	}
	
	/**
	 * Toggle the elements needed for the different login types.
	 * 
	 * @param type
	 *            Type of the login to toggle. Valid are:
	 *            	- LOGIN_TYPE_BWIDM
	 *            	-	LOGIN_TYPE_BWLEHRPOOL
	 *            	- LOGIN_TYPE_SATELLITE
	 */
	private void toggleLoginType(String type) {
		LOGGER.info("Toggling to login method to: " + type);
		panel.setVisible(false);
		switch(type) {
			case LOGIN_TYPE_BWIDM:
				panel.remove(lblSatIP);
				panel.remove(lblSatellitenIp);
				panel.add(lblIdp);
				panel.add(choice);
				panel.add(LabelPass);
				lblpass.setText("");
				lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein.");
				panel.add(lblpass);
				lblusername.setToolTipText("Bitte geben Sie Ihr bwIDM-Benutzername ein.");
				panel.revalidate();
				panel.repaint();
				panel.setVisible(true);
				break;
			case LOGIN_TYPE_BWLEHRPOOL:
				panel.remove(choice);
				panel.remove(lblIdp);
				panel.remove(lblSatIP);
				panel.remove(lblSatellitenIp);
				panel.add(LabelPass);
				lblpass.setToolTipText("Bitte geben Sie Ihr bwLehrpool-Passwort ein.");
				panel.add(lblpass);
				lblusername.setToolTipText("Bitte geben Sie Ihr bwLehrpool-Benutzername ein.");
				panel.revalidate();
				panel.repaint();
				panel.setVisible(true);
				break;
			case LOGIN_TYPE_SATELLITE:
				panel.remove(choice);
				panel.remove(lblIdp);
				panel.remove(LabelPass);
				panel.remove(lblpass);
				lblSatIP.setBounds(135, 85, 237, 20);
				lblSatIP.setText("");
				panel.add(lblSatIP);
				lblSatellitenIp.setBounds(25, 85, 82, 20);
				panel.add(lblSatellitenIp);
				panel.revalidate();
				panel.repaint();
				panel.setVisible(true);
				break;
			default:
				LOGGER.error("Unknown action '" + type + "'. Ignoring.");
				panel.setVisible(true);
				return;
		}
		
	}
}// end class