From 973919e4563735988ada6e65e52a8604fc615e9d Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Mon, 2 Feb 2009 13:58:30 +0000 Subject: [PATCH] Sampler intermediate commit; cleaning & slight modifications all over. svn changeset:6705/svn branch:trunk --- .../ITMILL/themes/sampler/sampler/flow.gif | Bin 269 -> 67 bytes .../ITMILL/themes/sampler/sampler/grid.gif | Bin 54 -> 54 bytes .../themes/sampler/sampler/hidetree.gif | Bin 58 -> 62 bytes .../ITMILL/themes/sampler/sampler/list.gif | Bin 250 -> 56 bytes .../themes/sampler/sampler/showtree.gif | Bin 61 -> 64 bytes .../ITMILL/themes/sampler/sampler/styles.css | 16 ++-- .../toolkit/demo/sampler/FeatureView.java | 10 +- .../demo/sampler/SamplerApplication.java | 87 ++++++++++++------ .../sampler/features/buttons/ButtonLink.java | 3 +- .../features/buttons/ButtonSwitch.java | 6 +- .../features/commons/ErrorsExample.java | 2 +- .../features/link/LinkCurrentWindow.java | 5 +- .../features/link/LinkNoDecorations.java | 7 +- .../features/link/LinkSizedWindow.java | 8 +- .../NotificationCustomExample.java | 4 +- .../NotificationErrorExample.java | 1 + .../NotificationHumanizedExample.java | 1 + .../NotificationTrayExample.java | 1 + .../NotificationWarningExample.java | 1 + .../features/selects/ComboBoxContains.java | 10 +- .../features/selects/ComboBoxNewItems.java | 14 ++- .../features/selects/ComboBoxPlain.java | 5 +- .../features/selects/ComboBoxStartsWith.java | 12 ++- .../features/selects/ListSelectMultiple.java | 6 +- .../features/selects/ListSelectSingle.java | 6 +- .../selects/ListSelectSingleExample.java | 32 ++++--- .../features/selects/NativeSelection.java | 15 ++- .../tabsheets/TabSheetIconsExample.java | 38 +++++--- 28 files changed, 196 insertions(+), 94 deletions(-) diff --git a/WebContent/ITMILL/themes/sampler/sampler/flow.gif b/WebContent/ITMILL/themes/sampler/sampler/flow.gif index 02d1233de268b35b70fca4a1a23ca8ed74e19aed..f6dcc1ed0522902508c6f0a42ab65ef3dc51fc26 100644 GIT binary patch literal 67 zcmZ?wbhEHbgi{jxuGVeBE$3b Vn=Adrrn!mFT6;M(MOZ`_tO0Fw6R-dP literal 269 zcmZ?wbhEHb~T{?UG%K6h*E}pw_ z<-(m?H{Lvd^yc~FH_xBEeewA1%O~$%K7IG<+56YeKfHPQ@!hLW?_Pg;|K{_Dw_iTK z`||Pq*H1w7;oIkr-@X9Rr|(~Z=<|XoPd+6{n rIxQCZ>8&^WkVet1maw_u*;{s`=5^lH`z|%FZM9d?trIcL%?#E6F+9ar diff --git a/WebContent/ITMILL/themes/sampler/sampler/grid.gif b/WebContent/ITMILL/themes/sampler/sampler/grid.gif index d1ff16fc7fc21f113c8d682bda15a2a369aeeb5e..2500d8d15be20a3825451fbdabb6c1b5a228420c 100644 GIT binary patch delta 37 scmXprlXv%Yv#?C$Vc=nCU}PxHO8Ec(zv538MlJ?M1|22_rit?60JW(JC;$Ke delta 37 scmXprlXv%Yv#?C$W8h$DU}PxHO8Ec(zv538MlJ?M1|4PwhKcgx0JV1sB>(^b diff --git a/WebContent/ITMILL/themes/sampler/sampler/hidetree.gif b/WebContent/ITMILL/themes/sampler/sampler/hidetree.gif index 93671348a8f1ae4d042acf6b274afb347d4874a4..b3fe017b9b48f808a6539009302b6f51bb2e185c 100644 GIT binary patch literal 62 zcmZ?wbhEHbSR#lXNM%F~y5QjA}|K=53o R>RI#bGr3ofs<1Lx0|4bZ5P|>z literal 58 zcmZ?wbhEHbSR#lXPC&(kM)`tANnEE}$^ LT$3gt%3uuunL7_+ literal 250 zcmZ?wbhEHb~T{?UG%K6h*E}pw_ z<-(m?H{Lvd^yc~FH_xBEeewA1%O~$%K7IG<+56YeKfHPQ@!hLW?_Pg;|K{_Dw_iTK z`||Pq*H1w7;oIkr-@X9Rr|(~Z=<|50z_QH}Yn7HCQDCqJ0Pgv`SO5S3 diff --git a/WebContent/ITMILL/themes/sampler/sampler/showtree.gif b/WebContent/ITMILL/themes/sampler/sampler/showtree.gif index afba39a3e5fe8ac035a2965df295d72a658c08e3..258ffe36b430a888c2bb65fa059afbb9542ce5b9 100644 GIT binary patch literal 64 zcmZ?wbhEHbSR#lXNM&eNB9QtY2xgYmAY T$49=M+E*LKk;&aG!e9*mEV2^} literal 61 zcmZ?wbhEHb 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("

" + f.getName() + "

" + f.getDescription()); b.addListener(new Button.ClickListener() { diff --git a/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonLink.java b/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonLink.java index 94fb0933ae..996ea8d66c 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonLink.java +++ b/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonLink.java @@ -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.
" + + "I.e it does not actually link somewhere, but triggers a server-side event, just like a regular button."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonSwitch.java b/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonSwitch.java index f3bf7d52fc..585a218f56 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonSwitch.java +++ b/src/com/itmill/toolkit/demo/sampler/features/buttons/ButtonSwitch.java @@ -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.
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 diff --git a/src/com/itmill/toolkit/demo/sampler/features/commons/ErrorsExample.java b/src/com/itmill/toolkit/demo/sampler/features/commons/ErrorsExample.java index f402fa699b..8b1da6415d 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/commons/ErrorsExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/commons/ErrorsExample.java @@ -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"); diff --git a/src/com/itmill/toolkit/demo/sampler/features/link/LinkCurrentWindow.java b/src/com/itmill/toolkit/demo/sampler/features/link/LinkCurrentWindow.java index 0e183780a6..7c10562a74 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/link/LinkCurrentWindow.java +++ b/src/com/itmill/toolkit/demo/sampler/features/link/LinkCurrentWindow.java @@ -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).
By default, links open" + + " in the current browser window."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/link/LinkNoDecorations.java b/src/com/itmill/toolkit/demo/sampler/features/link/LinkNoDecorations.java index ce1917615d..ae2ee5b000 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/link/LinkNoDecorations.java +++ b/src/com/itmill/toolkit/demo/sampler/features/link/LinkNoDecorations.java @@ -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).
Links can open new" + + " browser windows, and configure the amount of browser" + + " features shown, such as toolbar and addressbar."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/link/LinkSizedWindow.java b/src/com/itmill/toolkit/demo/sampler/features/link/LinkSizedWindow.java index 5f044ac660..05abb6f095 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/link/LinkSizedWindow.java +++ b/src/com/itmill/toolkit/demo/sampler/features/link/LinkSizedWindow.java @@ -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.
A link changes" + + " the url of the browser w/o triggering a server-side event" + + " (like the link-styled Button).
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 diff --git a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationCustomExample.java b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationCustomExample.java index 597d246d9b..cd1f224137 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationCustomExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationCustomExample.java @@ -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
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); diff --git a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationErrorExample.java b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationErrorExample.java index 0bc3c99a52..203e497899 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationErrorExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationErrorExample.java @@ -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"); diff --git a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationHumanizedExample.java b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationHumanizedExample.java index 23f3006b34..87079e9d11 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationHumanizedExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationHumanizedExample.java @@ -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"); diff --git a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationTrayExample.java b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationTrayExample.java index e137b7d1e3..e6295d0c2b 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationTrayExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationTrayExample.java @@ -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"); diff --git a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationWarningExample.java b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationWarningExample.java index 3d6ac77345..a6b3ceecc3 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationWarningExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/notifications/NotificationWarningExample.java @@ -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"); diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxContains.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxContains.java index e6762f3f5b..7a7905c92e 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxContains.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxContains.java @@ -13,10 +13,14 @@ public class ComboBoxContains extends Feature { @Override public String getDescription() { - return "A drop-down selection component with single item selection." - + " A 'contains' filter has been used with this combo box," + return "A drop-down selection component with single item selection.
" + + " A 'contains' filter has been used in this example," + " so you can key in some text and only the options" - + " containing your input will be shown."; + + " containing your input will be shown.
" + + " Because there are so many options, they are loaded on-demand" + + " (\"lazy-loading\") from the server when paging or" + + " filtering. This behavior is built-in and requires no extra" + + " code."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxNewItems.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxNewItems.java index 6579b094ba..8417dc0f3d 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxNewItems.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxNewItems.java @@ -13,10 +13,16 @@ public class ComboBoxNewItems extends Feature { @Override public String getDescription() { - return "A drop-down selection component with single item selection." - + " This selection box also allows you to input your own" - + " choice. Your input will also be added to the selection" - + " of available choices."; + return "A drop-down selection component with single item selection.
" + + " This example also allows you to input your own" + + " choice - your input will be added to the selection" + + " of available choices. This behavior is built-in and can" + + " be enabled with one method call. Note that by using this" + + " feature, one can easily create suggestion box -type" + + " inputs that for example remembers the users previous input," + + " or provides suggestions from a list of popular choices." + + " Configured like this (and optionally with a filter), the" + + " ComboBox can be a powerful alternative to TextField."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxPlain.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxPlain.java index 6dceeea68a..b65ed4aab0 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxPlain.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxPlain.java @@ -14,7 +14,10 @@ public class ComboBoxPlain extends Feature { @Override public String getDescription() { return "A drop-down selection component with single item selection." - + " No special features used in this example"; + + " Shown here is the most basic variant, which basically" + + " provides the same functionality as a NativeSelect with" + + " added lazy-loading if there are many options.
" + + " See related examples for more advanced features."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxStartsWith.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxStartsWith.java index a971097b98..46a694956e 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxStartsWith.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ComboBoxStartsWith.java @@ -13,10 +13,14 @@ public class ComboBoxStartsWith extends Feature { @Override public String getDescription() { - return "A drop-down selection component with single item selection." - + " A 'starts with' filter has been used with this combo box," - + " so you can key in the beginning of your selection to narrow" - + " down the amount of choices."; + return "A drop-down selection component with single item selection.
" + + " A 'starts-with' filter has been used in this example," + + " so you can key in some text and only the options" + + " beginning with your input will be shown.
" + + " Because there are so many options, they are loaded on-demand" + + " (\"lazy-loading\") from the server when paging or" + + " filtering. This behavior is built-in and requires no extra" + + " code."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectMultiple.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectMultiple.java index 8c5c069918..e71680643d 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectMultiple.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectMultiple.java @@ -14,8 +14,10 @@ public class ListSelectMultiple extends Feature { @Override public String getDescription() { return "A simple list select component with multiple item selection." - + " A null selection is also allowed in this example." - + "
You can select multiple items from the list by holding" + + " You can allow or disallow null selection - i.e the" + + " possibility to make an empty selection. Null selection is" + + " allowed in this example.
" + + "You can select multiple items from the list by holding" + " the CTRL of SHIFT key while clicking the items."; } diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingle.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingle.java index 78ae9aee1d..e8865ae20a 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingle.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingle.java @@ -13,8 +13,10 @@ public class ListSelectSingle extends Feature { @Override public String getDescription() { - return "A simple list select component with single item selection." - + " A null selection is not allowed in this example."; + return "A simple list select component with single item selection.
" + + " You can allow or disallow null selection - i.e the" + + " possibility to make an empty selection. Null selection is" + + " not allowed in this example."; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingleExample.java b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingleExample.java index 62df218ae2..78e36d6b0a 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingleExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/ListSelectSingleExample.java @@ -1,5 +1,8 @@ package com.itmill.toolkit.demo.sampler.features.selects; +import java.util.Arrays; +import java.util.List; + import com.itmill.toolkit.data.Property; import com.itmill.toolkit.data.Property.ValueChangeEvent; import com.itmill.toolkit.ui.ListSelect; @@ -8,27 +11,28 @@ import com.itmill.toolkit.ui.VerticalLayout; public class ListSelectSingleExample extends VerticalLayout implements Property.ValueChangeListener { - private static final String[] cities = new String[] { "Berlin", "Brussels", - "Helsinki", "Madrid", "Oslo", "Paris", "Stockholm" }; + private static final List cities = Arrays.asList(new String[] { "Berlin", + "Brussels", "Helsinki", "Madrid", "Oslo", "Paris", "Stockholm" }); public ListSelectSingleExample() { setSpacing(true); - ListSelect l = new ListSelect("Please select a city"); - for (int i = 0; i < cities.length; i++) { - l.addItem(cities[i]); - } - l.setRows(7); - l.setNullSelectionAllowed(false); - l.setValue("Berlin"); - l.setImmediate(true); - l.addListener(this); - - addComponent(l); + // 'Shorthand' constructor - also supports data binding using Containers + ListSelect citySelect = new ListSelect("Please select a city", cities); + + citySelect.setRows(7); // perfect length in out case + citySelect.setNullSelectionAllowed(false); // user can not 'unselect' + citySelect.select("Berlin"); // select this by default + citySelect.setImmediate(true); // send the change to the server at once + citySelect.addListener(this); // react when the user selects something + + addComponent(citySelect); } /* - * Shows a notification when a selection is made. + * Shows a notification when a selection is made. The listener will be + * called whenever the value of the component changes, i.e when the user + * makes a new selection. */ public void valueChange(ValueChangeEvent event) { getWindow().showNotification("Selected city: " + event.getProperty()); diff --git a/src/com/itmill/toolkit/demo/sampler/features/selects/NativeSelection.java b/src/com/itmill/toolkit/demo/sampler/features/selects/NativeSelection.java index 08b9ef49b0..83cf67e122 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/selects/NativeSelection.java +++ b/src/com/itmill/toolkit/demo/sampler/features/selects/NativeSelection.java @@ -2,6 +2,7 @@ package com.itmill.toolkit.demo.sampler.features.selects; import com.itmill.toolkit.demo.sampler.APIResource; import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.FeatureSet; import com.itmill.toolkit.demo.sampler.NamedExternalResource; import com.itmill.toolkit.ui.NativeSelect; @@ -13,7 +14,15 @@ public class NativeSelection extends Feature { @Override public String getDescription() { - return "A native selection component provides a simple drop-down list for selecting one item."; + return "A NativeSelect is a a simple drop-down list" + + " for selecting one item. It is called native" + + " because it uses the look and feel from the browser in use.
" + + " The ComboBox component is a much more versatile variant," + + " but without the native look and feel.
" + + " From a usability standpoint, you might also want to" + + " consider using a ListSelect in single-select-mode, so that" + + " the user can see all options right away."; + } @Override @@ -23,8 +32,8 @@ public class NativeSelection extends Feature { @Override public Class[] getRelatedFeatures() { - return new Class[] { ListSelectSingle.class, ListSelectMultiple.class, - TwinColumnSelect.class }; + return new Class[] { ComboBoxPlain.class, ListSelectSingle.class, + FeatureSet.Selects.class }; } @Override diff --git a/src/com/itmill/toolkit/demo/sampler/features/tabsheets/TabSheetIconsExample.java b/src/com/itmill/toolkit/demo/sampler/features/tabsheets/TabSheetIconsExample.java index 922974bab9..6d52fb3b35 100644 --- a/src/com/itmill/toolkit/demo/sampler/features/tabsheets/TabSheetIconsExample.java +++ b/src/com/itmill/toolkit/demo/sampler/features/tabsheets/TabSheetIconsExample.java @@ -9,23 +9,37 @@ import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent; public class TabSheetIconsExample extends VerticalLayout implements TabSheet.SelectedTabChangeListener { + // Icons for the table + private static final ThemeResource icon1 = new ThemeResource( + "icons/action_save.gif"); + private static final ThemeResource icon2 = new ThemeResource( + "icons/comment_yellow.gif"); + private static final ThemeResource icon3 = new ThemeResource( + "icons/icon_info.gif"); + private TabSheet t; public TabSheetIconsExample() { - Label l1 = new Label("There are no previously saved actions."); - Label l2 = new Label("There are no saved notes."); - Label l3 = new Label("There are currently no issues."); - - ThemeResource i1 = new ThemeResource("icons/action_save.gif"); - ThemeResource i2 = new ThemeResource("icons/comment_yellow.gif"); - ThemeResource i3 = new ThemeResource("icons/icon_info.gif"); + // Tab 1 content + VerticalLayout l1 = new VerticalLayout(); + l1.setMargin(true); + l1.addComponent(new Label("There are no previously saved actions.")); + // Tab 2 content + VerticalLayout l2 = new VerticalLayout(); + l2.setMargin(true); + l2.addComponent(new Label("There are no saved notes.")); + // Tab 3 content + VerticalLayout l3 = new VerticalLayout(); + l3.setMargin(true); + l3.addComponent(new Label("There are currently no issues.")); t = new TabSheet(); - t.setHeight(400, UNITS_PIXELS); - t.setWidth(400, UNITS_PIXELS); - t.addTab(l1, "Saved actions", i1); - t.addTab(l2, "Notes", i2); - t.addTab(l3, "Issues", i3); + t.setHeight("200px"); + t.setWidth("400px"); + + t.addTab(l1, "Saved actions", icon1); + t.addTab(l2, "Notes", icon2); + t.addTab(l3, "Issues", icon3); t.addListener(this); addComponent(t); -- 2.39.5