Example usage for com.vaadin.ui Label setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:probe.com.view.core.NotificationComponent1.java

public NotificationComponent1(int x, int y, String text, String uniqueID) {
    this.uniqueID = uniqueID;
    popupBody = new VerticalLayout();
    popupBody.setWidthUndefined();//from   w w  w  .j  a va2s  .  c o m
    ;//setWidth((200) + "px");
    popupBody.setHeightUndefined();
    ;//setHeight((200) + "px");
    popupBody.setStyleName("notificationbody");
    popupBody.addLayoutClickListener(NotificationComponent1.this);

    popupWindow = new Window() {

        @Override
        public void close() {
            popupWindow.setVisible(false);
        }

    };

    popupWindow.setStyleName("notificationwindow");
    popupWindow.setCaption(null);
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidthUndefined();//.setWidth((200) + "px");
    popupWindow.setHeightUndefined();//setHeight((200) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setModal(false);
    popupWindow.setDraggable(false);
    popupWindow.setModal(false);

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.setPositionX(x);
    popupWindow.setPositionY(y);

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(false);

    popupBody.setMargin(true);
    popupBody.setSpacing(true);

    Label content = new Label("<center>" + text + "</center>");
    content.setStyleName("notificationtext");
    content.setContentMode(ContentMode.HTML);
    popupBody.addComponent(content);

    VerticalLayout footer = new VerticalLayout();
    footer.setStyleName("bubbletalkfooter");
    footer.setWidth("30px");
    footer.setHeight("20px");
    popupBody.addComponent(footer);

}

From source file:probe.com.view.core.PopupInfoBtn.java

private VerticalLayout initPopupLayout(VerticalLayout popupLayout, String header) {
    VerticalLayout popupBodyWrapper = new VerticalLayout();
    popupBodyWrapper.setWidth("100%");
    popupBodyWrapper.setHeight("100%");
    VerticalLayout popupBodyLayout = new VerticalLayout();
    popupBodyLayout.setWidth((popupLayout.getWidth() + 2) + "px");
    popupBodyLayout.setHeightUndefined();
    popupBodyLayout.setStyleName("pupupbody");
    popupBodyLayout.setSpacing(true);//from w w  w.  j a va2s  .c  o m
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setWidthUndefined();
    titleLayout.setHeight("40px");

    popupBodyLayout.addComponent(titleLayout);
    popupBodyLayout.addLayoutClickListener(this);

    Label label = new Label("<b>" + header + "</b>");
    label.setStyleName("comparisonHeaders");
    label.setContentMode(ContentMode.HTML);
    label.setWidth((popupLayout.getWidth() - 17) + "px");
    titleLayout.addComponent(label);

    VerticalLayout closeBtn = new VerticalLayout();
    closeBtn.setWidth("16px");
    closeBtn.setHeight("16px");
    closeBtn.setStyleName("closepanelbtn");
    closeBtn.addLayoutClickListener(this);
    titleLayout.addComponent(closeBtn);
    titleLayout.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT);

    popupLayout.setMargin(true);
    popupLayout.setSpacing(true);
    popupBodyLayout.addComponent(popupLayout);
    popupBodyWrapper.addComponent(popupBodyLayout);
    popupBodyWrapper.setComponentAlignment(popupBodyLayout, Alignment.MIDDLE_CENTER);

    return popupBodyWrapper;

}

From source file:probe.com.view.core.TextFieldFilter.java

/**
 *
 * @param controller/*from w  w w .ja v a  2s  .co m*/
 * @param filterId
 * @param filterTitle
 */
public TextFieldFilter(SearchingFiltersControl_t controller, int filterId, String filterTitle) {
    this.control = controller;
    this.filterId = filterId;
    this.setSpacing(true);

    okBtn = new Button("ok");
    okBtn.setStyleName(Reindeer.BUTTON_SMALL);
    textField = new TextArea();
    textField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    textField.setHeight("60px");
    textField.setWidth("200px");
    textField.setInputPrompt("Please use one key-word per line");
    Label captionLabel = new Label(filterTitle);
    captionLabel.setWidth("70px");
    captionLabel.setStyleName("custLabel");
    if (filterTitle != null) {
        textField.setDescription(filterTitle);
    }
    this.addComponent(captionLabel);
    this.addComponent(textField);
    this.addComponent(okBtn);

    filterConfirmLabel = new FilterConfirmLabel();
    this.addComponent(filterConfirmLabel);

    filterBtn = new ClosableFilterLabel(filterTitle, "", filterId, true);
    filterBtn.getCloseBtn().addClickListener(TextFieldFilter.this);
    okBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            control.removeFilter(filterBtn.getCaption());
            filterConfirmLabel.setVisible(false);
            if (textField.getValue() != null && !textField.getValue().trim().equalsIgnoreCase("")) {
                filterBtn.setValue(textField.getValue().trim().toUpperCase());
                control.addFilter(filterBtn);
                filterConfirmLabel.setVisible(true);

            }
        }
    });
    textField.addFocusListener(TextFieldFilter.this);
    this.setEnabled(true);
    this.focus();

}

From source file:probe.com.view.core.ToggleBtn.java

public ToggleBtn(String strBtn1Label, String strBtn2Label, String btn1Comment, String btn2Comment, int width) {

    final Label btn1CommentLabel = new Label(btn1Comment);
    btn1CommentLabel.setStyleName(Reindeer.LABEL_SMALL);
    btn1CommentLabel.setWidth("120px");
    final Label btn2CommentLabel = new Label(btn2Comment);
    btn2CommentLabel.setStyleName(Reindeer.LABEL_SMALL);
    btn2CommentLabel.setVisible(false);//from  w  w w.j  av a2s . c  om
    btn2CommentLabel.setWidth("120px");

    this.setSpacing(true);
    Label btn1Label = new Label(strBtn1Label);
    btn1Label.setStyleName(Reindeer.LABEL_SMALL);
    Label btn2Label = new Label(strBtn2Label);
    btn2Label.setStyleName(Reindeer.LABEL_SMALL);
    toggleSwichButton = new HorizontalLayout();
    toggleSwichButton.setStyleName("toggleleft");
    toggleSwichButton.setWidth("50px");
    toggleSwichButton.setHeight("15px");
    toggleSwichButton.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (toggleSwichButton.getStyleName().equalsIgnoreCase("toggleleft")) {
                toggleSwichButton.setStyleName("toggleright");
                btn1CommentLabel.setVisible(false);
                btn2CommentLabel.setVisible(true);
            } else {
                toggleSwichButton.setStyleName("toggleleft");
                btn1CommentLabel.setVisible(true);
                btn2CommentLabel.setVisible(false);
            }
        }
    });

    this.addComponent(btn1CommentLabel);//commentLabel
    this.setComponentAlignment(btn1CommentLabel, Alignment.TOP_LEFT);//commentLabel
    this.addComponent(btn2CommentLabel);//commentLabel
    this.setComponentAlignment(btn2CommentLabel, Alignment.TOP_LEFT);//commentLabel
    VerticalLayout spacer = new VerticalLayout();
    width = Math.max((width - 120 - 75 - 75 - 55), 1);
    spacer.setHeight("15px");
    spacer.setWidth(width + "px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);
    this.addComponent(spacer);
    this.addComponent(btn1Label);
    this.addComponent(toggleSwichButton);
    this.addComponent(btn2Label);

}

From source file:probe.com.view.unused.DoubleBetweenValuesFilter.java

/**
 *
 * @param control//ww  w.ja  v  a  2s  . c  o m
 * @param filterId
 * @param defaultLabel
 */
public DoubleBetweenValuesFilter(SearchingFiltersControl_t control, int filterId, String defaultLabel) {
    this.control = control;
    this.filterId = filterId;
    this.setHeight("20px");
    this.defaultLabel = defaultLabel;
    this.setSpacing(true);
    Label fcPatientsGrI_patGrII = new Label(defaultLabel);
    fcPatientsGrI_patGrII.setStyleName("custLabel");
    this.addComponent(fcPatientsGrI_patGrII);

    minValueField = new DoubleTextField();
    this.addComponent(minValueField);
    Label betweenLabel = new Label("< Than & < Than");
    //        betweenLabel.setWidth("100px");
    betweenLabel.setStyleName(Reindeer.LABEL_SMALL);
    this.addComponent(betweenLabel);
    this.setComponentAlignment(betweenLabel, Alignment.MIDDLE_CENTER);
    maxValueField = new DoubleTextField();
    this.addComponent(maxValueField);
    okBtn = new Button("ok");
    this.addComponent(okBtn);

    filterConfirmLabel = new FilterConfirmLabel();
    this.addComponent(filterConfirmLabel);
    okBtn.setStyleName(Reindeer.BUTTON_SMALL);
    okBtn.addClickListener(this);
    filterBtn = new ClosableFilterLabel(defaultLabel, defaultLabel, filterId, true);
    filterBtn.getCloseBtn().addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            maxValueField.setValue(null);
            minValueField.setValue(null);
            okBtn.click();
        }
    });
}

From source file:ru.bormoshka.tstocks.view.FormGenerator.java

public static AbstractLayout getAddCategoryFormBean(Table table) {

    FormLayout form = new FormLayout();
    VerticalLayout holder = new VerticalLayout();

    BeanItem<Category> beanItem = new BeanItem<>(new Category(new String(), new String()));
    BeanFieldGroup beanBinder = new BeanFieldGroup(Category.class);

    beanBinder.setItemDataSource(beanItem);

    Label formName = new Label(L.get("new_list_form_label_category"));
    formName.setStyleName("form-name-label");
    holder.addComponent(formName);//from   ww w.jav  a 2s  .  co  m
    holder.addComponent(form);

    form.addComponent(beanBinder.buildAndBind(L.get("bean_field_category_name"), "name"));
    form.addComponent(beanBinder.buildAndBind(L.get("bean_field_category_description"), "description"));

    form.setImmediate(false);
    Button submit = new Button(L.get("form_save"));
    if (table == null) {
        submit.addClickListener(new SaveBeanListener<StockManager, Category>(beanBinder));
    } else {
        submit.addClickListener(new SaveBeanListener<StockManager, Category>(beanBinder, table));
    }
    form.addComponent(submit);
    form.setImmediate(false);
    return holder;
}

From source file:ru.codeinside.adm.ui.GroupEditor.java

License:Mozilla Public License

private void showEditor(String nameGroup) {
    List<Group> groups = AdminServiceProvider.get().findGroupByName(nameGroup);
    for (final Group g : groups) {
        Label header = new Label(
                " : " + g.getTitle() + " (" + nameGroup + ")");
        header.setStyleName("h2");
        addComponent(header);//from  ww w .  j a va 2s.  co  m
        Button delete = new Button("", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                String confirmMessage = " ,    ?";
                Window confirmWindow = new ConfirmWindow(confirmMessage);
                confirmWindow.addListener(new Listener() {
                    @Override
                    public void componentEvent(Event event) {
                        if (event instanceof ConfirmWindow.ConfirmOkEvent) {
                            AdminServiceProvider.get().deleteGroup(g.getId());
                            table.removeItem(g.getName());
                        }
                    }
                });
                getWindow().addWindow(confirmWindow);
            }
        });
        addComponent(delete);
    }
    final FilterTable all = new FilterTable();
    all.setCaption("? ? " + typeGroup.toLowerCase());
    table(all);
    final FilterTable current = new FilterTable();
    current.setCaption(" " + typeGroup.toLowerCase());
    table(current);
    addListener(all, current, current);
    addListener(current, all, current);
    addTableContent(all, current);
}

From source file:ru.codeinside.adm.ui.TreeTableOrganization.java

License:Mozilla Public License

private TableEmployee showOrganizationLabelsAndButtons(Long id) {
    panel.removeAllComponents();//from   w  w w  .j  a va  2  s  . c  o  m
    panel.addComponent(new ButtonCreateOrganization(treetable));
    treetable.setCollapsed(id, false);
    Organization org = AdminServiceProvider.get().findOrganizationById(id);
    Label nameLabel = new Label("?: " + org.getName());
    nameLabel.setStyleName("h2");
    panel.addComponent(nameLabel);
    if (org.getCreator() != null) {
        Label creatorLabel = new Label(": " + org.getCreator().getLogin());
        panel.addComponent(creatorLabel);
    }

    Format formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm");
    Label dateLabel = new Label(" ??: " + formatter.format(org.getDate()));
    panel.addComponent(dateLabel);
    panel.addComponent(groupLabel(id));
    HorizontalLayout layoutButton = new HorizontalLayout();
    layoutButton.addComponent(buttonEditOrganization(org, nameLabel));
    layoutButton.addComponent(buttonCreateOrganization(org));
    TableEmployee tableEmployee = new TableOrganizationEmployee(id);
    tableEmployee.setMargin(true, false, false, false);
    layoutButton.addComponent(buttonCreateEmployee(id));
    layoutButton.setMargin(true, false, false, false);
    layoutButton.addComponent(createGroupLabel(id));
    panel.addComponent(layoutButton);
    return tableEmployee;
}

From source file:ru.codeinside.gses.activiti.ReadOnly.java

License:Mozilla Public License

public ReadOnly(String labelValue, String value, boolean valid) {
    this.valid = valid;
    if (value == null || value.length() < 4000) {
        setSizeFull();/*from w  w w .  ja  v a2 s . c o  m*/
        Label label = new Label(labelValue);
        label.setSizeFull();
        label.setStyleName("left");
        HorizontalLayout layout = new HorizontalLayout(); //   GridLayout
        layout.setSizeFull();
        layout.addComponent(label);
        layout.setExpandRatio(label, 1f);
        setCompositionRoot(layout);
    } else {
        setSizeFull();
        TextArea area = new TextArea();
        area.setValue(value);
        area.setReadOnly(true);
        area.setSizeFull();
        area.setRows(25);
        setCompositionRoot(area);
    }
    if (valid) {
        setValue(value);
    }
}

From source file:ru.codeinside.gses.webui.CertificateSelection.java

License:Mozilla Public License

public CertificateSelection(String userLogin, CertificateListener certificateListener) {
    this.certificateListener = certificateListener;

    String userName = StringUtils
            .trimToNull(Flash.flash().getAdminService().findEmployeeByLogin(userLogin).getFio());
    if (userName == null) {
        userName = userLogin;//from w w  w  .j av  a 2s.com
    }

    Label header = new Label(" ?");
    header.setStyleName(Reindeer.LABEL_H1);

    Label hint = new Label("<b>" + userName
            + "</b>, ? ?   ? ?? ? "
            + "   ?,     ??? ? "
            + "<a target='_blank' href='http://ru.wikipedia.org/wiki/"
            + "%D0%AD%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D1%8C'"
            + ">? ?</a></i> ??  .",
            Label.CONTENT_XHTML);

    SignApplet applet = new SignApplet(new Protocol());
    applet.setName(" ?");
    applet.setCaption(null);
    applet.setBindingMode();

    appletHint = new Label("??  <b>Java</b>  "
            + Flash.getActor().getBrowser() + "   <b> JCP</b>.<br/> "
            + "   ?  ?  ?? "
            + "   <a target='_blank' href='http://ca.oep-penza.ru/'"
            + ">??  ?   ?</a>.",
            Label.CONTENT_XHTML);

    Button logout = new Button(" ( ?   )",
            new Logout());
    logout.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    buttons.addComponent(logout);

    VerticalLayout flow = new VerticalLayout();
    flow.setSizeUndefined();
    flow.setMargin(true);
    flow.setSpacing(true);
    flow.addComponent(header);
    flow.addComponent(hint);
    flow.addComponent(applet);
    flow.addComponent(appletHint);
    flow.addComponent(buttons);

    Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(flow);

    VerticalLayout center = new VerticalLayout();
    center.addComponent(panel);
    center.setExpandRatio(panel, 1f);
    center.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    center.setSizeFull();

    setCompositionRoot(center);

    setSizeFull();
}