Example usage for com.vaadin.ui Button setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@Override
public Component generateRow(final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false)
            .withWidth("100%").withStyleName("message");

    MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px");
    userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    ClickListener gotoUser = new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//  ww  w  .  j a  va  2s. com
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser()));
        }
    };
    Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(),
            comment.getOwnerFullName());
    userAvatarBtn.addClickListener(gotoUser);
    userBlock.addComponent(userAvatarBtn);

    Button userName = new Button(comment.getOwnerFullName());
    userName.setStyleName("user-name");
    userName.addStyleName("link");
    userName.addStyleName(UIConstants.WORD_WRAP);
    userName.addClickListener(gotoUser);
    userBlock.addComponent(userName);
    layout.addComponent(userBlock);

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName("message-container");
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%")
            .withStyleName("message-header");
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label timePostLbl = new Label(
            AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(),
                    DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())),
            ContentMode.HTML);
    timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName("time-post");
    messageHeader.addComponent(timePostLbl);
    messageHeader.setExpandRatio(timePostLbl, 1.0f);

    // Message delete button
    Button msgDeleteBtn = new Button();
    msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
    msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
    messageHeader.addComponent(msgDeleteBtn);

    if (hasDeletePermission(comment)) {
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                SiteConfiguration.getSiteName()),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                        AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = ApplicationContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment.getId(), AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    CommentRowDisplayHandler.this.owner.removeRow(layout);
                                }
                            }
                        });
            }
        });
    } else {
        msgDeleteBtn.setVisible(false);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new UrlDetectableLabel(comment.getComment());
    messageContent.setStyleName("message-body");
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true)
                .withWidth("100%").withStyleName("message-footer");
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.addComponent(attachmentDisplay);
        messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.addComponent(rowLayout);
    layout.setExpandRatio(rowLayout, 1.0f);
    return layout;
}

From source file:com.esofthead.mycollab.common.ui.components.notification.SmtpSetupNotification.java

License:Open Source License

@Override
public Component renderContent() {
    MHorizontalLayout layout = new MHorizontalLayout();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Button smtpBtn = new Button("Setup", new Button.ClickListener() {
        @Override//from  w  w w.j a  v a2s.  c o m
        public void buttonClick(Button.ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new SmtpConfigurationWindow());
        }
    });
    smtpBtn.setStyleName("link");
    layout.with(new Label("You did not set up a SMTP account yet."), smtpBtn);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.ui.AbstractRelatedItemSelectionView.java

License:Open Source License

public AbstractRelatedItemSelectionView(String title, final AbstractRelatedListView<T, S> relatedListView) {
    this.setCaption(title);
    this.relatedListView = relatedListView;
    // if (!relatedListView.getItemList().getCurrentDataList().isEmpty())
    // this.selections = new HashSet<T>(relatedListView.getItemList()
    // .getCurrentDataList());
    initUI();//w ww  . j  a  v a2s  . c om
    this.setContent(itemList);
    Button doneBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_DONE),
            new Button.ClickListener() {
                private static final long serialVersionUID = -652476076947907047L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    if (!selections.isEmpty()) {
                        relatedListView.fireSelectedRelatedItems(selections);
                    }
                }
            });
    doneBtn.setStyleName("save-btn");
    this.setRightComponent(doneBtn);
}

From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java

License:Open Source License

private void initUI() {
    noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService,
            NoteRowDisplayHandler.class);
    noteList.setDisplayEmptyListText(false);
    noteList.setStyleName("noteList");

    noteListContainer = new VerticalLayout();
    this.setContent(noteListContainer);
    displayNotes();//from   w w  w  .  j  a  v  a 2  s.  co m

    HorizontalLayout commentBox = new HorizontalLayout();
    commentBox.setSizeFull();
    commentBox.setStyleName("comment-box");
    commentBox.setSpacing(true);
    commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    final TextArea noteInput = new TextArea();
    noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT));
    noteInput.setSizeFull();
    commentBox.addComponent(noteInput);
    commentBox.setExpandRatio(noteInput, 1.0f);

    Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND));
    postBtn.setStyleName("submit-btn");
    postBtn.setWidthUndefined();
    postBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -5095455325725786794L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            final Note note = new Note();
            note.setCreateduser(AppContext.getUsername());
            note.setNote(noteInput.getValue());
            note.setSaccountid(AppContext.getAccountId());
            note.setSubject("");
            note.setType(type);
            note.setTypeid(typeid);
            note.setCreatedtime(new GregorianCalendar().getTime());
            note.setLastupdatedtime(new GregorianCalendar().getTime());
            noteService.saveWithSession(note, AppContext.getUsername());

            // Save Relay Email -- having time must refact to
            // Aop
            // ------------------------------------------------------
            RelayEmailNotification relayNotification = new RelayEmailNotification();
            relayNotification.setChangeby(AppContext.getUsername());
            relayNotification.setChangecomment(noteInput.getValue());
            relayNotification.setSaccountid(AppContext.getAccountId());
            relayNotification.setType(type);
            relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION);
            relayNotification.setTypeid("" + typeid);
            if (type.equals(CrmTypeConstants.ACCOUNT)) {
                relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CONTACT)) {
                relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CAMPAIGN)) {
                relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.LEAD)) {
                relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) {
                relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CASE)) {
                relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.TASK)) {
                relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.MEETING)) {
                relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CALL)) {
                relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName());
            }
            RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil
                    .getSpringBean(RelayEmailNotificationService.class);
            relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername());
            noteInput.setValue("");
            displayNotes();
        }
    });
    commentBox.addComponent(postBtn);

    this.setToolbar(commentBox);

}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountListViewImpl.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addAccount = new Button();
    addAccount.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*from w ww  .j a v  a 2  s . c  om*/
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new AccountEvent.GotoAdd(this, null));
        }
    });
    addAccount.setStyleName("add-btn");
    return addAccount;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedCaseView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addCase = new Button();
    addCase.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//  w  w  w.j  a v a 2  s  .co m
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addCase.setStyleName("add-btn");
    return addCase;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountRelatedOpportunityView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addOpportunity = new Button();
    addOpportunity.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7172838996944732255L;

        @Override//w  ww  .  j a  v a2 s  . c  o  m
        public void buttonClick(Button.ClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    addOpportunity.setStyleName("add-btn");
    return addOpportunity;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignListViewImpl.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addCampaign = new Button();
    addCampaign.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from w  w w  .  j  a  v a2s.c  o  m
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new CampaignEvent.GotoAdd(this, null));
        }
    });
    addCampaign.setStyleName("add-btn");
    return addCampaign;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.cases.CaseListViewImpl.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addCase = new Button();
    addCase.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from w  w w. j a v a  2  s  .  com
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new CaseEvent.GotoAdd(this, null));
        }
    });
    addCase.setStyleName("add-btn");
    return addCase;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.contact.ContactListViewImpl.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addContact = new Button();
    addContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//w ww.java  2 s  .c o m
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
        }
    });
    addContact.setStyleName("add-btn");
    return addContact;
}