diff options
author | Jani Laakso <jani.laakso@itmill.com> | 2008-04-07 15:38:15 +0000 |
---|---|---|
committer | Jani Laakso <jani.laakso@itmill.com> | 2008-04-07 15:38:15 +0000 |
commit | f51577b7567821f8bb13ecaa60eb101f708e6147 (patch) | |
tree | 10cef62ed79d94aba6e83d76f0b753f1f3cc1410 /src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java | |
parent | 638fe9899be27b8f4f92dc4750f813c1210ecb1f (diff) | |
download | vaadin-framework-f51577b7567821f8bb13ecaa60eb101f708e6147.tar.gz vaadin-framework-f51577b7567821f8bb13ecaa60eb101f708e6147.zip |
Created com.itmill.toolkit.automatedtests package which contains "official" automated tests
* do not touch them unless you change automated test client's testcase scripts too.
* copy your testing application to package com.itmill.toolkit.automatedtests
* do not point to "development / testing / production" packages which are edited in the future without relation to testing
* use setDebugId's for all components that are used in testing
Moved few classes from "experimental" com.itmill.toolkit.tests package into "official" side.
Copied featurebrowser to automatedtests package and added setDebugId's for most components that are used in the testing.
svn changeset:4138/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java')
-rw-r--r-- | src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java new file mode 100644 index 0000000000..ec90f37231 --- /dev/null +++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/LabelExample.java @@ -0,0 +1,93 @@ +/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.itmill.toolkit.automatedtests.featurebrowser;
+
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.GridLayout;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+
+/**
+ * Shows a few variations of Labels, including the effects of XHTML- and
+ * pre-formatted mode.
+ *
+ * @author IT Mill Ltd.
+ */
+public class LabelExample extends CustomComponent {
+
+ private static final String xhtml = "This text has <b>HTML</b> formatting.<br/>"
+ + "A plain <i>Label</i> will show the markup, while a <u>XHTML-mode</u>"
+ + " <i>Label</i> will show the formatted text.";
+
+ private static final String pre = "This text has linebreaks.\n\n"
+ + "They will show up in a preformatted Label,\n"
+ + "but not in a \"plain\" Label.\n\n"
+ + " This is an indented row. \n Same indentation here.";
+
+ public LabelExample() {
+
+ final OrderedLayout main = new OrderedLayout();
+ main.setMargin(true);
+ setCompositionRoot(main);
+
+ final GridLayout g = new GridLayout(2, 4);
+ main.addComponent(g);
+
+ // plain w/o caption
+ Panel p = new Panel("Plain");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ Label l = new Label("A plain label without caption.");
+ l.setDebugId("label1");
+ p.addComponent(l);
+ g.addComponent(p);
+ // plain w/ caption
+ p = new Panel("Plain w/ caption + tooltip");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ l = new Label("A plain label with caption.");
+ l.setCaption("Label caption");
+ l.setDebugId("label2");
+ l.setDescription("This is a description (tooltip) for the label.");
+ p.addComponent(l);
+ g.addComponent(p);
+ // plain w/ xhtml
+ p = new Panel("Plain w/ XHTML content");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ l = new Label(xhtml);
+ l.setDebugId("label3");
+ p.addComponent(l);
+ g.addComponent(p);
+ // xhtml w/ xhtml
+ p = new Panel("XHTML-mode w/ XHTML content");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ l = new Label(xhtml);
+ l.setDebugId("label4");
+ l.setContentMode(Label.CONTENT_XHTML);
+ p.addComponent(l);
+ g.addComponent(p);
+ // plain w/ preformatted
+ p = new Panel("Plain w/ preformatted content");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ l = new Label(pre);
+ l.setDebugId("label5");
+ p.addComponent(l);
+ g.addComponent(p);
+ // preformatted w/ preformatted
+ p = new Panel("Preformatted-mode w/ preformatted content");
+ p.setDebugId(p.getCaption());
+ p.setStyleName(Panel.STYLE_LIGHT);
+ l = new Label(pre);
+ l.setDebugId("label6");
+ l.setContentMode(Label.CONTENT_PREFORMATTED);
+ p.addComponent(l);
+ g.addComponent(p);
+
+ }
+}
|