Example usage for com.vaadin.ui Label setContentMode

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

Introduction

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

Prototype

public void setContentMode(ContentMode contentMode) 

Source Link

Document

Sets the content mode of the label.

Usage

From source file:de.catma.ui.repository.wizard.IndexerOptionsPanel.java

License:Open Source License

private void initComponents() {
    setSpacing(true);/* w  w w .  j a  v  a  2s  .c  om*/
    setSizeFull();

    Label infoLabel = new Label();

    infoLabel.setContentMode(Label.CONTENT_XHTML);
    infoLabel.setValue("<p>This section allows you to finetune the creation "
            + "of the word list of your Source Document.</p>"
            + "<p>If you are unsure what to do, just select the language "
            + "and leave everything else unmodified.</p>");
    addComponent(infoLabel, 0, 0, 2, 0);

    cbUseApostrophe = new CheckBox("always use the apostrophe as a word separator");

    addComponent(cbUseApostrophe, 0, 1, 2, 1);

    Locale[] all = Locale.getAvailableLocales();

    sortedLangs = new TreeSet<LanguageItem>();
    for (Locale locale : all) {
        sortedLangs.add(new LanguageItem(locale));
    }

    languagesListSelect = new ListSelect("Please select the predominant language of the Source Document:",
            sortedLangs);
    languagesListSelect.setNullSelectionAllowed(false);
    languagesListSelect.setSizeFull();
    languagesListSelect.setImmediate(true);

    addComponent(languagesListSelect, 0, 2, 0, 3);

    unseparableCharacterSequencesListSelect = new ListSelect("Unseparable character sequences:");
    unseparableCharacterSequencesListSelect.setNullSelectionAllowed(false);
    unseparableCharacterSequencesListSelect.setSizeFull();
    unseparableCharacterSequencesListSelect.setImmediate(true);

    addComponent(unseparableCharacterSequencesListSelect, 1, 2, 1, 3);

    HorizontalLayout ucsAddRemoveLayout = new HorizontalLayout();
    Panel ucsAddRemovePanel = new Panel(ucsAddRemoveLayout);
    ucsAddRemovePanel.setStyleName(Reindeer.PANEL_LIGHT);
    ucsAddRemoveLayout.setSpacing(true);
    ucsAddRemoveLayout.setSizeFull();

    btAddUcs = new Button("Add entry");
    btAddUcs.setEnabled(false);
    ucsAddRemovePanel.addComponent(btAddUcs);
    tfUcs = new TextField();
    tfUcs.setInputPrompt("Add things like 'e.g.' as you see fit.");
    tfUcs.setImmediate(true);
    tfUcs.setTextChangeEventMode(TextChangeEventMode.EAGER);
    tfUcs.setWidth("100%");

    ucsAddRemovePanel.addComponent(tfUcs);
    ucsAddRemoveLayout.setExpandRatio(tfUcs, 2);
    btRemoveUcs = new Button("Remove entry");
    btRemoveUcs.setEnabled(false);
    ucsAddRemovePanel.addComponent(btRemoveUcs);

    addComponent(ucsAddRemovePanel, 1, 4);

    VerticalLayout loadSavePanel = new VerticalLayout();
    loadSavePanel.setSpacing(true);
    loadSavePanel.setWidth("80px");

    btLoadUcsList = new Button("Load list");
    loadSavePanel.addComponent(btLoadUcsList);
    btSaveUcsList = new Button("Save list");
    loadSavePanel.addComponent(btSaveUcsList);

    addComponent(loadSavePanel, 2, 2);

    setColumnExpandRatio(0, 2);
    setColumnExpandRatio(1, 2);

    setRowExpandRatio(2, 2);
    setRowExpandRatio(3, 2);
}

From source file:de.catma.ui.tagmanager.ColorLabelColumnGenerator.java

License:Open Source License

public Object generateCell(Table source, Object itemId, Object columnId) {
    try {//  w  w w  . j  a v  a 2s. co m
        TagDefinition td = tagDefinitionProvider.getTagDefinition(itemId);

        if (td != null) {
            Label colorLabel = new Label(
                    MessageFormat.format(COLORLABEL_HTML, ColorConverter.toHex((td.getColor()))));
            colorLabel.setContentMode(Label.CONTENT_XHTML);
            return colorLabel;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();//TODO: log
        throw e;
    }
    return new Label();
}

From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java

License:Apache License

/**
 * Adds a pretty label for a read-only information item to the given form.
 * /*from   ww w .  j  a v  a 2  s.co  m*/
 * @param form
 *            form to manipulate (must not be <code>null</code>)
 * @param information
 *            read-only information item to turn into a control (must not be
 *            <code>null</code>)
 */
public void addControl(Form form, TInformation information) {
    if (form == null) {
        throw new IllegalArgumentException("Form is null");
    }
    if (information == null) {
        throw new IllegalArgumentException("Information is null");
    }

    Label label = new Label();
    /*
     * An information item may contain plain text or XHTML, we change the
     * content mode of our label accordingly.
     */
    label.setContentMode(information.getContent().getType().equals(ContentType.XHTML) ? Label.CONTENT_XHTML
            : Label.CONTENT_TEXT);
    label.setValue(information.getContent().getValue());
    /*
     * TODO there's a high chance that this label will look like crap when
     * slapped into the default layout. Remove this marker if it looks
     * pretty ~dh
     */
    form.getLayout().addComponent(label);
}

From source file:de.escidoc.admintool.view.admintask.filter.FilterView.java

License:Open Source License

private void addHeader() {
    final Label text = new H2(ViewConstants.FILTERING_RESOURCES_TITLE);
    text.setContentMode(Label.CONTENT_XHTML);
    cssLayout.addComponent(text);/*www .j a  va 2 s.  c  om*/
}

From source file:de.escidoc.admintool.view.admintask.loadexamples.LoadExample.java

License:Open Source License

@Override
public void addView() {
    Label text = new H2(ViewConstants.LOAD_EXAMPLES_TITLE);
    text.setContentMode(Label.CONTENT_XHTML);
    cssLayout.addComponent(text);/* ww  w.  j a va2  s. c o  m*/

    cssLayout.addComponent(new Ruler());

    text = new Label(ViewConstants.LOAD_EXAMPLE_TEXT, Label.CONTENT_XHTML);
    cssLayout.addComponent(text);

    final HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setWidth(100, UNITS_PERCENTAGE);
    hLayout.setHeight(100, UNITS_PERCENTAGE);

    final LoadExampleView filterView = new LoadExampleResourceViewImpl(mainWindow, services.getAdminService());
    hLayout.addComponent(filterView);
    cssLayout.addComponent(hLayout);
}

From source file:de.escidoc.admintool.view.admintask.reindex.ReindexView.java

License:Open Source License

@Override
public void addView() {
    Label text = new H2(ViewConstants.REINDEX_RESOURCES_TITLE);
    text.setContentMode(Label.CONTENT_XHTML);

    cssLayout.addComponent(text);//w  w w . j av  a2s  .c om
    cssLayout.addComponent(new Ruler());

    text = new Label(ViewConstants.REINDEX_TEXT, Label.CONTENT_XHTML);
    cssLayout.addComponent(text);

    final HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setWidth("100%");
    hLayout.setHeight("250px");

    final ReindexResourceView reindexResourceView = new ReindexResourceViewImpl(services.getAdminService(),
            mainWindow, application);
    reindexResourceView.init();
    hLayout.addComponent(reindexResourceView);

    cssLayout.addComponent(hLayout);
}

From source file:de.escidoc.admintool.view.admintask.repositoryinfo.RepositoryInfoMainView.java

License:Open Source License

@Override
public void addView() {

    Label text = new H2(ViewConstants.REPOSITORY_INFORMATION_TITLE);
    text.setContentMode(Label.CONTENT_XHTML);
    cssLayout.addComponent(text);/*from w w w  .  j a v a2 s.  c  o  m*/

    cssLayout.addComponent(new Ruler());

    text = new Label(ViewConstants.REPO_INFO_TEXT, Label.CONTENT_XHTML);
    cssLayout.addComponent(text);

    final HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setWidth(100, UNITS_PERCENTAGE);
    hLayout.setHeight(100, UNITS_PERCENTAGE);

    final RepoInfoClickListener listener = new RepoInfoClickListener(mainWindow, services.getAdminService());
    hLayout.addComponent(new RepositoryInfoView(listener));
    cssLayout.addComponent(hLayout);
}

From source file:de.fzi.fhemapi.view.vaadin.ui.model.DeviceDetailEntry.java

License:Apache License

private static Label buildRichTextField(String text) {
    Label label = new Label();
    label.setImmediate(false);//w  w w. j a va2s  . c  o  m
    label.setWidth("-1px");
    label.setHeight("-1px");
    label.setValue(text);
    label.setContentMode(Label.CONTENT_XHTML);
    return label;
}

From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java

License:Apache License

private static HorizontalLayout getTitlePanel() {
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setImmediate(false);//  w  w w  .j  a  v  a 2s  .c  o  m
    titleLayout.setWidth("-1");
    titleLayout.setHeight("-1");
    titleLayout.setMargin(false);

    // deviceTitle
    Label title = new Label();
    title.setImmediate(true);
    title.setWidth("100%");
    title.setHeight("50");
    title.setValue("<h1>Neues Gert..</h1>");
    title.setContentMode(Label.CONTENT_XHTML);

    titleLayout.addComponent(title);
    titleLayout.setComponentAlignment(title, Alignment.TOP_CENTER);
    return titleLayout;
}

From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java

License:Apache License

private VerticalLayout buildMainLayout() {
    VerticalLayout layout = new VerticalLayout();

    nameTextField = new TextField();
    HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField);
    layout.addComponent(nameLay);//from   ww w  .j  a  v  a  2  s  .c om

    typeComboBox = new ComboBox();
    for (String type : roomTypes) {
        typeComboBox.addItem(type);
    }

    HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox);
    layout.addComponent(typeLay);
    layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER);

    Label devicesLabel = new Label();
    devicesLabel.setImmediate(false);
    devicesLabel.setWidth("100%");
    devicesLabel.setHeight("50");
    devicesLabel.setValue("<b>Gerte</b>");
    devicesLabel.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(devicesLabel);
    layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER);

    List<Device> deviceList = parent.server.getDeviceManager().getDevices();
    devicesCheckBox = new CheckBox[deviceList.size()];
    for (int i = 0; i < deviceList.size(); i++) {
        devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName());
        layout.addComponent(devicesCheckBox[i]);
        layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER);
    }

    Button saveButton = new Button("Speichern");
    saveButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            List<String> names = new LinkedList<String>();
            for (CheckBox checkbox : devicesCheckBox) {
                if (checkbox.booleanValue())
                    names.add(checkbox.getCaption());
            }

            Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(),
                    names);
            MessageResponse response = parent.server.getStructureManager().createNewStructure(struc);
            getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION);
            parent.server.getStructureManager().rereadFromFHEM();
            parent.reloadTree();
        }
    });
    layout.addComponent(saveButton);
    layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);

    return layout;
}