Java Code Examples for com.vaadin.ui.GridLayout#addComponent()
The following examples show how to use
com.vaadin.ui.GridLayout#addComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddUpdateRolloutWindowLayout.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private GridLayout createSimpleGroupDefinitionTab() { final GridLayout layout = new GridLayout(); layout.setSpacing(true); layout.setColumns(3); layout.setRows(4); layout.setStyleName("marginTop"); layout.addComponent(getLabel("caption.rollout.generate.groups"), 0, 0, 2, 0); layout.addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 1); layout.addComponent(noOfGroups, 1, 1); noOfGroups.addValidator(nullValidator); layout.addComponent(groupSizeLabel, 2, 1); layout.addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 2); layout.addComponent(triggerThreshold, 1, 2); triggerThreshold.addValidator(nullValidator); layout.addComponent(getPercentHintLabel(), 2, 2); layout.addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 3); layout.addComponent(errorThreshold, 1, 3); errorThreshold.addValidator(nullValidator); layout.addComponent(errorThresholdOptionGroup, 2, 3); return layout; }
Example 2
Source File: UploadArtifactView.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private GridLayout createMainLayout() { createDetailsAndUploadLayout(); mainLayout = new GridLayout(3, 1); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setStyleName("fullSize"); mainLayout.addComponent(filterByTypeLayout, 0, 0); mainLayout.addComponent(smTableLayout, 1, 0); mainLayout.addComponent(detailAndUploadLayout, 2, 0); mainLayout.setRowExpandRatio(0, 1.0F); mainLayout.setColumnExpandRatio(1, 0.5F); mainLayout.setColumnExpandRatio(2, 0.5F); return mainLayout; }
Example 3
Source File: AgentForm.java From doecode with BSD 3-Clause "New" or "Revised" License | 5 votes |
public AgentForm(RepositoryForm form) { this.parent = form; setSizeUndefined(); GridLayout formContainer = new GridLayout(2,5); formContainer.setSpacing(true); agentTypeCode.addItems(Agent.agentTypes); agentTypeSpecific.addItems(Agent.specificTypes); Validator phoneValidator = new RegexpValidator("^((\\d{3}-|\\(\\d{3}\\)\\s?)?\\d{3}-|^\\d{3}(\\.)?\\d{3}\\3)\\d{4}$", "Please enter a valid phone number."); phoneNumber.addValidator(phoneValidator); formContainer.addComponent(firstName); formContainer.addComponent(lastName); formContainer.addComponent(agentTypeCode,0,1); formContainer.addComponent(agentTypeSpecific,1,1); formContainer.addComponent(email,0,2); formContainer.addComponent(affiliation,1,2); formContainer.addComponent(orcid,0,3); formContainer.addComponent(phoneNumber,1,3); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponents(save, delete); save.setStyleName(ValoTheme.BUTTON_FRIENDLY); delete.setStyleName(ValoTheme.BUTTON_DANGER); save.setEnabled(false); delete.setEnabled(false); save.addClickListener(e->this.save()); delete.addClickListener(e->this.delete()); formContainer.addComponent(buttons, 0,4,1,4); addComponent(formContainer); }
Example 4
Source File: RolloutConfigurationView.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull(); rootPanel.addStyleName("config-panel"); final VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(true); vLayout.setSizeFull(); final Label header = new Label(i18n.getMessage("configuration.rollout.title")); header.addStyleName("config-panel-header"); vLayout.addComponent(header); final GridLayout gridLayout = new GridLayout(3, 1); gridLayout.setSpacing(true); gridLayout.setImmediate(true); gridLayout.setColumnExpandRatio(1, 1.0F); gridLayout.setSizeFull(); approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, ""); approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX); approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled()); approvalCheckbox.addValueChangeListener(this); approvalConfigurationItem.addChangeListener(this); gridLayout.addComponent(approvalCheckbox, 0, 0); gridLayout.addComponent(approvalConfigurationItem, 1, 0); final Link linkToApprovalHelp = SPUIComponentProvider.getHelpLink(i18n, uiProperties.getLinks().getDocumentation().getRollout()); gridLayout.addComponent(linkToApprovalHelp, 2, 0); gridLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT); vLayout.addComponent(gridLayout); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
Example 5
Source File: DefineGroupsLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * Adds this group row to a grid layout * * @param layout * the grid layout * @param rowIndex * the row of the grid layout */ public void addToGridRow(final GridLayout layout, final int rowIndex) { layout.addComponent(groupName, 0, rowIndex); if (populated) { layout.addComponent(targetFilterQuery, 1, rowIndex); } else { layout.addComponent(targetFilterQueryCombo, 1, rowIndex); } layout.addComponent(targetPercentage, 2, rowIndex); layout.addComponent(triggerThreshold, 3, rowIndex); layout.addComponent(errorThreshold, 4, rowIndex); layout.addComponent(optionsLayout, 5, rowIndex); }
Example 6
Source File: AbstractTagLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
protected void buildLayout() { mainLayout = new GridLayout(3, 2); mainLayout.setSpacing(true); colorPickerLayout = new ColorPickerLayout(); ColorPickerHelper.setRgbSliderValues(colorPickerLayout); contentLayout = new VerticalLayout(); colorLabelLayout = new HorizontalLayout(); colorLabelLayout.setMargin(false); colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn); formLayout.addComponent(tagName); formLayout.addComponent(tagDesc); formLayout.setSizeFull(); contentLayout.addComponent(formLayout); contentLayout.addComponent(colorLabelLayout); contentLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(colorLabelLayout, Alignment.MIDDLE_LEFT); contentLayout.setSizeUndefined(); mainLayout.setSizeFull(); mainLayout.addComponent(contentLayout, 0, 0); colorPickerLayout.setVisible(false); mainLayout.addComponent(colorPickerLayout, 1, 0); mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(mainLayout); tagName.focus(); }
Example 7
Source File: DistributionsView.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void createMainLayout() { mainLayout = new GridLayout(4, 1); mainLayout.setSizeFull(); mainLayout.setSpacing(true); mainLayout.setStyleName("fullSize"); mainLayout.addComponent(filterByDSTypeLayout, 0, 0); mainLayout.addComponent(distributionTableLayout, 1, 0); mainLayout.addComponent(softwareModuleTableLayout, 2, 0); mainLayout.addComponent(filterBySMTypeLayout, 3, 0); mainLayout.setRowExpandRatio(0, 1.0F); mainLayout.setColumnExpandRatio(1, 0.5F); mainLayout.setColumnExpandRatio(2, 0.5F); }
Example 8
Source File: StorageAdminPanel.java From sensorhub with Mozilla Public License 2.0 | 5 votes |
protected void buildDataPanel(GridLayout form, IRecordStorageModule<?> storage) { // measurement outputs int i = 1; if (storage.isEnabled()) { for (IRecordStoreInfo dsInfo: storage.getRecordStores().values()) { Panel panel = newPanel("Stream #" + i++); GridLayout panelLayout = ((GridLayout)panel.getContent()); panelLayout.setSpacing(true); // stored time period double[] timeRange = storage.getRecordsTimeRange(dsInfo.getName()); Label l = new Label("<b>Time Range:</b> " + new DateTimeFormat().formatIso(timeRange[0], 0) + " / " + new DateTimeFormat().formatIso(timeRange[1], 0)); l.setContentMode(ContentMode.HTML); panelLayout.addComponent(l, 0, 0, 1, 0); // time line panelLayout.addComponent(buildGantt(storage, dsInfo), 0, 1, 1, 1); // data structure DataComponent dataStruct = dsInfo.getRecordDescription(); Component sweForm = new SWECommonForm(dataStruct); panelLayout.addComponent(sweForm); // data table panelLayout.addComponent(buildTable(storage, dsInfo)); if (oldPanel != null) form.replaceComponent(oldPanel, panel); else form.addComponent(panel); oldPanel = panel; } } }
Example 9
Source File: DateInfoComp.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public void displayEntryDateTime(ValuedBean bean) { this.removeAllComponents(); this.withMargin(false); Label dateInfoHeader = ELabel.html(VaadinIcons.CALENDAR.getHtml() + " " + UserUIContext.getMessage(ProjectCommonI18nEnum.SUB_INFO_DATES)).withStyleName("info-hdr"); this.addComponent(dateInfoHeader); GridLayout layout = new GridLayout(2, 2); layout.setSpacing(true); layout.setWidth("100%"); layout.setMargin(new MarginInfo(false, false, false, true)); layout.setColumnExpandRatio(1, 1.0f); try { LocalDateTime createdDate = (LocalDateTime) PropertyUtils.getProperty(bean, "createdtime"); layout.addComponent(new ELabel(UserUIContext.getMessage(ProjectCommonI18nEnum.ITEM_CREATED_DATE)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth(), 0, 0); layout.addComponent(new ELabel(UserUIContext.formatPrettyTime(createdDate)).withDescription(UserUIContext.formatDateTime(createdDate)), 1, 0); LocalDateTime updatedDate = (LocalDateTime) PropertyUtils.getProperty(bean, "lastupdatedtime"); layout.addComponent(new ELabel(UserUIContext.getMessage(ProjectCommonI18nEnum.ITEM_UPDATED_DATE)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth(), 0, 1); layout.addComponent(new ELabel(UserUIContext.formatPrettyTime(updatedDate)).withDescription(UserUIContext.formatDateTime(updatedDate)), 1, 1); this.addComponent(layout); } catch (Exception e) { LOG.error("Get date is failed {}", BeanUtility.printBeanObj(bean)); } }
Example 10
Source File: UserBulkInviteViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public void display() { removeAllComponents(); ELabel titleLbl = ELabel.h2(UserUIContext.getMessage(UserI18nEnum.BULK_INVITE)); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), (Button.ClickListener) clickEvent -> { EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null)); }).withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), (Button.ClickListener) clickEvent -> { sendInviteBulkUsers(); }).withStyleName(WebThemes.BUTTON_ACTION); this.with(new MHorizontalLayout(titleLbl, cancelBtn, saveBtn).withExpand(titleLbl, 1.0f).withFullWidth()); roleComboBox = new RoleComboBox(); roleComboBox.addValueChangeListener((HasValue.ValueChangeListener<SimpleRole>) valueChangeEvent -> { displayRolePermission(valueChangeEvent.getSource().getValue()); }); this.with(new MHorizontalLayout(ELabel.html(UserUIContext.getMessage(RoleI18nEnum.SINGLE)).withStyleName(WebThemes.META_COLOR), roleComboBox).alignAll(Alignment.TOP_LEFT)); ResponsiveLayout mainLayout = new ResponsiveLayout().withStyleName(WebThemes.MARGIN_TOP); ResponsiveRow mainRow = mainLayout.addRow(); bulkInviteUsersLayout = new GridLayout(3, 1); bulkInviteUsersLayout.setSpacing(true); ResponsiveColumn column1 = new ResponsiveColumn(12, 12, 6, 6).withComponent(bulkInviteUsersLayout); ResponsiveColumn column2 = new ResponsiveColumn(12, 12, 6, 6).withVisibilityRules(false, false, true, true) .withComponent(rolePermissionDisplayLayout); mainRow.addColumn(column1); mainRow.addColumn(column2); bulkInviteUsersLayout.addComponent(ELabel.h3(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL)).withWidth("220px"), 0, 0); bulkInviteUsersLayout.addComponent(ELabel.h3(UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD)), 1, 0); this.with(mainLayout); displayRolePermission(roleComboBox.getValue()); buildInviteUserBlock(); }
Example 11
Source File: AuthenticationConfigurationView.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull(); rootPanel.addStyleName("config-panel"); final VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(true); vLayout.setSizeFull(); final Label header = new Label(i18n.getMessage("configuration.authentication.title")); header.addStyleName("config-panel-header"); vLayout.addComponent(header); final GridLayout gridLayout = new GridLayout(3, 4); gridLayout.setSpacing(true); gridLayout.setImmediate(true); gridLayout.setSizeFull(); gridLayout.setColumnExpandRatio(1, 1.0F); certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled()); certificateAuthCheckbox.addValueChangeListener(this); certificateAuthenticationConfigurationItem.addChangeListener(this); gridLayout.addComponent(certificateAuthCheckbox, 0, 0); gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0); targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); targetSecTokenCheckBox.addValueChangeListener(this); targetSecurityTokenAuthenticationConfigurationItem.addChangeListener(this); gridLayout.addComponent(targetSecTokenCheckBox, 0, 1); gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1); gatewaySecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox"); gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); gatewaySecTokenCheckBox.addValueChangeListener(this); gatewaySecurityTokenAuthenticationConfigurationItem.addChangeListener(this); gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2); gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2); downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); downloadAnonymousCheckBox.setId(UIComponentIdProvider.DOWNLOAD_ANONYMOUS_CHECKBOX); downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled()); downloadAnonymousCheckBox.addValueChangeListener(this); anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this); gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3); gridLayout.addComponent(anonymousDownloadAuthenticationConfigurationItem, 1, 3); final Link linkToSecurityHelp = SPUIComponentProvider.getHelpLink(i18n, uiProperties.getLinks().getDocumentation().getSecurity()); gridLayout.addComponent(linkToSecurityHelp, 2, 3); gridLayout.setComponentAlignment(linkToSecurityHelp, Alignment.BOTTOM_RIGHT); vLayout.addComponent(gridLayout); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
Example 12
Source File: RepositoryConfigurationView.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull(); rootPanel.addStyleName("config-panel"); final VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(true); vLayout.setSizeFull(); final Label header = new Label(i18n.getMessage("configuration.repository.title")); header.addStyleName("config-panel-header"); vLayout.addComponent(header); final GridLayout gridLayout = new GridLayout(3, 3); gridLayout.setSpacing(true); gridLayout.setImmediate(true); gridLayout.setColumnExpandRatio(1, 1.0F); gridLayout.setSizeFull(); final boolean isMultiAssignmentsEnabled = multiAssignmentsConfigurationItem.isConfigEnabled(); actionAutocloseCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX); actionAutocloseCheckBox.setEnabled(!isMultiAssignmentsEnabled); actionAutocloseConfigurationItem.setEnabled(!isMultiAssignmentsEnabled); actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled()); actionAutocloseCheckBox.addValueChangeListener(this); actionAutocloseConfigurationItem.addChangeListener(this); gridLayout.addComponent(actionAutocloseCheckBox, 0, 0); gridLayout.addComponent(actionAutocloseConfigurationItem, 1, 0); multiAssignmentsCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); multiAssignmentsCheckBox.setId(UIComponentIdProvider.REPOSITORY_MULTI_ASSIGNMENTS_CHECKBOX); multiAssignmentsCheckBox.setValue(multiAssignmentsConfigurationItem.isConfigEnabled()); multiAssignmentsCheckBox.addValueChangeListener(this); multiAssignmentsCheckBox.setEnabled(!isMultiAssignmentsEnabled); multiAssignmentsConfigurationItem.setEnabled(!isMultiAssignmentsEnabled); multiAssignmentsConfigurationItem.addChangeListener(this); gridLayout.addComponent(multiAssignmentsCheckBox, 0, 1); gridLayout.addComponent(multiAssignmentsConfigurationItem, 1, 1); actionAutocleanupCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); actionAutocleanupCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLEANUP_CHECKBOX); actionAutocleanupCheckBox.setValue(actionAutocleanupConfigurationItem.isConfigEnabled()); actionAutocleanupCheckBox.addValueChangeListener(this); actionAutocleanupConfigurationItem.addChangeListener(this); gridLayout.addComponent(actionAutocleanupCheckBox, 0, 2); gridLayout.addComponent(actionAutocleanupConfigurationItem, 1, 2); final Link linkToProvisioningHelp = SPUIComponentProvider.getHelpLink(i18n, uiProperties.getLinks().getDocumentation().getProvisioningStateMachine()); gridLayout.addComponent(linkToProvisioningHelp, 2, 2); gridLayout.setComponentAlignment(linkToProvisioningHelp, Alignment.BOTTOM_RIGHT); vLayout.addComponent(gridLayout); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
Example 13
Source File: StorageAdminPanel.java From sensorhub with Mozilla Public License 2.0 | 4 votes |
@Override public void build(final MyBeanItem<ModuleConfig> beanItem, final IRecordStorageModule<?> storage) { super.build(beanItem, storage); if (storage != null) { // section layout final GridLayout form = new GridLayout(); form.setWidth(100.0f, Unit.PERCENTAGE); form.setMargin(false); form.setSpacing(true); // section title form.addComponent(new Label("")); HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setSpacing(true); Label sectionLabel = new Label("Data Store Content"); sectionLabel.addStyleName(STYLE_H3); sectionLabel.addStyleName(STYLE_COLORED); titleBar.addComponent(sectionLabel); titleBar.setComponentAlignment(sectionLabel, Alignment.MIDDLE_LEFT); // refresh button to show latest record Button refreshButton = new Button("Refresh"); refreshButton.setDescription("Reload data from storage"); refreshButton.setIcon(REFRESH_ICON); refreshButton.addStyleName(STYLE_QUIET); titleBar.addComponent(refreshButton); titleBar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); refreshButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { buildDataPanel(form, storage); } }); form.addComponent(titleBar); // add I/O panel buildDataPanel(form, storage); addComponent(form); } }
Example 14
Source File: SensorAdminPanel.java From sensorhub with Mozilla Public License 2.0 | 4 votes |
@Override public void build(final MyBeanItem<ModuleConfig> beanItem, final ISensorModule<?> module) { super.build(beanItem, module); // add section label final GridLayout form = new GridLayout(); form.setWidth(100.0f, Unit.PERCENTAGE); form.setMargin(false); form.setSpacing(true); // section title form.addComponent(new Label("")); HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setSpacing(true); Label sectionLabel = new Label("Inputs/Outputs"); sectionLabel.addStyleName(STYLE_H3); sectionLabel.addStyleName(STYLE_COLORED); titleBar.addComponent(sectionLabel); titleBar.setComponentAlignment(sectionLabel, Alignment.MIDDLE_LEFT); // refresh button to show latest record Button refreshButton = new Button("Refresh"); refreshButton.setDescription("Load latest data from sensor"); refreshButton.setIcon(REFRESH_ICON); refreshButton.addStyleName(STYLE_QUIET); titleBar.addComponent(refreshButton); titleBar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); refreshButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { rebuildSwePanels(form, module); } }); form.addComponent(titleBar); // add I/O panel rebuildSwePanels(form, module); addComponent(form); }