summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java')
-rw-r--r--Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java41
1 files changed, 39 insertions, 2 deletions
diff --git a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java b/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java
index ddca2323..57d36515 100644
--- a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java
+++ b/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java
@@ -24,6 +24,7 @@ import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
@@ -327,9 +328,45 @@ public class DeleteLecture_GUI extends JFrame {
button = new JButton("L\u00F6schen");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- String imageid;
- String imageversion;
+ String lectureID="";
int eingabe;
+
+ //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ö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();
+ System.out.println("Lösche Lecture "+lectureID);
+ try {
+ if(client.deleteLecture(lectureID)){
+ System.out.println("Löschen erfolgreich");
+ //delete successful
+ con.closeThriftConnection();
+ DeleteLecture_GUI dl = new DeleteLecture_GUI();
+ dl.setVisible(true);
+ dispose();
+ } else {
+ //delete not successful
+ 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
+
+ }//end check if a row is selected
}
});