Example usage for com.vaadin.shared.ui ContentMode TEXT

List of usage examples for com.vaadin.shared.ui ContentMode TEXT

Introduction

In this page you can find the example usage for com.vaadin.shared.ui ContentMode TEXT.

Prototype

ContentMode TEXT

To view the source code for com.vaadin.shared.ui ContentMode TEXT.

Click Source Link

Document

Textual values are displayed as plain text.

Usage

From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.VDragCaptionProvider.java

License:Apache License

public Element getDragCaptionElement(Widget w) {
    ComponentConnector component = Util.findConnectorFor(w);
    DDLayoutState state = ((DragAndDropAwareState) root.getState()).getDragAndDropState();
    DragCaptionInfo dci = state.dragCaptions.get(component);

    Document document = Document.get();

    Element dragCaptionImage = document.createDivElement();
    Element dragCaption = document.createSpanElement();

    String dragCaptionText = dci.caption;
    if (dragCaptionText != null) {
        if (dci.contentMode == ContentMode.TEXT) {
            dragCaption.setInnerText(dragCaptionText);
        } else if (dci.contentMode == ContentMode.HTML) {
            dragCaption.setInnerHTML(dragCaptionText);
        } else if (dci.contentMode == ContentMode.PREFORMATTED) {
            PreElement preElement = document.createPreElement();
            preElement.setInnerText(dragCaptionText);
            dragCaption.appendChild(preElement);
        }/*from  w ww.j a  v a2s .co  m*/
    }

    String dragIconKey = state.dragCaptions.get(component).iconKey;
    if (dragIconKey != null) {
        String resourceUrl = root.getResourceUrl(dragIconKey);
        Icon icon = component.getConnection().getIcon(resourceUrl);
        dragCaptionImage.appendChild(icon.getElement());
    }

    dragCaptionImage.appendChild(dragCaption);

    return dragCaptionImage;
}

From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropCaptionModeDemo.java

License:Apache License

@Override
public Component getLayout() {
    // start-source
    // Create layout
    DDAbsoluteLayout layout = new DDAbsoluteLayout();

    // Enable dragging components by their caption
    layout.setDragMode(LayoutDragMode.CAPTION);

    // Enable dropping components
    layout.setDropHandler(new DefaultAbsoluteLayoutDropHandler());

    // Add some content to the layout
    layout.addComponent(new Label("This layout uses the LayoutDragMode.CAPTION "
            + "drag mode for dragging the components. This mode is useful "
            + "when you only want users to drag items by their captions. The Panels below are only draggable by their captions (<< Move >>).",
            ContentMode.HTML));//from   w ww . ja v  a 2s . com

    Panel chapter1 = new Panel("<< Move >>");
    chapter1.setWidth("300px");
    Label chapter1Content = new Label(new LoremIpsum().getParagraphs(1), ContentMode.TEXT);
    chapter1Content.setCaption("===== Chapter 1 - The beginning ======");
    chapter1.setContent(chapter1Content);
    layout.addComponent(chapter1, "top:50px;left:10px");

    Panel chapter2 = new Panel("<< Move >>");
    chapter2.setWidth("300px");
    Label chapter2Content = new Label(new LoremIpsum().getParagraphs(1), ContentMode.TEXT);
    chapter2Content.setCaption("===== Chapter 2 - The finale ======");
    chapter2.setContent(chapter2Content);
    layout.addComponent(chapter2, "top:50px; left:320px");

    // end-source
    return layout;
}

From source file:org.apache.tamaya.ui.views.SystemView.java

License:Apache License

public SystemView() {
    Label caption = new Label("Tamaya Runtime");
    Label description = new Label(
            "This view shows the system components currently active. This information may be useful when checking if an"
                    + "configuration extension is loaded and for inspection of the configuration and property sources"
                    + "invovlved.",
            ContentMode.TEXT);
    configTree.setHeight("100%");
    configTree.setWidth("100%");
    fillAccordion();/* ww w.j  a  v  a2s  . c  o m*/

    addComponents(caption, description, configTree);
    caption.addStyleName(UIConstants.LABEL_HUGE);
}