private static final Object[][] demos = new Object[][] {
// Category, Name, Desc, Class, Viewed
- // Basic: Labels
- { "Basic", "Labels", "Some variations of Labels", Button.class,
- Boolean.FALSE },
- // Basic: Buttons
- { "Basic", "Buttons and links",
+ // Getting started: Labels
+ { "Getting started", "Labels", "Some variations of Labels",
+ LabelsExample.class, Boolean.FALSE },
+ // Getting started: Buttons
+ { "Getting started", "Buttons and links",
"Some variations of Buttons and Links", Button.class,
Boolean.FALSE },
- // Basic: Fields
- { "Basic", "User input", "TextFields, DateFields, and such",
- Button.class, Boolean.FALSE },
+ // Getting started: Fields
+ { "Getting started", "User input",
+ "TextFields, DateFields, and such", Button.class,
+ Boolean.FALSE },
//
- { "Basic", "RichText", "Rich text editing", RichTextExample.class,
+ { "Getting started", "RichText", "Rich text editing",
+ RichTextExample.class, Boolean.FALSE },
+ // Getting started: Selects
+ { "Getting started", "Choices, choices",
+ "Some variations of simple selects", Button.class,
Boolean.FALSE },
- // Basic: Selects
- { "Basic", "Choices, choices", "Some variations of simple selects",
- Button.class, Boolean.FALSE },
- // Organizing: ComboBox
- { "Organizing", "ComboBox", "ComboBox - the swiss army select",
+ // Wrangling data: ComboBox
+ { "Wrangling data", "ComboBox", "ComboBox - the swiss army select",
ComboBoxExample.class, Boolean.FALSE },
- // Organizing: Table
- { "Organizing", "Table", "A dynamic Table with bells and whistles",
- Button.class, Boolean.FALSE },
- // Organizing: Tree
- { "Organizing", "Tree", "Some variations of Buttons and Links",
+ // Wrangling data: Table
+ { "Wrangling data", "Table",
+ "A dynamic Table with bells and whistles", Button.class,
+ Boolean.FALSE },
+ // Wrangling data: Tree
+ { "Wrangling data", "Tree", "Some variations of Buttons and Links",
TreeExample.class, Boolean.FALSE },
// Misc: Notifications
{ "Misc", "Notifications", "Notifications can improve usability",
--- /dev/null
+package com.itmill.toolkit.demo.featurebrowser;\r
+\r
+import com.itmill.toolkit.ui.CustomComponent;\r
+import com.itmill.toolkit.ui.GridLayout;\r
+import com.itmill.toolkit.ui.Label;\r
+import com.itmill.toolkit.ui.OrderedLayout;\r
+import com.itmill.toolkit.ui.Panel;\r
+\r
+/**\r
+ * Shows a few variations of Labels, including the effects of XHTML- and\r
+ * pre-formatted mode.\r
+ * \r
+ * @author IT Mill Ltd.\r
+ */\r
+public class LabelsExample extends CustomComponent {\r
+\r
+ private static final String xhtml = "This text has <b>HTML</b> formatting.<br/>"\r
+ + "A plain <i>Label</i> will show the markup, while a <u>XHTML-mode</u>"\r
+ + " <i>Label</i> will show the formatted text.";\r
+\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
+\r
+ public LabelsExample() {\r
+\r
+ OrderedLayout main = new OrderedLayout();\r
+ main.setMargin(true);\r
+ setCompositionRoot(main);\r
+\r
+ GridLayout g = new GridLayout(2, 4);\r
+ main.addComponent(g);\r
+\r
+ // plain w/o caption\r
+ Panel p = new Panel("Plain");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ Label l = new Label("A plain label without caption.");\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+ // plain w/ caption\r
+ p = new Panel("Plain w/ caption");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ l = new Label("A plain label with caption.");\r
+ l.setCaption("Label caption");\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+ // plain w/ xhtml\r
+ p = new Panel("Plain w/ XHTML content");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ l = new Label(xhtml);\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+ // xhtml w/ xhtml\r
+ p = new Panel("XHTML-mode w/ XHTML content");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ l = new Label(xhtml);\r
+ l.setContentMode(Label.CONTENT_XHTML);\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+ // plain w/ preformatted\r
+ p = new Panel("Plain w/ preformatted content");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ l = new Label(pre);\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+ // preformatted w/ preformatted\r
+ p = new Panel("Preformatted-mode w/ preformatted content");\r
+ p.setStyleName(Panel.STYLE_LIGHT);\r
+ l = new Label(pre);\r
+ l.setContentMode(Label.CONTENT_PREFORMATTED);\r
+ p.addComponent(l);\r
+ g.addComponent(p);\r
+\r
+ }\r
+}\r