summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui
diff options
context:
space:
mode:
authorMichael Wilson2014-11-18 13:26:57 +0100
committerMichael Wilson2014-11-18 13:26:57 +0100
commitf9904d9a361d139ab3fe14f099b341fcc6cc1b63 (patch)
tree8574a0b74b535898fb8a848bc9467eb40ac09e41 /dozentenmodul/src/main/java/gui
parent- (diff)
downloadtutor-module-f9904d9a361d139ab3fe14f099b341fcc6cc1b63.tar.gz
tutor-module-f9904d9a361d139ab3fe14f099b341fcc6cc1b63.tar.xz
tutor-module-f9904d9a361d139ab3fe14f099b341fcc6cc1b63.zip
• Beim Bearbeiten eines Image oder einer Veranstaltung wurde bisher der aktuell eingeloggte Benutzer immer neu als Verantwortlicher eingetragen --> Der Verantwortliche ändert sich nun nicht mehr und wird korrekt angezeigt
Diffstat (limited to 'dozentenmodul/src/main/java/gui')
-rw-r--r--dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java31
-rw-r--r--dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java19
-rw-r--r--dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java40
-rw-r--r--dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java11
-rw-r--r--dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java19
-rw-r--r--dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java150
6 files changed, 118 insertions, 152 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java
index 778fbed1..28dae62b 100644
--- a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java
@@ -37,6 +37,7 @@ import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import models.Image;
+import models.ItemOwner;
import models.Links;
import models.person;
@@ -104,7 +105,6 @@ public class EditImageAllgemein_GUI extends JFrame {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
// Setzt den Fenstertitel
@@ -159,8 +159,8 @@ public class EditImageAllgemein_GUI extends JFrame {
Vorname.setEditable(false);
Vorname.setEnabled(false);
Vorname.setBackground(Color.WHITE);
- Vorname.setText(person.verantwortlicher.getVorname());
- //Vorname.setText(Image.image.get);
+ //Vorname.setText(person.verantwortlicher.getVorname());
+ Vorname.setText(ItemOwner.itemOwner.getVorname());
Vorname.setColumns(10);
Vorname.setBounds(145, 245, 350, 20);
panel_1.add(Vorname);
@@ -174,7 +174,8 @@ public class EditImageAllgemein_GUI extends JFrame {
Nachname.setEnabled(false);
Nachname.setEditable(false);
Nachname.setBackground(Color.WHITE);
- Nachname.setText(person.verantwortlicher.getName());
+ //Nachname.setText(person.verantwortlicher.getName());
+ Nachname.setText(ItemOwner.itemOwner.getNachname());
Nachname.setColumns(10);
Nachname.setBounds(145, 276, 350, 20);
panel_1.add(Nachname);
@@ -188,7 +189,8 @@ public class EditImageAllgemein_GUI extends JFrame {
Hochschule.setEnabled(false);
Hochschule.setEditable(false);
Hochschule.setBackground(Color.WHITE);
- Hochschule.setText(person.verantwortlicher.getHochschule());
+ //Hochschule.setText(person.verantwortlicher.getHochschule());
+ Hochschule.setText(ItemOwner.itemOwner.getHochschule());
Hochschule.setColumns(10);
Hochschule.setBounds(145, 307, 350, 20);
panel_1.add(Hochschule);
@@ -202,7 +204,8 @@ public class EditImageAllgemein_GUI extends JFrame {
EMail.setEnabled(false);
EMail.setEditable(false);
EMail.setBackground(Color.WHITE);
- EMail.setText(person.verantwortlicher.getEMail());
+ //EMail.setText(person.verantwortlicher.getEMail());
+ EMail.setText(ItemOwner.itemOwner.getEmail());
EMail.setColumns(10);
EMail.setBounds(145, 338, 350, 20);
panel_1.add(EMail);
@@ -385,11 +388,8 @@ public class EditImageAllgemein_GUI extends JFrame {
URI windows;
try {
windows = new URI(Links.getFAQ());
-
open.openWebpage(windows);
-
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -407,11 +407,8 @@ public class EditImageAllgemein_GUI extends JFrame {
URI windows;
try {
windows = new URI(Links.getOTRS());
-
open.openWebpage(windows);
-
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -427,14 +424,7 @@ public class EditImageAllgemein_GUI extends JFrame {
}
});
mnNewMenu_1.add(menuItem);
- // setFocusTraversalPolicy(new FocusTraversalOnArray(new
- // Component[]{getContentPane(), panel_2, lblNewLabel,
- // txtpnBitteWhlenSie, contentPanel, panel_1, label, Vorname, label_7,
- // Nachname, label_8, Hochschule, label_9, EMail, lblImagename,
- // imagename, txtrGebenSieBitte, panel, lblPflichtfelder, lblHauptmen,
- // label_1, lblVlimage, label_2, lblNewLabel_1, buttonPane, backButton,
- // okButton, separator, separator_1, menuBar, mnNewMenu_1, mntmFaq,
- // mntmOtrs}));
+
JMenu mnNewMenu_Info = new JMenu("Info");
mnNewMenu_Info.addMouseListener(new MouseAdapter() {
@Override
@@ -484,7 +474,6 @@ public class EditImageAllgemein_GUI extends JFrame {
Image.image.setShareMode(mode);
Image.image.setOS(map.get("os"));
} catch (TException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(c,
e.getCause() + "\n" + e.getStackTrace(), "Debug-Message",
diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
index 95f261c2..348828fe 100644
--- a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java
@@ -659,7 +659,6 @@ public class FTPEditUploader_GUI extends JFrame implements
Image.image.getDesc(),
//Image.image.getImagepath(),
"temp/"+Image.image.getNewName(),
-
Image.image.isLicensed(),
Image.image.isInternet(),
Image.image.getRam(),
@@ -681,15 +680,18 @@ public class FTPEditUploader_GUI extends JFrame implements
Image.image.getImagename(),
Image.image.getImagename(),
Image.image.getDesc(),
-
//"temp/" + Image.image.getNewName(), //wrong
Image.image.getImagepath(),
-
- Image.image.isLicensed(), Image.image.isInternet(),
- Image.image.getRam(), Image.image.getCpu(),
- Image.image.getImageId(), Image.image.getVersion(),
- Image.image.isVorlage(), Image.image.getFilesize(),
- Image.image.getShareMode(), Image.image.getOS());
+ Image.image.isLicensed(),
+ Image.image.isInternet(),
+ Image.image.getRam(),
+ Image.image.getCpu(),
+ Image.image.getImageId(),
+ Image.image.getVersion(),
+ Image.image.isVorlage(),
+ Image.image.getFilesize(),
+ Image.image.getShareMode(),
+ Image.image.getOS());
if (fileupload == true) {
client.startFileCopy(Image.image.getNewName());
@@ -697,7 +699,6 @@ public class FTPEditUploader_GUI extends JFrame implements
}
}
- // set additional user rights - quick and dirty TODO refactor
// remove all additional user permissions on first stage
diff --git a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java
index cfb83308..197068e8 100644
--- a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -53,6 +54,7 @@ import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import models.Image;
+import models.ItemOwner;
import models.Links;
import models.person;
@@ -442,7 +444,12 @@ public class SearchEditImage_GUI extends JFrame {
.convertRowIndexToModel(tablemyImages
.getSelectedRow()),
7).toString();
+
+ //write the values into the information pane on the right hand side
writeImageData(imageid, version);
+
+ //fill the itemOwnder model with information from selected item
+ setItemOwnerInformation(imageid);
}
}
});
@@ -673,7 +680,6 @@ public class SearchEditImage_GUI extends JFrame {
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -694,7 +700,6 @@ public class SearchEditImage_GUI extends JFrame {
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -775,7 +780,6 @@ public class SearchEditImage_GUI extends JFrame {
return model;
} catch (TException | ParseException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(c,
e1.getCause() + "\n" + e1.getStackTrace(), "Debug-Message",
@@ -846,10 +850,32 @@ public class SearchEditImage_GUI extends JFrame {
} catch (TException | ParseException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
- }
+ }//end writeImageData
+
+
+ public void setItemOwnerInformation(String imageid){
+ Map<String, String> map = new HashMap<String, String>();
+
+ try {
+ //get values from server and set them in model
+ map=client.getItemOwner(imageid);
+
+ ItemOwner.itemOwner.setUserID(map.get("userID"));
+ ItemOwner.itemOwner.setUsername(map.get("loginName"));
+ ItemOwner.itemOwner.setNachname(map.get("Nachname"));
+ ItemOwner.itemOwner.setVorname(map.get("Vorname"));
+ ItemOwner.itemOwner.setEmail(map.get("mail"));
+ ItemOwner.itemOwner.setHochschule(map.get("institution"));
+
+
+ } catch (TException e) {
+ e.printStackTrace();
+ }
+
+ }//end setItemInformation
+
public static String byteToGigabyte(long bytes, boolean si) {
int unit = si ? 1000 : 1024;
@@ -857,5 +883,5 @@ public class SearchEditImage_GUI extends JFrame {
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
- }
-}
+ }//end byteToGigabyte
+}// end class
diff --git a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java
index 0f68de44..fa98d193 100644
--- a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java
+++ b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java
@@ -47,6 +47,7 @@ import javax.swing.border.TitledBorder;
import models.GUIRights;
import models.Image;
import models.ImageRights;
+import models.ItemOwner;
import models.Lecture;
import models.Links;
import models.RightsManagement;
@@ -139,12 +140,16 @@ public class MainMenue_GUI extends JFrame {
panel.add(txtpnBitteWhlenSie);
}
- //reset the list of permissions every time the user goes back to the main menu
+
+
+ //reset the list of permissions and models
+ //every time the user goes back to the main menu
RightsManagement.rightsManagement.getPermittedUserList().clear();
- //reset model
Image.image.reset();
- //Lecture.lecture.reset();
+ ItemOwner.itemOwner.reset();
+
+
setResizable(false); // window is not resizable
contentPanel.setBounds(10, 104, 567, 502);
diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
index 98e2d513..45d4b0e2 100644
--- a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
+++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java
@@ -40,6 +40,7 @@ import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import models.Image;
+import models.ItemOwner;
import models.Lecture;
import models.Links;
import models.person;
@@ -101,7 +102,7 @@ public class EditLectureAllgemein_GUI extends JFrame {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
setTitle("bwLehrpool Suite - Veranstaltung bearbeiten");
@@ -153,7 +154,8 @@ public class EditLectureAllgemein_GUI extends JFrame {
Vorname = new JTextField();
Vorname.setEditable(false);
Vorname.setEnabled(false);
- Vorname.setText(person.verantwortlicher.getVorname());
+ //Vorname.setText(person.verantwortlicher.getVorname());
+ Vorname.setText(ItemOwner.itemOwner.getVorname());
Vorname.setBackground(Color.WHITE);
Vorname.setColumns(10);
Vorname.setBounds(145, 33, 350, 20);
@@ -167,7 +169,8 @@ public class EditLectureAllgemein_GUI extends JFrame {
Nachname = new JTextField();
Nachname.setEnabled(false);
Nachname.setEditable(false);
- Nachname.setText(person.verantwortlicher.getName());
+ //Nachname.setText(person.verantwortlicher.getName());
+ Nachname.setText(ItemOwner.itemOwner.getNachname());
Nachname.setBackground(Color.WHITE);
Nachname.setColumns(10);
Nachname.setBounds(145, 64, 350, 20);
@@ -181,7 +184,8 @@ public class EditLectureAllgemein_GUI extends JFrame {
Hochschule = new JTextField();
Hochschule.setEnabled(false);
Hochschule.setEditable(false);
- Hochschule.setText(person.verantwortlicher.getHochschule());
+ //Hochschule.setText(person.verantwortlicher.getHochschule());
+ Hochschule.setText(ItemOwner.itemOwner.getHochschule());
Hochschule.setBackground(Color.WHITE);
Hochschule.setColumns(10);
Hochschule.setBounds(145, 95, 350, 20);
@@ -195,7 +199,8 @@ public class EditLectureAllgemein_GUI extends JFrame {
EMail = new JTextField();
EMail.setEnabled(false);
EMail.setEditable(false);
- EMail.setText(person.verantwortlicher.getEMail());
+ //EMail.setText(person.verantwortlicher.getEMail());
+ EMail.setText(ItemOwner.itemOwner.getEmail());
EMail.setBackground(Color.WHITE);
EMail.setColumns(10);
EMail.setBounds(145, 126, 350, 20);
@@ -526,7 +531,7 @@ public class EditLectureAllgemein_GUI extends JFrame {
windows = new URI(Links.getFAQ());
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}
@@ -543,7 +548,7 @@ public class EditLectureAllgemein_GUI extends JFrame {
windows = new URI(Links.getOTRS());
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}
diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java
index ca33dc3c..b6cb5f10 100644
--- a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java
+++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java
@@ -22,6 +22,7 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -52,6 +53,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
+import models.ItemOwner;
import models.Lecture;
import models.Links;
import models.person;
@@ -135,7 +137,7 @@ public class EditLectureSearch_GUI extends JFrame {
//initTableModel(modelAll);
} catch (ParseException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
@@ -175,7 +177,7 @@ public class EditLectureSearch_GUI extends JFrame {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
// Setzt den Fenstertitel
@@ -307,19 +309,25 @@ public class EditLectureSearch_GUI extends JFrame {
if(tablemyLectures.getSelectedRow() != -1)
{
- String imageid = modelMyLectures.getValueAt(
+ String lectureid = modelMyLectures.getValueAt(
tablemyLectures
.convertRowIndexToModel(tablemyLectures
.getSelectedRow()), 8)
.toString();
try {
- writeLectureData(imageid);
+
+ //write the values into the information pane on the right hand side
+ writeLectureData(lectureid);
+
+ //fill the itemOwnder model with information from selected item
+ setItemOwnerInformation(lectureid);
+
} catch (TException e1) {
- // TODO Auto-generated catch block
+
e1.printStackTrace();
} catch (ParseException e1) {
- // TODO Auto-generated catch block
+
e1.printStackTrace();
}
}
@@ -414,7 +422,7 @@ public class EditLectureSearch_GUI extends JFrame {
enddate = out.format(in.parse(enddate));
startdate = out.format(in.parse(startdate));
} catch (ParseException e2) {
- // TODO Auto-generated catch block
+
e2.printStackTrace();
}
@@ -427,7 +435,7 @@ public class EditLectureSearch_GUI extends JFrame {
Lecture.lecture.setStartdate(df
.parse(startdate));
} catch (ParseException e1) {
- // TODO Auto-generated catch block
+
e1.printStackTrace();
}
if (modelMyLectures
@@ -447,98 +455,7 @@ public class EditLectureSearch_GUI extends JFrame {
el.setVisible(true);
dispose();
}
- /*else if (tableAllLectures.getSelectedRow() != -1
- && tableAllLectures
- .getValueAt(
- tableAllLectures
- .getSelectedRow(), 5)
- .toString().equals(username)) {
-
- // a row is selected, do operations
-
- Lecture.lecture.setid(modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 8).toString());
- Lecture.lecture.setName(modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 0).toString());
- Lecture.lecture.setDesc(modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 1).toString());
- String date = modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 2).toString();
-
- Lecture.lecture.setLinkedImagename(modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 6).toString());
-
- int zweitesLeerzeichen = date.indexOf(" ",
- date.indexOf(" ") + 1);
-
- String startdate = date.substring(0,
- 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");
-
- try {
- // Format has to be "yyyy-MM-dd HH:mm:ss"
- Lecture.lecture.setEnddate(df.parse(enddate));
- Lecture.lecture.setStartdate(df
- .parse(startdate));
- } catch (ParseException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- if (modelAll
- .getValueAt(
- tableAllLectures
- .convertRowIndexToModel(tableAllLectures
- .getSelectedRow()),
- 3).toString().equals("1")) {
- Lecture.lecture.setActive(true);
- } else {
- Lecture.lecture.setActive(false);
- }
-
- EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI();
- el.setVisible(true);
- dispose();
- } else {
- JOptionPane
- .showMessageDialog(
- null,
- "Bitte wählen Sie ein eigenes Image aus.",
- "Message",
- JOptionPane.INFORMATION_MESSAGE);
- } // End Else */
+
} // end action
});
@@ -667,7 +584,7 @@ public class EditLectureSearch_GUI extends JFrame {
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}
@@ -688,7 +605,7 @@ public class EditLectureSearch_GUI extends JFrame {
open.openWebpage(windows);
} catch (URISyntaxException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
@@ -754,7 +671,7 @@ public class EditLectureSearch_GUI extends JFrame {
return model;
} catch (TException e1) {
- // TODO Auto-generated catch block
+
e1.printStackTrace();
}
return model;
@@ -790,6 +707,29 @@ public class EditLectureSearch_GUI extends JFrame {
res.get("imagepath").indexOf("/") + 1));
labelimageversion.setText(res.get("imageversion"));
- }
+ }//end writeLectureData
+
+ public void setItemOwnerInformation(String lectureid){
+ Map<String, String> map = new HashMap<String, String>();
+
+ try {
+ //get values from server and set them in model
+ map=client.getItemOwner(lectureid);
+
+ ItemOwner.itemOwner.setUserID(map.get("userID"));
+ ItemOwner.itemOwner.setUsername(map.get("loginName"));
+ ItemOwner.itemOwner.setNachname(map.get("Nachname"));
+ ItemOwner.itemOwner.setVorname(map.get("Vorname"));
+ ItemOwner.itemOwner.setEmail(map.get("mail"));
+ ItemOwner.itemOwner.setHochschule(map.get("institution"));
+
+
+
+ } catch (TException e) {
+ e.printStackTrace();
+ }
+
+ }//end setItemInformation
+
-}
+}//end class