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.jiangyifen.ec2.ui.mgr.system.tabsheet.SystemLicence.java

public SystemLicence() {
    this.setMargin(true);
    this.setSizeUndefined();

    licence_glo = new GridLayout(3, 5);
    licence_glo.setMargin(true);//from w  w  w .j  av a2  s .  c o  m
    licence_glo.setSpacing(true);
    licence_glo.setSizeUndefined();
    this.addComponent(licence_glo);

    int row_index = 0;
    int column_index = 0;

    // 
    Label key_lb = new Label("<b>?</b>", Label.CONTENT_XHTML);
    key_lb.setWidth("-1px");
    licence_glo.addComponent(key_lb, (column_index++), row_index);
    licence_glo.setComponentAlignment(key_lb, Alignment.MIDDLE_LEFT);

    Label value_lb = new Label("<font color='blue'>?</font>", Label.CONTENT_XHTML);
    value_lb.setWidth("-1px");
    licence_glo.addComponent(value_lb, (column_index++), row_index);
    licence_glo.setComponentAlignment(value_lb, Alignment.MIDDLE_LEFT);

    Label description_lb = new Label("<font color='" + DESCRIPTION_COL_COLOR + "'>??</font>",
            Label.CONTENT_XHTML);
    description_lb.setWidth("-1px");
    licence_glo.addComponent(description_lb, (column_index++), row_index);
    licence_glo.setComponentAlignment(description_lb, Alignment.MIDDLE_LEFT);

    // grid ???
    row_index++;
    column_index = 0;

    // ??
    Label csrAmount_lb = new Label("<b>??</b>", Label.CONTENT_XHTML);
    csrAmount_lb.setWidth("-1px");
    licence_glo.addComponent(csrAmount_lb, (column_index++), row_index);

    csrAmountValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>" + 0 + "</font>",
            Label.CONTENT_XHTML);
    csrAmountValue_lb.setWidth("-1px");
    licence_glo.addComponent(csrAmountValue_lb, (column_index++), row_index);

    Label csrAmountDescription_lb = new Label(
            "<font color='" + DESCRIPTION_COL_COLOR + "'>????!!</font>",
            Label.CONTENT_XHTML);
    csrAmountDescription_lb.setWidth("-1px");
    licence_glo.addComponent(csrAmountDescription_lb, (column_index++), row_index);

    // grid ???
    row_index++;
    column_index = 0;

    //
    Label expiredDate_lb = new Label("<b></b>", Label.CONTENT_XHTML);
    expiredDate_lb.setWidth("-1px");
    licence_glo.addComponent(expiredDate_lb, (column_index++), row_index);

    expiredDateValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>invalid</font>",
            Label.CONTENT_XHTML);
    expiredDateValue_lb.setWidth("-1px");
    licence_glo.addComponent(expiredDateValue_lb, (column_index++), row_index);

    Label expiredDateDescription_lb = new Label("<font color='" + DESCRIPTION_COL_COLOR
            + "'>??!!</font>", Label.CONTENT_XHTML);
    expiredDateDescription_lb.setWidth("-1px");
    licence_glo.addComponent(expiredDateDescription_lb, (column_index++), row_index);

    // grid ???
    row_index++;
    column_index = 0;

    //??
    Label licence_lb = new Label("<b>?&nbsp; &nbsp; ?</b>", Label.CONTENT_XHTML);
    licence_lb.setWidth("-1px");
    licence_glo.addComponent(licence_lb, (column_index++), row_index);

    Label licenceValue_lb = new Label("<font color='" + VALUE_COL_COLOR + "'>" + serialNumber + "</font>",
            Label.CONTENT_XHTML);
    //      Label licenceValue_lb = new Label("<font color='blue'>"+GlobalVariable.CONCURRENT_MAX_CSR+"</font>", Label.CONTENT_XHTML);
    licenceValue_lb.setWidth("-1px");
    licence_glo.addComponent(licenceValue_lb, (column_index++), row_index);

    Label licenceDescription_lb = new Label(
            "<font color='" + DESCRIPTION_COL_COLOR
                    + "'>???!!</font>",
            Label.CONTENT_XHTML);
    licenceDescription_lb.setWidth("-1px");
    licence_glo.addComponent(licenceDescription_lb, (column_index++), row_index);

    this.addComponent(updateLicenseComponent());
    //??
    refreshLicenseInfo();
}

From source file:com.klwork.explorer.project.PublicProjectListPage.java

License:Apache License

Layout buildTree() {
    CssLayout margin = new CssLayout();
    margin.setWidth("100%");
    //margin.setMargin(new MarginInfo(true, false, true, true));
    // Spacing// ww w.j ava  2s.  co  m
    margin.addComponent(new Label("&nbsp;", ContentMode.HTML));
    Label text = new Label("hello,word");
    text.addStyleName(Runo.LABEL_SMALL);
    margin.addComponent(text);
    text.setWidth("90%");

    Tree t = new Tree();

    String itemId = "?";
    t.addItem(itemId);
    t.select(itemId);
    t.setItemIcon(itemId, new ThemeResource("icons/16/calendar.png"));
    createTreeItem(t, "(5000)", itemId);
    t.expandItem(itemId);

    String itemId2 = "";
    t.addItem(itemId2);
    t.setItemIcon(itemId2, new ThemeResource("icons/16/document.png"));
    createTreeItem(t, "?(300)", itemId2);
    createTreeItem(t, "log", itemId2);
    t.expandItem(itemId2);

    String itemId3 = "?";
    t.addItem(itemId3);
    t.setItemIcon(itemId3, new ThemeResource("icons/16/document.png"));
    createTreeItem(t, "?(3009)", itemId3);
    createTreeItem(t, "(40000)", itemId3);
    t.expandItem(itemId3);
    margin.addComponent(t);

    return margin;
}

From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java

License:Apache License

protected void addTaskEventText(final Comment taskEvent, final GridLayout eventGrid) {
    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT);
    layout.setWidth("100%");
    eventGrid.addComponent(layout);/*from   w  w w  . j a  v a  2  s.  c o  m*/

    // Actual text
    Label text = taskEventTextResolver.resolveText(taskEvent);
    text.setWidth("100%");
    layout.addComponent(text);

    // Time
    String human = new HumanTime(i18nManager).format(taskEvent.getTime());

    Label time = new Label(human + "(" + ")");
    time.setSizeUndefined();
    time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME);
    layout.addComponent(time);

}

From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java

License:Apache License

protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) {
    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT);
    layout.setWidth("100%");
    eventGrid.addComponent(layout);/*from w  ww .  j  a v  a 2 s .  c o  m*/

    // Actual text
    Label text = taskEventTextResolver.resolveText(taskEvent);
    text.setWidth("100%");
    layout.addComponent(text);

    // Time
    Label time = new Label(new HumanTime(i18nManager).format(taskEvent.getTime()));
    time.setSizeUndefined();
    time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME);
    layout.addComponent(time);

}

From source file:com.klwork.explorer.ui.user.UserEventsPanel.java

License:Apache License

protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) {
    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT);
    layout.setWidth("100%");
    eventGrid.addComponent(layout);//from   www .  ja v a 2s.  c om

    // Actual text
    Label text = taskEventTextResolver.resolveText(taskEvent);
    text.setWidth("100%");
    layout.addComponent(text);

    // Time
    String humFormat = new HumanTime(i18nManager).format(taskEvent.getTime());
    Label time = new Label(humFormat + " (" + StringDateUtil.dateToString(taskEvent.getTime(), 4) + ")");
    time.setSizeUndefined();
    time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME);
    layout.addComponent(time);

}

From source file:com.liferay.mail.vaadin.MessageContainer.java

License:Open Source License

private Property formatSubject(Message m, String value) {

    if (value == null) {
        return null;
    }// w  ww .  j  ava2s  . c o  m

    Label l = new Label(value, Label.CONTENT_XHTML);

    if (!MessageUtil.isSeen(m)) {
        l.addStyleName(MessageList.STYLE_NOT_SEEN);
    }
    if (MessageUtil.isImportant(m)) {
        l.addStyleName(MessageList.STYLE_IMPORTANT);
    }

    l.setWidth(null);
    return new ObjectProperty(l);
}

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.HourWidget.java

public HourWidget(int aHourNumber, int aTotalHourNumber) {
    setWidth("500px");
    setHeight("500px");
    //setStyleName("backColorGrey");

    String[] classes = { "VI", "VII", "VIII", "IX", "X" };
    int index1 = new Random().nextInt(classes.length);
    String selectedClass = (classes[index1]);

    String[] sections = { "A", "B", "C", "D", "E" };
    int index2 = new Random().nextInt(classes.length);
    String selectedSection = (sections[index2]);

    String[] content = { "Gravitation", "Lab", "Electricity", "Force", "Motion" };
    int index3 = new Random().nextInt(classes.length);
    String selectedContent = (content[index3]);

    //Button b= new Button("2");
    //addComponent(b);
    //c.setSizeFull();
    Button iMinorText = new Button(selectedContent);
    double redOrGreen = Math.random();
    if (Math.random() > 0.5) {
        iMinorText.setStyleName("v-button-type1-red");
    } else {//from w w  w. j a va 2  s .c o  m
        iMinorText.setStyleName("v-button-type1-green");
    }
    iMinorText.setHeight("40px");
    iMinorText.setWidth("125px");
    //c.setCaptionAsHtml(true);  kkk

    addComponent(iMinorText);//,"top:10px;left:10px");

    Label iMajorText = new Label(selectedClass + " - " + selectedSection);
    iMajorText.setStyleName("v-label-type1");
    iMajorText.setHeight("15px");
    iMajorText.setWidth("50px");
    addComponent(iMajorText, "top:2px;left:1px");

    double numberOfMemos = Math.floor(Math.random() * 5);
    //Diplay if any memo present
    NativeButton memoButton;
    if (numberOfMemos > 0) {
        memoButton = new NativeButton();//String.valueOf(numberOfMemos).replace(".0", ""));
        memoButton.setStyleName("v-button-type2");
        //memoButton.setHeight("15px");
        //memoButton.setWidth("30px");
        memoButton.setIcon(FontAwesome.PENCIL);
        addComponent(memoButton, "top:2px;left:85px");
    }

    double numberOfNotifications = Math.floor(Math.random() * 5);
    NativeButton notificationButton;
    if (numberOfNotifications > 0) {
        notificationButton = new NativeButton();//String.valueOf(numberOfNotifications).replace(".0", ""));
        notificationButton.setStyleName("v-button-type2");
        //notificationButton.setHeight("15px");
        //notificationButton.setWidth("30px");
        notificationButton.setIcon(FontAwesome.BELL);
        addComponent(notificationButton, "top:2px;left:100px");
    }

}

From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java

License:Open Source License

private void createView() {
    LspsUI ui = (LspsUI) getUI();/*from   www  . j av a  2s . c o  m*/
    Person user = ui.getUser().getPerson();
    userRights = user.getRights();

    setTitle(ui.getMessage(TITLE));

    Panel panel = new Panel();
    panel.addStyleName("l-border-none");
    setContent(panel);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    panel.setContent(layout);

    //user data and settings will be laid out next to each other
    HorizontalLayout topSection = new HorizontalLayout();
    topSection.setSpacing(true);
    topSection.setWidth("100%");
    layout.addComponent(topSection);

    VerticalLayout userData = createUserDataSection(ui, user);
    topSection.addComponent(userData);
    topSection.setExpandRatio(userData, 1);

    Label spacer = new Label();
    spacer.setWidth("20px");
    topSection.addComponent(spacer);

    VerticalLayout settings = createSettingsSection(ui);
    topSection.addComponent(settings);
    topSection.setExpandRatio(settings, 1);

    //substitution section
    VerticalLayout substitution = createSubstitutionSection(ui, user);
    layout.addComponent(substitution);

    Label spacer2 = new Label();
    spacer2.setHeight("10px");
    layout.addComponent(spacer2);

    //buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (save()) {
                if (requestReload) {
                    JavaScript.getCurrent().execute("window.location.reload()");
                } else {
                    close();
                }
            }
        }
    });
    saveButton.setData(BUTTON_TYPE_SAVE);
    buttons.addComponent(saveButton);
    Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttons.addComponent(cancelButton);
    layout.addComponent(buttons);
}

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * This method builds audio library for current filter.
 * /*from w  w w.j  a va  2s.co m*/
 * @param grid
 *            The object to locate the audio covers.
 * @param filter
 *            The filter to extract need music files.
 */
private void buildAudioLibrary(GridLayout grid, String filter) {
    AudioCollection audio = new AudioCollection();

    for (final AudioFile audioFile : audio.getAudioCollection(filter)) {

        CssLayout select = new CssLayout();
        select.addStyleName(Runo.CSSLAYOUT_SELECTABLE);

        CssLayout musicFile = new CssLayout();
        musicFile.addStyleName(Runo.CSSLAYOUT_SHADOW);
        musicFile.addComponent(createImageCover(audioFile.getCover()));
        select.addComponent(musicFile);

        musicFile.addLayoutClickListener(new LayoutClickListener() {

            private static final long serialVersionUID = 5789650754220216969L;

            @Override
            public void layoutClick(LayoutClickEvent event) {
                buildInformationPanel(audioFile);
            }
        });

        grid.addComponent(select);
        grid.setComponentAlignment(select, Alignment.MIDDLE_CENTER);
    }

    Label text = new Label("Note: This track are on Crative Common license.");
    text.addStyleName(Runo.LABEL_SMALL);
    text.setWidth("90%");
    grid.addComponent(text);
    grid.setComponentAlignment(text, Alignment.MIDDLE_CENTER);

}

From source file:com.m4gik.views.component.LicenseScreen.java

/**
 * Method adds for spacer between texts.
 * /*from www  .ja  v  a 2  s.  co  m*/
 * @param texts
 *            Texts to add.
 */
private void addSpacer(HorizontalLayout texts) {
    Label text = new Label("");
    text.setWidth("20px");
    texts.addComponent(text);
}