Example usage for com.vaadin.ui Label setCaption

List of usage examples for com.vaadin.ui Label setCaption

Introduction

In this page you can find the example usage for com.vaadin.ui Label setCaption.

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:annis.visualizers.component.RawTextVisualizer.java

License:Apache License

@Override
public Panel createComponent(VisualizerInput visInput, VisualizationToggle visToggle) {

    // get config for alignment
    boolean vertical = Boolean.parseBoolean(visInput.getMappings().getProperty("vertical", "true"));

    // get the texts
    RawTextWrapper texts = visInput.getRawText();

    // create the main panel
    Panel p = new Panel();
    p.setSizeFull();//  www. j a  v  a2  s  .c  om

    // some layout configuration
    p.addStyleName(ChameleonTheme.PANEL_BORDERLESS);
    p.addStyleName(PANEL_CLASS);

    // enable webfonts
    p.addStyleName(Helper.CORPUS_FONT_FORCE);

    Layout l;

    // if no text available inform user and exit
    if (texts == null) {
        Label text = new Label(NO_TEXT);
        text.addStyleName(LABEL_CLASS);
        text.setSizeFull();
        p.setContent(text);
        return p;
    }

    if (texts.hasMultipleTexts()) {

        // set the aligmnent
        if (vertical) {
            l = new VerticalLayout();
        } else {
            l = new GridLayout(texts.getTexts().size(), 1);
        }

        // limit the size to the parent panel.
        l.setSizeFull();

        // add the texts to the layout
        for (int i = 0; i < texts.getTexts().size(); i++) {

            String s = texts.getTexts().get(i);
            Label lblText;

            // check if the text is empty
            if (s == null || hasOnlyWhiteSpace(s)) {
                lblText = new Label(NO_TEXT);
            } else {
                lblText = new Label(s, ContentMode.TEXT);
            }

            lblText.setCaption("text " + (i + 1));
            lblText.addStyleName(LABEL_CLASS);
            lblText.setWidth(98, Sizeable.Unit.PERCENTAGE);

            l.addComponent(lblText);
        }

        // apply the panel
        p.setContent(l);
        return p;
    }

    Label lblText;
    if (texts.hasTexts() && !hasOnlyWhiteSpace(texts.getFirstText())) {
        lblText = new Label(texts.getFirstText(), ContentMode.TEXT);
    } else {
        lblText = new Label(NO_TEXT);
    }

    lblText.setSizeFull();
    lblText.addStyleName(LABEL_CLASS);
    p.setContent(lblText);

    return p;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getAudioView(SettingsAudio sB, int backgroundChanger) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);/*from  www. j  a v a2s .  c om*/

    return box;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getEnumView(SettingEnum<?> sB, int backgroundChanger) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);//  w  ww. j  a  va 2 s  .  c  o  m

    return box;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getTimeView(SettingTime sB, int backgroundChanger) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);//from w w w . j  a v a2  s  . c om

    return box;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getStringArrayView(SettingStringArray sB, int backgroundChanger) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);//from  w  ww  .  j  a  v a  2s .  c om

    return box;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getIntArrayView(SettingIntArray sB, int backgroundChanger) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);// w  w  w . j  a va 2 s.c om

    return box;
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getBoolView(SettingBool sB, int backgroundChanger) {

    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());
    box.addComponent(label);//from   ww  w. j  av a2 s .  c  o  m

    return box;
}

From source file:com.abien.vaadin.helloapp.HelloApp.java

License:Apache License

@Override
public void init() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from   www .j  ava 2s  .c  o  m*/
    Label header = new Label("Vaadin on Java EE");
    header.setStyleName("h1");
    layout.addComponent(header);

    final TextField nameField = new TextField("Input something:");
    final Label greetingLbl = new Label();
    layout.addComponent(nameField);

    layout.addComponent(
            new Button("Say slow Hello, clicking this shouldn't stall other users", new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        Thread.sleep(20 * 1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(HelloApp.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    getMainWindow().showNotification("Hello!");
                }
            }));

    layout.addComponent(new Button("Say Hello", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            greetingLbl.setCaption(greetingService.sayHello(nameField.getValue().toString()));
            buttonEvents.fire(event);
        }
    }));
    layout.addComponent(greetingLbl);

    Window mainWindow = new Window("Vaadin 6.8 - Java EE Integration", layout);
    setMainWindow(mainWindow);
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private Label createActiveWidgetsetLabel() {
    Label activeWidgetsetLabel = new Label();
    activeWidgetsetLabel.setCaption("Active Widget Set");
    String value = ControlPanelPortletUtil.getPortalWidgetset();
    activeWidgetsetLabel.setValue(value);
    return activeWidgetsetLabel;
}

From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java

License:Apache License

private Label createAdditionalDependenciesLabel() {
    Label dependencyList = new Label("", ContentMode.HTML);
    dependencyList.setCaption("Other Dependencies");
    if (includedDependencies != null) {
        String value = "";
        if (includedDependencies.size() > 0) {
            for (File file : includedDependencies) {
                if (!value.equals("")) {
                    value += "<br/>";
                }/*w w  w  .  j a v a 2 s .  c o m*/
                value += file.getName();
            }
        } else {
            value = "none";
        }

        dependencyList.setValue(value);
    }
    return dependencyList;
}