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.mobile.module.crm.view.lead.LeadListViewImpl.java

License:Open Source License

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

        @Override/*from w  w w  .ja  v  a2  s  . c om*/
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null));
        }
    });
    addLead.setStyleName("add-btn");
    return addLead;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityListViewImpl.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//from  w  w  w  .  j  av  a  2 s  .  com
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null));
        }
    });
    addOpportunity.setStyleName("add-btn");
    return addOpportunity;
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java

License:Open Source License

private void constructUI() {
    this.setWidth("100%");

    statusWrapper = new CssLayout();
    statusWrapper.setWidth("100%");
    statusWrapper.setStyleName("upload-status-wrap");
    this.addComponent(statusWrapper);

    inputWrapper = new HorizontalLayout();
    inputWrapper.setWidth("100%");
    inputWrapper.setStyleName("comment-box");
    inputWrapper.setSpacing(true);/*from w w  w.j  ava 2  s .  c o  m*/
    inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    this.prepareUploadField();

    inputWrapper.addComponent(uploadField);

    commentInput = new TextArea();
    commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT));
    commentInput.setSizeFull();
    inputWrapper.addComponent(commentInput);
    inputWrapper.setExpandRatio(commentInput, 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 = 6687918902751556313L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            final Comment comment = new Comment();
            comment.setComment(commentInput.getValue());
            comment.setCreatedtime(new GregorianCalendar().getTime());
            comment.setCreateduser(AppContext.getUsername());
            comment.setSaccountid(AppContext.getAccountId());
            comment.setType(type.toString());
            comment.setTypeid("" + typeid);
            comment.setExtratypeid(extraTypeId);

            final CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class);
            int commentId = commentService.saveWithSession(comment, AppContext.getUsername(),
                    isSendingEmailRelay, emailHandlerClass);

            String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type,
                    AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId);
            if (!"".equals(attachmentPath)) {
                saveContentsToRepo(attachmentPath);
            }

            // save success, clear comment area and load list
            // comments again
            commentInput.setValue("");
            statusWrapper.removeAllComponents();
            component.reload();
        }

    });
    inputWrapper.addComponent(postBtn);
    this.addComponent(inputWrapper);
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java

License:Open Source License

private Component createAttachmentRow(String fileName) {
    final HorizontalLayout uploadSucceedLayout = new HorizontalLayout();
    uploadSucceedLayout.setWidth("100%");
    Label uploadResult = new Label(fileName);
    uploadResult.setWidth("100%");
    uploadSucceedLayout.addComponent(uploadResult);
    uploadSucceedLayout.setExpandRatio(uploadResult, 1.0f);

    Button removeAttachment = new Button(
            "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>",
            new Button.ClickListener() {

                private static final long serialVersionUID = 1L;

                @Override/*from  w w w  .j av a2s . co m*/
                public void buttonClick(ClickEvent event) {
                    statusWrapper.removeComponent(uploadSucceedLayout);
                }

            });
    removeAttachment.setHtmlContentAllowed(true);
    removeAttachment.setStyleName("link");
    uploadSucceedLayout.addComponent(removeAttachment);
    uploadSucceedLayout.setStyleName("upload-succeed-layout");
    uploadSucceedLayout.setSpacing(true);
    return uploadSucceedLayout;
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java

License:Open Source License

private Component createAttachmentRow(String fileName) {
    final MHorizontalLayout uploadSucceedLayout = new MHorizontalLayout().withFullWidth();
    Label uploadResult = new Label(fileName);
    uploadSucceedLayout.with(uploadResult).expand(uploadResult);

    Button removeAttachment = new Button("", new Button.ClickListener() {
        @Override/*  w  w w . j a  v  a 2 s . com*/
        public void buttonClick(ClickEvent event) {
            statusWrapper.removeComponent(uploadSucceedLayout);
        }
    });
    removeAttachment.setIcon(FontAwesome.TRASH);
    removeAttachment.setHtmlContentAllowed(true);
    removeAttachment.setStyleName("link");
    uploadSucceedLayout.addComponent(removeAttachment);
    return uploadSucceedLayout;
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.TimeLogComp.java

License:Open Source License

public void displayTime(final V bean) {
    this.removeAllComponents();

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);/* w  w w  .  j  av  a 2 s.c om*/
    header.setStyleName("info-hdr");
    header.addStyleName("timelog-comp-hdr");
    header.setWidth("100%");
    Label dateInfoHeader = new Label(AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME));
    dateInfoHeader.setWidthUndefined();
    header.addComponent(dateInfoHeader);
    header.setExpandRatio(dateInfoHeader, 1.0f);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditTimeView(bean);

                    }
                });
        editBtn.setStyleName("link");
        editBtn.setHtmlContentAllowed(true);
        header.addComponent(editBtn);
        header.setComponentAlignment(editBtn, Alignment.BOTTOM_LEFT);
    }

    this.addComponent(header);

    GridFormLayoutHelper layout = new GridFormLayoutHelper(1, 3, "100%", "150px", Alignment.TOP_RIGHT);
    layout.getLayout().setWidth("100%");
    layout.getLayout().setMargin(false);

    double billableHours = getTotalBillableHours(bean);
    double nonBillableHours = getTotalNonBillableHours(bean);
    double remainHours = getRemainedHours(bean);
    layout.addComponent(new Label(billableHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_BILLABLE_HOURS), 0, 0);
    layout.addComponent(new Label(nonBillableHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_NON_BILLABLE_HOURS), 0, 1);
    layout.addComponent(new Label(remainHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_REMAIN_HOURS), 0, 2);
    this.addComponent(layout.getLayout());
}

From source file:com.esofthead.mycollab.mobile.module.project.view.bug.ApproveInputView.java

License:Open Source License

private void constructUI() {
    final Button approveBtn = new Button("Approve & Close", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//  ww  w .  ja  va 2s. co m
        public void buttonClick(final Button.ClickEvent event) {

            if (editForm.validateForm()) {
                // Save bug status and assignee
                ApproveInputView.this.bug.setStatus(BugStatus.Verified.name());

                final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                bugService.updateSelectiveWithSession(ApproveInputView.this.bug, AppContext.getUsername());

                // Save comment
                final String commentValue = editForm.commentArea.getValue();
                if (commentValue != null && !commentValue.trim().equals("")) {
                    final Comment comment = new Comment();
                    comment.setComment(editForm.commentArea.getValue());
                    comment.setCreatedtime(new GregorianCalendar().getTime());
                    comment.setCreateduser(AppContext.getUsername());
                    comment.setSaccountid(AppContext.getAccountId());
                    comment.setType(CommentType.PRJ_BUG.toString());
                    comment.setTypeid("" + ApproveInputView.this.bug.getId());
                    comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                    final CommentService commentService = ApplicationContextUtil
                            .getSpringBean(CommentService.class);
                    commentService.saveWithSession(comment, AppContext.getUsername());
                }
                ApproveInputView.this.callbackForm.previewItem(bug);
                EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null));
            }
        }
    });
    approveBtn.setStyleName("save-btn");
    this.setRightComponent(approveBtn);

    this.setContent(this.editForm);
}

From source file:com.esofthead.mycollab.mobile.module.project.view.bug.BugListViewImpl.java

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addBug = new Button();
    addBug.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 8204610801164300917L;

        @Override/*  w  w w.  ja  va 2 s . co m*/
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null));
        }
    });
    addBug.setStyleName("add-btn");
    return addBug;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.bug.ReOpenView.java

License:Open Source License

private void constructUI() {
    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setWidth("100%");
    contentLayout.addComponent(this.editForm);

    final Button reOpenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN),
            new Button.ClickListener() {
                @Override//from   w  ww .  j  a  v a 2s  . c  o  m
                public void buttonClick(final Button.ClickEvent event) {

                    if (editForm.validateForm()) {
                        ReOpenView.this.bug.setStatus(BugStatus.ReOpened.name());

                        // Save bug status and assignee
                        final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                        bugService.updateSelectiveWithSession(ReOpenView.this.bug, AppContext.getUsername());

                        // Save comment
                        final String commentValue = editForm.commentArea.getValue();
                        if (commentValue != null && !commentValue.trim().equals("")) {
                            final Comment comment = new Comment();
                            comment.setComment(commentValue);
                            comment.setCreatedtime(new GregorianCalendar().getTime());
                            comment.setCreateduser(AppContext.getUsername());
                            comment.setSaccountid(AppContext.getAccountId());
                            comment.setType(CommentType.PRJ_BUG.toString());
                            comment.setTypeid("" + ReOpenView.this.bug.getId());
                            comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                            final CommentService commentService = ApplicationContextUtil
                                    .getSpringBean(CommentService.class);
                            commentService.saveWithSession(comment, AppContext.getUsername());
                        }
                        ReOpenView.this.callbackForm.previewItem(bug);
                        EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null));
                    }

                }
            });
    reOpenBtn.setStyleName("save-btn");
    this.setRightComponent(reOpenBtn);

    this.setContent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.module.project.view.bug.ResolvedInputView.java

License:Open Source License

private void constructUI() {
    final Button resolvedBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override// w w  w  .  j a  va  2s . co  m
                public void buttonClick(final Button.ClickEvent event) {
                    if (editForm.validateForm()) {
                        ResolvedInputView.this.bug.setStatus(BugStatus.Resolved.name());

                        // Save bug status and assignee
                        final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                        bugService.updateSelectiveWithSession(ResolvedInputView.this.bug,
                                AppContext.getUsername());

                        // Save comment
                        final String commentValue = editForm.commentArea.getValue();
                        if (commentValue != null && !commentValue.trim().equals("")) {
                            final Comment comment = new Comment();
                            comment.setComment(commentValue);
                            comment.setCreatedtime(new GregorianCalendar().getTime());
                            comment.setCreateduser(AppContext.getUsername());
                            comment.setSaccountid(AppContext.getAccountId());
                            comment.setType(CommentType.PRJ_BUG.toString());
                            comment.setTypeid("" + ResolvedInputView.this.bug.getId());
                            comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                            final CommentService commentService = ApplicationContextUtil
                                    .getSpringBean(CommentService.class);
                            commentService.saveWithSession(comment, AppContext.getUsername());
                        }
                        ResolvedInputView.this.callbackForm.previewItem(bug);
                        EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null));
                    }

                }
            });
    resolvedBtn.setStyleName("save-btn");
    this.setRightComponent(resolvedBtn);
    this.setContent(this.editForm);
}