Example usage for com.vaadin.ui Label setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.esofthead.mycollab.vaadin.ui.GridFormLayoutHelper.java

License:Open Source License

public void addComponentNoWrapper(final Component field, final String caption, final int columns,
        final int rows) {
    if (caption != null) {
        final Label l = new Label(caption);
        l.setWidth(this.defaultCaptionWidth);
        this.layout.addComponent(l, 2 * columns, rows);
        this.layout.setComponentAlignment(l, this.captionAlignment);
    }// w  w w . j  a v  a 2s.c o  m
    if (!(field instanceof Button))
        field.setCaption(null);

    if (field instanceof MultiSelectComp) {
        field.setWidth("200px");
    } else {
        field.setWidth(fieldControlWidth);
    }

    this.layout.addComponent(field, 2 * columns + 1, rows);
    this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f);
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

private Layout createTextFieldMail(String title, Component component) {
    HorizontalLayout layout = new HorizontalLayout();
    Label lbTitle = new Label(title);
    lbTitle.setWidth("60px");
    lbTitle.setStyleName("lbmail");
    layout.addComponent(lbTitle);/*from   w  w w. j a  v  a2s  . co  m*/
    layout.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT);
    layout.addComponent(component);
    layout.setComponentAlignment(component, Alignment.MIDDLE_LEFT);
    layout.setWidth("100%");
    layout.setExpandRatio(component, 1.0f);
    return layout;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.field.UrlSocialNetworkLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(caption)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {//w  ww. j a va2 s  . c o  m
        linkAccount = (linkAccount == null) ? "" : linkAccount;
        final Link link = new Link();
        link.setResource(new ExternalResource(linkAccount));
        link.setCaption(caption);
        link.setTargetName("_blank");
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.NotificationComponent.java

License:Open Source License

private Component buildComponentFromNotification(AbstractNotification item) {
    final MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.setData(item);/*www . j  a v  a  2s.  c o m*/
    wrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (item instanceof NewUpdateAvailableNotification) {
        final NewUpdateAvailableNotification notification = (NewUpdateAvailableNotification) item;
        Span spanEl = new Span();
        spanEl.appendText(
                AppContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION, notification.getVersion()));
        Label lbl = new Label(FontAwesome.INFO_CIRCLE.getHtml() + " " + spanEl.write(), ContentMode.HTML);
        lbl.setWidth("100%");
        CssLayout lblWrapper = new CssLayout();
        lblWrapper.addComponent(lbl);
        wrapper.addComponent(lblWrapper);
        wrapper.expand(lblWrapper);
        if (AppContext.isAdmin()) {
            Button upgradeBtn = new Button(AppContext.getMessage(ShellI18nEnum.ACTION_UPGRADE),
                    new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            UI.getCurrent().addWindow(new UpgradeConfirmWindow(notification.getVersion(),
                                    notification.getManualDownloadLink(), notification.getInstallerFile()));
                            NotificationComponent.this.setPopupVisible(false);
                        }
                    });
            upgradeBtn.addStyleName(UIConstants.BUTTON_BLOCK);
            wrapper.addComponent(upgradeBtn);
        }
    } else if (item instanceof RequestUploadAvatarNotification) {
        wrapper.addComponent(new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + AppContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPLOAD_AVATAR), ContentMode.HTML));
        Button uploadAvatarBtn = new Button(AppContext.getMessage(ShellI18nEnum.ACTION_UPLOAD_AVATAR),
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                        NotificationComponent.this.setPopupVisible(false);
                    }
                });
        uploadAvatarBtn.setStyleName(UIConstants.BUTTON_BLOCK);
        wrapper.add(uploadAvatarBtn);
    } else if (item instanceof SmtpSetupNotification) {
        Button smtpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SETUP),
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent clickEvent) {
                        EventBusFactory.getInstance()
                                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
                        NotificationComponent.this.setPopupVisible(false);
                    }
                });
        smtpBtn.setStyleName(UIConstants.BUTTON_BLOCK);
        Label lbl = new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + AppContext.getMessage(ShellI18nEnum.ERROR_NO_SMTP_SETTING), ContentMode.HTML);
        MCssLayout lblWrapper = new MCssLayout(lbl);
        wrapper.with(lblWrapper, smtpBtn).expand(lblWrapper);
    } else {
        LOG.error("Do not render notification " + item);
    }
    return wrapper;
}

From source file:com.esspl.datagen.DataGenApplication.java

License:Open Source License

public void addRow(int noOfRow) {
    log.debug("DataGenApplication - addRow() start");
    int maxSize = tableLength + noOfRow;
    for (int i = tableLength; i <= maxSize; i++) {
        log.info("DataGenApplication - addRow(): Adding row- " + i);
        Select dataType = new Select();
        dataType.addItem("Name");
        dataType.addItem("Title");
        dataType.addItem("Phone/Fax");
        dataType.addItem("Email");
        dataType.addItem("Date");
        dataType.addItem("Street Address");
        dataType.addItem("City");
        dataType.addItem("Postal/Zip");
        dataType.addItem("State/Provience/County");
        dataType.addItem("Country");
        dataType.addItem("Random Text");
        dataType.addItem("Fixed Text");
        dataType.addItem("Incremental Number");
        dataType.addItem("Number Range");
        dataType.addItem("Alphanumeric");
        dataType.addItem("Marital Status");
        dataType.addItem("Department Name");
        dataType.addItem("Company Name");
        dataType.addItem("Boolean Flag");
        dataType.addItem("Passport Number");
        dataType.setWidth("100%");
        dataType.setImmediate(true);//from w w  w .j a v a  2 s. c o m
        dataType.setData(i);
        dataType.setCaption("DataType");
        dataType.addListener(this);

        Select format = new Select();
        format.setData(i);
        format.setCaption("Format");
        format.setImmediate(true);
        format.setWidth("100%");
        format.setEnabled(false);
        format.addListener(this);

        Label example = new Label("NA");
        example.setWidth("100%");

        TextField field = new TextField("");

        HorizontalLayout addBar = new HorizontalLayout();
        addBar.setWidth("100%");
        addBar.addComponent(new Label("NA"));

        listing.addItem(new Object[] { i, field, dataType, format, example, addBar }, i);
        tableLength = i;
    }
    log.debug("DataGenApplication - addRow() end");
}

From source file:com.etest.connection.ShowErrorNotification.java

public static void error(String error) {
    Label label = new Label();
    label.setWidth("400px");
    label.setValue(error);//from w  w w .  j  a  v a  2  s.  c  o m
    label.setContentMode(ContentMode.HTML);
    Notification.show(label.getValue(), Notification.Type.ERROR_MESSAGE);
}

From source file:com.etest.view.testbank.cellitem.CellCaseItemWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from  w ww .  ja v a2  s  .  co m
    form.setSpacing(true);

    CellCase cc = ccs.getCellCaseById(getCellCaseId());
    Panel panel = new Panel();
    panel.setWidth("100%");
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);

    Label caseLabel = new Label();
    caseLabel.setCaption("CASE: ");
    caseLabel.setStyleName("bold-font-style");
    caseLabel.setWidth("80px");

    Label caseTopic = new Label();
    caseTopic.setValue(caseLabel.getCaption() + cc.getCaseTopic());
    caseTopic.setContentMode(ContentMode.RAW);
    caseTopic.addStyleName("wrapline");

    panel.setContent(caseTopic);
    form.addComponent(panel);

    form.addComponent(table);

    HorizontalLayout v = new HorizontalLayout();
    v.setWidth("100%");

    Button create = new Button("CREATE NEW STEM");
    create.setWidthUndefined();
    create.addStyleName(ValoTheme.BUTTON_LINK);
    create.addStyleName(ValoTheme.BUTTON_TINY);
    create.addStyleName(ValoTheme.BUTTON_QUIET);
    create.addClickListener(modifyBtnClickListener);
    v.addComponent(create);
    v.setComponentAlignment(create, Alignment.MIDDLE_RIGHT);
    form.addComponent(v);

    return form;
}

From source file:com.etest.view.tq.reports.OnlineQueriesUI.java

public OnlineQueriesUI() {
    setWidth("100%");
    setMargin(true);//from w w w  . j a va2s  . co m
    setSpacing(true);

    Label lineSeparator1 = new Label();
    lineSeparator1.setContentMode(ContentMode.HTML);
    lineSeparator1.setStyleName("line-separator");

    Label lineSeparator2 = new Label();
    lineSeparator2.setContentMode(ContentMode.HTML);
    lineSeparator2.setStyleName("line-separator");

    disableAllComponents(false);

    GridLayout topGrid = new GridLayout(3, 2);
    topGrid.setWidth("800px");
    topGrid.setSpacing(true);

    VerticalLayout top = new VerticalLayout();
    top.setWidth("166px");

    graphicalInventory.addItem("Graphical Inventory");
    graphicalInventory.setWidth("300px");
    top.addComponent(graphicalInventory);
    graphicalInventory.addValueChangeListener(firstLevelOptionListener);
    graphicalInventory.setImmediate(true);

    graphicalInventoryGroup.addItem("All Subjects");

    Label subjectProportionedCaption = new Label();
    subjectProportionedCaption.setWidth("500px");
    subjectProportionedCaption
            .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy");
    subjectProportionedCaption.setContentMode(ContentMode.HTML);
    subjectProportionedCaption.setHeightUndefined();

    graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption());
    graphicalInventoryGroup.setWidth("400px");
    graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener);
    graphicalInventoryGroup.setImmediate(true);

    topGrid.addComponent(top, 0, 0);
    topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0);
    addComponent(topGrid);

    searchSubject1.setInputPrompt("Search Subject");
    searchSubject1.setWidth("225px");
    searchSubject1.addValueChangeListener(dropDownChangeListener);
    searchSubject1.setEnabled(false);
    topGrid.addComponent(searchSubject1, 1, 1);

    addComponent(lineSeparator1);

    GridLayout bottomGrid = new GridLayout(3, 3);
    bottomGrid.setWidth("800px");
    bottomGrid.setSpacing(true);

    VerticalLayout bottom = new VerticalLayout();
    bottom.setWidth("235px");

    itemAnalysis.addItem("Item Analysis");
    itemAnalysis.setWidth("310px");
    bottom.addComponent(itemAnalysis);
    itemAnalysis.addValueChangeListener(firstLevelOptionListener);
    itemAnalysis.setImmediate(true);

    graphicalView.addItem("Graphical View");
    graphicalView.setWidth("210px");
    graphicalView.addValueChangeListener(secondLevelBottomOptionListener);
    graphicalView.setImmediate(true);

    tabularView.addItem("Tabular View");
    tabularView.addValueChangeListener(secondLevelBottomOptionListener);
    tabularView.setImmediate(true);

    graphicalViewGroup.addItem("Summary: All Tests of a Subject");
    graphicalViewGroup.addItem("Difficulty Index of a Subject's Test");
    graphicalViewGroup.addItem("Discrimination Index of a Subject's Test");
    graphicalViewGroup.setWidth("300px");
    graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    graphicalViewGroup.setImmediate(true);

    tabularViewGroup.addItem("Summary: All Tests of a Subject");
    tabularViewGroup.addItem("Critical values of a test");
    tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    tabularViewGroup.setImmediate(true);

    searchSubject2.setInputPrompt("Search Subject");
    searchSubject2.setWidth("225px");
    searchSubject2.addValueChangeListener(dropDownChangeListener);
    searchSubject2.setEnabled(false);
    searchTest.setWidth("225px");
    searchTest.setInputPrompt("Search Test");
    searchTest.setEnabled(false);
    searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL);

    bottomGrid.addComponent(bottom, 0, 0);
    bottomGrid.addComponent(graphicalView, 1, 0);
    bottomGrid.addComponent(tabularView, 1, 1);
    bottomGrid.addComponent(graphicalViewGroup, 2, 0);
    bottomGrid.addComponent(tabularViewGroup, 2, 1);
    bottomGrid.addComponent(searchSubject2, 1, 2);
    bottomGrid.addComponent(searchTest, 2, 2);
    addComponent(bottomGrid);

    addComponent(lineSeparator2);

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");
    h.setMargin(true);

    Button calculateAndViewBtn = new Button("Calculate & View");
    calculateAndViewBtn.setWidth("300px");
    calculateAndViewBtn.addClickListener(buttonClickListener);
    h.addComponent(calculateAndViewBtn);
    h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT);
    addComponent(calculateAndViewBtn);

}

From source file:com.expressui.core.view.form.layout.LeftLabelGridLayout.java

License:Open Source License

@Override
public void addField(FormField formField) {
    HorizontalLayout fieldLayout = (HorizontalLayout) getComponent(getFieldColumn(formField),
            getRowStart(formField));/* w  ww . j  a  v  a  2 s .co  m*/
    if (fieldLayout == null) {
        addFieldImpl(formField);
    } else {
        if (formField.getFieldLabel().getValue() != null) {
            Label label = formField.getFieldLabel();
            fieldLayout.addComponent(label);
            Label spacer = new Label();
            spacer.setWidth("1em");
            fieldLayout.addComponent(spacer);
        }

        Field field = formField.getField();
        fieldLayout.addComponent(field);
        Label spacer = new Label();
        spacer.setWidth("1em");
        fieldLayout.addComponent(spacer);
    }
}

From source file:com.expressui.core.view.form.layout.LeftLabelGridLayout.java

License:Open Source License

private void addFieldImpl(FormField formField) {
    Label label = formField.getFieldLabel();

    HorizontalLayout fieldLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, fieldLayout, "fieldLayout");
    fieldLayout.setDebugId(id);//w w  w  .  j a  v  a2 s. co m
    fieldLayout.setSizeUndefined();
    Field field = formField.getField();
    fieldLayout.addComponent(field);

    Label spacer = new Label();
    spacer.setWidth("1em");

    if (formField.getColumnEnd() != null && formField.getRowEnd() != null) {
        addComponent(label, getLabelColumn(formField), getRowStart(formField), getLabelColumn(formField),
                getRowEnd(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField), getColumnEnd(formField),
                getRowEnd(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField), getSpacerColumn(formField),
                getRowEnd(formField));
    } else {
        addComponent(label, getLabelColumn(formField), getRowStart(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField));
    }
    setComponentAlignment(fieldLayout, Alignment.TOP_LEFT);
    setComponentAlignment(label, Alignment.TOP_RIGHT);
    setComponentAlignment(spacer, Alignment.TOP_LEFT);
}