summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java
diff options
context:
space:
mode:
authorMichael Wilson2014-08-21 13:40:29 +0200
committerMichael Wilson2014-08-21 13:40:29 +0200
commitfee1f46c12470fd5909aaf1b84a479ec2d2d42a7 (patch)
tree0c9bffe46ebaced07835023541c84b4c5650a5d8 /Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java
parentDeleted dead code and show version number in server log file (diff)
downloadtutor-module-fee1f46c12470fd5909aaf1b84a479ec2d2d42a7.tar.gz
tutor-module-fee1f46c12470fd5909aaf1b84a479ec2d2d42a7.tar.xz
tutor-module-fee1f46c12470fd5909aaf1b84a479ec2d2d42a7.zip
Imagename darf keine Sonderzeichen enthalten
Diffstat (limited to 'Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java')
-rw-r--r--Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java64
1 files changed, 54 insertions, 10 deletions
diff --git a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java b/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java
index 5ebee0c1..114e6952 100644
--- a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java
+++ b/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java
@@ -56,7 +56,7 @@ public class EditImageAllgemein_GUI extends JFrame {
private JTextField Hochschule;
private JTextField EMail;
private JTextField imagename;
- JTextArea textAreadesc;
+ private JTextArea textAreadesc;
ThriftConnection con = new ThriftConnection();
Client client = models.Client.clientcon.getClient();
private JPanel panel_2;
@@ -65,6 +65,8 @@ public class EditImageAllgemein_GUI extends JFrame {
private JPanel buttonPane;
private JButton backButton;
private JButton okButton;
+ boolean textfieldsHaveContent = false; //no textfield is empty
+ boolean nameIsLettersOnly = false; //imagename only contains letters
/**
* Create the dialog.
@@ -296,13 +298,7 @@ public class EditImageAllgemein_GUI extends JFrame {
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// check is textfield is empty
- if (imagename.getText().length() <= 0) {
- JOptionPane.showMessageDialog(null,
- "Bitte geben Sie einen Labornamen ein.",
- "Daten nicht vollst\u00e4ndig",
- JOptionPane.INFORMATION_MESSAGE);
-
- } else {
+ if (checkContent() == true && checkNameIsLettersOnly() == true) {
// setze Namen, egal ob alt oder nicht
Image.image.setImagename(imagename.getText());
@@ -313,6 +309,9 @@ public class EditImageAllgemein_GUI extends JFrame {
EditImageTechnisch_GUI ea = new EditImageTechnisch_GUI();
ea.setVisible(true);
dispose();
+
+ } else {
+
}// end else
}
});
@@ -444,5 +443,50 @@ public class EditImageAllgemein_GUI extends JFrame {
e.getCause() + "\n" + e.getStackTrace(), "Debug-Message",
JOptionPane.ERROR_MESSAGE);
}
- }
-}
+ }//end initData()
+
+ public boolean checkNameIsLettersOnly() {
+ nameIsLettersOnly = false;
+
+ //only allow letter from alphabet and nothing else
+ if (imagename.getText().matches("[a-zA-Z]+")) {
+ nameIsLettersOnly = true;
+ } else {
+ JOptionPane
+ .showMessageDialog(
+ null,
+ "Der Imagename darf keine Leer- oder Sonderzeichen enthalten.",
+ "Unerlaubte Zeichen",
+ JOptionPane.INFORMATION_MESSAGE);
+ }// if
+
+ return nameIsLettersOnly;
+ }// end nameIsLettersOnly
+
+ public boolean checkContent(){
+ textfieldsHaveContent=false;
+
+ //check if any textfield is empty
+ if(imagename.getText().isEmpty() == false
+ && textAreadesc.getText().isEmpty() == false
+ && Vorname.getText().isEmpty() == false
+ && Nachname.getText().isEmpty() == false
+ && Hochschule.getText().isEmpty() == false
+ && EMail.getText().isEmpty() == false) {
+ //all textfields have content
+ textfieldsHaveContent = true;
+ } else {
+ JOptionPane
+ .showMessageDialog(
+ null,
+ "Bitte geben Sie alle notwendigen Daten an!",
+ "Daten unvollst\u00e4ndig",
+ JOptionPane.INFORMATION_MESSAGE);
+ }//end if
+
+ return textfieldsHaveContent;
+ }//end checkContent
+
+
+
+}//end class