Example usage for com.vaadin.ui Label addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.klwork.explorer.ui.business.outproject.AbstractFlowManagerPage.java

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);//from  ww  w  .  j  av  a2  s . c o  m
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = createTitleLabel();
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

From source file:com.klwork.explorer.ui.business.social.DiscussPopupWindow.java

License:Apache License

public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) {
    return new VerticalLayout() {
        {//from  w  w  w  .  ja  v a2s.  c  o m
            setSizeFull();
            setSpacing(true);
            setMargin(new MarginInfo(true, true, false, true));

            Label descriptionField = new Label();
            descriptionField.addStyleName("wb_text");
            descriptionField.setContentMode(ContentMode.HTML);
            descriptionField.setValue(
                    "@" + userWeibo.getUserScreenName() + ":" + mainPage.textTranslate(userWeibo.getText()));
            addComponent(descriptionField);

            addComponent(new HorizontalLayout() {// ?,?
                {
                    setWidth("100%");

                    //
                    Label inputFontField = initInputFontField();
                    addComponent(inputFontField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT);
                    setExpandRatio(inputFontField, 0.2f);
                }
            });

            // ?
            weiboContentTA = new TextArea("");
            weiboContentTA.setWidth("100%");
            weiboContentTA.setColumns(25);
            weiboContentTA.focus();
            addComponent(weiboContentTA);
            scheduleEventFieldGroup.bind(weiboContentTA, "content");

            // ?
            addComponent(new HorizontalLayout() {
                {
                    setSpacing(true);
                    // setSizeFull();
                    // setMargin(true);
                    CheckBox simuField = CommonFieldHandler.createCheckBox("");
                    simuField.addValueChangeListener(new Property.ValueChangeListener() {

                        private static final long serialVersionUID = -7104996493482558021L;

                        @Override
                        public void valueChange(ValueChangeEvent event) {
                            Object value = event.getProperty().getValue();
                        }

                    });
                    addComponent(simuField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(simuField, Alignment.MIDDLE_LEFT);

                    Label commentLable = new Label();
                    commentLable.setContentMode(ContentMode.HTML);
                    commentLable.setValue("????");

                    addComponent(commentLable);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT);

                    Image image = initFaceComponet();//
                    addComponent(image);
                }
            });

            // 
            HorizontalLayout buttonLayout = new HorizontalLayout() {
                {
                    setSpacing(true);
                    setSizeFull();
                    // setMargin(true);
                    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                    addComponent(okButton);
                    setComponentAlignment(okButton, Alignment.TOP_RIGHT);

                    okButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            BinderHandler.commit(scheduleEventFieldGroup);
                            int ret = socialService.discussWeibo(weiboForwardSend);
                            if (ret == 1) {
                                Notification.show("??", Notification.Type.HUMANIZED_MESSAGE);
                            }
                            close();
                        }
                    });
                    setExpandRatio(okButton, 1.0f);

                    Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
                    addComponent(cancleButton);
                    setComponentAlignment(cancleButton, Alignment.TOP_RIGHT);

                    cancleButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            close();
                        }
                    });
                }
            };
            addComponent(buttonLayout);
            setExpandRatio(buttonLayout, 1f);

        }
    };
}

From source file:com.klwork.explorer.ui.business.social.SaveToNotePopupWindow.java

License:Apache License

public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) {
    return new VerticalLayout() {
        {/*from  w  w w  . ja  v a  2 s  .  c o m*/
            setSizeFull();
            setSpacing(true);
            setMargin(new MarginInfo(true, true, false, true));

            Label descriptionField = new Label();
            descriptionField.addStyleName("wb_text");
            descriptionField.setContentMode(ContentMode.HTML);
            descriptionField.setValue("");
            addComponent(descriptionField);
            // ?
            weiboContentTA = new TextArea("");
            weiboContentTA.setWidth("100%");
            weiboContentTA.setColumns(25);
            weiboContentTA.focus();
            addComponent(weiboContentTA);
            scheduleEventFieldGroup.bind(weiboContentTA, "content");

            if (hasOrginWeibo) {// 
                weiboContentTA.setValue("//@" + userWeibo.getUserScreenName() + ": " + userWeibo.getText());
            } else {
                weiboContentTA.setValue(userWeibo.getText());
                //+ mainPage.textTranslate(userWeibo.getText()));
            }

            //,
            addComponent(new VerticalLayout() {
                {
                    setSpacing(true);

                    TextField titleField = CommonFieldHandler.createTextField("");
                    scheduleEventFieldGroup.bind(titleField, "title");

                    //???
                    if (userWeibo.getText() != null && userWeibo.getText().length() > 10) {
                        titleField.setValue(userWeibo.getText().substring(0, 10));
                    }
                    addComponent(titleField);
                    // setSizeFull();
                    // setMargin(true);
                    SocialUserAccount noteAccount = socialUserAccountService
                            .findSocialUserByType(socialUserAccount.getOwnUser(), DictDef.dictInt("evernote"));
                    if (noteAccount != null) {
                        noteEntity.setUserAccountId(noteAccount.getId());
                    }

                    Map<String, String> map = socialEvernoteService.queryNotebook(noteAccount);
                    ComboBox noteMap = CommonFieldHandler.createComBox("", map, "");
                    addComponent(noteMap);
                    setComponentAlignment(noteMap, Alignment.MIDDLE_LEFT);
                }
            });

            // 
            HorizontalLayout buttonLayout = new HorizontalLayout() {
                {
                    setSpacing(true);
                    setSizeFull();
                    // setMargin(true);
                    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                    addComponent(okButton);
                    setComponentAlignment(okButton, Alignment.TOP_RIGHT);

                    okButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            BinderHandler.commit(scheduleEventFieldGroup);
                            //?
                            int ret = socialEvernoteService.saveWeiboToNotes(noteEntity);
                            if (ret == 1) {
                                Notification.show("??", Notification.Type.HUMANIZED_MESSAGE);
                            } else {
                                Notification.show("??!", Notification.Type.HUMANIZED_MESSAGE);
                            }
                            close();
                        }
                    });
                    setExpandRatio(okButton, 1.0f);

                    Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
                    addComponent(cancleButton);
                    setComponentAlignment(cancleButton, Alignment.TOP_RIGHT);

                    cancleButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            close();
                        }
                    });
                }
            };
            addComponent(buttonLayout);
            setExpandRatio(buttonLayout, 1f);

        }
    };
}

From source file:com.klwork.explorer.ui.business.social.TransmitPopupWindow.java

License:Apache License

public TransmitPopupWindow(final SocialUserWeibo userWeibo, final AbstractWeiboDisplayPage mainPage) {
    super(mainPage.getSocialType());
    this.socialUserWeiboService = ViewToolManager.getBean("socialUserWeiboService");
    this.socialService = AbstractSocialService.querySocialClass(mainPage.getSocialType());

    this.i18nManager = ViewToolManager.getI18nManager();

    weiboForwardSend.setWeibId(userWeibo.getWeiboId());
    weiboForwardSend.setUserAccountId(userWeibo.getUserAccountId());
    this.userWeibo = userWeibo;
    if (userWeibo.getRetweetedId() != null) {
        orginWeibo = socialUserWeiboService.findSocialUserWeiboById(userWeibo.getRetweetedId());
        hasOrginWeibo = true;//  w  w w  .j  a  v a 2s .  c  o  m
        weiboForwardSend.setWeibId(orginWeibo.getId());
    }

    scheduleEventFieldGroup.setBuffered(true);
    if (currentBeanItem != null) {
        scheduleEventFieldGroup.setItemDataSource(currentBeanItem);
    }

    mainLayout = new VerticalLayout() {
        {
            setSizeFull();
            setSpacing(true);
            setMargin(new MarginInfo(true, true, false, true));

            Label descriptionField = new Label();
            descriptionField.addStyleName("wb_text");
            descriptionField.setContentMode(ContentMode.HTML);
            descriptionField.setValue(
                    "@" + userWeibo.getUserScreenName() + ":" + mainPage.textTranslate(userWeibo.getText()));
            if (hasOrginWeibo) {
                descriptionField.setValue("@" + orginWeibo.getUserScreenName() + ":"
                        + mainPage.textTranslate(orginWeibo.getText()));
            }
            addComponent(descriptionField);

            addComponent(new HorizontalLayout() {// ?,?
                {
                    // setSizeFull();
                    // setSpacing(true);
                    setWidth("100%");
                    // setSpacing(true);
                    // setMargin(true);
                    /*Image image = initFaceComponet();
                    addComponent(image);
                    setExpandRatio(image, 1.2f);
                    setComponentAlignment(image, Alignment.MIDDLE_LEFT);*/
                    //
                    Label inputFontField = initInputFontField();
                    addComponent(inputFontField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT);
                    setExpandRatio(inputFontField, 0.2f);
                }
            });

            // ?

            weiboContentTA.setWidth("100%");
            weiboContentTA.setColumns(25);
            weiboContentTA.focus();
            addComponent(weiboContentTA);
            scheduleEventFieldGroup.bind(weiboContentTA, "content");
            if (hasOrginWeibo) {// 
                weiboContentTA.setValue("//@" + userWeibo.getUserScreenName() + ": " + userWeibo.getText());
            }

            // ?
            addComponent(new HorizontalLayout() {
                {
                    setSpacing(true);
                    // setSizeFull();
                    // setMargin(true);
                    CheckBox simuField = CommonFieldHandler.createCheckBox("");
                    simuField.addValueChangeListener(new Property.ValueChangeListener() {

                        private static final long serialVersionUID = -7104996493482558021L;

                        @Override
                        public void valueChange(ValueChangeEvent event) {
                            Object value = event.getProperty().getValue();
                        }

                    });
                    addComponent(simuField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(simuField, Alignment.MIDDLE_LEFT);

                    Label commentLable = new Label();
                    commentLable.setContentMode(ContentMode.HTML);
                    commentLable.setValue("? " + "" + userWeibo.getUserScreenName());

                    addComponent(commentLable);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT);

                    Image image = initFaceComponet();//
                    addComponent(image);
                }
            });

            if (hasOrginWeibo) {
                // ?
                addComponent(new HorizontalLayout() {
                    {
                        // setSizeFull();
                        setSpacing(true);
                        // setMargin(true);
                        CheckBox simuOriginalField = CommonFieldHandler.createCheckBox("");
                        simuOriginalField.addValueChangeListener(new Property.ValueChangeListener() {

                            private static final long serialVersionUID = -7104996493482558021L;

                            @Override
                            public void valueChange(ValueChangeEvent event) {
                                Object value = event.getProperty().getValue();
                            }

                        });
                        addComponent(simuOriginalField);
                        // setExpandRatio(image, 1.0f);
                        setComponentAlignment(simuOriginalField, Alignment.MIDDLE_LEFT);

                        Label commentLable = new Label();
                        commentLable.setContentMode(ContentMode.HTML);
                        commentLable
                                .setValue("? " + "" + orginWeibo.getUserScreenName());

                        addComponent(commentLable);
                        // setExpandRatio(image, 1.0f);
                        setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT);
                    }
                });
            }

            // 
            HorizontalLayout buttonLayout = new HorizontalLayout() {
                {
                    setSpacing(true);
                    setSizeFull();
                    // setMargin(true);
                    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                    addComponent(okButton);
                    setComponentAlignment(okButton, Alignment.TOP_RIGHT);

                    okButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            BinderHandler.commit(scheduleEventFieldGroup);
                            int ret = socialService.forwardWeibo(weiboForwardSend);
                            if (ret == 1) {
                                Notification.show("??", Notification.Type.HUMANIZED_MESSAGE);
                            }
                            close();
                        }
                    });
                    setExpandRatio(okButton, 1.0f);

                    Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
                    addComponent(cancleButton);
                    setComponentAlignment(cancleButton, Alignment.TOP_RIGHT);

                    cancleButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            // handleFormSubmit();
                            close();
                        }
                    });
                }
            };
            addComponent(buttonLayout);
            setExpandRatio(buttonLayout, 1f);

        }
    };
    setContent(mainLayout);
    setMainLayout(mainLayout);
    setWeiboContentTextArea(weiboContentTA);
}

From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

protected void addSimpleRow(String labelMessageKey, String content) {
    addLabel(labelMessageKey);//from w ww.j a  v  a  2  s.  c o  m

    Label subjectLabel = new Label(content);
    subjectLabel.setSizeUndefined();
    subjectLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);

    gridLayout.addComponent(subjectLabel);
    gridLayout.setComponentAlignment(subjectLabel, Alignment.MIDDLE_LEFT);
}

From source file:com.klwork.explorer.ui.custom.UploadComponent.java

License:Apache License

protected void addDescription(String description) {
    if (description != null) {
        Label descriptionLabel = new Label(description);
        descriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
        descriptionLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_UPLOAD_DESCRIPTION);
        addComponent(descriptionLabel);/*  w w  w.  ja va 2s . co m*/
    }
}

From source file:com.klwork.explorer.ui.custom.UploadComponent.java

License:Apache License

protected void addOrLabel() {
    Label orLabel = new Label("or");
    orLabel.setSizeUndefined();//from w  w  w . ja v a2s. c om
    orLabel.addStyleName(Reindeer.LABEL_SMALL);
    addComponent(orLabel);
    setComponentAlignment(orLabel, Alignment.MIDDLE_CENTER);
}

From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java

License:Apache License

protected void initTitle() {
    Label title = new Label();
    title.addStyleName(Reindeer.LABEL_H1);
    title.addStyleName(ExplorerLayout.STYLE_APPLICATION_LOGO);
    /*/*  w  ww.j a va  2  s . c  om*/
     * if (xx.getEnvironment().equals(Environments.ALFRESCO)) {
     * title.addStyleName(ExplorerLayout.STYLE_WORKFLOW_CONSOLE_LOGO); }
     * else { title.addStyleName(ExplorerLayout.STYLE_APPLICATION_LOGO); }
     */

    addComponent(title);

    setExpandRatio(title, 1.0f);
}

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

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);//from w  w  w .j  a v a2 s .c om
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = null;
    nameLabel = new Label("");
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

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

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(5, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);//w  ww . jav a 2s. c o  m
    taskDetails.setMargin(new MarginInfo(false, false, true, false));

    // Add image
    Embedded image = new Embedded(null, Images.TASK_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(historicTask.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 4, 0);

    // Add due date
    PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT),
            historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false);
    dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE);
    taskDetails.addComponent(dueDateLabel, 1, 1);

    // Add priority
    Integer lowMedHighPriority = convertPriority(historicTask.getPriority());
    Label priorityLabel = new Label();
    switch (lowMedHighPriority) {
    case 1:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW);
        break;
    case 2:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM);
        break;
    case 3:
    default:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH);
    }
    taskDetails.addComponent(priorityLabel, 2, 1);

    // Add create date
    PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT),
            historicTask.getStartTime(), "", true);
    createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME);
    taskDetails.addComponent(createLabel, 3, 1);

    // Add label to fill excess space
    Label spacer = new Label();
    spacer.setContentMode(Label.CONTENT_XHTML);
    spacer.setValue("&nbsp;");
    spacer.setSizeUndefined();
    taskDetails.addComponent(spacer);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);
    taskDetails.setColumnExpandRatio(3, 1.0f);
    taskDetails.setColumnExpandRatio(4, 1.0f);
    centralLayout.addComponent(taskDetails);
}