Example usage for com.vaadin.ui Alignment TOP_RIGHT

List of usage examples for com.vaadin.ui Alignment TOP_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment TOP_RIGHT.

Prototype

Alignment TOP_RIGHT

To view the source code for com.vaadin.ui Alignment TOP_RIGHT.

Click Source Link

Usage

From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java

License:Open Source License

public GridFormLayoutHelper(final int columns, final int rows, final String defaultCaptionWidth) {
    this(columns, rows, DEFAULT_CONTROL_WIDTH, defaultCaptionWidth, Alignment.TOP_RIGHT);
}

From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java

License:Open Source License

public GridFormLayoutHelper(final int columns, final int rows, final String fieldControlWidth,
        final String defaultCaptionWidth) {
    this(columns, rows, fieldControlWidth, defaultCaptionWidth, Alignment.TOP_RIGHT);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CommentInput.java

License:Open Source License

@SuppressWarnings("rawtypes")
CommentInput(final ReloadableComponent component, final CommentType typeVal, final String typeidVal,
        final Integer extraTypeIdVal, final boolean cancelButtonEnable, final boolean isSendingEmailRelay,
        final Class emailHandler) {
    this.setWidth("600px");
    setSpacing(true);//from   ww w.j a  v a2s . c om

    type = typeVal;
    typeid = typeidVal;
    extraTypeId = extraTypeIdVal;

    commentArea = new RichTextArea();
    commentArea.setWidth("100%");
    commentArea.setHeight("200px");

    final AttachmentPanel attachments = new AttachmentPanel();

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withWidth("100%");

    final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);
    controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt);

    final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    final Comment comment = new Comment();
                    comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
                    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;
                    if (isSendingEmailRelay) {
                        commentId = commentService.saveWithSession(comment, AppContext.getUsername(),
                                isSendingEmailRelay, emailHandler);
                    } else {
                        commentId = commentService.saveWithSession(comment, AppContext.getUsername(), false,
                                emailHandler);
                    }

                    String attachmentPath = "";
                    if (CommentType.CRM_NOTE.equals(type)) {
                        attachmentPath = AttachmentUtils.getCrmNoteCommentAttachmentPath(
                                AppContext.getAccountId(), Integer.parseInt(typeid), commentId);
                    } else {
                        // do nothing
                    }

                    if (!"".equals(attachmentPath)) {
                        attachments.saveContentsToRepo(attachmentPath);
                    }

                    // save success, clear comment area and load list
                    // comments again
                    commentArea.setValue("");
                    attachments.removeAllAttachmentsDisplay();
                    component.reload();
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SEND);
    controlsLayout.with(saveBtn).withAlign(saveBtn, Alignment.TOP_RIGHT);

    if (cancelButtonEnable) {
        final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        component.cancel();
                    }
                });
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        controlsLayout.addComponent(cancelBtn);
        controlsLayout.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT);
    }

    MVerticalLayout editBox = new MVerticalLayout();

    MHorizontalLayout commentWrap = new MHorizontalLayout().withWidth("100%");
    commentWrap.addStyleName("message");

    SimpleUser currentUser = AppContext.getSession();
    VerticalLayout userBlock = new VerticalLayout();
    userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    userBlock.setWidth("80px");
    userBlock.setSpacing(true);
    userBlock.addComponent(UserAvatarControlFactory.createUserAvatarButtonLink(currentUser.getAvatarid(),
            currentUser.getDisplayName()));
    Label userName = new Label(currentUser.getDisplayName());
    userName.setStyleName("user-name");
    userBlock.addComponent(userName);

    commentWrap.addComponent(userBlock);
    VerticalLayout textAreaWrap = new VerticalLayout();
    textAreaWrap.setStyleName("message-container");
    textAreaWrap.setWidth("100%");
    textAreaWrap.addComponent(editBox);

    commentWrap.addComponent(textAreaWrap);
    commentWrap.setExpandRatio(textAreaWrap, 1.0f);

    editBox.addComponent(commentArea);
    editBox.addComponent(controlsLayout);
    this.addComponent(commentWrap);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmCommentInput.java

License:Open Source License

CrmCommentInput(final ReloadableComponent component, final String typeVal) {
    super();//from w  ww .j  av a2  s  .c o m
    this.withMargin(new MarginInfo(true, true, false, true)).withFullWidth().withStyleName("message");

    SimpleUser currentUser = AppContext.getUser();
    UserBlock userBlock = new UserBlock(currentUser.getUsername(), currentUser.getAvatarid(),
            currentUser.getDisplayName());

    MVerticalLayout textAreaWrap = new MVerticalLayout().withFullWidth().withStyleName("message-container");
    this.with(userBlock, textAreaWrap).expand(textAreaWrap);

    type = typeVal;

    commentArea = new RichTextArea();
    commentArea.setWidth("100%");
    commentArea.setHeight("200px");

    final AttachmentPanel attachments = new AttachmentPanel();

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withFullWidth();
    controlsLayout.setDefaultComponentAlignment(Alignment.TOP_RIGHT);

    final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);
    controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt);

    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    commentArea.setValue("");
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);

    final Button newCommentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    CommentWithBLOBs comment = new CommentWithBLOBs();
                    comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
                    comment.setCreatedtime(new GregorianCalendar().getTime());
                    comment.setCreateduser(AppContext.getUsername());
                    comment.setSaccountid(AppContext.getAccountId());
                    comment.setType(type);
                    comment.setTypeid(typeId);

                    CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                    int commentId = commentService.saveWithSession(comment, AppContext.getUsername());

                    String attachmentPath = AttachmentUtils.getCommentAttachmentPath(typeVal,
                            AppContext.getAccountId(), null, typeId, commentId);

                    if (!"".equals(attachmentPath)) {
                        attachments.saveContentsToRepo(attachmentPath);
                    }

                    // save success, clear comment area and load list
                    // comments again
                    commentArea.setValue("");
                    attachments.removeAllAttachmentsDisplay();
                    component.reload();
                }
            });
    newCommentBtn.setStyleName(UIConstants.BUTTON_ACTION);
    newCommentBtn.setIcon(FontAwesome.SEND);
    controlsLayout.with(cancelBtn, newCommentBtn);
    textAreaWrap.with(commentArea, controlsLayout);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.NoteListItems.java

License:Open Source License

private void addCreateBtn() {
    final Component component = noteWrapper.getComponent(0);
    if (component instanceof NoteEditor) {
        noteWrapper.replaceComponent(component, createBtn);
        noteWrapper.setComponentAlignment(createBtn, Alignment.TOP_RIGHT);
    }/* www  .  j a va  2 s  .c  om*/
}

From source file:com.esofthead.mycollab.module.crm.ui.components.NoteListItems.java

License:Open Source License

private void initUI() {
    noteWrapper = new MVerticalLayout().withSpacing(true).withMargin(new MarginInfo(true, true, false, true))
            .withWidth("100%").withStyleName("note-view");

    this.addComponent(noteWrapper);
    addStyleName("note-list");

    createBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.BUTTON_NEW_NOTE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override/*  ww w .  ja v a 2s  .c  om*/
                public void buttonClick(final ClickEvent event) {
                    NoteEditor addCommentEditor = new NoteEditor();
                    noteWrapper.replaceComponent(createBtn, addCommentEditor);
                    noteWrapper.setComponentAlignment(addCommentEditor, Alignment.TOP_LEFT);
                }
            });

    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    noteWrapper.addComponent(createBtn);
    noteWrapper.setComponentAlignment(createBtn, Alignment.TOP_RIGHT);

    noteList = new BeanList<>(noteService, NoteRowDisplayHandler.class);
    noteList.setDisplayEmptyListText(false);
    noteList.setStyleName("noteList");

    noteListContainer = new VerticalLayout();
    noteWrapper.addComponent(noteListContainer);
}

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

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    SimpleContact contact = attachForm.getBean();

    if (propertyId.equals("accountid")) {
        return new LinkViewField(contact.getAccountName(),
                CrmLinkBuilder.generateAccountPreviewLinkFull(contact.getAccountid()),
                CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
    } else if (propertyId.equals("email")) {
        return new EmailViewField(attachForm.getBean().getEmail());
    } else if (propertyId.equals("assignuser")) {
        return new UserLinkViewField(contact.getAssignuser(), contact.getAssignUserAvatarId(),
                contact.getAssignUserFullName());
    } else if (propertyId.equals("iscallable")) {
        if (contact.getIscallable() == null || Boolean.FALSE == contact.getIscallable()) {
            return new DefaultViewField(AppContext.getMessage(GenericI18Enum.BUTTON_NO));
        } else {/*ww w  .  ja  v a2s .c  om*/
            return new DefaultViewField(AppContext.getMessage(GenericI18Enum.BUTTON_YES));
        }
    } else if (propertyId.equals("birthday")) {
        return new DateViewField(contact.getBirthday());
    } else if (propertyId.equals("firstname")) {
        final ContainerHorizontalViewField containerField = new ContainerHorizontalViewField();
        String displayName = "";
        if (contact.getPrefix() != null) {
            displayName = contact.getPrefix();
        }
        if (contact.getFirstname() != null) {
            displayName += contact.getFirstname();
        }

        final Label nameLbl = new Label(displayName);
        containerField.addComponentField(nameLbl);
        containerField.getLayout().setExpandRatio(nameLbl, 1.0f);
        final Button vcardDownloadBtn = new Button("");
        VCardStreamSource streamSource = new VCardStreamSource();
        OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource);
        downloaderExt.extend(vcardDownloadBtn);

        vcardDownloadBtn.setIcon(MyCollabResource.newResource("icons/12/vcard.png"));
        vcardDownloadBtn.setStyleName(UIConstants.THEME_TRANSPARENT_LINK);
        containerField.addComponentField(vcardDownloadBtn);
        containerField.getLayout().setComponentAlignment(vcardDownloadBtn, Alignment.TOP_RIGHT);
        return containerField;
    } else if (propertyId.equals("description")) {
        return new RichTextViewField(contact.getDescription());
    }

    return null;
}

From source file:com.esofthead.mycollab.module.crm.view.CrmHomeViewImpl.java

License:Open Source License

@Override
protected void displayView() {
    MHorizontalLayout contentLayout = new MHorizontalLayout().withSpacing(true).withWidth("100%");

    VerticalLayout myAssignmentsLayout = new VerticalLayout();

    if (AppContext.canRead(RolePermissionCollections.CRM_OPPORTUNITY)) {
        opportunityChartDashlet = ViewManager.getCacheComponent(IOpportunityPipelineFunnelChartDashlet.class);
        myAssignmentsLayout.addComponent(opportunityChartDashlet);
    }//from   w  ww.java 2  s.com

    if (AppContext.canRead(RolePermissionCollections.CRM_ACCOUNT)) {
        accountDashlet = new AccountListDashlet();
        myAssignmentsLayout.addComponent(accountDashlet);
    }

    if (AppContext.canRead(RolePermissionCollections.CRM_MEETING)) {
        meetingDashlet = new MeetingListDashlet();
        myAssignmentsLayout.addComponent(meetingDashlet);
    }

    if (AppContext.canRead(RolePermissionCollections.CRM_CALL)) {
        callDashlet = new CallListDashlet();
        myAssignmentsLayout.addComponent(callDashlet);
    }

    if (AppContext.canRead(RolePermissionCollections.CRM_LEAD)) {
        leadDashlet = new LeadListDashlet();
        myAssignmentsLayout.addComponent(leadDashlet);
    }

    contentLayout.addComponent(myAssignmentsLayout);
    contentLayout.setExpandRatio(myAssignmentsLayout, 1.0f);

    MVerticalLayout streamsLayout = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true));
    streamsLayout.setSizeUndefined();

    salesDashboard = new SalesDashboardView();
    salesDashboard.setWidth("550px");
    streamsLayout.addComponent(salesDashboard);
    streamsLayout.setComponentAlignment(salesDashboard, Alignment.MIDDLE_RIGHT);

    activityStreamPanel = new ActivityStreamPanel();
    activityStreamPanel.setWidth("550px");
    streamsLayout.addComponent(activityStreamPanel);
    streamsLayout.setComponentAlignment(activityStreamPanel, Alignment.MIDDLE_RIGHT);

    contentLayout.addComponent(streamsLayout);
    contentLayout.setComponentAlignment(streamsLayout, Alignment.TOP_RIGHT);

    this.addComponent(contentLayout);

    displayDashboard();
}

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

License:Open Source License

ProjectCommentInput(final ReloadableComponent component, final CommentType typeVal,
        final Integer extraTypeIdVal, final boolean cancelButtonEnable, final boolean isSendingEmailRelay,
        final Class<? extends SendingRelayEmailNotificationAction> emailHandler) {
    super();// w w w .  ja  va  2s . c om
    this.withWidth("100%").withStyleName("message");

    final SimpleUser currentUser = AppContext.getSession();
    MVerticalLayout userBlock = new MVerticalLayout().withMargin(false).withWidth("80px");
    userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    ClickListener gotoUser = new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoRead(this, currentUser.getUsername()));
        }
    };

    Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(currentUser.getAvatarid(),
            currentUser.getDisplayName());
    userAvatarBtn.addClickListener(gotoUser);
    userBlock.addComponent(userAvatarBtn);
    Button userName = new Button(currentUser.getDisplayName());
    userName.setStyleName("user-name");
    userName.addStyleName("link");
    userName.addStyleName(UIConstants.WORD_WRAP);
    userName.addClickListener(gotoUser);
    userBlock.addComponent(userName);

    this.addComponent(userBlock);
    MVerticalLayout textAreaWrap = new MVerticalLayout().withWidth("100%").withStyleName("message-container");
    this.addComponent(textAreaWrap);
    this.setExpandRatio(textAreaWrap, 1.0f);

    type = typeVal;
    extraTypeId = extraTypeIdVal;

    commentArea = new RichTextArea();
    commentArea.setWidth("100%");
    commentArea.setHeight("200px");

    final AttachmentPanel attachments = new AttachmentPanel();

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withSpacing(true).withMargin(false)
            .withWidth("100%");

    final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);
    controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt);

    final Label emptySpace = new Label();
    controlsLayout.addComponent(emptySpace);
    controlsLayout.setExpandRatio(emptySpace, 1.0f);

    if (cancelButtonEnable) {
        final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        component.cancel();
                    }
                });
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        controlsLayout.addComponent(cancelBtn);
        controlsLayout.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT);
    }

    final Button newCommentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    final Comment comment = new Comment();
                    comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
                    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, emailHandler);

                    String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(typeVal,
                            AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeId,
                            commentId);

                    if (!"".equals(attachmentPath)) {
                        attachments.saveContentsToRepo(attachmentPath);
                    }

                    // save success, clear comment area and load list
                    // comments again
                    commentArea.setValue("");
                    attachments.removeAllAttachmentsDisplay();
                    component.reload();
                }
            });
    newCommentBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    newCommentBtn.setIcon(FontAwesome.SEND);
    controlsLayout.with(newCommentBtn).withAlign(newCommentBtn, Alignment.TOP_RIGHT);

    textAreaWrap.addComponent(commentArea);
    textAreaWrap.addComponent(controlsLayout);
}

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

License:Open Source License

private void initUI() {
    this.setMargin(new MarginInfo(false, true, false, true));
    header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withWidth("100%");
    header.addStyleName("hdr-view");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    this.addComponent(header);

    final MHorizontalLayout body = new MHorizontalLayout().withMargin(false).withWidth("100%");

    this.leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false));
    body.with(this.leftColumn).expand(leftColumn);

    this.rightColumn = new MVerticalLayout().withMargin(false);

    body.with(this.rightColumn).withAlign(rightColumn, Alignment.TOP_RIGHT);

    this.addComponent(body);

    initHeader();/*from w ww.  ja  v  a  2s.c o m*/
}