changeset 613:471ca61b83b5

#165 Set the max length of project names to 50 characters. flys-client/trunk@2228 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 24 Jun 2011 11:19:35 +0000
parents e59f2569558e
children 80626c4a5bbf
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java
diffstat 6 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/ChangeLog	Fri Jun 24 11:19:35 2011 +0000
@@ -1,3 +1,18 @@
+2011-06-24  Ingo Weinzierl <ingo@intevation.de>
+
+	  flys/issue165 (Projektliste: Einige Auffälligkeiten nach Neuimplementierung)
+
+	* src/main/java/de/intevation/flys/client/client/ui/ProjectList.java:
+	  Set the maximal length of project names to 50 characters. If the name,
+	  entered by the user, is longer than this max value, it is not saved to
+	  artifact server and the old name is displayed again.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Added warning message for too long project names.
+
 2011-06-24  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 24 11:19:35 2011 +0000
@@ -40,6 +40,8 @@
 
     String really_delete();
 
+    String project_name_too_long();
+
     String logout();
 
     String switch_language();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 24 11:19:35 2011 +0000
@@ -14,6 +14,7 @@
 projectlist_title = Title
 projectlist_favorite = Permanent
 really_delete = Do you really want to delete this project?
+project_name_too_long = The entered project name is too long. Max length is $LEN characters.
 switch_language = German
 info = Info
 warning = Attention
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Jun 24 11:19:35 2011 +0000
@@ -14,6 +14,7 @@
 projectlist_title = Titel
 projectlist_favorite = Dauerhaft
 really_delete = Wollen Sie dieses Projekt wirklich l\u00f6schen?
+project_name_too_long = Der eingegebene Projektname ist zu lang. Die maximale L\u00e4nge betr\u00e4gt $LEN Zeichen.
 switch_language = Englisch
 info = Info
 warning = Achtung
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 24 11:19:35 2011 +0000
@@ -14,6 +14,7 @@
 projectlist_title = Title
 projectlist_favorite = Permanent
 really_delete = Do you really want to delete this project?
+project_name_too_long = The entered project name is too long. Max length is $LEN characters.
 switch_language = German
 info = Info
 warning = Attention
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Jun 24 09:53:25 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Jun 24 11:19:35 2011 +0000
@@ -76,6 +76,9 @@
     /** The initial width of this panel.*/
     public static final int MIN_WIDTH = 300;
 
+    /** The max length for new project names.*/
+    public static final int MAX_NAME_LENGTH = 50;
+
     public static final String COLUMN_DATE_WIDTH = "100px";
 
     public static final String COLUMN_TITLE_WIDTH = "*";
@@ -321,6 +324,21 @@
         Map newValues = event.getNewValues();
         String name   = (String) newValues.get("name");
 
+        int maxLength = getMaxNameLength();
+        int length    = name != null ? name.length() : 0;
+
+        if (length <= 0 || length > maxLength) {
+            String msg = messages.project_name_too_long();
+            msg        = msg.replace("$LEN", String.valueOf(maxLength));
+            SC.warn(msg);
+
+            ListGridRecord[] rs = grid.getRecords();
+            rs[row] = (ListGridRecord) event.getOldRecord();
+            grid.setRecords(rs);
+
+            return;
+        }
+
         c.setName(name);
         updateCollectionName(c);
     }
@@ -481,6 +499,11 @@
     }
 
 
+    public int getMaxNameLength() {
+        return MAX_NAME_LENGTH;
+    }
+
+
     /**
      * Builds the field in the grid that displays the creation time of a
      * project.

http://dive4elements.wald.intevation.org