]> source.dussan.org Git - vaadin-framework.git/commitdiff
Sampler intermediate commit; cleaning & slight modifications all over.
authorMarc Englund <marc.englund@itmill.com>
Mon, 2 Feb 2009 13:58:30 +0000 (13:58 +0000)
committerMarc Englund <marc.englund@itmill.com>
Mon, 2 Feb 2009 13:58:30 +0000 (13:58 +0000)
svn changeset:6705/svn branch:trunk

28 files changed:
WebContent/ITMILL/themes/sampler/sampler/flow.gif
WebContent/ITMILL/themes/sampler/sampler/grid.gif
WebContent/ITMILL/themes/sampler/sampler/hidetree.gif
WebContent/ITMILL/themes/sampler/sampler/list.gif
WebContent/ITMILL/themes/sampler/sampler/showtree.gif
WebContent/ITMILL/themes/sampler/sampler/styles.css
src/com/itmill/toolkit/demo/sampler/FeatureView.java
src/com/itmill/toolkit/demo/sampler/SamplerApplication.java
src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonLink.java
src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonSwitch.java
src/com/itmill/toolkit/demo/sampler/features/commons/ErrorsExample.java
src/com/itmill/toolkit/demo/sampler/features/link/LinkCurrentWindow.java
src/com/itmill/toolkit/demo/sampler/features/link/LinkNoDecorations.java
src/com/itmill/toolkit/demo/sampler/features/link/LinkSizedWindow.java
src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationCustomExample.java
src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationErrorExample.java
src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationHumanizedExample.java
src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationTrayExample.java
src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationWarningExample.java
src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxContains.java
src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxNewItems.java
src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxPlain.java
src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxStartsWith.java
src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectMultiple.java
src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingle.java
src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingleExample.java
src/com/itmill/toolkit/demo/sampler/features/selects/NativeSelection.java
src/com/itmill/toolkit/demo/sampler/features/tabsheets/TabSheetIconsExample.java

index 02d1233de268b35b70fca4a1a23ca8ed74e19aed..f6dcc1ed0522902508c6f0a42ab65ef3dc51fc26 100644 (file)
Binary files a/WebContent/ITMILL/themes/sampler/sampler/flow.gif and b/WebContent/ITMILL/themes/sampler/sampler/flow.gif differ
index d1ff16fc7fc21f113c8d682bda15a2a369aeeb5e..2500d8d15be20a3825451fbdabb6c1b5a228420c 100644 (file)
Binary files a/WebContent/ITMILL/themes/sampler/sampler/grid.gif and b/WebContent/ITMILL/themes/sampler/sampler/grid.gif differ
index 93671348a8f1ae4d042acf6b274afb347d4874a4..b3fe017b9b48f808a6539009302b6f51bb2e185c 100644 (file)
Binary files a/WebContent/ITMILL/themes/sampler/sampler/hidetree.gif and b/WebContent/ITMILL/themes/sampler/sampler/hidetree.gif differ
index 802ae56df361847410244a76cbde6a22b96d4161..9f4641bc9a4b29d4c9af36527aae932cedf6de3a 100644 (file)
Binary files a/WebContent/ITMILL/themes/sampler/sampler/list.gif and b/WebContent/ITMILL/themes/sampler/sampler/list.gif differ
index afba39a3e5fe8ac035a2965df295d72a658c08e3..258ffe36b430a888c2bb65fa059afbb9542ce5b9 100644 (file)
Binary files a/WebContent/ITMILL/themes/sampler/sampler/showtree.gif and b/WebContent/ITMILL/themes/sampler/sampler/showtree.gif differ
index c8fa6220f7a0b134219990fe8a33ef45933d3f5a..829e82e95e337563da8f6362584d94e8b84b92c4 100644 (file)
@@ -87,7 +87,7 @@
 }
 .i-app-SamplerApplication .i-caption-feature-controls {
        font-weight: bold;
-       font-size: 16px;
+       font-size: 18px;
        text-indent: 10px;
 }
 .i-app-SamplerApplication .feature-info {
        line-height: 20px;
 }
 .i-app-SamplerApplication .feature-info .i-panel-caption {
-       color: #def;
-       font-size: 22px;
+       color: #fff;
+       font-size: 16px;
        font-weight: bold;
        line-height: 25px;
 }
+/*
 .i-app-SamplerApplication .feature-info .i-panel-content {
        background: transparent url(finfofade.png) no-repeat 0px 5px;
 }
+*/
 .i-app-SamplerApplication .feature-info .i-caption {
        font-weight: bold;
        font-size: 16px;
 }
 
 .i-app-SamplerApplication .i-button-showcode {
-       border-bottom: 1px solid #eee;
-       padding-right: 10px;
+       border-bottom: 1px dotted #eee;
+       padding: 1px 0 1px 7px;
 }
 .i-app-SamplerApplication .i-button-showcode span {
-       float: right;
+       color: #999;
        text-decoration: none;
-       font-style: italic;
+       font-style: italic;;
 }
 .i-app-SamplerApplication .i-button-showcode:hover span {
        text-decoration: underline;
index fba906d70bf40e2bd8b0862fb062463f685b4e9b..433d1d551089ac9f4457a5be81f77ab372ea8464 100644 (file)
@@ -17,8 +17,8 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 
 public class FeatureView extends HorizontalLayout {
 
-    private static final String MSG_SHOW_SRC = "⊞ Show Java™ source";
-    private static final String MSG_HIDE_SRC = "⊟ Hide Java™ source";
+    private static final String MSG_SHOW_SRC = "Show Java™ source »";
+    private static final String MSG_HIDE_SRC = "Hide Java™ source";
 
     private Panel right;
     private Panel left;
@@ -51,10 +51,11 @@ public class FeatureView extends HorizontalLayout {
         right.setWidth("350px");
         right.setHeight("100%");
         addComponent(right);
+        right.getLayout().setMargin(false, true, true, true);
 
         controls = new VerticalLayout();
         controls.setStyleName("feature-controls");
-        controls.setCaption("Live example");
+        // controls.setCaption("Live example");
         showCode = new Button(MSG_SHOW_SRC, new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
                 toggleSource();
@@ -95,10 +96,11 @@ public class FeatureView extends HorizontalLayout {
             showSource(false);
 
             left.addComponent(controls);
+            controls.setCaption(feature.getName());
 
             left.addComponent(getExampleFor(feature));
 
-            right.setCaption(feature.getName());
+            right.setCaption("Description");
 
             Label l = new Label(feature.getDescription());
             l.setContentMode(Label.CONTENT_XHTML);
index b2102c1741a8f84f82be07b4b096e379570e99de..43655335275803bb954cab7150f512c935c019f5 100644 (file)
@@ -36,6 +36,7 @@ import com.itmill.toolkit.ui.VerticalLayout;
 import com.itmill.toolkit.ui.Window;
 import com.itmill.toolkit.ui.Button.ClickEvent;
 import com.itmill.toolkit.ui.Button.ClickListener;
+import com.itmill.toolkit.ui.PopupView.PopupVisibilityEvent;
 import com.itmill.toolkit.ui.UriFragmentUtility.FragmentChangedEvent;
 import com.itmill.toolkit.ui.UriFragmentUtility.FragmentChangedListener;
 
@@ -149,6 +150,9 @@ public class SamplerApplication extends Application {
         // breadcrumbs
         BreadCrumbs breadcrumbs = new BreadCrumbs();
 
+        Button previousSample;
+        Button nextSample;
+
         SamplerWindow() {
             // Main top/expanded-bottom layout
             VerticalLayout mainExpand = new VerticalLayout();
@@ -187,21 +191,20 @@ public class SamplerApplication extends Application {
                 }
             });
 
+            // Previous sample
+            previousSample = createPrevButton();
+            nav.addComponent(previousSample);
+            nav.setComponentAlignment(previousSample, Alignment.MIDDLE_RIGHT);
+            // Next sample
+            nextSample = createNextButton();
+            nav.addComponent(nextSample);
+            nav.setComponentAlignment(nextSample, Alignment.MIDDLE_LEFT);
             // "Search" combobox
             // TODO add input prompt
             Component search = createSearch();
             nav.addComponent(search);
             nav.setComponentAlignment(search, Alignment.MIDDLE_LEFT);
 
-            // Previous sample
-            Button b = createPrevButton();
-            nav.addComponent(b);
-            nav.setComponentAlignment(b, Alignment.MIDDLE_RIGHT);
-            // Next sample
-            b = createNextButton();
-            nav.addComponent(b);
-            nav.setComponentAlignment(b, Alignment.MIDDLE_LEFT);
-
             // togglebar
             // mainExpand.addComponent(toggleBar);
             toggleBar.setHeight("40px");
@@ -230,17 +233,17 @@ public class SamplerApplication extends Application {
             rightLayout.addComponent(mainArea);
             rightLayout.setExpandRatio(mainArea, 1);
 
-            // Show / hide tree
-            Component treeSwitch = createTreeSwitch();
-            toggleBar.addComponent(treeSwitch);
-            toggleBar.setExpandRatio(treeSwitch, 1);
-            toggleBar.setComponentAlignment(treeSwitch, Alignment.MIDDLE_RIGHT);
-
             // List/grid/coverflow
             Component mode = createModeSwitch();
             toggleBar.addComponent(mode);
             toggleBar.setComponentAlignment(mode, Alignment.MIDDLE_RIGHT);
 
+            // Show / hide tree
+            Component treeSwitch = createTreeSwitch();
+            nav.addComponent(treeSwitch);
+            // toggleBar.setExpandRatio(treeSwitch, 1);
+            nav.setComponentAlignment(treeSwitch, Alignment.MIDDLE_RIGHT);
+
             addListener(new CloseListener() {
                 public void windowClose(CloseEvent e) {
                     if (getMainWindow() != SamplerWindow.this) {
@@ -263,6 +266,10 @@ public class SamplerApplication extends Application {
             webAnalytics.trackPageview(path);
             uriFragmentUtility.setFragment(path, false);
             breadcrumbs.setPath(path);
+
+            previousSample.setEnabled(f != null);
+            nextSample.setEnabled(!allFeatures.isLastId(f));
+
             updateFeatureList(currentList);
         }
 
@@ -283,13 +290,21 @@ public class SamplerApplication extends Application {
          */
 
         private Component createSearch() {
-            ComboBox search = new ComboBox();
+            final ComboBox search = new ComboBox();
             search.setWidth("160px");
             search.setNewItemsAllowed(false);
             search.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS);
             search.setNullSelectionAllowed(true);
             search.setImmediate(true);
             search.setContainerDataSource(allFeatures);
+            for (Iterator it = allFeatures.getItemIds().iterator(); it
+                    .hasNext();) {
+                Object id = it.next();
+                if (id instanceof FeatureSet) {
+                    search.setItemIcon(id, new ClassResource("folder.gif",
+                            SamplerApplication.this));
+                }
+            }
             search.addListener(new ComboBox.ValueChangeListener() {
                 public void valueChange(ValueChangeEvent event) {
                     Feature f = (Feature) event.getProperty().getValue();
@@ -301,8 +316,20 @@ public class SamplerApplication extends Application {
                 }
             });
             // TODO add icons for section/sample
-
+            /*
+             * PopupView pv = new PopupView("", search) { public void
+             * changeVariables(Object source, Map variables) {
+             * super.changeVariables(source, variables); if (isPopupVisible()) {
+             * search.focus(); } } };
+             */
             PopupView pv = new PopupView("", search);
+            pv.addListener(new PopupView.PopupVisibilityListener() {
+                public void popupVisibilityChange(PopupVisibilityEvent event) {
+                    if (event.isPopupVisible()) {
+                        search.focus();
+                    }
+                }
+            });
             pv.setWidth("22px");
             pv.setHeight("22px");
             pv.setStyleName("quickjump");
@@ -332,7 +359,12 @@ public class SamplerApplication extends Application {
                     while (next != null && next instanceof FeatureSet) {
                         next = allFeatures.nextItemId(next);
                     }
-                    currentFeature.setValue(next);
+                    if (next != null) {
+                        currentFeature.setValue(next);
+                    } else {
+                        // could potentially occur if there is an empty section
+                        showNotification("Last sample");
+                    }
                 }
             });
             b.setWidth("22px");
@@ -354,6 +386,7 @@ public class SamplerApplication extends Application {
                     currentFeature.setValue(prev);
                 }
             });
+            b.setEnabled(false);
             b.setWidth("22px");
             b.setHeight("22px");
             b.setIcon(new ThemeResource("sampler/prev.png"));
@@ -471,7 +504,7 @@ public class SamplerApplication extends Application {
 
         public void show(Component c) {
             if (getCompositionRoot() != c) {
-                c.setSizeFull();
+                // c.setSizeFull();
                 setCompositionRoot(c);
             }
         }
@@ -508,7 +541,7 @@ public class SamplerApplication extends Application {
                     current += (i > 0 ? "/" : "") + parts[i];
                     Feature f = FeatureSet.FEATURES.getFeatureByPath(current);
                     link = new ActiveLink(f.getName(), new ExternalResource("#"
-                            + f.getPathName()));
+                            + getPathFor(f)));
                     link.setData(f);
                     link.addListener(this);
                     layout.addComponent(link);
@@ -634,12 +667,12 @@ public class SamplerApplication extends Application {
 
     private class FeatureGrid extends Panel implements FeatureList {
 
-        GridLayout grid = new GridLayout(5, 1);
+        GridLayout grid = new GridLayout(11, 1);
 
         FeatureGrid() {
             setSizeFull();
-            getLayout().setWidth("100%");
-            grid.setWidth("100%");
+            getLayout().setSizeUndefined();
+            // grid.setWidth("100%");
             grid.setSpacing(true);
             addComponent(grid);
             setStyleName(Panel.STYLE_LIGHT);
@@ -677,10 +710,10 @@ public class SamplerApplication extends Application {
                     Button b = new Button();
                     b.setStyleName(Button.STYLE_LINK);
                     b.addStyleName("screenshot");
-                    b.setIcon(new ClassResource(f.getClass(), f.getIconName(),
-                            SamplerApplication.this));
-                    b.setWidth("120px");
-                    b.setHeight("120px");
+                    b.setIcon(new ClassResource(f.getClass(), "75-"
+                            + f.getIconName(), SamplerApplication.this));
+                    b.setWidth("75px");
+                    b.setHeight("75px");
                     b.setDescription("<h3>" + f.getName() + "</h3>"
                             + f.getDescription());
                     b.addListener(new Button.ClickListener() {
index 94fb0933aee5bce6f2523ec095819a699f545c9f..996ea8d66c00861eebe63341ff9ec251347f68b6 100644 (file)
@@ -14,7 +14,8 @@ public class ButtonLink extends Feature {
 
     @Override
     public String getDescription() {
-        return "A link-styled button.";
+        return "A link-styled button; works like a Button but looks like a Link.<br/>"
+                + "I.e it does not actually link somewhere, but triggers a server-side event, just like a regular button.";
     }
 
     @Override
index f3bf7d52fc81384a113cc580332e837244dc9ef7..585a218f568798377346d6bdbe8a4320b2bd5a02 100644 (file)
@@ -3,14 +3,13 @@ package com.itmill.toolkit.demo.sampler.features.buttons;
 import com.itmill.toolkit.demo.sampler.APIResource;
 import com.itmill.toolkit.demo.sampler.Feature;
 import com.itmill.toolkit.demo.sampler.NamedExternalResource;
-import com.itmill.toolkit.demo.sampler.features.blueprints.ProminentPrimaryAction;
 import com.itmill.toolkit.ui.Button;
 
 public class ButtonSwitch extends Feature {
 
     @Override
     public String getDescription() {
-        return "A switch button.";
+        return "A switch button works like a regular button, triggering a server-side event, but it's state is 'sticky' - it toggles on or off, instead of popping right back out.<br/>Also know as a CheckBox.";
     }
 
     @Override
@@ -20,8 +19,7 @@ public class ButtonSwitch extends Feature {
 
     @Override
     public Class[] getRelatedFeatures() {
-        return new Class[] { ButtonPush.class, ButtonLink.class,
-                ProminentPrimaryAction.class };
+        return new Class[] { ButtonPush.class, ButtonLink.class };
     }
 
     @Override
index f402fa699ba73d2aed1be71ac84b657684624964..8b1da6415ddeae3d6db5921619bf83e37a977fbb 100644 (file)
@@ -11,7 +11,7 @@ public class ErrorsExample extends VerticalLayout {
         setSpacing(true);
 
         Panel panel = new Panel("Configure this");
-        panel.setComponentError(new UserError("This panel contains errors"));
+        panel.setComponentError(new UserError("'Input' contains an error"));
         addComponent(panel);
 
         TextField input = new TextField("Input");
index 0e183780a6dce50ee6c2afebddad6a4473e65372..7c10562a7420eb621e41ab2ba08926c3bf2613a9 100644 (file)
@@ -10,7 +10,10 @@ public class LinkCurrentWindow extends Feature {
 
     @Override
     public String getDescription() {
-        return "An external link.";
+        return "An external link - this is the basic HTML-style link, changing"
+                + " the url of the browser w/o triggering a server-side event"
+                + " (like the link-styled Button).<br/> By default, links open"
+                + " in the current browser window.";
     }
 
     @Override
index ce1917615ddc110bb8fefd4e6f9f812b25620725..ae2ee5b0002323d4eb9377cfbb8be594d2e37002 100644 (file)
@@ -10,7 +10,12 @@ public class LinkNoDecorations extends Feature {
 
     @Override
     public String getDescription() {
-        return "A link that opens a new window w/o decorations";
+        return "An basic HTML-style (external) link, opening a browser window"
+                + "w/o decorations. A Link changes"
+                + " the url of the browser w/o triggering a server-side event"
+                + " (like the link-styled Button).<br/> Links can open new"
+                + " browser windows, and configure the amount of browser"
+                + " features shown, such as toolbar and addressbar.";
     }
 
     @Override
index 5f044ac6607d3a1ec869ae1dc642b3daa23f099c..05abb6f09554736cbc0282984e3d103f865600a8 100644 (file)
@@ -10,7 +10,13 @@ public class LinkSizedWindow extends Feature {
 
     @Override
     public String getDescription() {
-        return "A link that opens a small new window w/o decorations";
+        return "An basic HTML-style (external) link, opening a small window w/o"
+                + " decorations.<br/> A link changes"
+                + " the url of the browser w/o triggering a server-side event"
+                + " (like the link-styled Button).<br/> Links can open new"
+                + " browser windows, and configure the amount of browser"
+                + " features shown, such as toolbar and addressbar, and can also"
+                + " set the size of the window.";
     }
 
     @Override
index 597d246d9baa9be2d59f2e0001669dbd378ded1a..cd1f224137e93b0cd6f4f0c977ec3afd1e7897b3 100644 (file)
@@ -19,6 +19,7 @@ public class NotificationCustomExample extends VerticalLayout {
 
     public NotificationCustomExample() {
         setSpacing(true);
+        setWidth(null); // layout will grow with content
 
         final TextField caption = new TextField("Caption");
         caption
@@ -28,7 +29,6 @@ public class NotificationCustomExample extends VerticalLayout {
 
         final RichTextArea description = new RichTextArea();
         description.setCaption("Description");
-        description.setWidth("400px");
         description
                 .setDescription("Additional information; try to keep it short.");
         addComponent(description);
@@ -50,7 +50,7 @@ public class NotificationCustomExample extends VerticalLayout {
         final Slider delay = new Slider("Delay (msec), -1 means click to hide");
         delay
                 .setDescription("Delay before fading<br/>Pull all the way to the left to get -1, which means forever (click to hide).");
-        delay.setWidth("400px");
+        delay.setWidth("100%"); // 'description' will push width
         delay.setMin(Notification.DELAY_FOREVER);
         delay.setMax(10000);
         addComponent(delay);
index 0bc3c99a5278edfea7bf3b1c60c905084224ee9c..203e4978999ac16f6aa6774dd429713d056206e6 100644 (file)
@@ -11,6 +11,7 @@ public class NotificationErrorExample extends VerticalLayout {
 
     public NotificationErrorExample() {
         setSpacing(true);
+        setWidth(null); // layout will grow with content
 
         final TextField caption = new TextField("Caption", "Upload failed");
         caption.setWidth("200px");
index 23f3006b348b927ea81112ab41c5dce1e70068ed..87079e9d11142e67a26046e93185a1e3edf94586 100644 (file)
@@ -10,6 +10,7 @@ public class NotificationHumanizedExample extends VerticalLayout {
 
     public NotificationHumanizedExample() {
         setSpacing(true);
+        setWidth(null); // layout will grow with content
 
         final TextField caption = new TextField("Caption", "Document saved");
         caption.setWidth("200px");
index e137b7d1e3058d733e1c1dbeed0fd10423a5057a..e6295d0c2bbaf4d1d49445e0ff825f1a0427e66c 100644 (file)
@@ -11,6 +11,7 @@ public class NotificationTrayExample extends VerticalLayout {
 
     public NotificationTrayExample() {
         setSpacing(true);
+        setWidth(null); // layout will grow with content
 
         final TextField caption = new TextField("Caption", "New message");
         caption.setWidth("200px");
index 3d6ac77345a77f572c25457a21b5e4f915ecefcc..a6b3ceecc360d980885b7dc439753f8cea3b55a9 100644 (file)
@@ -11,6 +11,7 @@ public class NotificationWarningExample extends VerticalLayout {
 
     public NotificationWarningExample() {
         setSpacing(true);
+        setWidth(null); // layout will grow with content
 
         final TextField caption = new TextField("Caption", "Upload canceled");
         caption.setWidth("200px");
index e6762f3f5b3b217178bbbb36dedfd7effdf367ab..7a7905c92e369cc3cb864f9d84e7a54e70c29811 100644 (file)
@@ -13,10 +13,14 @@ public class ComboBoxContains extends Feature {
 \r
     @Override\r
     public String getDescription() {\r
-        return "A drop-down selection component with single item selection."\r
-                + " A 'contains' filter has been used with this combo box,"\r
+        return "A drop-down selection component with single item selection.<br/>"\r
+                + " A 'contains' filter has been used in this example,"\r
                 + " so you can key in some text and only the options"\r
-                + " containing your input will be shown.";\r
+                + " containing your input will be shown.<br/>"\r
+                + " Because there are so many options, they are loaded on-demand"\r
+                + " (\"lazy-loading\") from the server when paging or"\r
+                + " filtering. This behavior is built-in and requires no extra"\r
+                + " code.";\r
     }\r
 \r
     @Override\r
index 6579b094ba2db38f5868bfe1597154d31f1ba959..8417dc0f3de278eb19647662b7d2212850105342 100644 (file)
@@ -13,10 +13,16 @@ public class ComboBoxNewItems extends Feature {
 \r
     @Override\r
     public String getDescription() {\r
-        return "A drop-down selection component with single item selection."\r
-                + " This selection box also allows you to input your own"\r
-                + " choice. Your input will also be added to the selection"\r
-                + " of available choices.";\r
+        return "A drop-down selection component with single item selection.<br/>"\r
+                + " This example also allows you to input your own"\r
+                + " choice - your input will be added to the selection"\r
+                + " of available choices. This behavior is built-in and can"\r
+                + " be enabled with one method call. Note that by using this"\r
+                + " feature, one can easily create <i>suggestion box</i> -type"\r
+                + " inputs that for example remembers the users previous input,"\r
+                + " or provides suggestions from a list of popular choices."\r
+                + " Configured like this (and optionally with a filter), the"\r
+                + " ComboBox can be a powerful alternative to TextField.";\r
     }\r
 \r
     @Override\r
index 6dceeea68acf26ea91bfe4ba5fb89637c01f47ab..b65ed4aab0cfc124d8156d6cf4d14e4cf31bd6e9 100644 (file)
@@ -14,7 +14,10 @@ public class ComboBoxPlain extends Feature {
     @Override\r
     public String getDescription() {\r
         return "A drop-down selection component with single item selection."\r
-                + " No special features used in this example";\r
+                + " Shown here is the most basic variant, which basically"\r
+                + " provides the same functionality as a NativeSelect with"\r
+                + " added lazy-loading if there are many options.<br/>"\r
+                + " See related examples for more advanced features.";\r
     }\r
 \r
     @Override\r
index a971097b98c230f0233577faf5804fdb1e7956f3..46a694956ed97d2b6e66552627ad28e5a42e547d 100644 (file)
@@ -13,10 +13,14 @@ public class ComboBoxStartsWith extends Feature {
 \r
     @Override\r
     public String getDescription() {\r
-        return "A drop-down selection component with single item selection."\r
-                + " A 'starts with' filter has been used with this combo box,"\r
-                + " so you can key in the beginning of your selection to narrow"\r
-                + " down the amount of choices.";\r
+        return "A drop-down selection component with single item selection.<br/>"\r
+                + " A 'starts-with' filter has been used in this example,"\r
+                + " so you can key in some text and only the options"\r
+                + " beginning with your input will be shown.<br/>"\r
+                + " Because there are so many options, they are loaded on-demand"\r
+                + " (\"lazy-loading\") from the server when paging or"\r
+                + " filtering. This behavior is built-in and requires no extra"\r
+                + " code.";\r
     }\r
 \r
     @Override\r
index 8c5c069918228291d921c3409ef2c4efe3a8dc6b..e71680643dd25620b5f66253d4ee2a6413929086 100644 (file)
@@ -14,8 +14,10 @@ public class ListSelectMultiple extends Feature {
     @Override\r
     public String getDescription() {\r
         return "A simple list select component with multiple item selection."\r
-                + " A null selection is also allowed in this example."\r
-                + "<br>You can select multiple items from the list by holding"\r
+                + " You can allow or disallow <i>null selection</i> - i.e the"\r
+                + " possibility to make an empty selection. Null selection is"\r
+                + " allowed in this example.<br/>"\r
+                + "You can select multiple items from the list by holding"\r
                 + " the CTRL of SHIFT key while clicking the items.";\r
     }\r
 \r
index 78ae9aee1d0b8642edac54b648a459c9ce1bd2f7..e8865ae20a2c458c445ef2b54d1408ea91a3e93c 100644 (file)
@@ -13,8 +13,10 @@ public class ListSelectSingle extends Feature {
 \r
     @Override\r
     public String getDescription() {\r
-        return "A simple list select component with single item selection."\r
-                + " A null selection is not allowed in this example.";\r
+        return "A simple list select component with single item selection.<br/>"\r
+                + " You can allow or disallow <i>null selection</i> - i.e the"\r
+                + " possibility to make an empty selection. Null selection is"\r
+                + " not allowed in this example.";\r
     }\r
 \r
     @Override\r
index 62df218ae27cf449edbadd3b8cbe95f654f539e6..78e36d6b0a92ed5f04a847c1206d961a9bee7d01 100644 (file)
@@ -1,5 +1,8 @@
 package com.itmill.toolkit.demo.sampler.features.selects;\r
 \r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
 import com.itmill.toolkit.data.Property;\r
 import com.itmill.toolkit.data.Property.ValueChangeEvent;\r
 import com.itmill.toolkit.ui.ListSelect;\r
@@ -8,27 +11,28 @@ import com.itmill.toolkit.ui.VerticalLayout;
 public class ListSelectSingleExample extends VerticalLayout implements\r
         Property.ValueChangeListener {\r
 \r
-    private static final String[] cities = new String[] { "Berlin", "Brussels",\r
-            "Helsinki", "Madrid", "Oslo", "Paris", "Stockholm" };\r
+    private static final List cities = Arrays.asList(new String[] { "Berlin",\r
+            "Brussels", "Helsinki", "Madrid", "Oslo", "Paris", "Stockholm" });\r
 \r
     public ListSelectSingleExample() {\r
         setSpacing(true);\r
 \r
-        ListSelect l = new ListSelect("Please select a city");\r
-        for (int i = 0; i < cities.length; i++) {\r
-            l.addItem(cities[i]);\r
-        }\r
-        l.setRows(7);\r
-        l.setNullSelectionAllowed(false);\r
-        l.setValue("Berlin");\r
-        l.setImmediate(true);\r
-        l.addListener(this);\r
-\r
-        addComponent(l);\r
+        // 'Shorthand' constructor - also supports data binding using Containers\r
+        ListSelect citySelect = new ListSelect("Please select a city", cities);\r
+\r
+        citySelect.setRows(7); // perfect length in out case\r
+        citySelect.setNullSelectionAllowed(false); // user can not 'unselect'\r
+        citySelect.select("Berlin"); // select this by default\r
+        citySelect.setImmediate(true); // send the change to the server at once\r
+        citySelect.addListener(this); // react when the user selects something\r
+\r
+        addComponent(citySelect);\r
     }\r
 \r
     /*\r
-     * Shows a notification when a selection is made.\r
+     * Shows a notification when a selection is made. The listener will be\r
+     * called whenever the value of the component changes, i.e when the user\r
+     * makes a new selection.\r
      */\r
     public void valueChange(ValueChangeEvent event) {\r
         getWindow().showNotification("Selected city: " + event.getProperty());\r
index 08b9ef49b06294c17618fb962b3034e7aba8bea9..83cf67e122a8545c5eebb782babd2370cd59bd29 100644 (file)
@@ -2,6 +2,7 @@ package com.itmill.toolkit.demo.sampler.features.selects;
 \r
 import com.itmill.toolkit.demo.sampler.APIResource;\r
 import com.itmill.toolkit.demo.sampler.Feature;\r
+import com.itmill.toolkit.demo.sampler.FeatureSet;\r
 import com.itmill.toolkit.demo.sampler.NamedExternalResource;\r
 import com.itmill.toolkit.ui.NativeSelect;\r
 \r
@@ -13,7 +14,15 @@ public class NativeSelection extends Feature {
 \r
     @Override\r
     public String getDescription() {\r
-        return "A native selection component provides a simple drop-down list for selecting one item.";\r
+        return "A NativeSelect is a a simple drop-down list"\r
+                + " for selecting one item. It is called <i>native</i>"\r
+                + " because it uses the look and feel from the browser in use.<br/>"\r
+                + " The ComboBox component is a much more versatile variant,"\r
+                + " but without the native look and feel.<br/>"\r
+                + " From a usability standpoint, you might also want to"\r
+                + " consider using a ListSelect in single-select-mode, so that"\r
+                + " the user can see all options right away.";\r
+\r
     }\r
 \r
     @Override\r
@@ -23,8 +32,8 @@ public class NativeSelection extends Feature {
 \r
     @Override\r
     public Class[] getRelatedFeatures() {\r
-        return new Class[] { ListSelectSingle.class, ListSelectMultiple.class,\r
-                TwinColumnSelect.class };\r
+        return new Class[] { ComboBoxPlain.class, ListSelectSingle.class,\r
+                FeatureSet.Selects.class };\r
     }\r
 \r
     @Override\r
index 922974bab999e04f8902b2fb2a17f857ff4bf93b..6d52fb3b358fa000c22c6864c584a62950209b85 100644 (file)
@@ -9,23 +9,37 @@ import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent;
 public class TabSheetIconsExample extends VerticalLayout implements\r
         TabSheet.SelectedTabChangeListener {\r
 \r
+    // Icons for the table\r
+    private static final ThemeResource icon1 = new ThemeResource(\r
+            "icons/action_save.gif");\r
+    private static final ThemeResource icon2 = new ThemeResource(\r
+            "icons/comment_yellow.gif");\r
+    private static final ThemeResource icon3 = new ThemeResource(\r
+            "icons/icon_info.gif");\r
+\r
     private TabSheet t;\r
 \r
     public TabSheetIconsExample() {\r
-        Label l1 = new Label("There are no previously saved actions.");\r
-        Label l2 = new Label("There are no saved notes.");\r
-        Label l3 = new Label("There are currently no issues.");\r
-\r
-        ThemeResource i1 = new ThemeResource("icons/action_save.gif");\r
-        ThemeResource i2 = new ThemeResource("icons/comment_yellow.gif");\r
-        ThemeResource i3 = new ThemeResource("icons/icon_info.gif");\r
+        // Tab 1 content\r
+        VerticalLayout l1 = new VerticalLayout();\r
+        l1.setMargin(true);\r
+        l1.addComponent(new Label("There are no previously saved actions."));\r
+        // Tab 2 content\r
+        VerticalLayout l2 = new VerticalLayout();\r
+        l2.setMargin(true);\r
+        l2.addComponent(new Label("There are no saved notes."));\r
+        // Tab 3 content\r
+        VerticalLayout l3 = new VerticalLayout();\r
+        l3.setMargin(true);\r
+        l3.addComponent(new Label("There are currently no issues."));\r
 \r
         t = new TabSheet();\r
-        t.setHeight(400, UNITS_PIXELS);\r
-        t.setWidth(400, UNITS_PIXELS);\r
-        t.addTab(l1, "Saved actions", i1);\r
-        t.addTab(l2, "Notes", i2);\r
-        t.addTab(l3, "Issues", i3);\r
+        t.setHeight("200px");\r
+        t.setWidth("400px");\r
+\r
+        t.addTab(l1, "Saved actions", icon1);\r
+        t.addTab(l2, "Notes", icon2);\r
+        t.addTab(l3, "Issues", icon3);\r
         t.addListener(this);\r
 \r
         addComponent(t);\r