Example usage for com.vaadin.ui Alignment TOP_LEFT

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

Introduction

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

Prototype

Alignment TOP_LEFT

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

Click Source Link

Usage

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

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/*w ww  .  ja  va  2 s  .c o m*/
    Label header = new Label(AppContext.getMessage(BugI18nEnum.M_FORM_READ_TITLE));
    header.setStyleName("h2");
    layout.addComponent(header);

    this.informationLayout = new GridFormLayoutHelper(1, 12, "100%", "150px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().setWidth("100%");
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.milestone.MilestoneFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/*  ww  w .j  a  va 2 s .  co m*/
    Label header = new Label(AppContext.getMessage(MilestoneI18nEnum.M_FORM_READ_TITLE));
    header.setStyleName("h2");
    layout.addComponent(header);

    this.informationLayout = new GridFormLayoutHelper(1, 8, "100%", "150px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.settings.ProjectMemberFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/*w  ww  .j av a2s  .c  o  m*/
    Label header = new Label(AppContext.getMessage(ProjectMemberI18nEnum.FORM_INFORMATION_SECTION));
    header.setStyleName("h2");
    layout.addComponent(header);

    this.informationLayout = new GridFormLayoutHelper(1, 3, "100%", "150px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/*w  w  w  . ja  v  a  2 s  . co  m*/
    Label header = new Label(AppContext.getMessage(TaskI18nEnum.M_FORM_READ_TITLE));
    header.setStyleName("h2");
    layout.addComponent(header);

    this.informationLayout = new GridFormLayoutHelper(1, 11, "100%", "150px", Alignment.TOP_LEFT);

    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskGroupFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    Label header = new Label(AppContext.getMessage(TaskGroupI18nEnum.M_FORM_READ_TITLE));
    header.setStyleName("h2");
    layout.addComponent(header);/*  w  w w .  j  a  va2  s  .co  m*/
    this.informationLayout = new GridFormLayoutHelper(1, 6, "100%", "150px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().setWidth("100%");

    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

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

License:Open Source License

public static GridFormLayoutHelper defaultFormLayoutHelper(int columns, int rows) {
    GridFormLayoutHelper helper = new GridFormLayoutHelper(columns, rows, "100%", "150px", Alignment.TOP_LEFT);
    helper.getLayout().setWidth("100%");
    helper.getLayout().addStyleName(UIConstants.GRIDFORM_STANDARD);
    return helper;
}

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);//  w  w w.java 2  s.  c o m

    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();//w w  w.j a  v a  2  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.DynaFormLayout.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    int sectionCount = dynaForm.getSectionCount();
    sectionMappings = new HashMap<>();

    for (int i = 0; i < sectionCount; i++) {
        DynaSection section = dynaForm.getSection(i);
        if (section.isDeletedSection()) {
            continue;
        }//from   www.  ja v a  2  s .  co  m
        Label header = new Label(section.getHeader());
        header.setStyleName("h2");
        layout.addComponent(header);

        GridFormLayoutHelper gridLayout;

        if (section.isDeletedSection() || section.getFieldCount() == 0) {
            continue;
        }

        if (section.getLayoutType() == LayoutType.ONE_COLUMN) {
            gridLayout = new GridFormLayoutHelper(2, section.getFieldCount(), "100%", "167px",
                    Alignment.TOP_LEFT);
        } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) {
            gridLayout = new GridFormLayoutHelper(2, (section.getFieldCount() + 3) / 2, "100%", "167px",
                    Alignment.TOP_LEFT);
        } else {
            throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns");
        }

        gridLayout.getLayout().setWidth("100%");
        gridLayout.getLayout().setMargin(false);
        gridLayout.getLayout().setSpacing(false);
        gridLayout.getLayout().addStyleName("colored-gridlayout");
        layout.addComponent(gridLayout.getLayout());

        sectionMappings.put(section, gridLayout);
    }
    return layout;
}

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// w w  w. j  ava  2 s  . c  o m
                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);
}