List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption, boolean initialState)
From source file:com.hybridbpm.ui.component.dashboard.tab.TabConfigurationLayout.java
License:Apache License
public TabConfigurationLayout(TabDefinition tab, ViewDefinition viewDefinition) { Design.read(this); this.tabDefinition = tab; if (this.tabDefinition != null) { this.tabDefinition = HybridbpmUI.getDashboardAPI().getTabDefinitionById(this.tabDefinition.getId()); permissions = HybridbpmUI.getDashboardAPI().getTabPermissions(this.tabDefinition.getId().toString()); } else {/*from w w w .j av a 2 s . c om*/ Integer o = HybridbpmUI.getDashboardAPI().getNextTabOrder(viewDefinition.getId().toString()); this.tabDefinition = TabDefinition.createDefaultVertical(); this.tabDefinition.setViewId(viewDefinition); this.tabDefinition.setOrder(o); permissions = HybridbpmUI.getDashboardAPI().getDefaultPermissions(); } this.tabDefinition.setViewId(viewDefinition); for (FontAwesome fontAwesome : FontAwesome.values()) { Item item = iconComboBox.addItem(fontAwesome.name()); iconComboBox.setItemIcon(fontAwesome.name(), fontAwesome); iconComboBox.setItemCaption(fontAwesome.name(), fontAwesome.name()); } iconComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT); for (TabDefinition.LAYOUT_TYPE layout : TabDefinition.LAYOUT_TYPE.values()) { layoutOptionGroup.addItem(layout); } binder.setItemDataSource(this.tabDefinition); binder.bind(titleTextField, "title"); binder.bind(iconComboBox, "icon"); binder.bind(layoutOptionGroup, "layout"); binder.setBuffered(true); accessTable.addContainerProperty("role", String.class, null, "Role", null, Table.Align.LEFT); accessTable.addContainerProperty("canView", CheckBox.class, null, "Can view", null, Table.Align.CENTER); accessTable.setColumnWidth("canView", 100); accessTable.setVisibleColumns("role", "canView"); for (Role role : HybridbpmUI.getAccessAPI().getAllRoles()) { Item item = accessTable.addItem(role); item.getItemProperty("role").setValue(role.getName()); CheckBox checkBox = new CheckBox(null, containsPermission(role)); checkBox.setEnabled(!Objects.equals(role.getName(), Role.ADMINISTRATOR)); item.getItemProperty("canView").setValue(checkBox); } }
From source file:com.hybridbpm.ui.component.dashboard.ViewConfigurationLayout.java
License:Apache License
public ViewConfigurationLayout(ViewDefinition viewDefinition) { Design.read(this); this.viewDefinition = viewDefinition; if (this.viewDefinition != null) { this.viewDefinition = HybridbpmUI.getDashboardAPI().getViewDefinitionById(viewDefinition.getId()); permissions = HybridbpmUI.getDashboardAPI().getViewPermissions(this.viewDefinition.getId().toString()); } else {/*w ww . ja va 2 s. c o m*/ Integer o = HybridbpmUI.getDashboardAPI().getNextViewOrder(); this.viewDefinition = new ViewDefinition(o, "view" + o, "View " + o, FontAwesome.HTML5.name()); permissions = HybridbpmUI.getDashboardAPI().getDefaultPermissions(); } for (FontAwesome fontAwesome : FontAwesome.values()) { Item item = iconComboBox.addItem(fontAwesome.name()); iconComboBox.setItemIcon(fontAwesome.name(), fontAwesome); iconComboBox.setItemCaption(fontAwesome.name(), fontAwesome.name()); } iconComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT); binder.setItemDataSource(this.viewDefinition); binder.bind(urlTextField, "url"); binder.bind(titleTextField, "title"); binder.bind(iconComboBox, "icon"); binder.setBuffered(true); accessTable.addContainerProperty("role", String.class, null, "Role", null, Table.Align.LEFT); accessTable.addContainerProperty("canView", CheckBox.class, null, "Can view", null, Table.Align.CENTER); accessTable.setColumnWidth("canView", 100); accessTable.setVisibleColumns("role", "canView"); for (Role role : HybridbpmUI.getAccessAPI().getAllRoles()) { Item item = accessTable.addItem(role); item.getItemProperty("role").setValue(role.getName()); CheckBox checkBox = new CheckBox(null, containsPermission(role)); checkBox.setEnabled(!Objects.equals(role.getName(), Role.ADMINISTRATOR)); item.getItemProperty("canView").setValue(checkBox); } }
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();/*from w w w. jav a 2 s . co m*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }
From source file:com.mycollab.mobile.module.user.view.LoginViewImpl.java
License:Open Source License
private void initUI() { MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Image mainLogo = new Image(null, AccountAssetsResolver.createLogoResource(MyCollabUI.getBillingAccount().getLogopath(), 150)); contentLayout.addComponent(mainLogo); CssLayout welcomeTextWrapper = new CssLayout(); ELabel welcomeText = new ELabel( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.BUTTON_LOG_IN)) .withStyleName("h1"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeText); final EmailField emailField = new EmailField(); new Dom(emailField).setAttribute("placeholder", LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), GenericI18Enum.FORM_EMAIL)); emailField.setWidth("100%"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); new Dom(pwdField).setAttribute("placeholder", LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.FORM_PASSWORD)); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.OPT_REMEMBER_PASSWORD), true);//w ww. j a v a 2s. com rememberPassword.setWidth("100%"); contentLayout.addComponent(rememberPassword); MButton signInBtn = new MButton( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.BUTTON_LOG_IN), clickEvent -> { try { LoginViewImpl.this.fireEvent(new ViewEvent<>(LoginViewImpl.this, new UserEvent.PlainLogin( emailField.getValue(), pwdField.getValue(), rememberPassword.getValue()))); } catch (Exception e) { throw new MyCollabException(e); } }).withStyleName(MobileUIConstants.BUTTON_ACTION); contentLayout.addComponent(signInBtn); this.addComponent(contentLayout); }
From source file:com.mycollab.module.project.ui.components.ProjectSubscribersComp.java
License:Open Source License
@Override protected Component initContent() { ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class); List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, MyCollabUI.getAccountId());/*from w ww .j a va2 s .c o m*/ CssLayout container = new CssLayout(); container.setStyleName("followers-container"); final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll); selectAllCheckbox.addValueChangeListener(valueChangeEvent -> { boolean val = selectAllCheckbox.getValue(); for (FollowerCheckbox followerCheckbox : memberSelections) { followerCheckbox.setValue(val); } }); container.addComponent(selectAllCheckbox); for (SimpleUser user : members) { final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user); memberCheckbox.addValueChangeListener(valueChangeEvent -> { if (!memberCheckbox.getValue()) { selectAllCheckbox.setValue(false); } }); if (defaultSelectAll || selectedUsers.contains(user.getUsername())) { memberCheckbox.setValue(true); } memberSelections.add(memberCheckbox); container.addComponent(memberCheckbox); } return container; }
From source file:com.mycollab.module.project.view.milestone.MilestoneRoadmapViewImpl.java
License:Open Source License
@Override protected void displayView() { initUI();/*from w ww .j a va 2s .co m*/ baseCriteria = new MilestoneSearchCriteria(); baseCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); baseCriteria.setOrderFields(Arrays.asList(new SearchCriteria.OrderField("startdate", SearchCriteria.DESC), new SearchCriteria.OrderField("enddate", SearchCriteria.DESC))); displayMilestones(); closeMilestoneSelection = new CheckBox("", true); inProgressMilestoneSelection = new CheckBox("", true); futureMilestoneSelection = new CheckBox("", true); closeMilestoneSelection.addValueChangeListener( valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue())); inProgressMilestoneSelection.addValueChangeListener( valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue())); futureMilestoneSelection.addValueChangeListener( valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue())); futureMilestoneSelection.setIcon(FontAwesome.CLOCK_O); filterPanel.with(closeMilestoneSelection, inProgressMilestoneSelection, futureMilestoneSelection); displayWidget(); }
From source file:com.mycollab.shell.view.SetupNewInstanceView.java
License:Open Source License
SetupNewInstanceView() { this.setDefaultComponentAlignment(Alignment.TOP_CENTER); MHorizontalLayout content = new MHorizontalLayout().withFullHeight(); this.with(content); content.with(new MHorizontalLayout( ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO)) .withStyleName(WebThemes.META_COLOR)).withMargin(true).withWidth("400px") .withStyleName("separator")); MVerticalLayout formLayout = new MVerticalLayout().withWidth("600px"); content.with(formLayout).withAlign(formLayout, Alignment.TOP_LEFT); formLayout.with(ELabel.h2("Last step, you are almost there!").withWidthUndefined()); formLayout.with(ELabel.h3("All fields are required *").withStyleName("overdue").withWidthUndefined()); GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(2, 8, "200px"); formLayoutHelper.getLayout().setWidth("600px"); final TextField adminField = formLayoutHelper.addComponent(new TextField(), "Admin email", 0, 0); final PasswordField passwordField = formLayoutHelper.addComponent(new PasswordField(), "Admin password", 0, 1);// w w w .ja va 2s. co m final PasswordField retypePasswordField = formLayoutHelper.addComponent(new PasswordField(), "Retype Admin password", 0, 2); final DateFormatField dateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 3); final DateFormatField shortDateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_SHORT_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4); final DateFormatField longDateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_LONG_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5); final TimeZoneSelectionField timeZoneSelectionField = formLayoutHelper.addComponent( new TimeZoneSelectionField(false), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 6); timeZoneSelectionField.setValue(TimeZone.getDefault().getID()); final LanguageSelectionField languageBox = formLayoutHelper.addComponent(new LanguageSelectionField(), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7); languageBox.setValue(Locale.US.toLanguageTag()); formLayout.with(formLayoutHelper.getLayout()); CheckBox createSampleDataSelection = new CheckBox("Create sample data", true); MButton installBtn = new MButton("Setup", clickEvent -> { String adminName = adminField.getValue(); String password = passwordField.getValue(); String retypePassword = retypePasswordField.getValue(); if (!StringUtils.isValidEmail(adminName)) { NotificationUtil.showErrorNotification("Invalid email value"); return; } if (!password.equals(retypePassword)) { NotificationUtil.showErrorNotification("Password is not match"); return; } String dateFormat = dateFormatField.getValue(); String shortDateFormat = shortDateFormatField.getValue(); String longDateFormat = longDateFormatField.getValue(); if (!isValidDayPattern(dateFormat) || !isValidDayPattern(shortDateFormat) || !isValidDayPattern(longDateFormat)) { NotificationUtil.showErrorNotification("Invalid date format"); return; } String language = languageBox.getValue(); String timezoneDbId = timeZoneSelectionField.getValue(); BillingAccountMapper billingAccountMapper = AppContextUtil.getSpringBean(BillingAccountMapper.class); BillingAccountExample ex = new BillingAccountExample(); ex.createCriteria().andIdEqualTo(MyCollabUI.getAccountId()); List<BillingAccount> billingAccounts = billingAccountMapper.selectByExample(ex); BillingAccount billingAccount = billingAccounts.get(0); billingAccount.setDefaultlanguagetag(language); billingAccount.setDefaultyymmddformat(dateFormat); billingAccount.setDefaultmmddformat(shortDateFormat); billingAccount.setDefaulthumandateformat(longDateFormat); billingAccount.setDefaulttimezone(timezoneDbId); billingAccountMapper.updateByPrimaryKey(billingAccount); BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.class); billingAccountService.createDefaultAccountData(adminName, password, timezoneDbId, language, true, createSampleDataSelection.getValue(), MyCollabUI.getAccountId()); ((DesktopApplication) UI.getCurrent()).doLogin(adminName, password, false); }).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout buttonControls = new MHorizontalLayout(createSampleDataSelection, installBtn) .alignAll(Alignment.MIDDLE_RIGHT); formLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.peter.vaadin.components.vaadin.chart.timeline.Monitor.java
public Monitor() { // Create the container ds = new IndexedContainer(); // Add the required property ids, we use the default ones here ds.addContainerProperty(Timeline.PropertyId.TIMESTAMP, Date.class, null); ds.addContainerProperty(Timeline.PropertyId.VALUE, Float.class, 0f); // Create a timeline to display data timeline = new Timeline("Monitor"); timeline.setImmediate(true);//w ww . j av a 2 s. c o m timeline.addGraphDataSource(ds); timeline.setSizeFull(); timeline.setBrowserSelectionLock(false); timeline.setVerticalAxisRange(0f, 110f); timeline.setZoomLevelsVisible(false); timeline.setDateSelectVisible(false); timeline.setGraphOutlineThickness(4); timeline.setGraphFillColor(ds, new SolidColor(0, 30, 220, 128)); timeline.setGraphOutlineColor(ds, SolidColor.RED); addComponent(timeline); HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true); addComponent(controls); ProgressIndicator pi = new ProgressIndicator(); pi.setIndeterminate(true); pi.setPollingInterval(1000); pi.setHeight("0px"); pi.setWidth("0px"); controls.addComponent(pi); final Button start = new Button("Start updates", new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { updateTimer.cancel(); } catch (Exception e) { } updateTimer = new Timer(); updateTimer.scheduleAtFixedRate(new TimerTask() { public void run() { updateDataContainer(); } }, new Date(), 1000L); } }); controls.addComponent(start); Button stop = new Button("Stop updates", new Button.ClickListener() { public void buttonClick(ClickEvent event) { updateTimer.cancel(); } }); controls.addComponent(stop); CheckBox lock = new CheckBox("Selection lock", false); lock.setImmediate(true); lock.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { timeline.setBrowserSelectionLock((Boolean) event.getProperty().getValue()); } }); controls.addComponent(lock); setExpandRatio(timeline, 1); }
From source file:com.peter.vaadin.components.vaadin.chart.timeline.MyTimelineDemo.java
public MyTimelineDemo() { timeline = new Timeline("My graph"); timeline.setSizeFull();/*w w w. j a va2 s .c o m*/ timeline.setVerticalAxisRange(-1f, 2f); timeline.setZoomLevelsVisible(false); timeline.setDateSelectVisible(false); // Create the data sources firstDataSource = createGraphDataSource(); datasourcesList.add(firstDataSource); final Container.Indexed markerDataSource = createMarkerDataSource(); final Container.Indexed eventDataSource = createEventDataSource(); // Add our data sources timeline.addGraphDataSource(firstDataSource, Timeline.PropertyId.TIMESTAMP, Timeline.PropertyId.VALUE); // Markers and events timeline.setMarkerDataSource(markerDataSource, Timeline.PropertyId.TIMESTAMP, Timeline.PropertyId.CAPTION, Timeline.PropertyId.VALUE); timeline.setEventDataSource(eventDataSource, Timeline.PropertyId.TIMESTAMP, Timeline.PropertyId.CAPTION); // Set the caption of the graph timeline.setGraphLegend(firstDataSource, "Our cool graph"); // Set the color of the graph timeline.setGraphOutlineColor(firstDataSource, SolidColor.RED); // Set the fill color of the graph timeline.setGraphFillColor(firstDataSource, new SolidColor(255, 0, 0, 128)); // Set the width of the graph timeline.setGraphOutlineThickness(1); // Set the color of the browser graph timeline.setBrowserOutlineColor(firstDataSource, SolidColor.BLACK); // Set the fill color of the graph timeline.setBrowserFillColor(firstDataSource, new SolidColor(0, 0, 0, 128)); // Add some zoom levels timeline.addZoomLevel("Day", 86400000L); timeline.addZoomLevel("Week", 7 * 86400000L); timeline.addZoomLevel("Month", 2629743830L); // Listen to click events from events timeline.addListener(new Timeline.EventClickListener() { @Override public void eventClick(EventButtonClickEvent event) { Item item = eventDataSource.getItem(event.getItemIds().iterator().next()); Date sunday = (Date) item.getItemProperty(Timeline.PropertyId.TIMESTAMP).getValue(); SimpleDateFormat formatter = new SimpleDateFormat("EEE, MMM d, ''yy"); Notification.show(formatter.format(sunday)); } }); addComponent(timeline); HorizontalLayout addDateForm = new HorizontalLayout(); final DateField dateField = new DateField(); dateField.setImmediate(true); addDateForm.addComponent(dateField); final TextField valueField = new TextField(); valueField.setImmediate(true); addDateForm.addComponent(valueField); Button addBtn = new Button("Add", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { java.util.Date d = dateField.getValue(); Date date = new Date(d.getTime()); float value = Float.valueOf(valueField.getValue().toString()); // Create a point in time Item item = firstDataSource.addItem(date.getTime()); if (item == null) { item = firstDataSource.getItem(date.getTime()); } // Set the timestamp property item.getItemProperty(Timeline.PropertyId.TIMESTAMP).setValue(date); // Set the value property item.getItemProperty(Timeline.PropertyId.VALUE).setValue(value); } }); addDateForm.addComponent(addBtn); addComponent(addDateForm); Button addGraphDataSource = new Button("Add graph data source", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Container.Indexed ds = createGraphDataSource(); datasourcesList.add(ds); timeline.addGraphDataSource(ds); timeline.setGraphFillColor(ds, SolidColor.BLACK); } }); addComponent(addGraphDataSource); Button removeGraphDataSource = new Button("Remove graph data source", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (datasourcesList.size() > 1) { Container.Indexed ds = datasourcesList.get(datasourcesList.size() - 1); timeline.removeGraphDataSource(ds); datasourcesList.remove(ds); } } }); addComponent(removeGraphDataSource); CheckBox stacked = new CheckBox("Stacked graphs", false); stacked.setImmediate(true); stacked.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { timeline.setGraphStacking((Boolean) event.getProperty().getValue()); } }); addComponent(stacked); CheckBox lock = new CheckBox("Selection lock", true); lock.setImmediate(true); lock.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { timeline.setBrowserSelectionLock((Boolean) event.getProperty().getValue()); } }); addComponent(lock); setExpandRatio(timeline, 1); }
From source file:com.rex.components.valo.Tables.java
License:Apache License
static void configure(Table table, Grid grid, boolean footer, boolean sized, boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true);/*from www . j a v a 2 s . co m*/ table.setMultiSelect(true); grid.setSelectionMode(SelectionMode.MULTI); table.setSortEnabled(true); for (Column c : grid.getColumns()) { if (!c.getPropertyId().equals("icon")) { c.setSortable(true); } c.setHidable(true); } table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); grid.setColumnReorderingAllowed(true); table.setPageLength(6); grid.setHeightByRows(6); table.addActionHandler(ReportEngineUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); table.setColumnAlignment(ReportEngineUI.DESCRIPTION_PROPERTY, Align.RIGHT); table.setColumnAlignment(ReportEngineUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.removeGeneratedColumn("textfield"); table.removeContainerProperty("button"); table.removeGeneratedColumn("button"); table.removeContainerProperty("label"); table.removeGeneratedColumn("label"); table.removeContainerProperty("checkbox"); table.removeGeneratedColumn("checkbox"); table.removeContainerProperty("datefield"); table.removeGeneratedColumn("datefield"); table.removeContainerProperty("combobox"); table.removeGeneratedColumn("combobox"); table.removeContainerProperty("optiongroup"); table.removeGeneratedColumn("optiongroup"); table.removeContainerProperty("slider"); table.removeGeneratedColumn("slider"); table.removeContainerProperty("progress"); table.removeGeneratedColumn("progress"); if (componentsInRows) { table.addContainerProperty("textfield", TextField.class, null); table.addGeneratedColumn("textfield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here"); // tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("datefield", TextField.class, null); table.addGeneratedColumn("datefield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("combobox", TextField.class, null); table.addGeneratedColumn("combobox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("button", Button.class, null); table.addGeneratedColumn("button", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); b.addStyleName("small"); return b; } }); table.addContainerProperty("label", TextField.class, null); table.addGeneratedColumn("label", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); label.addStyleName("bold"); return label; } }); table.addContainerProperty("checkbox", TextField.class, null); table.addGeneratedColumn("checkbox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(null, true); return cb; } }); table.addContainerProperty("optiongroup", TextField.class, null); table.addGeneratedColumn("optiongroup", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); op.addStyleName("horizontal"); return op; } }); table.addContainerProperty("slider", TextField.class, null); table.addGeneratedColumn("slider", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Slider s = new Slider(); s.setValue(30.0); return s; } }); table.addContainerProperty("progress", TextField.class, null); table.addGeneratedColumn("progress", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ProgressBar bar = new ProgressBar(); bar.setValue(0.7f); return bar; } }); } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ReportEngineUI.CAPTION_PROPERTY, "caption"); table.setColumnFooter(ReportEngineUI.DESCRIPTION_PROPERTY, "description"); table.setColumnFooter(ReportEngineUI.ICON_PROPERTY, "icon"); table.setColumnFooter(ReportEngineUI.INDEX_PROPERTY, "index"); } if (sized) { table.setWidth("400px"); grid.setWidth("400px"); table.setHeight("300px"); grid.setHeight("300px"); } else { table.setSizeUndefined(); grid.setSizeUndefined(); } if (componentsInRows) { table.setWidth("100%"); } else { table.setWidth(null); } if (expandRatios) { if (!sized) { table.setWidth("100%"); } } table.setColumnExpandRatio(ReportEngineUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); table.setColumnExpandRatio(ReportEngineUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { table.addStyleName("no-stripes"); } else { table.removeStyleName("no-stripes"); } if (!verticalLines) { table.addStyleName("no-vertical-lines"); } else { table.removeStyleName("no-vertical-lines"); } if (!horizontalLines) { table.addStyleName("no-horizontal-lines"); } else { table.removeStyleName("no-horizontal-lines"); } if (borderless) { table.addStyleName("borderless"); } else { table.removeStyleName("borderless"); } if (!headers) { table.addStyleName("no-header"); } else { table.removeStyleName("no-header"); } if (compact) { table.addStyleName("compact"); } else { table.removeStyleName("compact"); } if (small) { table.addStyleName("small"); } else { table.removeStyleName("small"); } if (!rowIndex && !rowCaption && rowIcon) { table.setRowHeaderMode(RowHeaderMode.HIDDEN); } if (rowIndex) { table.setRowHeaderMode(RowHeaderMode.INDEX); } if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); table.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); table.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } }