Example usage for com.vaadin.ui HorizontalLayout setDefaultComponentAlignment

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

Introduction

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

Prototype

@Override
    public void setDefaultComponentAlignment(Alignment defaultAlignment) 

Source Link

Usage

From source file:ch.wscr.management.ui.view.MemberView.java

/**
 * Kopfzeile fr das Grid erstellen/*from ww  w .j a  va2  s. c  o m*/
 *
 * @param grid das Grid dem die Kopfzeile hinzugefgt werden soll
 */
private void setHeaderRow(final Grid grid) {
    // TODO Erstellung neuer Mitglieder muss noch optimiert werden

    final Button addMember = new Button("Neu", clickEvent -> {
        BeanItem<Member> beanItem = memberBeanItemContainer.addItem(new Member());
        grid.setEditorEnabled(true);
        //grid.editItem(beanItem);

    });

    addMember.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    addMember.setIcon(FontAwesome.PLUS_CIRCLE);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setSpacing(true);
    buttonLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    buttonLayout.addComponent(addMember);

    HeaderRow headerRow = grid.prependHeaderRow();
    headerRow.join("memberId", "lastName", "firstName", "adrStreet", "adrPostalCode", "adrCity", "adrCountry",
            "birthDate", "driverLicense");
    headerRow.getCell("lastName").setComponent(buttonLayout);
}

From source file:ch.wscr.management.ui.view.MemberView.java

/**
 * Header der View erstellen//w w  w. j  a  v a 2s.c  o m
 *
 * @return der Header
 */
private Component buidViewHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth(100f, Unit.PERCENTAGE);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
    header.setSpacing(true);

    Label title = new Label("Mitgliederverwaltung");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H1);

    header.addComponent(title);

    Label gap = new Label();
    gap.setWidth(10, Unit.PIXELS);

    header.addComponent(gap);
    header.setExpandRatio(title, 1);
    return header;
}

From source file:com.cavisson.gui.dashboard.components.controls.Forms.java

License:Apache License

public Forms() {
    setSpacing(true);/*from   w  ww .  jav a2  s.c o  m*/
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);
    StringGenerator sg = new StringGenerator();

    TextField name = new TextField("Name");
    name.setValue(sg.nextString(true) + " " + sg.nextString(true));
    name.setWidth("50%");
    form.addComponent(name);

    DateField birthday = new DateField("Birthday");
    birthday.setValue(new Date(80, 0, 31));
    form.addComponent(birthday);

    TextField username = new TextField("Username");
    username.setValue(sg.nextString(false) + sg.nextString(false));
    username.setRequired(true);
    form.addComponent(username);

    OptionGroup sex = new OptionGroup("Sex");
    sex.addItem("Female");
    sex.addItem("Male");
    sex.select("Male");
    sex.addStyleName("horizontal");
    form.addComponent(sex);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField email = new TextField("Email");
    email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com");
    email.setWidth("50%");
    email.setRequired(true);
    form.addComponent(email);

    TextField location = new TextField("Location");
    location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
    location.setWidth("50%");
    location.setComponentError(new UserError("This address doesn't exist"));
    form.addComponent(location);

    TextField phone = new TextField("Phone");
    phone.setWidth("50%");
    form.addComponent(phone);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    wrap.setCaption("Newsletter");
    CheckBox newsletter = new CheckBox("Subscribe to newsletter", true);
    wrap.addComponent(newsletter);

    ComboBox period = new ComboBox();
    period.setTextInputAllowed(false);
    period.addItem("Daily");
    period.addItem("Weekly");
    period.addItem("Montly");
    period.setNullSelectionAllowed(false);
    period.select("Weekly");
    period.addStyleName("small");
    period.setWidth("10em");
    wrap.addComponent(period);
    form.addComponent(wrap);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField website = new TextField("Website");
    website.setInputPrompt("http://");
    website.setWidth("100%");
    form.addComponent(website);

    TextArea shortbio = new TextArea("Short Bio");
    shortbio.setValue(
            "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum.");
    shortbio.setWidth("100%");
    shortbio.setRows(2);
    form.addComponent(shortbio);

    final RichTextArea bio = new RichTextArea("Bio");
    bio.setWidth("100%");
    bio.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bio);

    form.setReadOnly(true);
    bio.setReadOnly(true);

    Button edit = new Button("Edit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bio.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bio.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);
}

From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items/*w  w  w  .  jav  a 2 s  . co m*/
    menuItems.put("common", "Common UI Elements");
    menuItems.put("labels", "Labels");
    menuItems.put("buttons-and-links", "Buttons & Links");
    menuItems.put("textfields", "Text Fields");
    menuItems.put("datefields", "Date Fields");
    menuItems.put("comboboxes", "Combo Boxes");
    menuItems.put("selects", "Selects");
    menuItems.put("checkboxes", "Check Boxes & Option Groups");
    menuItems.put("sliders", "Sliders & Progress Bars");
    menuItems.put("colorpickers", "Color Pickers");
    menuItems.put("menubars", "Menu Bars");
    menuItems.put("trees", "Trees");
    menuItems.put("tables", "Tables");
    menuItems.put("dragging", "Drag and Drop");
    menuItems.put("panels", "Panels");
    menuItems.put("splitpanels", "Split Panels");
    menuItems.put("tabs", "Tabs");
    menuItems.put("accordions", "Accordions");
    menuItems.put("popupviews", "Popup Views");
    // menuItems.put("calendar", "Calendar");
    menuItems.put("forms", "Forms");

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    menu.addComponent(createThemeSelect());

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    final StringGenerator sg = new StringGenerator();
    final MenuItem settingsItem = settings.addItem(
            sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false),
            new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null);
    settingsItem.addItem("Edit Profile", null);
    settingsItem.addItem("Preferences", null);
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", null);
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    Label label = null;
    int count = -1;
    for (final Entry<String, String> item : menuItems.entrySet()) {
        if (item.getKey().equals("labels")) {
            label = new Label("Components", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("panels")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Containers", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("forms")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Other", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        if (count == 2) {
            b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>");
        }
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(testIcon.get());
        menuItemsLayout.addComponent(b);
        count++;
    }
    label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");

    return menu;
}

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();/*  w  w w  . j a  v  a  2  s  .c  o 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.AccountReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from  w  w w  . jav a  2  s . c  o  m

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)));
        }
    });
    toolbarLayout.addComponent(relatedContacts);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_OPPORTUNITY) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new AccountEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateOpportunities)));
        }
    });
    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)));
        }
    });
    toolbarLayout.addComponent(relatedLeads);

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new AccountEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateActivities)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

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

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*ww w . j ava 2  s.  c  o  m*/

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(AssignmentReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

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

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from  w w  w  . j av a2  s. c o m

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(CallReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

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

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from w  w  w.  jav  a 2 s .  co  m

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(MeetingReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

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

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from  w  ww  .j a  v  a  2 s .co  m

    Button relatedAccounts = new Button();
    relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACCOUNT) + "</div>");
    relatedAccounts.setHtmlContentAllowed(true);
    relatedAccounts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateAccounts)));
        }
    });
    toolbarLayout.addComponent(relatedAccounts);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)));
        }
    });
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)));
        }
    });
    toolbarLayout.addComponent(relatedLeads);

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new CampaignEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateActivities)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}