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/lecture/EditLectureSearch_GUI.java | |
| 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/lecture/EditLectureSearch_GUI.java')
| -rw-r--r-- | Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java | 310 |
1 files changed, 255 insertions, 55 deletions
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")); + + +} } |
