/**
* Label component for showing non-editable short texts.
*
- * The label content can be set to the modes specified by the final members
- * CONTENT_*
+ * The label content can be set to the modes specified by {@link ContentMode}
*
* <p>
* The contents of the label may contain simple formatting:
Property.ValueChangeNotifier, Comparable<Object> {
/**
- * Content mode, where the label contains only plain text. The getValue()
- * result is coded to XML when painting.
+ * Content modes defining how the client should interpret a Label's value.
+ *
+ * @sine 7.0
*/
- public static final int CONTENT_TEXT = 0;
+ public enum ContentMode {
+ /**
+ * Content mode, where the label contains only plain text. The
+ * getValue() result is coded to XML when painting.
+ */
+ TEXT(null) {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.addText(text);
+ }
+ },
+
+ /**
+ * Content mode, where the label contains preformatted text.
+ */
+ PREFORMATTED("pre") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("pre");
+ target.addText(text);
+ target.endTag("pre");
+ }
+ },
+
+ /**
+ * Content mode, where the label contains XHTML. Contents is then
+ * enclosed in DIV elements having namespace of
+ * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
+ */
+ XHTML("xhtml") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("data");
+ target.addXMLSection("div", text,
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
+ target.endTag("data");
+ }
+ },
+
+ /**
+ * Content mode, where the label contains well-formed or well-balanced
+ * XML. Each of the root elements must have their default namespace
+ * specified.
+ */
+ XML("xml") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.addXMLSection("data", text, null);
+ }
+ },
+
+ /**
+ * Content mode, where the label contains RAW output. Output is not
+ * required to comply to with XML. In Web Adapter output is inserted
+ * inside the resulting HTML document as-is. This is useful for some
+ * specific purposes where possibly broken HTML content needs to be
+ * shown, but in most cases XHTML mode should be preferred.
+ */
+ RAW("raw") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("data");
+ target.addAttribute("escape", false);
+ target.addText(text);
+ target.endTag("data");
+ }
+ };
+
+ private final String uidlName;
+
+ /**
+ * The default content mode is text
+ */
+ public static ContentMode DEFAULT = TEXT;
+
+ private ContentMode(String uidlName) {
+ this.uidlName = uidlName;
+ }
+
+ /**
+ * Gets the name representing this content mode in UIDL messages
+ *
+ * @return the UIDL name of this content mode
+ */
+ public String getUidlName() {
+ return uidlName;
+ }
+
+ /**
+ * Adds the text value to a {@link PaintTarget} according to this
+ * content mode
+ *
+ * @param text
+ * the text to add
+ * @param target
+ * the paint target to add the value to
+ * @throws PaintException
+ * if the paint operation failed
+ */
+ public abstract void paintText(String text, PaintTarget target)
+ throws PaintException;
+ }
/**
- * Content mode, where the label contains preformatted text.
+ * @deprecated From 7.0, use {@link ContentMode#TEXT} instead
*/
- public static final int CONTENT_PREFORMATTED = 1;
+ @Deprecated
+ public static final ContentMode CONTENT_TEXT = ContentMode.TEXT;
/**
- * Formatted content mode, where the contents is XML restricted to the UIDL
- * 1.0 formatting markups.
- *
- * @deprecated Use CONTENT_XML instead.
+ * @deprecated From 7.0, use {@link ContentMode#PREFORMATTED} instead
*/
@Deprecated
- public static final int CONTENT_UIDL = 2;
+ public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED;
/**
- * Content mode, where the label contains XHTML. Contents is then enclosed
- * in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
+ * @deprecated From 7.0, use {@link ContentMode#XHTML} instead
*/
- public static final int CONTENT_XHTML = 3;
+ @Deprecated
+ public static final ContentMode CONTENT_XHTML = ContentMode.XHTML;
/**
- * Content mode, where the label contains well-formed or well-balanced XML.
- * Each of the root elements must have their default namespace specified.
+ * @deprecated From 7.0, use {@link ContentMode#XML} instead
*/
- public static final int CONTENT_XML = 4;
+ @Deprecated
+ public static final ContentMode CONTENT_XML = ContentMode.XML;
/**
- * Content mode, where the label contains RAW output. Output is not required
- * to comply to with XML. In Web Adapter output is inserted inside the
- * resulting HTML document as-is. This is useful for some specific purposes
- * where possibly broken HTML content needs to be shown, but in most cases
- * XHTML mode should be preferred.
+ * @deprecated From 7.0, use {@link ContentMode#RAW} instead
*/
- public static final int CONTENT_RAW = 5;
+ @Deprecated
+ public static final ContentMode CONTENT_RAW = ContentMode.RAW;
/**
- * The default content mode is plain text.
+ * @deprecated From 7.0, use {@link ContentMode#DEFAULT} instead
*/
- public static final int CONTENT_DEFAULT = CONTENT_TEXT;
-
- /** Array of content mode names that are rendered in UIDL as mode attribute. */
- private static final String[] CONTENT_MODE_NAME = { "text", "pre", "uidl",
- "xhtml", "xml", "raw" };
+ @Deprecated
+ public static final ContentMode CONTENT_DEFAULT = ContentMode.DEFAULT;
private static final String DATASOURCE_MUST_BE_SET = "Datasource must be set";
private Property dataSource;
- private int contentMode = CONTENT_DEFAULT;
+ private ContentMode contentMode = ContentMode.DEFAULT;
/**
* Creates an empty Label.
* @param content
*/
public Label(String content) {
- this(content, CONTENT_DEFAULT);
+ this(content, ContentMode.DEFAULT);
}
/**
* @param contentSource
*/
public Label(Property contentSource) {
- this(contentSource, CONTENT_DEFAULT);
+ this(contentSource, ContentMode.DEFAULT);
}
/**
* @param content
* @param contentMode
*/
- public Label(String content, int contentMode) {
+ public Label(String content, ContentMode contentMode) {
this(new ObjectProperty<String>(content, String.class), contentMode);
}
* @param contentSource
* @param contentMode
*/
- public Label(Property contentSource, int contentMode) {
+ public Label(Property contentSource, ContentMode contentMode) {
setPropertyDataSource(contentSource);
- if (contentMode != CONTENT_DEFAULT) {
+ if (contentMode != ContentMode.DEFAULT) {
setContentMode(contentMode);
}
setWidth(100, UNITS_PERCENTAGE);
*/
@Override
public void paintContent(PaintTarget target) throws PaintException {
- if (contentMode != CONTENT_TEXT) {
- target.addAttribute("mode", CONTENT_MODE_NAME[contentMode]);
- }
- if (contentMode == CONTENT_TEXT) {
- target.addText(getStringValue());
- } else if (contentMode == CONTENT_UIDL) {
- target.addUIDL(getStringValue());
- } else if (contentMode == CONTENT_XHTML) {
- target.startTag("data");
- target.addXMLSection("div", getStringValue(),
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
- target.endTag("data");
- } else if (contentMode == CONTENT_PREFORMATTED) {
- target.startTag("pre");
- target.addText(getStringValue());
- target.endTag("pre");
- } else if (contentMode == CONTENT_XML) {
- target.addXMLSection("data", getStringValue(), null);
- } else if (contentMode == CONTENT_RAW) {
- target.startTag("data");
- target.addAttribute("escape", false);
- target.addText(getStringValue());
- target.endTag("data");
+ String uidlName = contentMode.getUidlName();
+ if (uidlName != null) {
+ target.addAttribute("mode", uidlName);
}
+ contentMode.paintText(getStringValue(), target);
}
/**
* Gets the content mode of the Label.
*
- * <p>
- * Possible content modes include:
- * <ul>
- * <li><b>CONTENT_TEXT</b> Content mode, where the label contains only plain
- * text. The getValue() result is coded to XML when painting.</li>
- * <li><b>CONTENT_PREFORMATTED</b> Content mode, where the label contains
- * preformatted text.</li>
- * <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is XML
- * restricted to the UIDL 1.0 formatting markups.</li>
- * <li><b>CONTENT_XHTML</b> Content mode, where the label contains XHTML.
- * Contents is then enclosed in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".</li>
- * <li><b>CONTENT_XML</b> Content mode, where the label contains well-formed
- * or well-balanced XML. Each of the root elements must have their default
- * namespace specified.</li>
- * <li><b>CONTENT_RAW</b> Content mode, where the label contains RAW output.
- * Output is not required to comply to with XML. In Web Adapter output is
- * inserted inside the resulting HTML document as-is. This is useful for
- * some specific purposes where possibly broken HTML content needs to be
- * shown, but in most cases XHTML mode should be preferred.</li>
- * </ul>
- * </p>
- *
* @return the Content mode of the label.
+ *
+ * @see ContentMode
*/
- public int getContentMode() {
+ public ContentMode getContentMode() {
return contentMode;
}
/**
* Sets the content mode of the Label.
*
- * <p>
- * Possible content modes include:
- * <ul>
- * <li><b>CONTENT_TEXT</b> Content mode, where the label contains only plain
- * text. The getValue() result is coded to XML when painting.</li>
- * <li><b>CONTENT_PREFORMATTED</b> Content mode, where the label contains
- * preformatted text.</li>
- * <li><b>CONTENT_UIDL</b> Formatted content mode, where the contents is XML
- * restricted to the UIDL 1.0 formatting markups.</li>
- * <li><b>CONTENT_XHTML</b> Content mode, where the label contains XHTML.
- * Contents is then enclosed in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".</li>
- * <li><b>CONTENT_XML</b> Content mode, where the label contains well-formed
- * or well-balanced XML. Each of the root elements must have their default
- * namespace specified.</li>
- * <li><b>CONTENT_RAW</b> Content mode, where the label contains RAW output.
- * Output is not required to comply to with XML. In Web Adapter output is
- * inserted inside the resulting HTML document as-is. This is useful for
- * some specific purposes where possibly broken HTML content needs to be
- * shown, but in most cases XHTML mode should be preferred.</li>
- * </ul>
- * </p>
- *
* @param contentMode
* the New content mode of the label.
+ *
+ * @see ContentMode
*/
- public void setContentMode(int contentMode) {
- if (contentMode != this.contentMode && contentMode >= CONTENT_TEXT
- && contentMode <= CONTENT_RAW) {
+ public void setContentMode(ContentMode contentMode) {
+ if (contentMode == null) {
+ throw new IllegalArgumentException("Content mode can not be null");
+ }
+ if (contentMode != this.contentMode) {
this.contentMode = contentMode;
requestRepaint();
}
String thisValue;
String otherValue;
- if (contentMode == CONTENT_XML || contentMode == CONTENT_UIDL
- || contentMode == CONTENT_XHTML) {
+ if (contentMode == ContentMode.XML || contentMode == ContentMode.XHTML) {
thisValue = stripTags(getStringValue());
} else {
thisValue = getStringValue();
}
if (other instanceof Label
- && (((Label) other).getContentMode() == CONTENT_XML
- || ((Label) other).getContentMode() == CONTENT_UIDL || ((Label) other)
- .getContentMode() == CONTENT_XHTML)) {
+ && (((Label) other).getContentMode() == ContentMode.XML || ((Label) other)
+ .getContentMode() == ContentMode.XHTML)) {
otherValue = stripTags(((Label) other).getStringValue());
} else {
// TODO not a good idea - and might assume that Field.toString()
import com.vaadin.ui.Embedded;\r
import com.vaadin.ui.HorizontalSplitPanel;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.Tree;\r
import com.vaadin.ui.Tree.ItemStyleGenerator;\r
naviLayout\r
.addComponent(new Label(\r
"Click to open a test case.<br/>Right click to open test in a new window<br/><br/>",\r
- Label.CONTENT_XHTML));\r
+ ContentMode.XHTML));\r
naviLayout.addComponent(createMenu());\r
naviLayout.addComponent(createMissingTestsList());\r
\r
embeddingLayout\r
.addComponent(new Label(\r
"<b>Do not use the embedded version for creating automated tests. Open the test in a new window before recording.</b><br/>",\r
- Label.CONTENT_XHTML));\r
+ ContentMode.XHTML));\r
applicationEmbedder.setSizeFull();\r
embeddingLayout.addComponent(applicationEmbedder);\r
embeddingLayout.setExpandRatio(applicationEmbedder, 1);\r
+ component.getSimpleName() + "</font><br/>";\r
}\r
return new Label("<b>Components without a test:</B><br/>"\r
- + missingTests, Label.CONTENT_XHTML);\r
+ + missingTests, ContentMode.XHTML);\r
}\r
\r
private Component createMenu() {\r
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Field;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.Root.LegacyWindow;
// Add heading label and custom layout panel to main window
mainWindow.addComponent(new Label("<h3>Custom layout demo</h3>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(customLayoutPanel);
}
username.setValue("Anonymous");
}
mainLayout.replaceComponent(loginButton, new Label("Welcome user <em>"
- + username.getValue() + "</em>", Label.CONTENT_XHTML));
+ + username.getValue() + "</em>", ContentMode.XHTML));
}
/**
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
//
mainWindow.addComponent(new Label(
"<h3>Horizontal ordered layout</h3>Added four components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutA);
mainWindow.addComponent(new Label(
"<br /><h3>Vertical ordered layout</h3>Added four components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutB);
mainWindow.addComponent(new Label(
"<br /><h3>Grid Layout (4 x 4)</h3>Added 16 components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutG);
- mainWindow
- .addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>"
- + "Added four panels and four embedded components "
- + "diagonally with absolute coordinates.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>"
+ + "Added four panels and four embedded components "
+ + "diagonally with absolute coordinates.", ContentMode.XHTML));
mainWindow.addComponent(layoutG2);
mainWindow.addComponent(new Label(
"<br /><h3>TabSheet</h3>Added above layouts as tabs.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(tabsheet);
}
+ "extremities and may have a caption to clarify the nature of the contained components' purpose."
+ " Panel contains an layout where the actual contained components are added, "
+ "this layout may be switched on the fly.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
panel.setWidth("222px");
return panel;
}
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Window;
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
}
}));
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class PerformanceTestLabelsAndOrderedLayouts extends CustomComponent {
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.NativeSelect;
// Custom components
layout.addComponent(new Label("<B>Below are few custom components</B>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
final TestForUpload tfu = new TestForUpload();
layout.addComponent(tfu);
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Window;
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
}
}));
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;
main.addComponent(new Button("commit content to label below"));
- l = new Label("", Label.CONTENT_XHTML);
+ l = new Label("", ContentMode.XHTML);
main.addComponent(l);
CheckBox b = new CheckBox("enabled");
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
"Upload finished, but output buffer is null!!"));
} else {
status.addComponent(new Label(
- "<b>Name:</b> " + event.getFilename(), Label.CONTENT_XHTML));
+ "<b>Name:</b> " + event.getFilename(), ContentMode.XHTML));
status.addComponent(new Label("<b>Mimetype:</b> "
- + event.getMIMEType(), Label.CONTENT_XHTML));
+ + event.getMIMEType(), ContentMode.XHTML));
status.addComponent(new Label("<b>Size:</b> " + event.getLength()
- + " bytes.", Label.CONTENT_XHTML));
+ + " bytes.", ContentMode.XHTML));
status.addComponent(new Link("Download " + buffer.getFileName(),
new StreamResource(buffer, buffer.getFileName(), this)));
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
"Upload finished, but output buffer is null"));
} else {
status.addComponent(new Label("<b>Name:</b> "
- + event.getFilename(), Label.CONTENT_XHTML));
+ + event.getFilename(), ContentMode.XHTML));
status.addComponent(new Label("<b>Mimetype:</b> "
- + event.getMIMEType(), Label.CONTENT_XHTML));
+ + event.getMIMEType(), ContentMode.XHTML));
status.addComponent(new Label("<b>Size:</b> "
- + event.getLength() + " bytes.",
- Label.CONTENT_XHTML));
+ + event.getLength() + " bytes.", ContentMode.XHTML));
status.addComponent(new Link("Download "
+ buffer.getFileName(), new StreamResource(buffer,
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class TestIFrames extends CustomComponent {
final int height = 250;
final String iFrame = "<iframe height=\"" + height + "\" width=\""
+ width + "\" src=\"" + URL + "\" />";
- return new Label(iFrame, Label.CONTENT_XHTML);
+ return new Label(iFrame, ContentMode.XHTML);
}
}
import com.vaadin.data.Item;
import com.vaadin.tests.util.SampleDirectory;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Tree;
setMainWindow(main);
// Main window contains heading and panel
- main.addComponent(new Label("<h2>Tree demo</h2>", Label.CONTENT_XHTML));
+ main.addComponent(new Label("<h2>Tree demo</h2>", ContentMode.XHTML));
// configure file structure panel
main.addComponent(explorerPanel);
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
private final Select select = new Select();
private final Label selectedTask = new Label("Selected task",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
public LinkedList<?> exampleTasks = new LinkedList<Object>();
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
\r
public class ApplicationCloseTest extends TestBase {\r
\r
@Override\r
protected void setup() {\r
Label applications = new Label("Applications in session: <br/>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
for (Application a : ((WebApplicationContext) getContext())\r
.getApplications()) {\r
applications.setValue(applications.getValue() + "App: " + a\r
/ 1000\r
/ 1000\r
+ "MiB memory for this application.<br/>Total memory usage reported as "\r
- + totalUsageString + "<br/>", Label.CONTENT_XHTML);\r
+ + totalUsageString + "<br/>", ContentMode.XHTML);\r
\r
addComponent(thisApp);\r
addComponent(memoryUsage);\r
import com.vaadin.terminal.gwt.server.WebBrowser;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root;
import com.vaadin.ui.VerticalLayout;
public void init(WrappedRequest request) {
setCaption(getClass().getName());
- Label label = new Label(getTestDescription(), Label.CONTENT_XHTML);
+ Label label = new Label(getTestDescription(), ContentMode.XHTML);
label.setWidth("100%");
layout = new VerticalLayout();
\r
import com.vaadin.ui.Component;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.VerticalLayout;\r
\r
setMainWindow(window);\r
window.getContent().setSizeFull();\r
\r
- Label label = new Label(getDescription(), Label.CONTENT_XHTML);\r
+ Label label = new Label(getDescription(), ContentMode.XHTML);\r
label.setWidth("100%");\r
window.getContent().addComponent(label);\r
\r
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class ButtonMouseDetails extends TestBase {
- private Label out = new Label("", Label.CONTENT_PREFORMATTED);
+ private Label out = new Label("", ContentMode.PREFORMATTED);
private int clickCounter = 1;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class IconsInCaption extends TestBase {
ComponentContainer container = containerClass.newInstance();
for (String size : sizes) {
Label title = new Label("<h3>" + size + "x" + size + "</h3>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
container.addComponent(title);
for (String icon : icons) {
ThemeResource res = new ThemeResource("../runo/icons/" + size
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.TextField;
public class ComboFocusBlurEvents extends TestBase {
@Override
protected void setup() {
-
+
List<String> list = new ArrayList<String>();
for (int i = 0; i < 100; i++) {
list.add("Item " + i);
}
-
+
ComboBox cb = new ComboBox("Combobox", list);
cb.setImmediate(true);
cb.setInputPrompt("Enter text");
cb.setDescription("Some Combobox");
addComponent(cb);
-
+
final ObjectProperty<String> log = new ObjectProperty<String>("");
cb.addListener(new FieldEvents.FocusListener() {
counter++;
}
});
-
+
TextField field = new TextField("Some textfield");
field.setImmediate(true);
addComponent(field);
Label output = new Label(log);
output.setCaption("Events:");
- output.setContentMode(Label.CONTENT_XHTML);
+ output.setContentMode(ContentMode.XHTML);
addComponent(output);
}
import com.vaadin.ui.Button;\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.TextField;\r
\r
public class ClipContent extends TestBase {\r
\r
Label text = new Label(\r
"1_long_line_that_should_be_clipped<br/>2_long_line_that_should_be_clipped<br/>3_long_line_that_should_be_clipped<br/>4_long_line_that_should_be_clipped<br/>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
\r
final CustomComponent cc = new CustomComponent(text);\r
cc.setWidth("20px");\r
w.setValue("20px");\r
w.addListener(new TextField.ValueChangeListener() {\r
public void valueChange(ValueChangeEvent event) {\r
- cc.setWidth((String) w.getValue());\r
+ cc.setWidth(w.getValue());\r
}\r
});\r
addComponent(w);\r
h.setValue("20px");\r
h.addListener(new TextField.ValueChangeListener() {\r
public void valueChange(ValueChangeEvent event) {\r
- cc.setHeight((String) h.getValue());\r
+ cc.setHeight(h.getValue());\r
}\r
});\r
addComponent(h);\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.DateField;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.PopupDateField;\r
\r
@SuppressWarnings("serial")\r
\r
@Override\r
protected void setup() {\r
- addComponent(new Label("<br/><br/>", Label.CONTENT_XHTML));\r
+ addComponent(new Label("<br/><br/>", ContentMode.XHTML));\r
log = new Log(8);\r
addComponent(log);\r
df = new MyDateField();\r
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.PopupDateField;
public class ValueThroughProperty extends TestBase {
+ "Then try to set DateField's value using the first button. It sets the value "
+ "correctly (as we can see from the Label) but the client-side is not updated.<br/>"
+ "Using second button updates value correctly on the client-side too.",
- Label.CONTENT_XML));
+ ContentMode.XML));
final PopupDateField df = new PopupDateField(dateProperty);
df.setLocale(new Locale("en", "US"));
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class LabelModes extends ComponentTestCase<Label> {
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\npreformatted mode");
- l.setContentMode(Label.CONTENT_PREFORMATTED);
+ l.setContentMode(ContentMode.PREFORMATTED);
l.setWidth(null);
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\nhtml mode");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setWidth(null);
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\nraw mode");
- l.setContentMode(Label.CONTENT_RAW);
+ l.setContentMode(ContentMode.RAW);
l.setWidth(null);
addTestComponent(l);
import com.vaadin.data.Property.ValueChangeListener;\r
import com.vaadin.tests.components.AbstractComponentTest;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
\r
public class LabelTest extends AbstractComponentTest<Label> implements\r
ValueChangeListener {\r
}\r
};\r
\r
- private Command<Label, Integer> contentModeCommand = new Command<Label, Integer>() {\r
- public void execute(Label c, Integer value, Object data) {\r
+ private Command<Label, ContentMode> contentModeCommand = new Command<Label, ContentMode>() {\r
+ public void execute(Label c, ContentMode value, Object data) {\r
c.setContentMode(value);\r
}\r
};\r
\r
@SuppressWarnings("deprecation")\r
private void createContentModeSelect(String category) {\r
- LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();\r
- options.put("Text", Label.CONTENT_TEXT);\r
- options.put("Preformatted", Label.CONTENT_PREFORMATTED);\r
- options.put("Raw", Label.CONTENT_RAW);\r
- options.put("UIDL", Label.CONTENT_UIDL);\r
- options.put("XHTML", Label.CONTENT_XHTML);\r
- options.put("XML", Label.CONTENT_XML);\r
+ LinkedHashMap<String, ContentMode> options = new LinkedHashMap<String, ContentMode>();\r
+ options.put("Text", ContentMode.TEXT);\r
+ options.put("Preformatted", ContentMode.PREFORMATTED);\r
+ options.put("Raw", ContentMode.RAW);\r
+ options.put("UIDL", ContentMode.XML); // Deprecated UIDL mode still used\r
+ // to avoid breaking old tests\r
+ options.put("XHTML", ContentMode.XHTML);\r
+ options.put("XML", ContentMode.XML);\r
\r
createSelectAction("Content mode", category, options, "Text",\r
contentModeCommand);\r
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class Labels extends ComponentTestCase<Label> {
l = createLabel(
"<div style='border: 1px solid red'><h1>Hello\n\n\n</h1><p/><h2>I am a rich Label</h3></div>",
"This is an XHTML label with rich content");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
addTestComponent(l);
l = createLabel(
"<div style='border: 1px solid blue'><h1>Hello</h1><p/><h2>I am a rich Label</h3></div>",
"This is an XHTML label with fixed 200px width and rich content");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setWidth("200px");
addTestComponent(l);
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.OptionGroup;
public class OptionGroupMultipleValueChange extends TestBase {
og.setImmediate(true);
addComponent(og);
- final Label events = new Label("", Label.CONTENT_PREFORMATTED);
+ final Label events = new Label("", ContentMode.PREFORMATTED);
events.setWidth(null);
addComponent(events);
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
panel.addComponent(new Label(
"fooooooooo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>"
+ "foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return panel;
}
import com.vaadin.ui.Component;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.VerticalLayout;
Label l = new Label(
"<div style='width: 100%; height: 100%; background: " + bg
+ "'>" + LoremIpsum.get(2000) + "</div>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
l.setSizeFull();
p.addComponent(l);
PopupView pv = new PopupView("Click here to popup", p);
import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
public class EditableTableLeak extends TestBase {
private final Table table = new Table("ISO-3166 Country Codes and flags");
private final CheckBox useFieldFactory = new CheckBox(
"Use a caching TableFieldFactory");
- private final Label sizeLabel = new Label("", Label.CONTENT_XHTML);
+ private final Label sizeLabel = new Label("", ContentMode.XHTML);
private long size = 0;
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
public class LabelEmbeddedClickThroughForTable extends TestBase {
item.getItemProperty("Column 1").setValue("String A");
item.getItemProperty("Column 2").setValue(new Label("Label A"));
item.getItemProperty("Column 3").setValue(
- new Label("<b>Label A</b>", Label.CONTENT_XHTML));
+ new Label("<b>Label A</b>", ContentMode.XHTML));
item.getItemProperty("Column 4").setValue(
new Embedded("An embedded image", new ThemeResource(
"../runo/icons/32/ok.png")));
.setValue(
new Label(
"<a style=\"color: blue\" href=\"javascript:false\">Label A</a>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
item.getItemProperty("Column 4").setValue(
new Embedded("", new ThemeResource(
"../runo/icons/32/cancel.png")));
import com.vaadin.ui.AbstractSelect.MultiSelectMode;\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Table;\r
import com.vaadin.ui.Table.CellStyleGenerator;\r
import com.vaadin.ui.Table.ColumnGenerator;\r
l.setWidth(col.width);\r
if (col.html) {\r
l.setValue(value);\r
- l.setContentMode(Label.CONTENT_XHTML);\r
+ l.setContentMode(ContentMode.XHTML);\r
} else {\r
l.setValue(value);\r
}\r
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.BrowserWindowResizeEvent;
import com.vaadin.ui.Root.BrowserWindowResizeListener;
import com.vaadin.ui.Root.LegacyWindow;
mainWindow.addComponent(resizeListenerCheckBox);
mainWindow.addComponent(immediateCheckBox);
mainWindow.addComponent(log);
- mainWindow.addComponent(new Label("<br/><br/>", Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br/><br/>", ContentMode.XHTML));
mainWindow.addComponent(new Label(LoremIpsum.get(10000)));
setLazy(false);
import com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Link;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Root;
main.addComponent(specialNameResourceTest);
userInfo.setCaption("User info");
- userInfo.setContentMode(Label.CONTENT_PREFORMATTED);
+ userInfo.setContentMode(ContentMode.PREFORMATTED);
main.addComponent(userInfo);
tf.setEnabled(false);
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.MenuBar;
l.setMargin(true);
l.setCaption("Labels");
- l.addComponent(new Label("Normal Label", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal Label", ContentMode.XHTML));
l.addComponent(new Label(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."));
return l;
l.setWidth("400px");
l.setColumnExpandRatio(0, 1);
- l.addComponent(new Label("Normal TextField", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal TextField", ContentMode.XHTML));
TextField tf = new TextField();
tf.setInputPrompt("Enter text");
l.addComponent(tf);
- l.addComponent(new Label("Normal TextArea", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal TextArea", ContentMode.XHTML));
TextArea ta = new TextArea();
ta.setHeight("5em");
l.setColumnExpandRatio(0, 2);
l.setColumnExpandRatio(1, 5);
- l.addComponent(new Label("Normal Panel", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal Panel", ContentMode.XHTML));
Panel p = new Panel("Normal Panel");
p.setHeight("100px");
l.addComponent(new Label(
"Light Style (<code>LiferayTheme.PANEL_LIGHT</code>)",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
Panel p2 = new Panel("Light Style Panel");
p2.setStyleName(LiferayTheme.PANEL_LIGHT);
w2.setPositionX(350);
w2.setPositionY(160);
w2.addComponent(new Label("<code>Window.setResizable(false)</code>",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
tabs.addListener(new TabSheet.SelectedTabChangeListener() {
public void selectedTabChange(SelectedTabChangeEvent event) {
l.addComponent(lockCheckBox, 1, 0);
l.newLine();
- Label label = new Label("Normal SplitPanel", Label.CONTENT_XHTML);
+ Label label = new Label("Normal SplitPanel", ContentMode.XHTML);
label.setWidth(null);
l.addComponent(label);
final HorizontalSplitPanel sp = new HorizontalSplitPanel();
label = new Label(
"Small Style<br />(<code>LiferayTheme.SPLITPANEL_SMALL</code>)",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
label.setWidth(null);
l.addComponent(label);
l.setWidth("400px");
l.setColumnExpandRatio(0, 1);
- l.addComponent(new Label("Horizontal Slider", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Horizontal Slider", ContentMode.XHTML));
Slider s = new Slider();
s.setWidth("200px");
try {
}
l.addComponent(s);
- l.addComponent(new Label("Vertical Slider", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Vertical Slider", ContentMode.XHTML));
s = new Slider();
s.setOrientation(Slider.ORIENTATION_VERTICAL);
s.setHeight("200px");
message.setValue("Jumped over the lazy dog.");
message.setWidth("15em");
- l.addComponent(new Label("<h3>Type</h3>", Label.CONTENT_XHTML));
- l.addComponent(new Label("<h3>Preview</h3>", Label.CONTENT_XHTML));
+ l.addComponent(new Label("<h3>Type</h3>", ContentMode.XHTML));
+ l.addComponent(new Label("<h3>Preview</h3>", ContentMode.XHTML));
- l.addComponent(new Label("Humanized", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Humanized", ContentMode.XHTML));
Button show = new Button("Humanized Notification",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
});
l.addComponent(show);
- l.addComponent(new Label("Warning", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Warning", ContentMode.XHTML));
show = new Button("Warning Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
});
l.addComponent(show);
- l.addComponent(new Label("Error", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Error", ContentMode.XHTML));
show = new Button("Error Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
});
l.addComponent(show);
- l.addComponent(new Label("Tray", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Tray", ContentMode.XHTML));
show = new Button("Tray Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.VerticalLayout;\r
\r
public class HiddenHorizontalLayout extends TestBase {\r
+ "3. Click \"toggle layout visibility\"<br>"\r
+ "4. Resize browser window to full <br/>"\r
+ "5. Click \"toggle layout visibility\"<br/>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
vl.addComponent(l);\r
Button b = new Button("toggle layout visibility",\r
new Button.ClickListener() {\r
import com.vaadin.ui.CssLayout;\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.NativeSelect;\r
import com.vaadin.ui.TextField;\r
@Override\r
protected void setup() {\r
Label label = new Label("<h1>CssLayout performance test.</h1>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
getLayout().addComponent(label);\r
\r
label = new Label(\r
"<em>Hint</em>. Use debug dialog to measure rendering times TODO: extend with size settings (to both layout and content).",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
getLayout().addComponent(label);\r
\r
ns = new NativeSelect("Select component to test");\r
b.addListener(new Button.ClickListener() {\r
\r
public void buttonClick(ClickEvent event) {\r
- int components = Integer.parseInt((String) n.getValue());\r
+ int components = Integer.parseInt(n.getValue());\r
Layout layout = getCurrentLayout();\r
for (int i = 0; i < components; i++) {\r
Component component = newTestComponent();\r
- if ((Boolean) cb.getValue()) {\r
+ if (cb.getValue()) {\r
component.setCaption("caption " + i);\r
}\r
layout.addComponent(component);\r
import com.vaadin.ui.DateField;\r
import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Link;\r
import com.vaadin.ui.Select;\r
\r
final AbstractComponent c1 = new Button("BUTTON");\r
final AbstractComponent c2 = new Label("<b>LABEL</b>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
final AbstractComponent c3 = new Table("TABLE");\r
c3.setHeight("100px");\r
c3.setWidth("100%");\r
import com.vaadin.ui.DateField;\r
import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Link;\r
import com.vaadin.ui.NativeSelect;\r
((TextField) components[i]).setValue("FIELD " + i);\r
vlo.addComponent(components[i]);\r
vlo.setComponentAlignment(components[i], alignments[i]);\r
- vlo.addComponent(new Label("<hr />", Label.CONTENT_XHTML));\r
+ vlo.addComponent(new Label("<hr />", ContentMode.XHTML));\r
}\r
baseLayout.addComponent(vlo);\r
vlo = getTestLaytout();\r
((TextField) components[i]).setValue("FIELD " + i);\r
vlo.addComponent(components[i]);\r
vlo.setComponentAlignment(components[i], alignments[i]);\r
- vlo.addComponent(new Label("<hr />", Label.CONTENT_XHTML));\r
+ vlo.addComponent(new Label("<hr />", ContentMode.XHTML));\r
}\r
baseLayout.addComponent(vlo);\r
return baseLayout;\r
\r
final AbstractComponent c1 = new Button("BUTTON");\r
final AbstractComponent c2 = new Label("<b>LABEL</b>",\r
- Label.CONTENT_XHTML);\r
+ ContentMode.XHTML);\r
final AbstractComponent c3 = new Table("TABLE");\r
c3.setHeight("100px");\r
c3.setWidth("100%");\r
button4.setEnabled(false);\r
\r
vlo2.addComponent(c1);\r
- vlo2.addComponent(new Label("<hr />", Label.CONTENT_XHTML));\r
+ vlo2.addComponent(new Label("<hr />", ContentMode.XHTML));\r
vlo2.addComponent(c2);\r
vlo2.setExpandRatio(c1, 0.5f);\r
vlo2.setExpandRatio(c2, 0.5f);\r
final VerticalLayout vlo2 = getTestLaytout();\r
\r
vlo2.addComponent(c1);\r
- vlo2.addComponent(new Label("<hr />", Label.CONTENT_XHTML));\r
+ vlo2.addComponent(new Label("<hr />", ContentMode.XHTML));\r
vlo2.addComponent(c2);\r
vlo2.setExpandRatio(c1, 0.5f);\r
vlo2.setExpandRatio(c2, 0.5f);\r
import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
Label red = new Label(
"<div style='background:red;width:100%;height:100%;'>??</div>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
// red.setCaption("cap");
// red.setSizeFull();
ts.getTab(red).setCaption("REd tab");
Label l = new Label("<div style='background:blue;'>sdf</div>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
el.addComponent(l);
el.setComponentAlignment(l, Alignment.MIDDLE_RIGHT);
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.TextField;\r
\r
gl.addComponent(new Label("0,0-1,0"), 0, 0, 1, 0);\r
gl.addComponent(new Label("2,0-3,0"), 2, 0, 3, 0);\r
Label l = new Label("Large cell 0,1-2,2<br/>yadayada<br/>lorem ipsum");\r
- l.setContentMode(Label.CONTENT_XHTML);\r
+ l.setContentMode(ContentMode.XHTML);\r
gl.addComponent(l, 0, 1, 2, 2);\r
gl.addComponent(new Label("3-1"), 3, 1);\r
gl.addComponent(new Label("3,2-3,3"), 3, 2, 3, 3);\r
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
Label red = new Label(
"<div style='background:red;width:100%;height:100%;'>??</div>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
red.setSizeFull();
ol.addComponent(red);
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.Select;\r
import com.vaadin.ui.Window;\r
w.setModal(true);\r
w.setScrollable(true);\r
w.setHeight("80%");\r
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));\r
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));\r
main.addWindow(w);\r
}\r
});\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.TextField;\r
import com.vaadin.ui.Window;\r
}\r
Window w = new Window("Status of the fields");\r
w.setModal(true);\r
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));\r
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));\r
main.addWindow(w);\r
}\r
});\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.Select;\r
import com.vaadin.ui.Window;\r
}\r
Window w = new Window("Status of the fields");\r
w.setModal(true);\r
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));\r
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));\r
main.addWindow(w);\r
}\r
});\r
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket1970 extends Application.LegacyApplication {
}
}));
w.addComponent(new Label("<a href='" + getURL().toExternalForm() + "'>"
- + getURL().toExternalForm() + "</a>", Label.CONTENT_XHTML));
+ + getURL().toExternalForm() + "</a>", ContentMode.XHTML));
w.addComponent(new Label(
"<h2>How to reproduce</h2>Open the above link in another browser"
+ " window and then press the Show-button on this window.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return w;
}
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
private static final Label info = new Label(
"Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)",
- Label.CONTENT_RAW);
+ ContentMode.RAW);
Tree tree = new Tree();
Table table = new Table();
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket2117 extends Application.LegacyApplication {
+ "'>"
+ getURL().toExternalForm()
+ "</a> which opens new windows to this uri. They should end up having a separate Window and URL.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return w;
}
}
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
+ " - Go to the second Window\n"
+ " - Click the arrow in the Select\n"
+ " --> The opened list correctly shows the new value but the old one is shown in the \"input\" part");
- label.setContentMode(Label.CONTENT_PREFORMATTED);
+ label.setContentMode(ContentMode.PREFORMATTED);
layout.addComponent(label);
final Select select = new Select("Test Select");
import com.vaadin.Application;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
layout.setStyleName("borders");
// layout.setSizeFull();
final Label l = new Label(txt);
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
// l.setWidth("100%");
TextField tf = new TextField("This is a textField");
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Layout.AlignmentHandler;
import com.vaadin.ui.Root.LegacyWindow;
vl.setHeight("500px");
vl.setStyleName("borders");
label = new Label("<b>Error messages follows:</b><br/>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
vl.addComponent(label);
layout.addComponent(vl);
gl.setHeight("500px");
gl.setStyleName("borders");
label = new Label("<b>Error messages follows:</b><br/>",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
gl.addComponent(label);
layout.addComponent(gl);
import java.net.URL;\r
\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
\r
public class Ticket2287 extends Ticket2292 {\r
"Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));\r
\r
Label l = new Label();\r
- l.setContentMode(Label.CONTENT_XHTML);\r
+ l.setContentMode(ContentMode.XHTML);\r
l.setValue("This is a label with as slow image. <img src=\"" + url\r
+ "/icon.png\" />");\r
main.addComponent(l);\r
\r
l = new Label();\r
- l.setContentMode(Label.CONTENT_XHTML);\r
+ l.setContentMode(ContentMode.XHTML);\r
l.setValue("This is a label with as slow image. <img src=\"" + url\r
+ "/icon.png\" />");\r
main.addComponent(l);\r
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.themes.Reindeer;
Label l = new Label(
"a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
- l.setContentMode(Label.CONTENT_PREFORMATTED);
+ l.setContentMode(ContentMode.PREFORMATTED);
p.addComponent(l);
main.addComponent(new Label(
"This text should be right below the panel, w/o spacing"));
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket2426 extends Application.LegacyApplication {
final String content = "<select/>";
w.addComponent(new Label("CONTENT_DEFAULT: " + content,
- Label.CONTENT_DEFAULT));
+ ContentMode.DEFAULT));
w.addComponent(new Label("CONTENT_PREFORMATTED: " + content,
- Label.CONTENT_PREFORMATTED));
- w.addComponent(new Label("CONTENT_RAW: " + content, Label.CONTENT_RAW));
- w.addComponent(new Label("CONTENT_TEXT: " + content, Label.CONTENT_TEXT));
- w.addComponent(new Label("CONTENT_XML: " + content, Label.CONTENT_XML));
- w.addComponent(new Label("CONTENT_XHTML: " + content,
- Label.CONTENT_XHTML));
+ ContentMode.PREFORMATTED));
+ w.addComponent(new Label("CONTENT_RAW: " + content, ContentMode.RAW));
+ w.addComponent(new Label("CONTENT_TEXT: " + content, ContentMode.TEXT));
+ w.addComponent(new Label("CONTENT_XML: " + content, ContentMode.XML));
+ w.addComponent(new Label("CONTENT_XHTML: " + content, ContentMode.XHTML));
}
\r
import com.vaadin.Application;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Root.LegacyWindow;\r
\r
public class Ticket5952 extends Application.LegacyApplication {\r
+ " <mn>2</mn>"\r
+ " </msup>"\r
+ " </mrow>" + "</math>";\r
- Label mathLabel = new Label(mathml, Label.CONTENT_XML);\r
+ Label mathLabel = new Label(mathml, ContentMode.XML);\r
mainWindow.addComponent(mathLabel);\r
}\r
}\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Root.LegacyWindow;\r
import com.vaadin.ui.Table;\r
+ "<li> focusing should fail (try tabbing as well) [worked previousy]"\r
+ "<li> no variable changes should be sent from disabled fields [changed sent previously]"\r
+ "<li> try further toggling and tabbing around",\r
- Label.CONTENT_RAW);\r
+ ContentMode.RAW);\r
\r
Panel root = new Panel("Enabled");\r
Panel one = new Panel("Enabled");\r
import java.util.List;\r
\r
import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ContentMode;\r
import com.vaadin.ui.VerticalLayout;\r
\r
public class Log extends VerticalLayout {\r
}\r
\r
private Label createEventLabel() {\r
- Label l = new Label(" ", Label.CONTENT_XHTML);\r
+ Label l = new Label(" ", ContentMode.XHTML);\r
l.setWidth(null);\r
return l;\r
}\r
import com.vaadin.Application;
import com.vaadin.terminal.SystemError;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root;
errorPanel.setStyleName("strong");
errorPanel.setComponentError(new SystemError(
"Cannot provide sample directory"));
- errorPanel.addComponent(new Label(errorMessage, Label.CONTENT_XHTML));
+ errorPanel.addComponent(new Label(errorMessage, ContentMode.XHTML));
// Remove all components from applications main window
root.getContent().removeAllComponents();
// Add error panel