Example usage for com.vaadin.ui VerticalLayout setDefaultComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setDefaultComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setDefaultComponentAlignment.

Prototype

@Override
    public void setDefaultComponentAlignment(Alignment defaultAlignment) 

Source Link

Usage

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

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*w ww  . j  a  v  a 2 s . c  o  m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to CRM");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

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

License:Open Source License

private void initUI() {
    headerPanel = new HorizontalLayout();
    headerPanel.setWidth("100%");
    headerPanel.setStyleName("summary-info-panel");
    headerPanel.setMargin(new MarginInfo(true, false, true, false));
    headerPanel.setHeightUndefined();/*from   ww  w. j  a va2 s. co m*/
    content.addComponent(headerPanel);
    constructSpentTimeEntryPanel();
    constructRemainTimeEntryPanel();

    this.tableItem = new DefaultPagedBeanList<ItemTimeLoggingService, ItemTimeLoggingSearchCriteria, SimpleItemTimeLogging>(
            ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), new TimeLogRowHandler()) {

        private static final long serialVersionUID = -4549910960891655297L;

        @Override
        protected void renderRows() {
            int i = 0;
            Date currentDate = new GregorianCalendar(2100, 1, 1).getTime();
            for (final SimpleItemTimeLogging item : currentListData) {
                if (!DateUtils.isSameDay(item.getLogforday(), currentDate)) {
                    Label dateLbl = new Label(AppContext.formatDate(item.getLogforday()));
                    dateLbl.setStyleName("log-day");
                    listContainer.addComponent(dateLbl);
                    currentDate = item.getLogforday();
                }
                final Component row = getRowDisplayHandler().generateRow(item, i);
                listContainer.addComponent(row);
                i++;
            }
        }

    };

    this.tableItem.setWidth("100%");
    content.addComponent(tableItem);
    content.setExpandRatio(tableItem, 1.0f);

    VerticalLayout controlBtns = new VerticalLayout();
    controlBtns.setSpacing(true);
    controlBtns.setWidth("100%");
    controlBtns.setMargin(true);
    controlBtns.addStyleName("edit-btn-layout");
    controlBtns.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    Button addNewEntryBtn = new Button(AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_ADD_TIME_LOG_ENTRY),
            new Button.ClickListener() {

                private static final long serialVersionUID = -2540265040691537699L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new NewTimeLogEntryWindow());
                }
            });
    addNewEntryBtn.setWidth("100%");
    controlBtns.addComponent(addNewEntryBtn);

    Button updateRemainTimeBtn = new Button(
            AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_UPDATE_REMAIN_HOURS),
            new Button.ClickListener() {

                private static final long serialVersionUID = 9215577509351959739L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new UpdateRemainTimeWindow());
                }
            });
    updateRemainTimeBtn.setWidth("100%");
    controlBtns.addComponent(updateRemainTimeBtn);

    NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu();
    editBtn.setButtonCaption(null);
    editBtn.setStyleName("edit-btn");
    editBtn.setContent(controlBtns);
    this.setRightComponent(editBtn);
}

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

License:Open Source License

@Override
public void displayDashboard() {
    mainLayout.removeAllComponents();//w  w  w .j  a v  a  2 s.  co m
    SimpleProject currentProject = CurrentProjectVariables.getProject();
    VerticalLayout projectInfo = new VerticalLayout();
    projectInfo.setStyleName("project-info-layout");
    projectInfo.setWidth("100%");
    projectInfo.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label projectIcon = new Label("<span aria-hidden=\"true\" data-icon=\"&#xe614\"></span>");
    projectIcon.setStyleName("project-icon");
    projectIcon.setContentMode(ContentMode.HTML);
    projectIcon.setWidthUndefined();
    projectInfo.addComponent(projectIcon);

    Label projectName = new Label(StringUtils.trim(currentProject.getName(), 50, true));
    projectName.setWidth("100%");
    projectName.setStyleName("project-name");
    projectInfo.addComponent(projectName);

    GridLayout projectModulesList = new GridLayout(2, 3);
    projectModulesList.setStyleName("project-modules-layout");
    projectModulesList.setWidth("100%");
    projectModulesList.setSpacing(true);
    projectModulesList.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_MESSAGE), "&#xf04f;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_MILESTONE), "&#xf075;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK), "&#xe60f;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG), "&#xf188;"));

    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_FILE), "&#xf017;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_RISK), "&#xf02d;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_PROBLEM), "&#xf0d2;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_TIME), "&#xe612;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_STANDAUP), "&#xf0c0;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_USERS), "&#xe601;"), 0, 2,
            1, 2);

    mainLayout.addComponent(projectInfo);
    mainLayout.addComponent(projectModulesList);
}

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

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);//  ww  w. j a  v  a2s .co  m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to Projects");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/* www  .  j  av a 2s.  c om*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    Label welcomeText = new Label("Welcome Back!");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ShellController.doLogin(emailField.getValue(), pwdField.getValue(), rememberPassword.getValue());
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.ui.MainView.java

License:Open Source License

private void initUI() {
    this.setStyleName("main-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);//from  w w  w . j  a  va 2  s  .co  m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    ModuleButton crmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_CRM));
    crmButton.setWidth("100%");
    crmButton.addStyleName("crm");
    crmButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1218427186205574547L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });

    contentLayout.addComponent(crmButton);

    ModuleButton pmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT));
    pmButton.setWidth("100%");
    pmButton.addStyleName("project");
    pmButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -5323408319082242586L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
        }
    });
    contentLayout.addComponent(pmButton);

    ModuleButton fileButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT));
    fileButton.setWidth("100%");
    fileButton.addStyleName("document");
    contentLayout.addComponent(fileButton);

    this.addComponent(contentLayout);
}

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

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();//from  w  ww .  ja  va  2 s  .  c o  m
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    Button.ClickListener listener = new Button.ClickListener() {
        private static final long serialVersionUID = -8306231710367659086L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialog.this.setConfirmed(event.getButton() == okBtn);
            if (ConfirmDialog.this.getListener() != null) {
                ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
            }
            ConfirmDialog.this.close();
        }

    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}

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   w w w .  java  2s  .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.view.account.AccountListNoItemView.java

License:Open Source License

public AccountListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from  w ww .  j  a v a 2 s  .c  o  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/account.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createAccountBtn = new Button(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new AccountEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(createAccountBtn);
    createAccountBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Accounts", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

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

License:Open Source License

public CampaignListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from   w  ww  .  ja v a 2 s. co  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/campaign.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(CampaignI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(CampaignI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CampaignEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Campaigns", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}