]> source.dussan.org Git - vaadin-framework.git/commitdiff
"Viewed" -checkbox added
authorMarc Englund <marc.englund@itmill.com>
Fri, 30 Nov 2007 13:41:57 +0000 (13:41 +0000)
committerMarc Englund <marc.englund@itmill.com>
Fri, 30 Nov 2007 13:41:57 +0000 (13:41 +0000)
svn changeset:3075/svn branch:trunk

src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java
src/com/itmill/toolkit/demo/featurebrowser/LabelsExample.java

index d8081ebce7895b374bebcab1c05c3198cf541c64..02d5689d5e090ba7b28c59a9e252a1d333d7bba9 100644 (file)
@@ -155,6 +155,9 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         } catch (Exception e) {
             e.printStackTrace(System.err);
         }
+        // Hide some columns
+        table.setVisibleColumns(new Object[] { PROPERTY_ID_CATEGORY,
+                PROPERTY_ID_NAME, PROPERTY_ID_DESC, PROPERTY_ID_VIEWED });
         table.addListener(this);
         table.setImmediate(true);
         split2.addComponent(table);
@@ -251,7 +254,9 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         prop = item.getItemProperty(PROPERTY_ID_CLASS);
         prop.setValue(data[p++]);
         prop = item.getItemProperty(PROPERTY_ID_VIEWED);
-        prop.setValue(data[p++]);
+        Button b = new Button("", false);
+        b.setEnabled(false);
+        prop.setValue(b);
     }
 
     private HierarchicalContainer createContainer() {
@@ -259,10 +264,9 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         c.addContainerProperty(PROPERTY_ID_CATEGORY, String.class, null);
         c.addContainerProperty(PROPERTY_ID_NAME, String.class, "");
         c.addContainerProperty(PROPERTY_ID_DESC, String.class, "");
-        c.addContainerProperty(PROPERTY_ID_CLASS, Class.class, Button.class);
-        c
-                .addContainerProperty(PROPERTY_ID_VIEWED, Boolean.class,
-                        Boolean.FALSE);
+        c.addContainerProperty(PROPERTY_ID_CLASS, Class.class, null);
+        c.addContainerProperty(PROPERTY_ID_VIEWED, Button.class, new Button("",
+                false));
         return c;
     }
 
@@ -270,6 +274,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         if (event.getProperty() == tree) {
             Object id = tree.getValue();
             Item item = tree.getItem(id);
+            //
             String section;
             if (tree.isRoot(id)) {
                 section = ""; // show all sections
@@ -291,6 +296,8 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
                                 false, true);
             }
             if (!tree.hasChildren(id)) {
+                // Example, not section
+                // update table selection
                 table.setValue(id);
             }
 
@@ -309,6 +316,13 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
                     ts.removeAllComponents();
                     ts.addTab(component, caption, null);
                 }
+                // update "viewed" state
+                Button b = (Button) item.getItemProperty(PROPERTY_ID_VIEWED)
+                        .getValue();
+                if (b != null) {
+                    b.setValue(Boolean.TRUE);
+                }
+                table.requestRepaint();
             }
         }
 
@@ -326,9 +340,4 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         return (Component) components.get(componentClass);
     }
 
-    public class Dummy extends Label {
-        public Dummy() {
-            super("Dummy component");
-        }
-    }
 }
index 25fb189437f21fc1d57a005f96518f49465910f2..04e335276789836dcb05dc29504abd460afea4d2 100644 (file)
@@ -20,8 +20,8 @@ public class LabelsExample extends CustomComponent {
 \r
     private static final String pre = "This text has linebreaks.\n\n"\r
             + "They will show up in a preformatted Label,\n"\r
-            + "but not in a \"plain\" Label.\n\n" + "       Indented row. \n"\r
-            + "       Same indentation.";\r
+            + "but not in a \"plain\" Label.\n\n"\r
+            + "       This is an indented row. \n       Same indentation here.";\r
 \r
     public LabelsExample() {\r
 \r