diff options
author | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2009-10-05 05:09:55 +0000 |
---|---|---|
committer | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2009-10-05 05:09:55 +0000 |
commit | 3e28b8746c8eafb7b3a5b9df86e2098dacbac1d0 (patch) | |
tree | 27bb46ae4784c94ef882ad5141bc45e86337f50f /src | |
parent | 8f10fd5b7ac58e01bc5b7a4532d6d3cd5c5b670f (diff) | |
download | vaadin-framework-3e28b8746c8eafb7b3a5b9df86e2098dacbac1d0.tar.gz vaadin-framework-3e28b8746c8eafb7b3a5b9df86e2098dacbac1d0.zip |
Initial commit for new Sampler home screen layout.
svn changeset:9061/svn branch:6.2
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/demo/sampler/FeatureSet.java | 14 | ||||
-rw-r--r-- | src/com/vaadin/demo/sampler/SamplerApplication.java | 36 |
2 files changed, 20 insertions, 30 deletions
diff --git a/src/com/vaadin/demo/sampler/FeatureSet.java b/src/com/vaadin/demo/sampler/FeatureSet.java index 8936d450dc..2766b63d8d 100644 --- a/src/com/vaadin/demo/sampler/FeatureSet.java +++ b/src/com/vaadin/demo/sampler/FeatureSet.java @@ -124,7 +124,7 @@ public class FeatureSet extends Feature { public static class Components extends FeatureSet { public Components() { - super("Components", new Feature[] { + super("Vaadin Core Components", new Feature[] { // new Common(), // new Accordions(), // @@ -435,19 +435,19 @@ public class FeatureSet extends Feature { * FeatureSet implementation follows. */ - private String pathname; + private final String pathname; - private String name; + private final String name; - private String desc; + private final String desc; - private String icon = "folder.gif"; + private final String icon = "folder.gif"; - private Feature[] content; + private final Feature[] content; private HierarchicalContainer container = null; - private boolean containerRecursive = false; + private final boolean containerRecursive = false; FeatureSet(String pathname, Feature[] content) { this(pathname, pathname, "", content); diff --git a/src/com/vaadin/demo/sampler/SamplerApplication.java b/src/com/vaadin/demo/sampler/SamplerApplication.java index 91ae0b4c84..7c0f5b34e2 100644 --- a/src/com/vaadin/demo/sampler/SamplerApplication.java +++ b/src/com/vaadin/demo/sampler/SamplerApplication.java @@ -25,9 +25,9 @@ import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; +import com.vaadin.ui.CssLayout; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.Embedded; -import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.NativeButton; @@ -737,15 +737,14 @@ public class SamplerApplication extends Application { private class FeatureGrid extends Panel implements FeatureList { - GridLayout grid = new GridLayout(11, 1); + CssLayout grid = new CssLayout(); private final HashMap<Object, Resource> iconCache = new HashMap<Object, Resource>(); FeatureGrid() { setSizeFull(); setContent(grid); - grid.setSizeUndefined(); - grid.setSpacing(true); setStyleName(Panel.STYLE_LIGHT); + grid.setStyleName("grid"); } @SuppressWarnings("unchecked") @@ -755,30 +754,25 @@ public class SamplerApplication extends Application { for (Iterator<Feature> it = features.iterator(); it.hasNext();) { final Feature f = it.next(); if (f instanceof FeatureSet) { - grid.newLine(); Label title = new Label(f.getName()); if (c.isRoot(f)) { - title.setWidth("100%"); title.setStyleName("section"); - grid.setRows(grid.getCursorY() + 1); - grid.addComponent(title, 0, grid.getCursorY(), grid - .getColumns() - 1, grid.getCursorY()); - grid - .setComponentAlignment(title, - Alignment.MIDDLE_LEFT); + grid.addComponent(title); } else { + String text = "<h3>" + f.getName() + "</h3>"; + if (f.getDescription() != null + && f.getDescription() != "") { + text += f.getDescription().substring(0, + f.getDescription().indexOf(".") + 1); + } + title = new Label(text, Label.CONTENT_XHTML); title.setStyleName("subsection"); + title.setSizeUndefined(); grid.addComponent(title); - grid - .setComponentAlignment(title, - Alignment.MIDDLE_LEFT); } } else { - if (grid.getCursorX() == 0) { - grid.space(); - } - Button b = new NativeButton(); + Button b = new Button(f.getName()); b.setStyleName(Button.STYLE_LINK); b.addStyleName("screenshot"); String resId = "75-" + f.getIconName(); @@ -787,12 +781,8 @@ public class SamplerApplication extends Application { res = new ClassResource(f.getClass(), resId, SamplerApplication.this); iconCache.put(resId, res); - } b.setIcon(res); - b.setWidth("75px"); - b.setHeight("75px"); - b.setDescription("<h3>" + f.getName() + "</h3>"); b.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { ((SamplerWindow) getWindow()).setFeature(f); |