diff options
| author | unknown | 2014-04-11 09:55:31 +0200 |
|---|---|---|
| committer | unknown | 2014-04-11 09:55:31 +0200 |
| commit | 7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7 (patch) | |
| tree | 8d167a7b63e55aeac7bb8c68c6591d1d732da5eb /Dozentenmodul | |
| parent | :) (diff) | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.tar.gz tutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.tar.xz tutor-module-7bccfece99b9a7e0218f7288c08fff5fc9ac0ac7.zip | |
Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module
Conflicts: delete Image db and server
Dozentenmodul/bin/gui/intro/MainMenue_GUI.class
Dozentenmodulserver/bin/server/ServerHandler.class
Dozentenmodulserver/bin/sql/SQL.class
Dozentenmodulserver/src/sql/SQL.java
Diffstat (limited to 'Dozentenmodul')
22 files changed, 1018 insertions, 62 deletions
diff --git a/Dozentenmodul/bin/Models/Lecture.class b/Dozentenmodul/bin/Models/Lecture.class Binary files differindex 7c968cd1..a0cb753d 100644 --- a/Dozentenmodul/bin/Models/Lecture.class +++ b/Dozentenmodul/bin/Models/Lecture.class diff --git a/Dozentenmodul/bin/Models/person.class b/Dozentenmodul/bin/Models/person.class Binary files differindex 49a2be85..32519c65 100644 --- a/Dozentenmodul/bin/Models/person.class +++ b/Dozentenmodul/bin/Models/person.class diff --git a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class Binary files differindex 905b7b6c..5e67252a 100644 --- a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class +++ b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class Binary files differindex 1d9589af..2b40e2a5 100644 --- a/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class +++ b/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class diff --git a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI$6.class b/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI$6.class Binary files differindex e4b01d60..adcc7fd5 100644 --- a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI$6.class +++ b/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI$6.class diff --git a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class b/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class Binary files differindex 8bbcc3d0..031b69b7 100644 --- a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class +++ b/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class diff --git a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI$4.class b/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI$4.class Binary files differindex 57e66269..c412ac7b 100644 --- a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI$4.class +++ b/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI$4.class diff --git a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class b/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class Binary files differindex 05c6ac16..83d7cf3e 100644 --- a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class +++ b/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class diff --git a/Dozentenmodul/bin/models/Lecture.class b/Dozentenmodul/bin/models/Lecture.class Binary files differindex 7c968cd1..a0cb753d 100644 --- a/Dozentenmodul/bin/models/Lecture.class +++ b/Dozentenmodul/bin/models/Lecture.class diff --git a/Dozentenmodul/bin/models/person.class b/Dozentenmodul/bin/models/person.class Binary files differindex 49a2be85..32519c65 100644 --- a/Dozentenmodul/bin/models/person.class +++ b/Dozentenmodul/bin/models/person.class diff --git a/Dozentenmodul/src/GUI/SearchImage_GUI.java b/Dozentenmodul/src/GUI/SearchImage_GUI.java new file mode 100644 index 00000000..83e6bc07 --- /dev/null +++ b/Dozentenmodul/src/GUI/SearchImage_GUI.java @@ -0,0 +1,458 @@ +package gui; + + +import gui.image.EditImageAllgemein_GUI; +import gui.image.FTPDownloader_GUI; +import gui.intro.MainMenue_GUI; +import gui.lecture.ExtendedSearchForImages_GUI; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +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.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; + +@SuppressWarnings("serial") +public class SearchImage_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox<String> comboBox; + JTable tableAllImages; + JTable tablemyImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles= {"Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", "Verantwortlicher", "Letztes Update", "Schlagwort"}; + ThriftConnection con=new ThriftConnection(); + Client client=con.getThriftConnection(); + final DefaultTableModel modelAll = new DefaultTableModel( titles, 0 ); + final DefaultTableModel modelMyImages = new DefaultTableModel( titles, 0 ); + final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll ); + final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( modelMyImages ); + + /** + * Launch the application. + */ + public static void main(String[] args) { + try { + SearchImage_GUI dialog = new SearchImage_GUI(); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Create the dialog. + */ + public SearchImage_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + //Beendet die Anwendung nach klick auf X + System.exit(0); + } + }); + //Verhindert das Vergrößern Des Fensters + setResizable(false); + + try { + //Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp*"); + //Zentriert das Fenster in die Bildmitte + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + int top=(screenSize.height - 722) / 2; + int left=(screenSize.width - 603) / 2; + setBounds(left, top, 603, 722); + + + + final DefaultTableModel model = new DefaultTableModel( titles, 0 ); + + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + 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"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + //Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + //Textfield eingabe auslesen + String stext=textFieldName.getText(); + + //Wenn Textfield nicht leer + if(stext!="") + { + //Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); + + } + }}); + + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel("<html><u>Erweiterte Suche</u></html>"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + //Öffnet das Fenster Extended GUI + ExtendedSearchForImages_GUI es=new ExtendedSearchForImages_GUI(); + es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(431, 106, 89, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox<String>(); + try { + //Holt sich eine Liste aller verfügbaren Betriebssysteme vom Server + List<String> list=client.getAllOS(); + //Leeres Item hinzufügen + comboBox.addItem(""); + for(int i=0;i<list.size();i++) + { + //Hinzufügen der verfügbaren Betriebssysteme + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + //Registriert Auswahländerungen der Box + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + //Prüft das die Auswahl nicht leer ist + if(comboBox.getSelectedItem().toString()!="") + { + //Filtert nach dem ausgewählten Betriebssystem + rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); + } + } + + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + //Öffnet das Hauütmenü + SearchImage_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(146, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + System.out.println(tabbedPane.getSelectedIndex()); + if(tabbedPane.getSelectedIndex()==0){ + + + + } + else if(tabbedPane.getSelectedIndex()==1){ + String username="Spitzer Tobias"; + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(username, 4)); + //rowSorterMyImages.toggleSortOrder(0); + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages=new JTable(); + tablemyImages.setModel(modelMyImages); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelMyImages); + tablemyImages.setRowSorter(rowSorterMyImages); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages=new JTable(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + tableAllImages.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + JTable 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 Images", null, scrollPaneCoopImages, null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + JTable 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 Images", null, scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + JTable tablePublicVorlagen=new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + + + + JButton btnDownload = new JButton("Download"); + btnDownload.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + //Öffnet den Downloader + FTPDownloader_GUI down=new FTPDownloader_GUI(); + down.setVisible(true); + SearchImage_GUI.this.setVisible(false); + } + }); + btnDownload.setBounds(449, 508, 118, 23); + contentPanel.add(btnDownload); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //Öffnet das Hauptmenü + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + EditImageAllgemein_GUI ea=new EditImageAllgemein_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mnNewMenu_1.add(mntmFaq); + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mnNewMenu_1.add(mntmOtrs); + + } + //Initiale Beffülung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model){ + List<server.Image> images; + try { + //Hole eine Liste der Images + + images = client.getImageList(); + Iterator<server.Image> i=images.iterator(); + + int x=0; + + while(i.hasNext()) + { + //erzeuge Objekte für die Tabelle + Object [] obj={images.get(x).getImageName(),images.get(x).getLicenseRestriction(),images.get(x).getOsName(),images.get(x).getLectureName(),images.get(x).getUserData(),images.get(x).getUpdateTime()}; + //Füge diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } + + } + + diff --git a/Dozentenmodul/src/Models/Lecture.java b/Dozentenmodul/src/Models/Lecture.java index 069946b3..6b7e6fa1 100644 --- a/Dozentenmodul/src/Models/Lecture.java +++ b/Dozentenmodul/src/Models/Lecture.java @@ -6,6 +6,7 @@ public class Lecture { private String name; + private String newName; private String shortDesc; private String desc; private Date startdate; @@ -18,6 +19,14 @@ public class Lecture { public static Lecture lecture =new Lecture(); + public String getNewName() { + return newName; + } + + public void setNewName(String newName) { + this.newName = newName; + } + public String getLinkedImagename() { return linkedImagename; } diff --git a/Dozentenmodul/src/Models/person.java b/Dozentenmodul/src/Models/person.java index 24ab16f3..435f3c1d 100644 --- a/Dozentenmodul/src/Models/person.java +++ b/Dozentenmodul/src/Models/person.java @@ -3,7 +3,9 @@ package models; public class person{ + private String username; + private String Name; private String Vorname; private String Hochschule; @@ -13,6 +15,11 @@ public class person{ private boolean ischecked; + + public static person verantowrtlicher=new person(); + public static person ersteller=new person(); + + public static person verantwortlicher=new person(); @@ -22,6 +29,7 @@ public class person{ public void setUsername(String username) { this.username = username; } + public String getName() { return Name; } diff --git a/Dozentenmodul/src/gui/SearchImage_GUI.java b/Dozentenmodul/src/gui/SearchImage_GUI.java new file mode 100644 index 00000000..83e6bc07 --- /dev/null +++ b/Dozentenmodul/src/gui/SearchImage_GUI.java @@ -0,0 +1,458 @@ +package gui; + + +import gui.image.EditImageAllgemein_GUI; +import gui.image.FTPDownloader_GUI; +import gui.intro.MainMenue_GUI; +import gui.lecture.ExtendedSearchForImages_GUI; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +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.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; + +@SuppressWarnings("serial") +public class SearchImage_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox<String> comboBox; + JTable tableAllImages; + JTable tablemyImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles= {"Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", "Verantwortlicher", "Letztes Update", "Schlagwort"}; + ThriftConnection con=new ThriftConnection(); + Client client=con.getThriftConnection(); + final DefaultTableModel modelAll = new DefaultTableModel( titles, 0 ); + final DefaultTableModel modelMyImages = new DefaultTableModel( titles, 0 ); + final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll ); + final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( modelMyImages ); + + /** + * Launch the application. + */ + public static void main(String[] args) { + try { + SearchImage_GUI dialog = new SearchImage_GUI(); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Create the dialog. + */ + public SearchImage_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + //Beendet die Anwendung nach klick auf X + System.exit(0); + } + }); + //Verhindert das Vergrößern Des Fensters + setResizable(false); + + try { + //Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp*"); + //Zentriert das Fenster in die Bildmitte + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + int top=(screenSize.height - 722) / 2; + int left=(screenSize.width - 603) / 2; + setBounds(left, top, 603, 722); + + + + final DefaultTableModel model = new DefaultTableModel( titles, 0 ); + + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + 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"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + //Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + //Textfield eingabe auslesen + String stext=textFieldName.getText(); + + //Wenn Textfield nicht leer + if(stext!="") + { + //Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); + + } + }}); + + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel("<html><u>Erweiterte Suche</u></html>"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + //Öffnet das Fenster Extended GUI + ExtendedSearchForImages_GUI es=new ExtendedSearchForImages_GUI(); + es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(431, 106, 89, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox<String>(); + try { + //Holt sich eine Liste aller verfügbaren Betriebssysteme vom Server + List<String> list=client.getAllOS(); + //Leeres Item hinzufügen + comboBox.addItem(""); + for(int i=0;i<list.size();i++) + { + //Hinzufügen der verfügbaren Betriebssysteme + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + //Registriert Auswahländerungen der Box + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + //Prüft das die Auswahl nicht leer ist + if(comboBox.getSelectedItem().toString()!="") + { + //Filtert nach dem ausgewählten Betriebssystem + rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); + } + } + + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + //Öffnet das Hauütmenü + SearchImage_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(146, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + System.out.println(tabbedPane.getSelectedIndex()); + if(tabbedPane.getSelectedIndex()==0){ + + + + } + else if(tabbedPane.getSelectedIndex()==1){ + String username="Spitzer Tobias"; + rowSorterMyImages.setRowFilter(RowFilter.regexFilter(username, 4)); + //rowSorterMyImages.toggleSortOrder(0); + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages=new JTable(); + tablemyImages.setModel(modelMyImages); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelMyImages); + tablemyImages.setRowSorter(rowSorterMyImages); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages=new JTable(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + tableAllImages.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + JTable 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 Images", null, scrollPaneCoopImages, null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + JTable 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 Images", null, scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + JTable tablePublicVorlagen=new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + + + + JButton btnDownload = new JButton("Download"); + btnDownload.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + //Öffnet den Downloader + FTPDownloader_GUI down=new FTPDownloader_GUI(); + down.setVisible(true); + SearchImage_GUI.this.setVisible(false); + } + }); + btnDownload.setBounds(449, 508, 118, 23); + contentPanel.add(btnDownload); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //Öffnet das Hauptmenü + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + EditImageAllgemein_GUI ea=new EditImageAllgemein_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mnNewMenu_1.add(mntmFaq); + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mnNewMenu_1.add(mntmOtrs); + + } + //Initiale Beffülung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model){ + List<server.Image> images; + try { + //Hole eine Liste der Images + + images = client.getImageList(); + Iterator<server.Image> i=images.iterator(); + + int x=0; + + while(i.hasNext()) + { + //erzeuge Objekte für die Tabelle + Object [] obj={images.get(x).getImageName(),images.get(x).getLicenseRestriction(),images.get(x).getOsName(),images.get(x).getLectureName(),images.get(x).getUserData(),images.get(x).getUpdateTime()}; + //Füge diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } + + } + + diff --git a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java b/Dozentenmodul/src/gui/image/DeleteImage_GUI.java index d7cf2a3c..fb2d5926 100644 --- a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java +++ b/Dozentenmodul/src/gui/image/DeleteImage_GUI.java @@ -7,6 +7,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.HeadlessException; import java.awt.SystemColor; import java.awt.Toolkit; import java.awt.event.ActionEvent; @@ -368,64 +369,59 @@ public class DeleteImage_GUI extends JFrame { String id; String version; - //Öffnet den Downloader - /*FTPDownloader_GUI down=new FTPDownloader_GUI("Test"); - down.setVisible(true); - DeleteImage_GUI.this.setVisible(false); - */ - - - - //frage, soll das selektierte Daten gelöscht werden? int eingabe = JOptionPane.showConfirmDialog(null, "Wollen Sie diese Daten löschen?", "Löschen?",JOptionPane.YES_NO_OPTION); - if (eingabe == JOptionPane.YES_OPTION) { - //Wenn ja, dann daten selektieren und löschen - // Element in der Datenbank selektieren und löschen - //Login l = new Login(); - //l.createAndShowUI(); - //System.exit(0); - // client. deleteimage... - - //getSelectedRow(); - - //index = tableAllImages.getSelectedRow(); - - //rowSorterAll ? - - + if (eingabe == JOptionPane.YES_OPTION) { String imageid = modelAll.getValueAt(tableAllImages.convertRowIndexToModel (tableAllImages.getSelectedRow()), 7).toString(); String imageversion = modelAll.getValueAt(tableAllImages.convertRowIndexToModel (tableAllImages.getSelectedRow()), 8).toString(); - //client.deleteImageData(Image.image.getImageId(),Image.image.getVersion()); - if (client.deleteImageData(imageid ,imageversion)) { - - JOptionPane.showConfirmDialog(null, "Löschen erfolgreich!", - imageversion, JOptionPane.OK_CANCEL_OPTION); - - } else { - - JOptionPane.showConfirmDialog(null, "Löschen hat leider nicht geklappt!!", - imageversion, JOptionPane.OK_CANCEL_OPTION); - - } - //TODO - //das file ist aus der DB raus, aber ist noch auf dem Server als Datei hinterlegt. dieses muss auch gelöscht werden, um den festplattenlatz wieder frei zu geben. - //Hierzu könnte ein löschbefehl an die kommande zeile des server geschickt werden um das entsprechende file zu löschen. identifizieren über den image-namen!! - //z.B. FileUtils.moveFile(tmpFile, new File("141.79.128.102:/srv//openslx/nfs/temp/"+tmpFile.getName())); - //FileUtils.ForceDelete (.. ); - - //TODO - //Image darf nur gelöscht werden, wenn keine Veranstaltung mehr auf das Image verweist. Unbdingt abfragen! + //TODO + //Image darf nur gelöscht werden, wenn keine Veranstaltung mehr auf das Image verweist. + //Unbdingt abfragen! - - - } + try { + if(client.connectedToEvents(imageid ,imageversion)) { + + try { + if (client.deleteImageData(imageid ,imageversion) && + client.deleteImageServer(imageid ,imageversion)) { + + JOptionPane.showConfirmDialog(null, "Löschen erfolgreich!", + imageversion, JOptionPane.OK_CANCEL_OPTION); + + } else { + + JOptionPane.showConfirmDialog(null, "Löschen hat leider nicht geklappt!!", + imageversion, JOptionPane.OK_CANCEL_OPTION); + + } + } catch (HeadlessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //TODO --> client.deleteImageServer(imageid ,imageversion) + //das file ist aus der DB raus, aber ist noch auf dem Server als Datei hinterlegt. + //dieses muss auch gelöscht werden, um den festplattenlatz wieder frei zu geben. + //Hierzu könnte ein löschbefehl an die kommande zeile des server geschickt werden + //um das entsprechende file zu löschen. identifizieren über den image-namen!! + //z.B. FileUtils.moveFile(tmpFile, new File("141.79.128.102:/srv//openslx/nfs/temp/"+ + //tmpFile.getName())); + //FileUtils.ForceDelete (.. ); + + } + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } }); btnDelete.setBounds(449, 508, 118, 23); diff --git a/Dozentenmodul/src/gui/intro/MainMenue_GUI.java b/Dozentenmodul/src/gui/intro/MainMenue_GUI.java index a5588963..774fbf74 100644 --- a/Dozentenmodul/src/gui/intro/MainMenue_GUI.java +++ b/Dozentenmodul/src/gui/intro/MainMenue_GUI.java @@ -79,7 +79,7 @@ public class MainMenue_GUI extends JFrame { // TODO Auto-generated catch block e.printStackTrace(); } - setTitle("bwLehrpool Suite *Prototyp*"); + setTitle("bwLehrpool Suite *Prototyp* "); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int top = (screenSize.height - 722) / 2; int left = (screenSize.width - 603) / 2; diff --git a/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java b/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java index 936f9b13..026cb7c5 100644 --- a/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java +++ b/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java @@ -412,6 +412,7 @@ public class CreateLectureAllgemein_GUI extends JFrame { "Das End-Datum liegt zu weit in der Zukunft. Erlaubt ist maximal:\n" + endDate, "Datum fehlerhaft", JOptionPane.INFORMATION_MESSAGE); + dateChooserend.setDate(endDate); //setze Datum auf maximum } else { // bereit isDateMaxLifeTimeCorrect = true; diff --git a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java index a9125829..2243fd43 100644 --- a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java +++ b/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java @@ -476,8 +476,9 @@ public class CreateLectureLink_GUI extends JFrame { images.get(x).getLicenseRestriction(), images.get(x).getOsName(), images.get(x).getLectureName(), - images.get(x).getUpdateTime(), - images.get(x).getUserData() }; + images.get(x).getUserData(), + images.get(x).getUpdateTime() + }; ListObj.add(obj); model.addRow(ListObj.get(x)); x++; diff --git a/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java index 40b3ce84..115a9f1f 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java @@ -361,13 +361,14 @@ public class EditLectureAllgemein_GUI extends JFrame { } Lecture.lecture.setName(textFieldLaborname.getText()); + Lecture.lecture.setNewName(textFieldLaborname.getText()); Lecture.lecture.setDesc(description.getText()); Lecture.lecture.setEnddate(dateChooserend.getDate()); Lecture.lecture.setStartdate(dateChooserstart.getDate()); Image.image.setImagename(textFieldLaborname.getText()); - CreateLectureLink_GUI ev=new CreateLectureLink_GUI(); + EditLectureLink_GUI ev=new EditLectureLink_GUI(); ev.setVisible(true); dispose(); } diff --git a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java index c245ce79..c1fdec80 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java @@ -63,7 +63,7 @@ public class EditLectureLink_GUI extends JFrame { JTable tablePublicVorlagen = new JTable(); private JTextField textFieldName; String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort" }; + "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; ThriftConnection thrift = new ThriftConnection(); Client client = thrift.getThriftConnection(); @@ -355,7 +355,7 @@ public class EditLectureLink_GUI extends JFrame { } { JButton cancelButton = new JButton( - "Veranstaltung erzeugen und abschlie\u00DFen"); + "Veranstaltung ändern und abschlie\u00DFen"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -370,14 +370,16 @@ public class EditLectureLink_GUI extends JFrame { String imagename = tableAllImages.getValueAt( tableAllImages.getSelectedRow(), 0) .toString(); + System.out.println("ID: "+Lecture.lecture.getid()); + try { - DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); - System.out.println(formatter.format( - Lecture.lecture.getStartdate()) + + DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + System.out.println( formatter.format( + Lecture.lecture.getEnddate()) .toString()); - client.writeLecturedata( - Lecture.lecture.getName(), + client.updateLecturedata(Lecture.lecture.getName(), + Lecture.lecture.getNewName(), Lecture.lecture.getShortDesc(), Lecture.lecture.getDesc(), formatter.format( @@ -393,7 +395,9 @@ public class EditLectureLink_GUI extends JFrame { person.verantwortlicher.getHochschule(), person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultät()); + person.verantwortlicher.getFakultät(), + Lecture.lecture.getid()); + } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -407,6 +411,8 @@ public class EditLectureLink_GUI extends JFrame { JOptionPane.INFORMATION_MESSAGE); } + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); dispose(); } @@ -459,8 +465,9 @@ public class EditLectureLink_GUI extends JFrame { images.get(x).getLicenseRestriction(), images.get(x).getOsName(), images.get(x).getLectureName(), - images.get(x).getUpdateTime(), - images.get(x).getUserData() }; + images.get(x).getUserData(), + images.get(x).getUpdateTime(), "", images.get(x).id, + images.get(x).getVersion() }; ListObj.add(obj); model.addRow(ListObj.get(x)); x++; diff --git a/Dozentenmodul/src/models/Lecture.java b/Dozentenmodul/src/models/Lecture.java index 069946b3..6b7e6fa1 100644 --- a/Dozentenmodul/src/models/Lecture.java +++ b/Dozentenmodul/src/models/Lecture.java @@ -6,6 +6,7 @@ public class Lecture { private String name; + private String newName; private String shortDesc; private String desc; private Date startdate; @@ -18,6 +19,14 @@ public class Lecture { public static Lecture lecture =new Lecture(); + public String getNewName() { + return newName; + } + + public void setNewName(String newName) { + this.newName = newName; + } + public String getLinkedImagename() { return linkedImagename; } diff --git a/Dozentenmodul/src/models/person.java b/Dozentenmodul/src/models/person.java index 24ab16f3..435f3c1d 100644 --- a/Dozentenmodul/src/models/person.java +++ b/Dozentenmodul/src/models/person.java @@ -3,7 +3,9 @@ package models; public class person{ + private String username; + private String Name; private String Vorname; private String Hochschule; @@ -13,6 +15,11 @@ public class person{ private boolean ischecked; + + public static person verantowrtlicher=new person(); + public static person ersteller=new person(); + + public static person verantwortlicher=new person(); @@ -22,6 +29,7 @@ public class person{ public void setUsername(String username) { this.username = username; } + public String getName() { return Name; } |
