From 0ed4549c028e2523534a09fd6e41c49c9d178ec1 Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Mon, 27 Oct 2014 18:13:20 +0100 Subject: Sämtliche Logik und Grafiken zur Vergabe und Verwaltung von Berechtigungen eingeführt. Kleinere Bugs sind bekannt, werden aktuell behoben --- .../main/java/gui/lecture/DeleteLecture_GUI.java | 431 +++++++++++---------- 1 file changed, 221 insertions(+), 210 deletions(-) (limited to 'dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java') diff --git a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java index cbde2d18..38d29620 100644 --- a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java @@ -1,7 +1,6 @@ package gui.lecture; import gui.intro.About_GUI; -import gui.intro.Login_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -36,19 +35,15 @@ 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.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; @@ -63,13 +58,13 @@ import org.apache.thrift.TException; import server.generated.Server.Client; import thrift.ThriftConnection; -import util.GuiOrganizer; import util.OpenLinks; @SuppressWarnings("serial") public class DeleteLecture_GUI extends JFrame { - - private final static Logger LOGGER = Logger.getLogger(DeleteLecture_GUI.class); + + private final static Logger LOGGER = Logger + .getLogger(DeleteLecture_GUI.class); private final JPanel contentPanel = new JPanel(); String[] result; @@ -85,11 +80,11 @@ public class DeleteLecture_GUI extends JFrame { JLabel labelVerantwortlicher; JTable tablemyLectures; private JTextField textFieldName; - boolean activeSearch=false; + boolean activeSearch = false; String[] titles = { "Veranstaltungsname", "Beschreibung", "GĂŒltigkeitsdatum", "Aktiv", "Letzte Benutzung", "Verantwortlicher", "Image", "Schlagwort", "ID" }; - + ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); @@ -102,15 +97,13 @@ public class DeleteLecture_GUI extends JFrame { private JTextField textField; Component c = null; - - private static final String HELP_MESSAGE = "
" + - "In der Übersicht sehen Sie primĂ€r alle Veranstaltungen, die Sie erzeugt haben.
" + - "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete EintrÀge irgendwann automatisch gelöscht.
" + - "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + - "
"; + private static final String HELP_MESSAGE = "
" + + "In der Übersicht sehen Sie primĂ€r alle Veranstaltungen, die Sie erzeugt haben.
" + + "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete EintrÀge irgendwann automatisch gelöscht.
" + + "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + + "
"; - /** * Create the dialog. */ @@ -122,6 +115,7 @@ public class DeleteLecture_GUI extends JFrame { con.closeThriftConnection(); System.exit(0); } + @Override public void windowOpened(WindowEvent arg0) { textFieldName.requestFocusInWindow(); @@ -133,7 +127,7 @@ public class DeleteLecture_GUI extends JFrame { // TODO Auto-generated catch block e.printStackTrace(); } - + // auszublendende Angaben // 1=Beschreibung // 2=GĂŒltigkeitsdatum @@ -159,27 +153,39 @@ public class DeleteLecture_GUI extends JFrame { 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); - */ + * 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 @@ -199,7 +205,6 @@ public class DeleteLecture_GUI extends JFrame { setBounds(0, 0, 842, 722); setLocationRelativeTo(formerGUI); - getContentPane().setLayout(null); { JPanel panel = new JPanel(); @@ -250,15 +255,15 @@ public class DeleteLecture_GUI extends JFrame { String stext = textFieldName.getText(); // Wenn Textfield nicht leer if (stext != "") { - activeSearch=true; + activeSearch = true; // Filtere nach der Eingabe rowSorterAll.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); - }else{ - activeSearch=false; + } else { + activeSearch = false; String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname(); rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( @@ -277,7 +282,7 @@ public class DeleteLecture_GUI extends JFrame { @Override public void mouseClicked(MouseEvent arg0) { // oeffnet das Hauptmenue - + DeleteLecture_GUI.this.setVisible(false); MainMenue_GUI main = new MainMenue_GUI(c); main.setVisible(true); @@ -307,38 +312,36 @@ public class DeleteLecture_GUI extends JFrame { scrollPaneMyImage.setBounds(10, 120, 552, 369); contentPanel.add(scrollPaneMyImage); tablemyLectures = new JTable(); - tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - String imageid = modelMyLectures - .getValueAt( + tablemyLectures.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + String imageid = modelMyLectures.getValueAt( tablemyLectures .convertRowIndexToModel(tablemyLectures .getSelectedRow()), 8) - .toString(); - - try { - writeLectureData(imageid); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (ParseException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - }); + .toString(); + + 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(); - tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyLectures.setRowSorter(rowSorterMyLectures); - - scrollPaneMyImage.setViewportView(tablemyLectures); + + tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyLectures.setRowSorter(rowSorterMyLectures); + + scrollPaneMyImage.setViewportView(tablemyLectures); { JPanel buttonPane = new JPanel(); buttonPane.setBounds(0, 640, 826, 33); @@ -350,7 +353,7 @@ public class DeleteLecture_GUI extends JFrame { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // oeffnet das Hauptmenue - + MainMenue_GUI main = new MainMenue_GUI(c); main.setVisible(true); dispose(); @@ -369,69 +372,68 @@ public class DeleteLecture_GUI extends JFrame { JSeparator separator_1 = new JSeparator(); 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)); + 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, 98, 104, 14); panel.add(lblAktiv); - + labelAktiv = new JLabel(""); labelAktiv.setBounds(10, 114, 218, 14); panel.add(labelAktiv); - + labelstartdate = new JLabel(""); labelstartdate.setBounds(10, 147, 218, 14); panel.add(labelstartdate); - + JLabel lblStartdatum = new JLabel("Startdatum:"); lblStartdatum.setBounds(10, 129, 104, 14); panel.add(lblStartdatum); - + labelenddate = new JLabel(""); labelenddate.setBounds(10, 175, 218, 14); panel.add(labelenddate); - + JLabel lblEnddatum = new JLabel("Enddatum:"); lblEnddatum.setBounds(10, 161, 104, 14); panel.add(lblEnddatum); - + JLabel lblBeschreibung = new JLabel("Beschreibung:"); lblBeschreibung.setBounds(10, 189, 104, 14); panel.add(lblBeschreibung); - + JLabel lblImage = new JLabel("Image:"); lblImage.setBounds(10, 293, 104, 14); panel.add(lblImage); - + labelVerantwortlicher = new JLabel(""); labelVerantwortlicher.setBounds(10, 426, 218, 14); panel.add(labelVerantwortlicher); - + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); lblVerantwortlicher.setBounds(10, 411, 104, 14); panel.add(lblVerantwortlicher); - + JLabel lblImageversion = new JLabel("Imageversion:"); lblImageversion.setBounds(10, 381, 104, 14); panel.add(lblImageversion); - + labelimageversion = new JLabel(""); labelimageversion.setBounds(10, 399, 218, 14); panel.add(labelimageversion); - - + labeldesc = new JTextArea(); labeldesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); labeldesc.setEditable(false); @@ -441,8 +443,8 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPane = new JScrollPane(labeldesc); scrollPane.setBounds(10, 209, 218, 81); panel.add(scrollPane); - //panel.add(labeldesc); - + // panel.add(labeldesc); + labelimage = new JTextArea(); labelimage.setLineWrap(true); labelimage.setFont(new Font("Tahoma", Font.PLAIN, 11)); @@ -452,7 +454,7 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPaneImage = new JScrollPane(labelimage); scrollPaneImage.setBounds(10, 309, 215, 69); panel.add(scrollPaneImage); - + labelName = new JTextArea(); labelName.setEditable(false); labelName.setFont(new Font("Tahoma", Font.PLAIN, 11)); @@ -461,100 +463,103 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPaneName = new JScrollPane(labelName); scrollPaneName.setBounds(10, 40, 218, 55); panel.add(scrollPaneName); - - button = new JButton("Löschen"); - 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(c, - "Wollen Sie diese Daten löschen?", "Löschen?", - 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(); - LOGGER.info("Lösche Veranstaltung: " + lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - LOGGER.info("Löschen erfolgreich."); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(c); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - LOGGER.error("Konnte Veranstaltung '" + lectureID + "' nicht aus der Datenbank löschen!"); - JOptionPane + + button = new JButton("Löschen"); + 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(c, + "Wollen Sie diese Daten löschen?", "Löschen?", + 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(); + LOGGER.info("Lösche Veranstaltung: " + lectureID); + try { + if (client.deleteLecture(lectureID, + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getUsername())) { + LOGGER.info("Löschen erfolgreich."); + // delete successful + + DeleteLecture_GUI dl = new DeleteLecture_GUI(c); + dl.setVisible(true); + dispose(); + } else { + // delete not successful + LOGGER.error("Konnte Veranstaltung '" + + lectureID + + "' nicht aus der Datenbank löschen!"); + JOptionPane .showMessageDialog( c, "Löschen der Veranstaltung aus der 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öschen?", "Löschen?", - 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(); - LOGGER.info("Lösche Veranstaltung: "+lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - LOGGER.info("Löschen erfolgreich."); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - LOGGER.error("Konnte Veranstaltung '" + lectureID + "' nicht aus der Datenbank löschen!"); - JOptionPane - .showMessageDialog( - null, - "Löschen aus Datenbank fehlgeschlagen.", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - } else { //end check if a row is selected - JOptionPane - .showMessageDialog( - null, - "Bitte wĂ€hlen Sie ein eigenes Image aus.", - "Message", - 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öschen?", "Löschen?", + * 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(); + * LOGGER.info("Lösche Veranstaltung: "+lectureID); try { + * if(client.deleteLecture(lectureID, + * person.verantwortlicher.getHochschule + * (),person.verantwortlicher.getUsername())){ + * LOGGER.info("Löschen erfolgreich."); //delete successful + * + * DeleteLecture_GUI dl = new DeleteLecture_GUI(); + * dl.setVisible(true); dispose(); } else { //delete not + * successful LOGGER.error("Konnte Veranstaltung '" + lectureID + * + "' nicht aus der Datenbank löschen!"); JOptionPane + * .showMessageDialog( null, + * "Löschen aus Datenbank fehlgeschlagen.", "Fehler", + * JOptionPane.INFORMATION_MESSAGE); } } catch (TException e1) { + * // TODO Auto-generated catch block e1.printStackTrace(); + * }//end delete }//end ask for confirmation + * + * } else { //end check if a row is selected JOptionPane + * .showMessageDialog( null, + * "Bitte wĂ€hlen Sie ein eigenes Image aus.", "Message", + * JOptionPane.INFORMATION_MESSAGE); } + */ - } - }); + } + }); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); @@ -566,15 +571,15 @@ public class DeleteLecture_GUI extends JFrame { mntmFaq.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - + OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getFAQ()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -582,7 +587,6 @@ public class DeleteLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmFaq); - JMenuItem mntmOtrs = new JMenuItem("OTRS"); mntmOtrs.addMouseListener(new MouseAdapter() { @@ -590,22 +594,22 @@ public class DeleteLecture_GUI extends JFrame { public void mousePressed(MouseEvent arg0) { OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getOTRS()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } }); mnNewMenu_1.add(mntmOtrs); - + JMenuItem mntmAbout = new JMenuItem("About"); mntmAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -614,30 +618,35 @@ public class DeleteLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmAbout); - + JMenu mnNewMenu_Info = new JMenu("Info"); mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - JOptionPane.showMessageDialog(c, HELP_MESSAGE, "Hilfe zu dieser OberflĂ€che", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(c, HELP_MESSAGE, + "Hilfe zu dieser OberflĂ€che", + JOptionPane.INFORMATION_MESSAGE); } }); menuBar.add(mnNewMenu_Info); - + c = this; } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) throws ParseException { + public DefaultTableModel initTableModel(DefaultTableModel model) + throws ParseException { List lectures; try { // Hole eine Liste der erlaubten Images fĂŒr die diese Person - //lectures = client.getLectureList(); - lectures = client.getLectureListPermissionWrite(person.verantwortlicher.getUserID()); + // lectures = client.getLectureList(); + lectures = client + .getLectureListPermissionWrite(person.verantwortlicher + .getUserID()); Iterator i = lectures.iterator(); - SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); + 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()) { @@ -647,9 +656,10 @@ public class DeleteLecture_GUI extends JFrame { lectures.get(x).desc, 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).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 model.addRow(obj); x++; @@ -664,20 +674,21 @@ 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 res=client.getLectureData(id); + + 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 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)); + labelimage.setText(res.get("imagepath").substring( + res.get("imagepath").indexOf("/") + 1)); labelimageversion.setText(res.get("imageversion")); - -} -} + } +}//end class -- cgit v1.2.3-55-g7522