diff options
| author | Tobias Spitzer | 2014-08-20 11:20:24 +0200 |
|---|---|---|
| committer | Tobias Spitzer | 2014-08-20 11:20:24 +0200 |
| commit | 515e5b984f573d8ff2f5d3253a1ffc2b8b450ce3 (patch) | |
| tree | 67d1eef820ed1e3a83a590620a597081aedd6a5b /Dozentenmodul/src/gui | |
| parent | update build date (diff) | |
| download | tutor-module-515e5b984f573d8ff2f5d3253a1ffc2b8b450ce3.tar.gz tutor-module-515e5b984f573d8ff2f5d3253a1ffc2b8b450ce3.tar.xz tutor-module-515e5b984f573d8ff2f5d3253a1ffc2b8b450ce3.zip | |
Neueste Version
Diffstat (limited to 'Dozentenmodul/src/gui')
| -rw-r--r-- | Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java | 448 | ||||
| -rw-r--r-- | Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java | 374 | ||||
| -rw-r--r-- | Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java | 310 | ||||
| -rw-r--r-- | Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java | 239 |
4 files changed, 1093 insertions, 278 deletions
diff --git a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java b/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java index 9b3d0ef3..cadb4ca3 100644 --- a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java +++ b/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java @@ -17,8 +17,11 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.net.URI; import java.net.URISyntaxException; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; @@ -33,15 +36,19 @@ import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; import javax.swing.JTable; +import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.RowFilter; +import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; @@ -63,16 +70,22 @@ public class DeleteLecture_GUI extends JFrame { String[] result; JRadioButton rdbtnInternetJa; JRadioButton rdbtnInternetNein; + JLabel labelAktiv; + JLabel labelstartdate; + JLabel labelenddate; + JLabel labelimageversion; + JTextArea labelName; + JTextArea labelimage; + JTextArea labeldesc; + JLabel labelVerantwortlicher; JTable tableAllLectures; JTable tablemyLectures; - JTable tableCoopImages; - JTable tablePublicImages; private JTextField textFieldName; JTabbedPane tabbedPane; boolean activeSearch=false; String[] titles = { "Veranstaltungsname", "Beschreibung", "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", - "Verantwortlicher", "Image", "ID" }; + "Verantwortlicher", "Image", "Schlagwort", "ID" }; ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); @@ -97,9 +110,51 @@ public class DeleteLecture_GUI extends JFrame { } @Override public void windowOpened(WindowEvent arg0) { - initTableModel(modelAll); - initTableModel(modelMyLectures); textFieldName.requestFocusInWindow(); + try { + initTableModel(modelMyLectures); + initTableModel(modelAll); + + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + tablemyLectures.getColumnModel().getColumn(1).setWidth(0); + tablemyLectures.getColumnModel().getColumn(1).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(1).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setMaxWidth(0); } }); // Verhindert das Vergroessern Des Fensters @@ -116,16 +171,15 @@ public class DeleteLecture_GUI extends JFrame { // Setzt den Fenstertitel setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung l\u00F6schen"); // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); + setBounds(0, 0, 842, 722); GuiOrganizer.centerGUI(this); - final DefaultTableModel model = new DefaultTableModel(titles, 0); getContentPane().setLayout(null); { JPanel panel = new JPanel(); panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); + panel.setBounds(10, 11, 816, 57); getContentPane().add(panel); panel.setLayout(null); { @@ -144,7 +198,7 @@ public class DeleteLecture_GUI extends JFrame { txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); panel.add(txtpnBitteWhlenSie); } - contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBounds(10, 85, 570, 518); contentPanel.setBackground(SystemColor.menu); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel); @@ -241,12 +295,35 @@ public class DeleteLecture_GUI extends JFrame { } }); - tabbedPane.setBounds(10, 124, 557, 373); + tabbedPane.setBounds(10, 123, 557, 397); contentPanel.add(tabbedPane); JScrollPane scrollPaneAllImages = new JScrollPane(); tableAllLectures = new JTable(); + tableAllLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelAll + .getValueAt( + tableAllLectures + .convertRowIndexToModel(tableAllLectures + .getSelectedRow()), 8) + .toString(); + System.out.println(imageid); + + try { + writeLectureData(imageid); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); tableAllLectures.setModel(modelAll); tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -256,6 +333,29 @@ public class DeleteLecture_GUI extends JFrame { tableAllLectures.setRowSorter(rowSorterAll); JScrollPane scrollPaneMyImage = new JScrollPane(); tablemyLectures = new JTable(); + tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), 8) + .toString(); + System.out.println(imageid); + + try { + writeLectureData(imageid); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); tablemyLectures.setModel(modelMyLectures); tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); @@ -272,121 +372,9 @@ public class DeleteLecture_GUI extends JFrame { scrollPaneAllImages.setViewportView(tableAllLectures); tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Veranstaltungen", null, - scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Veranstaltungen", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - button = new JButton("L\u00F6schen"); - button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - String lectureID=""; - int eingabe; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - //check if a row is selected - if (tablemyLectures.getSelectedRowCount() !=0){ - //a row is selected - //ask for confirmation - eingabe = JOptionPane.showConfirmDialog(null, - "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - //user has confirmed deletion, now get the ID of the selected lecture - lectureID = modelMyLectures.getValueAt(tablemyLectures.convertColumnIndexToModel(tablemyLectures.getSelectedRow()), 7).toString(); - System.out.println("L\u00f6sche Lecture "+lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - System.out.println("L\u00f6schen erfolgreich"); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - JOptionPane - .showMessageDialog( - null, - "L\u00f6schen aus Datenbank fehlgeschlagen.", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - }//end check if a row is selected - else if (tableAllLectures.getSelectedRowCount() !=0 && tableAllLectures.getValueAt(tableAllLectures.getSelectedRow(), 5).toString().equals(username)){ - //a row is selected - //ask for confirmation - eingabe = JOptionPane.showConfirmDialog(null, - "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - //user has confirmed deletion, now get the ID of the selected lecture - lectureID = tableAllLectures.getValueAt(tableAllLectures.convertColumnIndexToModel(tableAllLectures.getSelectedRow()), 7).toString(); - System.out.println("L\u00f6sche Lecture "+lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - System.out.println("L\u00f6schen erfolgreich"); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - JOptionPane - .showMessageDialog( - null, - "L\u00f6schen aus Datenbank fehlgeschlagen.", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - }//end check if a row is selected - - } - }); - button.setBounds(459, 508, 118, 23); - contentPanel.add(button); { JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBounds(0, 640, 826, 33); buttonPane.setBackground(SystemColor.menu); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane); @@ -408,12 +396,193 @@ public class DeleteLecture_GUI extends JFrame { } JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); + separator.setBounds(0, 79, 836, 1); getContentPane().add(separator); JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); + separator_1.setBounds(0, 628, 836, 1); getContentPane().add(separator_1); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBorder(new TitledBorder(null, "Detailinformationen", + + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBackground(SystemColor.menu); + panel.setBounds(591, 85, 235, 518); + getContentPane().add(panel); + + JLabel lblNewLabel_3 = new JLabel("Name:"); + lblNewLabel_3.setBounds(10, 27, 104, 14); + panel.add(lblNewLabel_3); + + JLabel lblAktiv = new JLabel("Aktiv:"); + lblAktiv.setBounds(10, 88, 104, 14); + panel.add(lblAktiv); + + labelAktiv = new JLabel(""); + labelAktiv.setBounds(124, 88, 104, 14); + panel.add(labelAktiv); + + labelstartdate = new JLabel(""); + labelstartdate.setBounds(124, 113, 104, 14); + panel.add(labelstartdate); + + JLabel lblStartdatum = new JLabel("Startdatum:"); + lblStartdatum.setBounds(10, 113, 104, 14); + panel.add(lblStartdatum); + + labelenddate = new JLabel(""); + labelenddate.setBounds(124, 138, 104, 14); + panel.add(labelenddate); + + JLabel lblEnddatum = new JLabel("Enddatum:"); + lblEnddatum.setBounds(10, 138, 104, 14); + panel.add(lblEnddatum); + + JLabel lblBeschreibung = new JLabel("Beschreibung:"); + lblBeschreibung.setBounds(10, 163, 104, 14); + panel.add(lblBeschreibung); + + JLabel lblImage = new JLabel("Image:"); + lblImage.setBounds(10, 284, 104, 14); + panel.add(lblImage); + + labelVerantwortlicher = new JLabel(""); + labelVerantwortlicher.setBounds(124, 401, 104, 14); + panel.add(labelVerantwortlicher); + + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); + lblVerantwortlicher.setBounds(10, 401, 104, 14); + panel.add(lblVerantwortlicher); + + JLabel lblImageversion = new JLabel("Imageversion:"); + lblImageversion.setBounds(10, 376, 104, 14); + panel.add(lblImageversion); + + labelimageversion = new JLabel(""); + labelimageversion.setBounds(124, 376, 104, 14); + panel.add(labelimageversion); + + + labeldesc = new JTextArea(); + labeldesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labeldesc.setEditable(false); + labeldesc.setLineWrap(true); + labeldesc.setBackground(SystemColor.menu); + labeldesc.setBounds(124, 127, 104, 110); + JScrollPane scrollPane = new JScrollPane(labeldesc); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setBounds(124, 163, 104, 110); + panel.add(scrollPane); + //panel.add(labeldesc); + + labelimage = new JTextArea(); + labelimage.setLineWrap(true); + labelimage.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labelimage.setEditable(false); + labelimage.setBackground(SystemColor.menu); + labelimage.setBounds(124, 248, 101, 81); + JScrollPane scrollPaneImage = new JScrollPane(labelimage); + scrollPaneImage.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPaneImage.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPaneImage.setBounds(124, 284, 101, 81); + panel.add(scrollPaneImage); + + labelName = new JTextArea(); + labelName.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labelName.setBackground(SystemColor.menu); + labelName.setBounds(124, 22, 101, 55); + JScrollPane scrollPaneName = new JScrollPane(labelName); + scrollPaneName.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPaneName.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPaneName.setBounds(124, 22, 101, 55); + panel.add(scrollPaneName); + + button = new JButton("L\u00F6schen"); + button.setBounds(469, 606, 118, 23); + getContentPane().add(button); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String lectureID=""; + int eingabe; + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + //check if a row is selected + if (tablemyLectures.getSelectedRowCount() !=0){ + //a row is selected + //ask for confirmation + eingabe = JOptionPane.showConfirmDialog(null, + "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", + JOptionPane.YES_NO_OPTION); + + if (eingabe == JOptionPane.YES_OPTION) { + //user has confirmed deletion, now get the ID of the selected lecture + lectureID = modelMyLectures.getValueAt(tablemyLectures.convertColumnIndexToModel(tablemyLectures.getSelectedRow()), 8).toString(); + System.out.println("L\u00f6sche Lecture "+lectureID); + try { + if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ + System.out.println("L\u00f6schen erfolgreich"); + //delete successful + + DeleteLecture_GUI dl = new DeleteLecture_GUI(); + dl.setVisible(true); + dispose(); + } else { + //delete not successful + JOptionPane + .showMessageDialog( + null, + "L\u00f6schen aus Datenbank fehlgeschlagen.", + "Fehler", + JOptionPane.INFORMATION_MESSAGE); + } + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + }//end delete + }//end ask for confirmation + + }//end check if a row is selected + else if (tableAllLectures.getSelectedRowCount() !=0 && tableAllLectures.getValueAt(tableAllLectures.getSelectedRow(), 5).toString().equals(username)){ + //a row is selected + //ask for confirmation + eingabe = JOptionPane.showConfirmDialog(null, + "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", + JOptionPane.YES_NO_OPTION); + + if (eingabe == JOptionPane.YES_OPTION) { + //user has confirmed deletion, now get the ID of the selected lecture + lectureID = tableAllLectures.getValueAt(tableAllLectures.convertColumnIndexToModel(tableAllLectures.getSelectedRow()), 8).toString(); + System.out.println("L\u00f6sche Lecture "+lectureID); + try { + if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ + System.out.println("L\u00f6schen erfolgreich"); + //delete successful + + DeleteLecture_GUI dl = new DeleteLecture_GUI(); + dl.setVisible(true); + dispose(); + } else { + //delete not successful + JOptionPane + .showMessageDialog( + null, + "L\u00f6schen aus Datenbank fehlgeschlagen.", + "Fehler", + JOptionPane.INFORMATION_MESSAGE); + } + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + }//end delete + }//end ask for confirmation + + }//end check if a row is selected + + } + }); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); @@ -477,13 +646,14 @@ public class DeleteLecture_GUI extends JFrame { } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { + public DefaultTableModel initTableModel(DefaultTableModel model) throws ParseException { List<server.Lecture> lectures; try { // Hole eine Liste der Images lectures = client.getLectureList(); Iterator<server.Lecture> i = lectures.iterator(); - + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); int x = 0; while (i.hasNext()) { @@ -491,11 +661,11 @@ public class DeleteLecture_GUI extends JFrame { Object[] obj = { lectures.get(x).lecturename, lectures.get(x).desc, - lectures.get(x).starttime + " " - + lectures.get(x).endtime, - lectures.get(x).isActive, lectures.get(x).lastused, + out.format(in.parse(lectures.get(x).starttime)) + " " + + out.format(in.parse(lectures.get(x).endtime)), + lectures.get(x).isActive, out.format(in.parse(lectures.get(x).lastused)), lectures.get(x).username, - lectures.get(x).imagename,lectures.get(x).id }; + lectures.get(x).imagename," " ,lectures.get(x).id }; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -510,4 +680,20 @@ public class DeleteLecture_GUI extends JFrame { } return model; } + public void writeLectureData(String id) throws TException, ParseException{ + + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + Map<String,String> res=client.getLectureData(id); + labelName.setText(res.get("name")); + labelAktiv.setText(res.get("isActive")); + labeldesc.setText(res.get("desc")); + labelVerantwortlicher.setText(res.get("owner")); + labelstartdate.setText(out.format(in.parse(res.get("startTime")))); + labelenddate.setText(out.format(in.parse(res.get("endTime")))); + labelimage.setText(res.get("imagepath").substring(res.get("imagepath").indexOf("/")+1)); + labelimageversion.setText(res.get("imageversion")); + + +} } diff --git a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java index a98ea836..149c93f5 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java @@ -18,10 +18,12 @@ import java.awt.event.WindowEvent; import java.net.URI; import java.net.URISyntaxException; import java.text.DateFormat; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.swing.JButton; import javax.swing.JComboBox; @@ -60,6 +62,8 @@ import util.GuiOrganizer; import util.OpenLinks; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; @SuppressWarnings("serial") public class EditLectureLink_GUI extends JFrame { @@ -69,10 +73,19 @@ public class EditLectureLink_GUI extends JFrame { JRadioButton rdbtnInternetJa; JRadioButton rdbtnInternetNein; JComboBox<String> comboBox; + JLabel labelName; + JLabel labelUpdate; + JLabel labelVerantwortlicher; + JLabel labelWeitereVerantwortliche; + JLabel labelVorlage; + JLabel labelLizenzSoftware; + JLabel labelInternet; + JLabel labelRam; + JLabel labelCPU; + private JLabel labelOS; JTable tableAllImages = new JTable(); JTable tablemyImages = new JTable(); JTable tableCoopImages = new JTable(); - JTable tablePublicImages = new JTable(); JTable tablePublicVorlagen = new JTable(); private JTextField textFieldName; JTabbedPane tabbedPane; @@ -114,9 +127,54 @@ public class EditLectureLink_GUI extends JFrame { } @Override public void windowOpened(WindowEvent arg0) { - initTableModel(modelAll); - initTableModel(modelMyImages); - initTableModel(modelPublicVorlagen); + try { + initTableModel(modelAll); + initTableModel(modelMyImages); + initTableModel(modelPublicVorlagen); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + tablemyImages.getColumnModel().getColumn(1).setWidth(0); + tablemyImages.getColumnModel().getColumn(1).setMinWidth(0); + tablemyImages.getColumnModel().getColumn(1).setMaxWidth(0); + tablemyImages.getColumnModel().getColumn(8).setWidth(0); + tablemyImages.getColumnModel().getColumn(8).setMinWidth(0); + tablemyImages.getColumnModel().getColumn(8).setMaxWidth(0); + tablemyImages.getColumnModel().getColumn(6).setWidth(0); + tablemyImages.getColumnModel().getColumn(6).setMinWidth(0); + tablemyImages.getColumnModel().getColumn(6).setMaxWidth(0); + tablemyImages.getColumnModel().getColumn(7).setWidth(0); + tablemyImages.getColumnModel().getColumn(7).setMinWidth(0); + tablemyImages.getColumnModel().getColumn(7).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(1).setWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(1).setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(1).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(8).setWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(8).setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(8).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(6).setWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(6).setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(6).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(7).setWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(7).setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(7).setMaxWidth(0); + tableAllImages.getColumnModel().getColumn(1).setWidth(0); + tableAllImages.getColumnModel().getColumn(1).setMinWidth(0); + tableAllImages.getColumnModel().getColumn(1).setMaxWidth(0); + tableAllImages.getColumnModel().getColumn(8).setWidth(0); + tableAllImages.getColumnModel().getColumn(8).setMinWidth(0); + tableAllImages.getColumnModel().getColumn(8).setMaxWidth(0); + tableAllImages.getColumnModel().getColumn(6).setWidth(0); + tableAllImages.getColumnModel().getColumn(6).setMinWidth(0); + tableAllImages.getColumnModel().getColumn(6).setMaxWidth(0); + tableAllImages.getColumnModel().getColumn(7).setWidth(0); + tableAllImages.getColumnModel().getColumn(7).setMinWidth(0); + tableAllImages.getColumnModel().getColumn(7).setMaxWidth(0); textFieldName.requestFocusInWindow(); } }); @@ -131,7 +189,7 @@ public class EditLectureLink_GUI extends JFrame { } setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); - setBounds(0, 0, 603, 722); + setBounds(0, 0, 918, 722); GuiOrganizer.centerGUI(this); @@ -304,10 +362,33 @@ public class EditLectureLink_GUI extends JFrame { } }); - tabbedPane.setBounds(10, 151, 557, 346); + tabbedPane.setBounds(10, 158, 557, 339); contentPanel.add(tabbedPane); JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + + String imageid = modelAll + .getValueAt( + tableAllImages + .convertRowIndexToModel(tableAllImages + .getSelectedRow()), 6) + .toString(); + System.out.println(imageid); + String version = modelAll + .getValueAt( + tableAllImages + .convertRowIndexToModel(tableAllImages + .getSelectedRow()), 7) + .toString(); + System.out.println(version); + writeImageData(imageid, version); + + } + }); tableAllImages.setModel(modelAll); tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -316,7 +397,27 @@ public class EditLectureLink_GUI extends JFrame { tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); tableAllImages.setRowSorter(rowSorterAll); JScrollPane scrollPaneMyImage = new JScrollPane(); - + tablemyImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 6) + .toString(); + System.out.println(imageid); + String version = modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7) + .toString(); + System.out.println(version); + writeImageData(imageid, version); + } + }); tablemyImages.setModel(modelMyImages); tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -328,7 +429,28 @@ public class EditLectureLink_GUI extends JFrame { tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - + scrollPanePublicVorlagen.setEnabled(false); + tablePublicVorlagen.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelPublicVorlagen + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), 6) + .toString(); + System.out.println(imageid); + String version = modelPublicVorlagen + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), 7) + .toString(); + System.out.println(version); + writeImageData(imageid, version); + } + }); tablePublicVorlagen.setModel(modelPublicVorlagen); tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -337,7 +459,7 @@ public class EditLectureLink_GUI extends JFrame { tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); tablePublicVorlagen.setRowSorter(rowSorterPublicVorlagen); scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + tabbedPane.addTab("Vorlagen", null, scrollPanePublicVorlagen, null); tabbedPane.setEnabledAt(1, false); @@ -354,24 +476,10 @@ public class EditLectureLink_GUI extends JFrame { tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + tabbedPane.addTab("bwLehrpool", null, scrollPaneCoopImages, null); tabbedPane.setEnabledAt(3, false); - JScrollPane scrollPanePublicImages = new JScrollPane(); - - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(4, false); - JButton btnLinkLschen = new JButton("Link l\u00F6schen"); btnLinkLschen.setEnabled(false); btnLinkLschen.setBounds(478, 508, 89, 23); @@ -380,7 +488,7 @@ public class EditLectureLink_GUI extends JFrame { { JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBounds(0, 640, 902, 33); buttonPane.setBackground(SystemColor.menu); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane); @@ -415,8 +523,9 @@ public class EditLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - client.writeLecturedata( + client.updateLecturedata( Lecture.lecture.getName(), + Lecture.lecture.getNewName(), Lecture.lecture.getShortDesc(), Lecture.lecture.getDesc(), formatter.format( @@ -426,18 +535,28 @@ public class EditLectureLink_GUI extends JFrame { Lecture.lecture.getEnddate()) .toString(), Lecture.lecture.isActive(), - imagename, - person.verantwortlicher.getUsername(), + modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 6).toString(), + modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7) + .toString(), person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), person.verantwortlicher.getHochschule(), person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet()); + person.verantwortlicher.getFakultaet(), + Lecture.lecture.getid()); JOptionPane .showMessageDialog( null, - "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", + "Ihre Veranstaltung wurde erfolgreich geändert. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", "Veranstaltung angelegt", JOptionPane.INFORMATION_MESSAGE); // zurueck zum Menue @@ -468,8 +587,9 @@ public class EditLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - client.writeLecturedata( + client.updateLecturedata( Lecture.lecture.getName(), + Lecture.lecture.getNewName(), Lecture.lecture.getShortDesc(), Lecture.lecture.getDesc(), formatter.format( @@ -479,18 +599,27 @@ public class EditLectureLink_GUI extends JFrame { Lecture.lecture.getEnddate()) .toString(), Lecture.lecture.isActive(), - imagename, - person.verantwortlicher.getUsername(), + modelPublicVorlagen + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), 6).toString(), + modelPublicVorlagen + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), 7).toString(), person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), person.verantwortlicher.getHochschule(), person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet()); + person.verantwortlicher.getFakultaet(), + Lecture.lecture.getid()); JOptionPane .showMessageDialog( null, - "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", + "Ihre Veranstaltung wurde erfolgreich geändert. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", "Veranstaltung angelegt", JOptionPane.INFORMATION_MESSAGE); // zurueck zum Menue @@ -521,8 +650,9 @@ public class EditLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - client.writeLecturedata( + client.updateLecturedata( Lecture.lecture.getName(), + Lecture.lecture.getNewName(), Lecture.lecture.getShortDesc(), Lecture.lecture.getDesc(), formatter.format( @@ -532,18 +662,30 @@ public class EditLectureLink_GUI extends JFrame { Lecture.lecture.getEnddate()) .toString(), Lecture.lecture.isActive(), - imagename, - person.verantwortlicher.getUsername(), + modelAll + .getValueAt( + tableAllImages + .convertRowIndexToModel(tableAllImages + .getSelectedRow()), 6) + .toString(), + modelAll + .getValueAt( + tableAllImages + .convertRowIndexToModel(tableAllImages + .getSelectedRow()), 7) + .toString(), + person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), person.verantwortlicher.getHochschule(), person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet()); + person.verantwortlicher.getFakultaet(), + Lecture.lecture.getid()); JOptionPane .showMessageDialog( null, - "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", + "Ihre Veranstaltung wurde erfolgreich geändert. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", "Veranstaltung angelegt", JOptionPane.INFORMATION_MESSAGE); // zurueck zum Menue @@ -582,12 +724,109 @@ public class EditLectureLink_GUI extends JFrame { } JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); + separator.setBounds(0, 79, 912, 1); getContentPane().add(separator); JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); + separator_1.setBounds(0, 627, 912, 2); getContentPane().add(separator_1); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBorder(new TitledBorder(null, "Detailinformationen", + + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBackground(SystemColor.menu); + panel.setBounds(586, 85, 316, 531); + getContentPane().add(panel); + + JLabel lblName = new JLabel("Name:"); + lblName.setBounds(10, 30, 130, 14); + panel.add(lblName); + + labelName = new JLabel(""); + labelName.setBounds(150, 30, 130, 14); + panel.add(labelName); + + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); + lblVerantwortlicher.setBounds(10, 105, 130, 14); + panel.add(lblVerantwortlicher); + + labelOS = new JLabel(""); + labelOS.setBounds(150, 55, 130, 14); + panel.add(labelOS); + + JLabel lblWeitereVerantwortliche = new JLabel("Betriebssystem:"); + lblWeitereVerantwortliche.setBounds(10, 55, 130, 14); + panel.add(lblWeitereVerantwortliche); + + labelVerantwortlicher = new JLabel(""); + labelVerantwortlicher.setBounds(150, 105, 130, 14); + panel.add(labelVerantwortlicher); + + JLabel label = new JLabel("Weitere Verantwortliche:"); + label.setBounds(10, 130, 130, 14); + panel.add(label); + + labelWeitereVerantwortliche = new JLabel(""); + labelWeitereVerantwortliche.setBounds(150, 130, 130, 14); + panel.add(labelWeitereVerantwortliche); + + JLabel label_5 = new JLabel(""); + label_5.setBounds(150, 130, 130, 14); + panel.add(label_5); + + labelUpdate = new JLabel(""); + labelUpdate.setBounds(150, 80, 130, 14); + panel.add(labelUpdate); + + JLabel lblLetztesUpdate = new JLabel("Letztes Update:"); + lblLetztesUpdate.setBounds(10, 80, 130, 14); + panel.add(lblLetztesUpdate); + + JLabel lblImageIstVorlage = new JLabel("Image ist Vorlage:"); + lblImageIstVorlage.setBounds(10, 259, 130, 14); + panel.add(lblImageIstVorlage); + + labelVorlage = new JLabel(""); + labelVorlage.setBounds(150, 259, 130, 14); + panel.add(labelVorlage); + + labelLizenzSoftware = new JLabel(""); + labelLizenzSoftware.setBounds(150, 284, 130, 14); + panel.add(labelLizenzSoftware); + + JLabel lblLizenzpflichtigeSoftware = new JLabel("Lizenzpflichtige Software:"); + lblLizenzpflichtigeSoftware.setBounds(10, 284, 130, 14); + panel.add(lblLizenzpflichtigeSoftware); + + JLabel lblInternet = new JLabel("Internet:"); + lblInternet.setBounds(10, 309, 130, 14); + panel.add(lblInternet); + + labelInternet = new JLabel(""); + labelInternet.setBounds(150, 309, 130, 14); + panel.add(labelInternet); + + JLabel lblEmpfehlungRam = new JLabel("Empfehlung RAM:"); + lblEmpfehlungRam.setBounds(10, 334, 130, 14); + panel.add(lblEmpfehlungRam); + + labelRam = new JLabel(""); + labelRam.setBounds(150, 334, 130, 14); + panel.add(labelRam); + + JLabel lblEmpfehlungCpu = new JLabel("Empfehlung CPU:"); + lblEmpfehlungCpu.setBounds(10, 359, 130, 14); + panel.add(lblEmpfehlungCpu); + + labelCPU = new JLabel(""); + labelCPU.setBounds(150, 359, 130, 14); + panel.add(labelCPU); + + JLabel lblTechnischeDaten = new JLabel("Technische Daten:"); + lblTechnischeDaten.setBounds(10, 223, 296, 14); + panel.add(lblTechnischeDaten); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); @@ -657,14 +896,15 @@ public class EditLectureLink_GUI extends JFrame { } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { + public DefaultTableModel initTableModel(DefaultTableModel model) throws TException, ParseException { List<server.Image> images; - try { + // Hole eine Liste der Images images = client.getImageList(); Iterator<server.Image> i = images.iterator(); - + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); int x = 0; while (i.hasNext()) { @@ -674,9 +914,9 @@ public class EditLectureLink_GUI extends JFrame { images.get(x).getOsName(), images.get(x).getLectureName(), images.get(x).getUserData(), - images.get(x).getUpdateTime(), images.get(x).id, + out.format(in.parse(images.get(x).updateTime)), images.get(x).id, images.get(x).getVersion(), - images.get(x).getIsTemplate()}; + images.get(x).getIsTemplate() }; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -685,13 +925,43 @@ public class EditLectureLink_GUI extends JFrame { } return model; - } catch (TException e1) { + + + } + public void writeImageData(String id, String version){ + try { + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + Map<String,String> res=client.getImageData(id,version); + labelName.setText(res.get("name")); + labelOS.setText(res.get("os")); + labelUpdate.setText(out.format(in.parse(res.get("lastupdate")))); + labelVerantwortlicher.setText(res.get("owner")); + labelWeitereVerantwortliche.setText("Noch nicht Verf�gbar"); + if(res.get("template").equals("true")){ + labelVorlage.setText("Ja"); + }else{ + labelVorlage.setText("Nein"); + } + if(res.get("license").equals("1")){ + labelLizenzSoftware.setText("Ja"); + } + else + { + labelLizenzSoftware.setText("Nein"); + } + if(res.get("internet").equals("1")){ + labelInternet.setText("Ja"); + } + else + { + labelInternet.setText("Nein"); + } + labelRam.setText(res.get("ram")); + labelCPU.setText(res.get("cpu")); + } catch (TException | ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); } - return model; } } diff --git a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java index 9dc4b36c..0a81f96d 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java @@ -22,6 +22,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; @@ -36,15 +37,19 @@ import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; import javax.swing.JTable; +import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.RowFilter; +import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; @@ -67,16 +72,22 @@ public class EditLectureSearch_GUI extends JFrame { String[] result; JRadioButton rdbtnInternetJa; JRadioButton rdbtnInternetNein; + JLabel labelAktiv; + JLabel labelstartdate; + JLabel labelenddate; + JLabel labelimageversion; + JTextArea labelName; + JTextArea labelimage; + JTextArea labeldesc; + JLabel labelVerantwortlicher; JTable tableAllLectures; JTable tablemyLectures; - JTable tableCoopImages; - JTable tablePublicImages; private JTextField textFieldName; JTabbedPane tabbedPane; boolean activeSearch=false; String[] titles = { "Veranstaltungsname", "Beschreibung", "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", - "Verantwortlicher", "Image", "ID" }; + "Verantwortlicher", "Image", "Schlagwort", "ID" }; ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ @@ -109,9 +120,51 @@ public class EditLectureSearch_GUI extends JFrame { } @Override public void windowOpened(WindowEvent arg0) { - initTableModel(modelAll); - initTableModel(modelMyLectures); textFieldName.requestFocusInWindow(); + try { + initTableModel(modelMyLectures); + initTableModel(modelAll); + + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + tablemyLectures.getColumnModel().getColumn(1).setWidth(0); + tablemyLectures.getColumnModel().getColumn(1).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(1).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(2).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(3).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(6).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(7).setMaxWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0); + tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(1).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(2).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(3).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(6).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(7).setMaxWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setMinWidth(0); + tableAllLectures.getColumnModel().getColumn(8).setMaxWidth(0); } }); // Verhindert das Vergroessern Des Fensters @@ -128,16 +181,14 @@ public class EditLectureSearch_GUI extends JFrame { // Setzt den Fenstertitel setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); + setBounds(0, 0, 842, 722); GuiOrganizer.centerGUI(this); - final DefaultTableModel model = new DefaultTableModel(titles, 0); - getContentPane().setLayout(null); { JPanel panel = new JPanel(); panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); + panel.setBounds(10, 11, 816, 57); getContentPane().add(panel); panel.setLayout(null); { @@ -252,12 +303,35 @@ public class EditLectureSearch_GUI extends JFrame { } }); - tabbedPane.setBounds(10, 126, 557, 394); + tabbedPane.setBounds(10, 123, 557, 397); contentPanel.add(tabbedPane); JScrollPane scrollPaneAllImages = new JScrollPane(); tableAllLectures = new JTable(); + tableAllLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelAll + .getValueAt( + tableAllLectures + .convertRowIndexToModel(tableAllLectures + .getSelectedRow()), 8) + .toString(); + System.out.println(imageid); + + try { + writeLectureData(imageid); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); tableAllLectures.setModel(modelAll); tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -268,6 +342,29 @@ public class EditLectureSearch_GUI extends JFrame { JScrollPane scrollPaneMyImage = new JScrollPane(); tablemyLectures = new JTable(); + tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + String imageid = modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), 8) + .toString(); + System.out.println(imageid); + + try { + writeLectureData(imageid); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); tablemyLectures.setModel(modelMyLectures); tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); @@ -284,37 +381,9 @@ public class EditLectureSearch_GUI extends JFrame { scrollPaneAllImages.setViewportView(tableAllLectures); tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Veranstaltungen", null, - scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Veranstaltungen", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); { JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBounds(0, 640, 826, 33); buttonPane.setBackground(SystemColor.menu); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane); @@ -351,7 +420,7 @@ public class EditLectureSearch_GUI extends JFrame { tablemyLectures .convertRowIndexToModel(tablemyLectures .getSelectedRow()), - 7).toString()); + 8).toString()); Lecture.lecture.setName(modelMyLectures .getValueAt( tablemyLectures @@ -385,6 +454,16 @@ public class EditLectureSearch_GUI extends JFrame { zweitesLeerzeichen); String enddate = date .substring(zweitesLeerzeichen); + SimpleDateFormat out=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat in=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + try { + enddate=out.format(in.parse(enddate)); + startdate=out.format(in.parse(startdate)); + } catch (ParseException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + DateFormat df = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); @@ -415,7 +494,7 @@ public class EditLectureSearch_GUI extends JFrame { EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); el.setVisible(true); dispose(); - } if (tableAllLectures.getSelectedRow() != -1 && tableAllLectures.getValueAt(tableAllLectures.getSelectedRow(), 5).toString().equals(username)) { + } else if (tableAllLectures.getSelectedRow() != -1 && tableAllLectures.getValueAt(tableAllLectures.getSelectedRow(), 5).toString().equals(username)) { // a row is selected, do operations @@ -426,7 +505,7 @@ public class EditLectureSearch_GUI extends JFrame { tableAllLectures .convertRowIndexToModel(tableAllLectures .getSelectedRow()), - 7).toString()); + 8).toString()); Lecture.lecture.setName(modelAll .getValueAt( tableAllLectures @@ -460,6 +539,15 @@ public class EditLectureSearch_GUI extends JFrame { zweitesLeerzeichen); String enddate = date .substring(zweitesLeerzeichen); + SimpleDateFormat out=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat in=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + try { + enddate=out.format(in.parse(enddate)); + startdate=out.format(in.parse(startdate)); + } catch (ParseException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } DateFormat df = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); @@ -484,9 +572,6 @@ public class EditLectureSearch_GUI extends JFrame { Lecture.lecture.setActive(false); } - - // EditImageAllgemein_GUI ea=new - // EditImageAllgemein_GUI(); EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); el.setVisible(true); dispose(); @@ -497,8 +582,8 @@ public class EditLectureSearch_GUI extends JFrame { "Bitte w\u00f4hlen Sie ein eigenes Image aus", "Message", JOptionPane.INFORMATION_MESSAGE); - } - } + } //End Else + } //Action }); @@ -508,13 +593,111 @@ public class EditLectureSearch_GUI extends JFrame { } JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); + separator.setBounds(0, 79, 836, 1); getContentPane().add(separator); JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); + separator_1.setBounds(0, 628, 836, 1); getContentPane().add(separator_1); + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBorder(new TitledBorder(null, "Detailinformationen", + + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBackground(SystemColor.menu); + panel.setBounds(591, 85, 235, 518); + getContentPane().add(panel); + + JLabel lblNewLabel_3 = new JLabel("Name:"); + lblNewLabel_3.setBounds(10, 27, 104, 14); + panel.add(lblNewLabel_3); + + JLabel lblAktiv = new JLabel("Aktiv:"); + lblAktiv.setBounds(10, 88, 104, 14); + panel.add(lblAktiv); + + labelAktiv = new JLabel(""); + labelAktiv.setBounds(124, 88, 104, 14); + panel.add(labelAktiv); + + labelstartdate = new JLabel(""); + labelstartdate.setBounds(124, 113, 104, 14); + panel.add(labelstartdate); + + JLabel lblStartdatum = new JLabel("Startdatum:"); + lblStartdatum.setBounds(10, 113, 104, 14); + panel.add(lblStartdatum); + + labelenddate = new JLabel(""); + labelenddate.setBounds(124, 138, 104, 14); + panel.add(labelenddate); + + JLabel lblEnddatum = new JLabel("Enddatum:"); + lblEnddatum.setBounds(10, 138, 104, 14); + panel.add(lblEnddatum); + + JLabel lblBeschreibung = new JLabel("Beschreibung:"); + lblBeschreibung.setBounds(10, 163, 104, 14); + panel.add(lblBeschreibung); + + JLabel lblImage = new JLabel("Image:"); + lblImage.setBounds(10, 284, 104, 14); + panel.add(lblImage); + + labelVerantwortlicher = new JLabel(""); + labelVerantwortlicher.setBounds(124, 401, 104, 14); + panel.add(labelVerantwortlicher); + + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); + lblVerantwortlicher.setBounds(10, 401, 104, 14); + panel.add(lblVerantwortlicher); + + JLabel lblImageversion = new JLabel("Imageversion:"); + lblImageversion.setBounds(10, 376, 104, 14); + panel.add(lblImageversion); + + labelimageversion = new JLabel(""); + labelimageversion.setBounds(124, 376, 104, 14); + panel.add(labelimageversion); + + + labeldesc = new JTextArea(); + labeldesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labeldesc.setEditable(false); + labeldesc.setLineWrap(true); + labeldesc.setBackground(SystemColor.menu); + labeldesc.setBounds(124, 127, 104, 110); + JScrollPane scrollPane = new JScrollPane(labeldesc); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setBounds(124, 163, 104, 110); + panel.add(scrollPane); + //panel.add(labeldesc); + + labelimage = new JTextArea(); + labelimage.setLineWrap(true); + labelimage.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labelimage.setEditable(false); + labelimage.setBackground(SystemColor.menu); + labelimage.setBounds(124, 248, 101, 81); + JScrollPane scrollPaneImage = new JScrollPane(labelimage); + scrollPaneImage.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPaneImage.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPaneImage.setBounds(124, 284, 101, 81); + panel.add(scrollPaneImage); + + labelName = new JTextArea(); + labelName.setFont(new Font("Tahoma", Font.PLAIN, 11)); + labelName.setBackground(SystemColor.menu); + labelName.setBounds(124, 22, 101, 55); + JScrollPane scrollPaneName = new JScrollPane(labelName); + scrollPaneName.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrollPaneName.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPaneName.setBounds(124, 22, 101, 55); + panel.add(scrollPaneName); + //panel.add(labelName); + //panel.add(labelimage); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); @@ -577,13 +760,14 @@ public class EditLectureSearch_GUI extends JFrame { } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { + public DefaultTableModel initTableModel(DefaultTableModel model) throws ParseException { List<server.Lecture> lectures; try { // Hole eine Liste der Images lectures = client.getLectureList(); Iterator<server.Lecture> i = lectures.iterator(); - + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); int x = 0; while (i.hasNext()) { @@ -591,11 +775,11 @@ public class EditLectureSearch_GUI extends JFrame { Object[] obj = { lectures.get(x).lecturename, lectures.get(x).desc, - lectures.get(x).starttime + " " - + lectures.get(x).endtime, - lectures.get(x).isActive, lectures.get(x).lastused, + out.format(in.parse(lectures.get(x).starttime)) + " " + + out.format(in.parse(lectures.get(x).endtime)), + lectures.get(x).isActive, out.format(in.parse(lectures.get(x).lastused)), lectures.get(x).username, - lectures.get(x).imagename ,lectures.get(x).id }; + lectures.get(x).imagename," " ,lectures.get(x).id }; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -610,5 +794,21 @@ public class EditLectureSearch_GUI extends JFrame { } return model; } + public void writeLectureData(String id) throws TException, ParseException{ + + SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + Map<String,String> res=client.getLectureData(id); + labelName.setText(res.get("name")); + labelAktiv.setText(res.get("isActive")); + labeldesc.setText(res.get("desc")); + labelVerantwortlicher.setText(res.get("owner")); + labelstartdate.setText(out.format(in.parse(res.get("startTime")))); + labelenddate.setText(out.format(in.parse(res.get("endTime")))); + labelimage.setText(res.get("imagepath").substring(res.get("imagepath").indexOf("/")+1)); + labelimageversion.setText(res.get("imageversion")); + + +} } diff --git a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java b/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java index a0276f6c..07a48925 100644 --- a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java +++ b/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java @@ -6,6 +6,7 @@ import gui.intro.MainMenue_GUI; import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
+import java.awt.Point;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -17,8 +18,11 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent;
import java.net.URI;
import java.net.URISyntaxException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -41,6 +45,8 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
@@ -54,6 +60,8 @@ import server.Server.Client; import thrift.ThriftConnection;
import util.GuiOrganizer;
import util.OpenLinks;
+import javax.swing.JTextArea;
+import javax.swing.ScrollPaneConstants;
@SuppressWarnings("serial")
public class SearchLecture_GUI extends JFrame {
@@ -62,10 +70,19 @@ public class SearchLecture_GUI extends JFrame { String[] result;
JRadioButton rdbtnInternetJa;
JRadioButton rdbtnInternetNein;
+ JLabel labelAktiv;
+ JLabel labelstartdate;
+ JLabel labelenddate;
+ JLabel labelimageversion;
+ JTextArea labelName;
+ JTextArea labelimage;
+ JTextArea labeldesc;
+ JLabel labelVerantwortlicher;
JTable tableAllLectures;
JTable tablemyLectures;
private JTextField textFieldName;
JTabbedPane tabbedPane;
+ boolean activeSearch=false;
String[] titles = { "Veranstaltungsname", "Beschreibung",
"G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung",
"Verantwortlicher", "Image", "Schlagwort", "ID" };
@@ -98,6 +115,53 @@ public class SearchLecture_GUI extends JFrame { con.closeThriftConnection();
System.exit(0);
}
+ @Override
+ public void windowOpened(WindowEvent arg0) {
+ try {
+ initTableModel(modelMyLectures);
+ initTableModel(modelAll);
+
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ tablemyLectures.getColumnModel().getColumn(1).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(1).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(1).setMaxWidth(0);
+ tablemyLectures.getColumnModel().getColumn(2).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(2).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(2).setMaxWidth(0);
+ tablemyLectures.getColumnModel().getColumn(3).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(3).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(3).setMaxWidth(0);
+ tablemyLectures.getColumnModel().getColumn(6).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(6).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(6).setMaxWidth(0);
+ tablemyLectures.getColumnModel().getColumn(7).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(7).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(7).setMaxWidth(0);
+ tablemyLectures.getColumnModel().getColumn(8).setWidth(0);
+ tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0);
+ tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(1).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(1).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(1).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(2).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(2).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(2).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(3).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(3).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(3).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(6).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(6).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(6).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(7).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(7).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(7).setMaxWidth(0);
+ tableAllLectures.getColumnModel().getColumn(8).setWidth(0);
+ tableAllLectures.getColumnModel().getColumn(8).setMinWidth(0);
+ tableAllLectures.getColumnModel().getColumn(8).setMaxWidth(0);
+ }
});
// Verhindert das Vergroessern Des Fensters
setResizable(false);
@@ -116,8 +180,6 @@ public class SearchLecture_GUI extends JFrame { setBounds(0, 0, 842, 722);
GuiOrganizer.centerGUI(this);
- final DefaultTableModel model = new DefaultTableModel(titles, 0);
-
getContentPane().setLayout(null);
{
JPanel panel = new JPanel();
@@ -136,7 +198,7 @@ public class SearchLecture_GUI extends JFrame { txtpnBitteWhlenSie.setEditable(false);
txtpnBitteWhlenSie.setBackground(SystemColor.menu);
txtpnBitteWhlenSie
- .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen");
+ .setText("Hier k\u00F6nnen Sie nach Ihrer gew\u00FCnschten Veranstaltung suchen und diese f\u00FCr weitere Schritte ausw\u00E4hlen");
txtpnBitteWhlenSie.setBounds(10, 36, 509, 32);
panel.add(txtpnBitteWhlenSie);
}
@@ -165,15 +227,22 @@ public class SearchLecture_GUI extends JFrame { public void keyReleased(KeyEvent e) {
// Textfield eingabe auslesen
String stext = textFieldName.getText();
-
// Wenn Textfield nicht leer
if (stext != "") {
+ activeSearch=true;
// Filtere nach der Eingabe
rowSorterAll.setRowFilter(RowFilter.regexFilter(
textFieldName.getText(), 0));
rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
textFieldName.getText(), 0));
+ }else{
+ activeSearch=false;
+ String username = person.verantwortlicher.getName() + " "
+ + person.verantwortlicher.getVorname();
+ rowSorterMyLectures.setRowFilter(RowFilter.regexFilter(
+ username, 5));
+ rowSorterAll.setRowFilter(null);
}
}
});
@@ -232,20 +301,65 @@ public class SearchLecture_GUI extends JFrame { tabbedPane.setBounds(10, 123, 557, 397);
contentPanel.add(tabbedPane);
- initTableModel(modelMyLectures);
+
JScrollPane scrollPaneAllImages = new JScrollPane();
tableAllLectures = new JTable();
+ tableAllLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ String imageid = modelAll
+ .getValueAt(
+ tableAllLectures
+ .convertRowIndexToModel(tableAllLectures
+ .getSelectedRow()), 8)
+ .toString();
+ System.out.println(imageid);
+
+ try {
+ writeLectureData(imageid);
+ } catch (TException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (ParseException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ });
tableAllLectures.setModel(modelAll);
tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit();
tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit();
tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit();
tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit();
tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit();
- initTableModel(modelAll);
JScrollPane scrollPaneMyImage = new JScrollPane();
tablemyLectures = new JTable();
+ tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ String imageid = modelMyLectures
+ .getValueAt(
+ tablemyLectures
+ .convertRowIndexToModel(tablemyLectures
+ .getSelectedRow()), 8)
+ .toString();
+ System.out.println(imageid);
+
+ try {
+ writeLectureData(imageid);
+ } catch (TException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (ParseException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ });
tablemyLectures.setModel(modelMyLectures);
tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit();
@@ -305,65 +419,91 @@ public class SearchLecture_GUI extends JFrame { lblNewLabel_3.setBounds(10, 27, 104, 14);
panel.add(lblNewLabel_3);
- JLabel labelName = new JLabel("");
- labelName.setBounds(124, 27, 104, 14);
- panel.add(labelName);
-
JLabel lblAktiv = new JLabel("Aktiv:");
- lblAktiv.setBounds(10, 52, 104, 14);
+ lblAktiv.setBounds(10, 88, 104, 14);
panel.add(lblAktiv);
- JLabel labelAktiv = new JLabel("");
- labelAktiv.setBounds(124, 52, 104, 14);
+ labelAktiv = new JLabel("");
+ labelAktiv.setBounds(124, 88, 104, 14);
panel.add(labelAktiv);
- JLabel labelstartdate = new JLabel("");
- labelstartdate.setBounds(124, 77, 104, 14);
+ labelstartdate = new JLabel("");
+ labelstartdate.setBounds(124, 113, 104, 14);
panel.add(labelstartdate);
JLabel lblStartdatum = new JLabel("Startdatum:");
- lblStartdatum.setBounds(10, 77, 104, 14);
+ lblStartdatum.setBounds(10, 113, 104, 14);
panel.add(lblStartdatum);
- JLabel labelenddate = new JLabel("");
- labelenddate.setBounds(124, 102, 104, 14);
+ labelenddate = new JLabel("");
+ labelenddate.setBounds(124, 138, 104, 14);
panel.add(labelenddate);
JLabel lblEnddatum = new JLabel("Enddatum:");
- lblEnddatum.setBounds(10, 102, 104, 14);
+ lblEnddatum.setBounds(10, 138, 104, 14);
panel.add(lblEnddatum);
JLabel lblBeschreibung = new JLabel("Beschreibung:");
- lblBeschreibung.setBounds(10, 127, 104, 14);
+ lblBeschreibung.setBounds(10, 163, 104, 14);
panel.add(lblBeschreibung);
- JLabel labeldesc = new JLabel("");
- labeldesc.setBounds(124, 127, 104, 110);
- panel.add(labeldesc);
-
JLabel lblImage = new JLabel("Image:");
- lblImage.setBounds(10, 248, 104, 14);
+ lblImage.setBounds(10, 284, 104, 14);
panel.add(lblImage);
- JLabel labelimage = new JLabel("");
- labelimage.setBounds(124, 248, 104, 14);
- panel.add(labelimage);
-
- JLabel labelVerantwortlicher = new JLabel("");
- labelVerantwortlicher.setBounds(124, 298, 104, 14);
+ labelVerantwortlicher = new JLabel("");
+ labelVerantwortlicher.setBounds(124, 401, 104, 14);
panel.add(labelVerantwortlicher);
JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:");
- lblVerantwortlicher.setBounds(10, 298, 104, 14);
+ lblVerantwortlicher.setBounds(10, 401, 104, 14);
panel.add(lblVerantwortlicher);
JLabel lblImageversion = new JLabel("Imageversion:");
- lblImageversion.setBounds(10, 273, 104, 14);
+ lblImageversion.setBounds(10, 376, 104, 14);
panel.add(lblImageversion);
- JLabel labelimageversion = new JLabel("");
- labelimageversion.setBounds(124, 273, 104, 14);
+ labelimageversion = new JLabel("");
+ labelimageversion.setBounds(124, 376, 104, 14);
panel.add(labelimageversion);
+
+
+ labeldesc = new JTextArea();
+ labeldesc.setFont(new Font("Tahoma", Font.PLAIN, 11));
+ labeldesc.setEditable(false);
+ labeldesc.setLineWrap(true);
+ labeldesc.setBackground(SystemColor.menu);
+ labeldesc.setBounds(124, 127, 104, 110);
+ JScrollPane scrollPane = new JScrollPane(labeldesc);
+ scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+ scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setBounds(124, 163, 104, 110);
+ panel.add(scrollPane);
+ //panel.add(labeldesc);
+
+ labelimage = new JTextArea();
+ labelimage.setLineWrap(true);
+ labelimage.setFont(new Font("Tahoma", Font.PLAIN, 11));
+ labelimage.setEditable(false);
+ labelimage.setBackground(SystemColor.menu);
+ labelimage.setBounds(124, 248, 101, 81);
+ JScrollPane scrollPaneImage = new JScrollPane(labelimage);
+ scrollPaneImage.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+ scrollPaneImage.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPaneImage.setBounds(124, 284, 101, 81);
+ panel.add(scrollPaneImage);
+
+ labelName = new JTextArea();
+ labelName.setFont(new Font("Tahoma", Font.PLAIN, 11));
+ labelName.setBackground(SystemColor.menu);
+ labelName.setBounds(124, 22, 101, 55);
+ JScrollPane scrollPaneName = new JScrollPane(labelName);
+ scrollPaneName.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+ scrollPaneName.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPaneName.setBounds(124, 22, 101, 55);
+ panel.add(scrollPaneName);
+ //panel.add(labelName);
+ //panel.add(labelimage);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
@@ -373,6 +513,7 @@ public class SearchLecture_GUI extends JFrame { JMenuItem mntmFaq = new JMenuItem("FAQ");
mntmFaq.addMouseListener(new MouseAdapter() {
+ @SuppressWarnings("static-access")
@Override
public void mousePressed(MouseEvent arg0) {
@@ -395,6 +536,7 @@ public class SearchLecture_GUI extends JFrame { JMenuItem mntmOtrs = new JMenuItem("OTRS");
mntmOtrs.addMouseListener(new MouseAdapter() {
+ @SuppressWarnings("static-access")
@Override
public void mousePressed(MouseEvent arg0) {
@@ -427,13 +569,14 @@ public class SearchLecture_GUI extends JFrame { }
// Initiale Beffuelung eines Table models
- public DefaultTableModel initTableModel(DefaultTableModel model) {
+ public DefaultTableModel initTableModel(DefaultTableModel model) throws ParseException {
List<server.Lecture> lectures;
try {
// Hole eine Liste der Images
lectures = client.getLectureList();
Iterator<server.Lecture> i = lectures.iterator();
-
+ SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
int x = 0;
while (i.hasNext()) {
@@ -441,9 +584,9 @@ public class SearchLecture_GUI extends JFrame { Object[] obj = {
lectures.get(x).lecturename,
lectures.get(x).desc,
- lectures.get(x).starttime + " "
- + lectures.get(x).endtime,
- lectures.get(x).isActive, lectures.get(x).lastused,
+ out.format(in.parse(lectures.get(x).starttime)) + " "
+ + out.format(in.parse(lectures.get(x).endtime)),
+ lectures.get(x).isActive, out.format(in.parse(lectures.get(x).lastused)),
lectures.get(x).username,
lectures.get(x).imagename," " ,lectures.get(x).id };
// Fuege diese Objekte der Tabelle hinzu
@@ -460,4 +603,20 @@ public class SearchLecture_GUI extends JFrame { }
return model;
}
+ public void writeLectureData(String id) throws TException, ParseException{
+
+ SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
+ Map<String,String> res=client.getLectureData(id);
+ labelName.setText(res.get("name"));
+ labelAktiv.setText(res.get("isActive"));
+ labeldesc.setText(res.get("desc"));
+ labelVerantwortlicher.setText(res.get("owner"));
+ labelstartdate.setText(out.format(in.parse(res.get("startTime"))));
+ labelenddate.setText(out.format(in.parse(res.get("endTime"))));
+ labelimage.setText(res.get("imagepath").substring(res.get("imagepath").indexOf("/")+1));
+ labelimageversion.setText(res.get("imageversion"));
+
+
+ }
}
|
