Revision: 8100
Author: [email protected]
Date: Tue May 11 19:14:49 2010
Log: Allow user friendly names on Property

Review at http://gwt-code-reviews.appspot.com/509801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8100

Modified:
/branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeRecord.java /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpenseRecord.java /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java
 /branches/2.1/bikeshed/src/com/google/gwt/valuestore/shared/Property.java
/branches/2.1/bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java

=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeRecord.java Mon May 10 19:50:25 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/EmployeeRecord.java Tue May 11 19:14:49 2010
@@ -34,14 +34,14 @@
    */
   String TOKEN = "EmployeeRecord";

- Property<String> userName = new Property<String>("userName", String.class);
-  Property<String> displayName = new Property<String>("displayName",
+ Property<String> userName = new Property<String>("userName", "User Name", String.class); + Property<String> displayName = new Property<String>("displayName", "Display Name",
       String.class);
- Property<String> password = new Property<String>("password", String.class);
-  Property<String> supervisorKey = new Property<String>("supervisorKey",
+ Property<String> password = new Property<String>("password", "Password", String.class); + Property<String> supervisorKey = new Property<String>("supervisorKey", "Supervisor Key",
       String.class);

- Property<String> department = new Property<String>("department", String.class); + Property<String> department = new Property<String>("department", "Department", String.class);

   String getDepartment();

=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpenseRecord.java Tue May 11 10:56:00 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpenseRecord.java Tue May 11 19:14:49 2010
@@ -36,13 +36,13 @@
    */
   String TOKEN = "ExpenseRecord";

-  Property<Double> amount = new Property<Double>("amount", Double.class);
- Property<String> approval = new Property<String>("approval", String.class); - Property<String> category = new Property<String>("category", String.class);
-  Property<Date> created = new Property<Date>("created", Date.class);
- Property<String> description = new Property<String>("description", String.class); - Property<String> reasonDenied = new Property<String>("reasonDenied", String.class); - Property<String> reportId = new Property<String>("reportId", String.class); + Property<Double> amount = new Property<Double>("amount", "Amount", Double.class); + Property<String> approval = new Property<String>("approval", "Approval", String.class); + Property<String> category = new Property<String>("category", "Category", String.class); + Property<Date> created = new Property<Date>("created", "Created", Date.class); + Property<String> description = new Property<String>("description", "Description", String.class); + Property<String> reasonDenied = new Property<String>("reasonDenied", "Reason Denied", String.class); + Property<String> reportId = new Property<String>("reportId", "Report Id", String.class);

   Double getAmount();

=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java Tue May 11 17:08:18 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java Tue May 11 19:14:49 2010
@@ -36,13 +36,13 @@
    */
   String TOKEN = "ReportRecord";

- Property<String> approvedSupervisorKey = new Property<String>("approvedSupervisorKey", + Property<String> approvedSupervisorKey = new Property<String>("approvedSupervisorKey", "Approved Supervisor Key",
       String.class);
-  Property<Date> created = new Property<Date>("created", Date.class);
- Property<String> department = new Property<String>("department", String.class);
-  Property<String> notes = new Property<String>("notes", String.class);
-  Property<String> purpose = new Property<String>("purpose", String.class);
-  Property<String> reporterKey = new Property<String>("reporterKey",
+ Property<Date> created = new Property<Date>("created", "Created", Date.class); + Property<String> department = new Property<String>("department", "Department", String.class); + Property<String> notes = new Property<String>("notes", "Notes", String.class); + Property<String> purpose = new Property<String>("purpose", "Purpose", String.class); + Property<String> reporterKey = new Property<String>("reporterKey", "Reporter Key",
       String.class);

   String getApprovedSupervisorKey();
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/valuestore/shared/Property.java Tue Apr 20 16:34:24 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/valuestore/shared/Property.java Tue May 11 19:14:49 2010
@@ -23,15 +23,30 @@
 public class Property<V> {
   private final String name;
   private final Class<V> type;
+  private final String displayName;

   /**
-   * @param name the property's name
+   * @param name the property's name and displayName
    * @param type the class of the property's value
    */
   public Property(String name, Class<V> type) {
+    this(name, name, type);
+  }
+
+  /**
+   * @param name the property's name
+   * @param displayName the property's user visible name
+   * @param type the class of the property's value
+   */
+  public Property(String name, String displayName, Class<V> type) {
     this.name = name;
+    this.displayName = displayName;
     this.type = type;
   }
+
+  public String getDisplayName() {
+    return displayName;
+  }

   public String getName() {
     return name;
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java Fri May 7 15:22:39 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/valuestore/ui/AbstractRecordListView.java Tue May 11 19:14:49 2010
@@ -93,7 +93,7 @@
     table.setSelectionEnabled(true);

     for (PropertyColumn<R, ?> column : columns) {
-      table.addColumn(column, column.getProperty().getName());
+      table.addColumn(column, column.getProperty().getDisplayName());
       properties.add(column.getProperty());
     }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to