Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

From source file:com.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("AccountSearchName", ShortcutAction.KeyCode.ENTER, null) {
                @Override/*from www.  j a v  a 2  s  .  co m*/
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPanel.addComponent(textValueField, 0, 0);
    layoutSearchPanel.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

From source file:com.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java

License:Open Source License

private void addUserListSelectField() {
    userBox = new ActiveUserComboBox();
    userBox.setImmediate(true);//from  w  ww  .  ja v  a 2s.  c  om
    layoutSearchPanel.addComponent(userBox, 0, 0);
    layoutSearchPanel.setComponentAlignment(userBox, Alignment.MIDDLE_CENTER);
}

From source file:com.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java

License:Open Source License

private void initContent() {
    MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth();
    this.addComponent(contentWrapper);

    /* Content cheat */
    MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true))
            .withFullWidth().withStyleName("readview-layout");
    contentWrapper.with(mainContent).expand(mainContent);

    MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("250px");
    rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    contentWrapper.addComponent(rightColumn);

    MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth().withStyleName(WebThemes.HEADER_VIEW);
    actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Component headerText = ComponentUtils.header(CrmTypeConstants.ACTIVITY, "Calendar");
    actionPanel.with(headerText).expand(headerText);

    mainContent.addComponent(actionPanel);

    dateHdr = new Label();
    dateHdr.setSizeUndefined();// ww  w .  java 2  s  . c  o  m
    dateHdr.setStyleName(ValoTheme.LABEL_H3);
    mainContent.addComponent(this.dateHdr);
    mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER);

    toggleViewBtn = new PopupButton(UserUIContext.getMessage(DayI18nEnum.OPT_MONTHLY));
    toggleViewBtn.setWidth("200px");
    toggleViewBtn.addStyleName("calendar-view-switcher");
    MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withWidth("190px");

    monthViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_MONTHLY), clickEvent -> {
        toggleViewBtn.setPopupVisible(false);
        toggleViewBtn.setCaption(monthViewBtn.getCaption());
        calendarComponent.switchToMonthView(new Date(), true);
        datePicker.selectDate(new Date());
        monthViewBtn.addStyleName("selected-style");
        initLabelCaption();
    });
    monthViewBtn.setStyleName(WebThemes.BUTTON_LINK);
    popupLayout.addComponent(monthViewBtn);

    weekViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_WEEKLY), clickEvent -> {
        toggleViewBtn.setPopupVisible(false);
        toggleViewBtn.setCaption(weekViewBtn.getCaption());
        calendarComponent.switchToWeekView(new Date());
        datePicker.selectWeek(new Date());
    });
    weekViewBtn.setStyleName(WebThemes.BUTTON_LINK);
    popupLayout.addComponent(weekViewBtn);

    dailyViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_DAILY), clickEvent -> {
        toggleViewBtn.setPopupVisible(false);
        toggleViewBtn.setCaption(dailyViewBtn.getCaption());
        Date currentDate = new Date();
        datePicker.selectDate(currentDate);
        calendarComponent.switchToDateView(currentDate);
    });
    dailyViewBtn.setStyleName(WebThemes.BUTTON_LINK);
    popupLayout.addComponent(dailyViewBtn);

    toggleViewBtn.setContent(popupLayout);
    CssLayout toggleBtnWrap = new CssLayout();
    toggleBtnWrap.setStyleName("switcher-wrap");
    toggleBtnWrap.addComponent(toggleViewBtn);

    rightColumn.addComponent(toggleBtnWrap);
    rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER);

    rightColumn.addComponent(this.datePicker);
    initLabelCaption();
    addCalendarEvent();

    actionPanel.addComponent(calendarActionBtn);
    actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT);

    OptionPopupContent actionBtnLayout = new OptionPopupContent();

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

        @Override
        public void buttonClick(ClickEvent event) {
            calendarActionBtn.setPopupVisible(false);
            String caption = event.getButton().getCaption();
            if (caption.equals("New Task")) {
                EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null));
            } else if (caption.equals("New Call")) {
                EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null));
            } else if (caption.equals("New Meeting")) {
                EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null));
            }
        }
    };

    MButton todoBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.NEW), listener)
            .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK))
            .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_TASK));
    actionBtnLayout.addOption(todoBtn);

    MButton callBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), listener)
            .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL))
            .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_CALL));
    actionBtnLayout.addOption(callBtn);

    MButton meetingBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), listener)
            .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING))
            .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_MEETING));
    actionBtnLayout.addOption(meetingBtn);

    calendarActionBtn.setContent(actionBtnLayout);

    ButtonGroup viewSwitcher = new ButtonGroup();

    Button calendarViewBtn = new Button("Calendar");
    calendarViewBtn.setStyleName("selected");
    calendarViewBtn.addStyleName(WebThemes.BUTTON_ACTION);
    viewSwitcher.addButton(calendarViewBtn);

    Button activityListBtn = new Button("Activities", event -> {
        ActivitySearchCriteria criteria = new ActivitySearchCriteria();
        criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
        EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null));
    });
    activityListBtn.addStyleName(WebThemes.BUTTON_ACTION);
    viewSwitcher.addButton(activityListBtn);

    actionPanel.addComponent(viewSwitcher);
    actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT);

    calendarComponent = new CalendarDisplay();
    mainContent.addComponent(calendarComponent);
    mainContent.setExpandRatio(calendarComponent, 1);
    mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER);

    HorizontalLayout spacing = new HorizontalLayout();
    spacing.setHeight("30px");
    mainContent.addComponent(spacing);

    HorizontalLayout noteInfoLayout = new HorizontalLayout();
    noteInfoLayout.setSpacing(true);

    HorizontalLayout noteWapper = new HorizontalLayout();
    noteWapper.setHeight("30px");
    Label noteLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE));
    noteWapper.addComponent(noteLbl);
    noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(noteWapper);

    HorizontalLayout completeWapper = new HorizontalLayout();
    completeWapper.setWidth("100px");
    completeWapper.setHeight("30px");
    completeWapper.addStyleName("eventLblcompleted");
    Label completeLabel = new Label("Completed");
    completeWapper.addComponent(completeLabel);
    completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(completeWapper);

    HorizontalLayout overdueWapper = new HorizontalLayout();
    overdueWapper.setWidth("100px");
    overdueWapper.setHeight("30px");
    overdueWapper.addStyleName("eventLbloverdue");
    Label overdueLabel = new Label("Overdue");
    overdueWapper.addComponent(overdueLabel);
    overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(overdueWapper);

    HorizontalLayout futureWapper = new HorizontalLayout();
    futureWapper.setWidth("100px");
    futureWapper.setHeight("30px");
    futureWapper.addStyleName("eventLblfuture");
    Label futureLabel = new Label("Future");
    futureWapper.addComponent(futureLabel);
    futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER);
    noteInfoLayout.addComponent(futureWapper);

    mainContent.addComponent(noteInfoLayout);
    mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 2);
    layoutSearchPane.setSpacing(true);//w  w w .  j  a va 2  s . c  o  m

    group = new ValueComboBox(false, "Campaign Name", "Start Date", "End Date");
    group.select("Campaign Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Campaign Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Start Date")) {
                addDateFieldSearch();
            } else if (searchType.equals("End Date")) {
                addDateFieldSearch();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

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

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("CampaignSearchField", ShortcutAction.KeyCode.ENTER, null) {
                @Override/* w  w w. j  a  v a  2  s. com*/
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

private void addDateFieldSearch() {
    dateSearchField = new DateSelectionField();
    layoutSearchPane.addComponent(dateSearchField, 0, 0);
    layoutSearchPane.setComponentAlignment(dateSearchField, Alignment.MIDDLE_CENTER);
}

From source file:com.mycollab.module.crm.view.cases.CaseSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);//from  w w w  .j  ava2  s. c  o  m

    group = new ValueComboBox(false, "Subject", "Account Name", "Status",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Subject")) {
                addTextFieldSearch();
            } else if (searchType.equals("Account Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Status")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

From source file:com.mycollab.module.crm.view.cases.CaseSimpleSearchPanel.java

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("CaseSearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override/*from   ww  w .ja  v a2s.  com*/
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}

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

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);//from www  . j av a  2s.c  o m

    group = new ValueComboBox(false, "Name", "Email", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

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

License:Open Source License

private void addTextFieldSearch() {
    textValueField = ShortcutExtension.installShortcutAction(new TextField(),
            new ShortcutListener("ContactSearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override//from w w  w.j  a va  2s .  c  o m
                public void handleAction(Object o, Object o1) {
                    doSearch();
                }
            });
    layoutSearchPane.addComponent(textValueField, 0, 0);
    layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
}