List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.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); Button relatedContacts = new Button(); relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>"); relatedOpportunities.setHtmlContentAllowed(true); relatedOpportunities.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(LeadI18nEnum.LIST) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)))); toolbarLayout.addComponent(relatedLeads); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)))); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.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); Button relatedAccounts = new Button(); relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(AccountI18nEnum.LIST) + "</div>"); relatedAccounts.setHtmlContentAllowed(true); relatedAccounts.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(ContactI18nEnum.LIST) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(LeadI18nEnum.LIST) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)))); toolbarLayout.addComponent(relatedLeads); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post( new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)))); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true); Button relatedCampaigns = new Button(); relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CampaignI18nEnum.LIST) + "</div>"); relatedCampaigns.setHtmlContentAllowed(true); relatedCampaigns//from ww w .j av a 2 s . c om .addClickListener(clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems( LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns)))); toolbarLayout.addComponent(relatedCampaigns); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)))); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
From source file:com.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true); Button relatedContacts = new Button(); relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST) + "</div>"); relatedContacts.setHtmlContentAllowed(true); relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance().post( new OpportunityEvent.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\">" + UserUIContext.getMessage(LeadI18nEnum.LIST) + "</div>"); relatedLeads.setHtmlContentAllowed(true); relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance() .post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)))); toolbarLayout.addComponent(relatedLeads); Button relatedActivities = new Button(); relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>"); relatedActivities.setHtmlContentAllowed(true); relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post( new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)))); toolbarLayout.addComponent(relatedActivities); return toolbarLayout; }
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();/*w w w . j a v a 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.activity.ActivityRelatedItemListComp.java
License:Open Source License
private void initUI() { if (allowCreateNew) { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); final MButton newTaskBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.NEW), clickEvent -> fireNewRelatedItem("task")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_TASK)); buttonLayout.addComponent(newTaskBtn); final MButton newCallBtn = new MButton(UserUIContext.getMessage(CallI18nEnum.NEW), clickEvent -> fireNewRelatedItem("call")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_CALL)); buttonLayout.addComponent(newCallBtn); final MButton newMeetingBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), clickEvent -> fireNewRelatedItem("meeting")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_MEETING)); buttonLayout.addComponent(newMeetingBtn); this.addComponent(buttonLayout); this.addStyleName("activity-realated-content"); }//from w w w. j av a 2s. com tableItem = new ActivityTableDisplay(Arrays.asList( new TableViewField(ActivityI18nEnum.FORM_SUBJECT, "subject", WebUIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_STATUS, "status", WebUIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_START_DATE, "startDate", WebUIConstants.TABLE_DATE_TIME_WIDTH), new TableViewField(GenericI18Enum.FORM_END_DATE, "endDate", WebUIConstants.TABLE_DATE_TIME_WIDTH))); this.addComponent(tableItem); }
From source file:com.mycollab.vaadin.web.ui.StyleCalendarExp.java
License:Open Source License
public StyleCalendarExp() { this.setWidth("230px"); this.setHeightUndefined(); this.setSpacing(false); this.setStyleName("stylecalendar-ext"); this.setMargin(new MarginInfo(true, false, false, false)); styleCalendar.setRenderHeader(false); styleCalendar.setRenderWeekNumbers(false); styleCalendar.setImmediate(true);/*from ww w . ja va2 s.c o m*/ styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_next.png"))); btnShowNextYear.setStyleName(WebThemes.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_next.png"))); btnShowNextMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_pre.png"))); btnShowPreviousMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_pre.png"))); btnShowPreviousYear.setStyleName(WebThemes.BUTTON_LINK); lbSelectedDate.setValue(UserUIContext.formatDate(new Date())); lbSelectedDate.addStyleName("calendarDateLabel"); lbSelectedDate.setWidth("80"); HorizontalLayout layoutControl = new HorizontalLayout(); layoutControl.setStyleName("calendarHeader"); layoutControl.setWidth("100%"); layoutControl.setHeight("35px"); HorizontalLayout layoutButtonPrevious = new HorizontalLayout(); layoutButtonPrevious.setSpacing(true); layoutButtonPrevious.addComponent(btnShowPreviousYear); layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT); layoutButtonPrevious.addComponent(btnShowPreviousMonth); layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT); layoutControl.addComponent(layoutButtonPrevious); layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT); layoutControl.addComponent(lbSelectedDate); layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER); MHorizontalLayout layoutButtonNext = new MHorizontalLayout(); layoutButtonNext.addComponent(btnShowNextMonth); layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT); layoutButtonNext.addComponent(btnShowNextYear); layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT); layoutControl.addComponent(layoutButtonNext); layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT); this.addComponent(layoutControl); this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER); this.addComponent(styleCalendar); this.setExpandRatio(styleCalendar, 1.0f); }
From source file:com.mycompany.project.views.ContactsView.java
public ContactsView() { VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);// w ww . j av a2 s.c o m mainVLayout.setSpacing(true); setContent(mainVLayout); // view header Label header = new Label("<div align=\"center\" style=\"font-size:12pt;\">Contactos</div>"); header.setContentMode(ContentMode.HTML); mainVLayout.addComponent(header); // set window properties window.setWidth("400px"); window.setCaption("Nuevo Contacto"); window.setModal(true); window.setContent(newContactForm); // add new cotact button Button btnNew = new Button("Agregar Nuevo Contacto"); mainVLayout.addComponent(btnNew); // clicking the button should display the NewContactForm btnNew.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (window.getParent() == null) { getUI().addWindow(window); } } }); //add a horozontal layout - left has a table, right has a ContactDetail component HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setSpacing(true); mainVLayout.addComponent(hLayout); //add a table table.setWidth("600px"); table.setImmediate(true); hLayout.addComponent(table); // how does table get its data beanContainer.setBeanIdProperty("id"); table.setContainerDataSource(beanContainer); //set columns final Object[] NATURAL_COL_ORDER = new Object[] { "name", "phone", "email" }; final String[] COL_HEADERS_ENGLISH = new String[] { "Name", "Phone", "Email" }; table.setSelectable(true); table.setColumnCollapsingAllowed(true); table.setRowHeaderMode(RowHeaderMode.INDEX); table.setVisibleColumns(NATURAL_COL_ORDER); table.setColumnHeaders(COL_HEADERS_ENGLISH); // selecting a table row should enable/disale the ContactDetails component table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String contactId = (String) table.getValue(); contactDetails.setContactId(contactId); } }); //add a ContactDetails component // contactDetails.setWidth("500px"); hLayout.addComponent(contactDetails); // let the table fill the entire remaining width hLayout.setExpandRatio(contactDetails, 1); }
From source file:com.mycompany.project.views.GroupsView.java
public GroupsView() { VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);//from www . ja va 2s . co m mainVLayout.setSpacing(true); setContent(mainVLayout); // view header Label header = new Label("<div align=\"center\" style=\"font-size:12pt;\">Grupos</div>"); header.setContentMode(ContentMode.HTML); mainVLayout.addComponent(header); // set window properties window.setWidth("400px"); window.setCaption("New Group"); window.setModal(true); window.setContent(newGroupForm); // add new cotact button Button btnNew = new Button("Add New Group"); mainVLayout.addComponent(btnNew); // clicking the button should display the NewContactForm btnNew.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (window.getParent() == null) { getUI().addWindow(window); } } }); //add a horozontal layout - left has a table, right has a ContactDetail component HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setSpacing(true); mainVLayout.addComponent(hLayout); //add a table table.setWidth("600px"); table.setImmediate(true); hLayout.addComponent(table); // how does table get its data beanContainer.setBeanIdProperty("id"); table.setContainerDataSource(beanContainer); //set columns final Object[] NATURAL_COL_ORDER = new Object[] { "name" }; final String[] COL_HEADERS_ENGLISH = new String[] { "Name" }; table.setSelectable(true); table.setColumnCollapsingAllowed(true); table.setRowHeaderMode(RowHeaderMode.INDEX); table.setVisibleColumns(NATURAL_COL_ORDER); table.setColumnHeaders(COL_HEADERS_ENGLISH); // selecting a table row should enable/disale the ContactDetails component table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String groupId = (String) table.getValue(); groupDetails.setGroupId(groupId); } }); //add a ContactDetails component // contactDetails.setWidth("500px"); hLayout.addComponent(groupDetails); // let the table fill the entire remaining width hLayout.setExpandRatio(groupDetails, 1); }
From source file:com.naoset.framework.frontend.view.window.DialogWindow.java
public void setFooterButtons(DialogButton... buttons) { footer.removeAllComponents();/*from ww w. j a v a2 s. co m*/ HorizontalLayout innerLayout = new HorizontalLayout(); innerLayout.setSpacing(true); footer.addComponent(innerLayout); footer.setComponentAlignment(innerLayout, Alignment.TOP_RIGHT); for (DialogButton button : buttons) { Button btn = new Button(); if (button.equals(DialogButton.OK)) { btn.setCaption("OK"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonOKClicked(); } }); okButton = btn; } if (button.equals(DialogButton.CANCEL)) { btn.setCaption("CANCEL"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonCancelClicked(); } }); cancelButton = btn; } if (button.equals(DialogButton.YES)) { btn.setCaption("YES"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonYesClicked(); } }); yesButton = btn; } if (button.equals(DialogButton.NO)) { btn.setCaption("NO"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonNoClicked(); } }); noButton = btn; } if (button.equals(DialogButton.CLOSE)) { btn.setCaption("CLOSE"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonCloseClicked(); } }); closeButton = btn; } innerLayout.addComponent(btn); } }