List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
From source file:org.casbah.ui.MainCAView.java
License:Open Source License
public void init() throws CAProviderException { final X509Certificate caCert = provider.getCACertificate(); Panel panel = new Panel("CA Details"); VerticalLayout mainLayout = new VerticalLayout(); panel.setContent(mainLayout); mainLayout.setSizeFull();//from w ww.j a v a2 s .c o m VerticalLayout caInfo = new VerticalLayout(); TextField name = new TextField("Distinguished Name"); String nameValue = caCert.getSubjectX500Principal().getName(); name.setValue(nameValue); name.setColumns(50); name.setReadOnly(true); TextField issuer = new TextField("Issuer"); issuer.setColumns(50); issuer.setValue(caCert.getIssuerX500Principal().getName()); issuer.setReadOnly(true); DateField expDate = new DateField("Expiration Date"); expDate.setResolution(DateField.RESOLUTION_SEC); expDate.setValue(caCert.getNotAfter()); expDate.setReadOnly(true); TextField serial = new TextField("Serial"); serial.setValue(caCert.getSerialNumber().toString(16)); serial.setReadOnly(true); caInfo.addComponent(name); caInfo.addComponent(issuer); caInfo.addComponent(expDate); caInfo.addComponent(serial); caInfo.setSizeFull(); HorizontalLayout caButtons = new HorizontalLayout(); caButtons.addComponent(new Button("View Certificate", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { showEncodedCertificate(caCert, caCert.getSerialNumber().toString(16)); } catch (CAProviderException e) { e.printStackTrace(); } } })); caButtons.addComponent(new Button("Download Certificate", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { downloadEncodedCertificate(caCert, caCert.getSerialNumber().toString(16)); } catch (CAProviderException e) { e.printStackTrace(); } } })); caButtons.addComponent(new Button("Sign a CSR", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { uploadAndSignCsr(); } catch (CAProviderException pe) { pe.printStackTrace(); } } })); caButtons.addComponent(new Button("Get CRL", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { downloadCrlList(provider.getLatestCrl(false)); } catch (CAProviderException pe) { logger.log(Level.SEVERE, "Could not retrieve CRL", pe); getWindow().showNotification("An error occurred while retrieving the CRL", Notification.TYPE_ERROR_MESSAGE); } } })); panel.addComponent(caInfo); panel.addComponent(caButtons); panel.setSizeFull(); setSizeFull(); setCompositionRoot(panel); }
From source file:org.dressdiscover.gui.components.RightsLayout.java
public RightsLayout(final String entity, final RightsSetBean model) { int rightsRowCount = 0; for (final RightsBean rights_ : model.getElements()) { rightsRowCount++;//from w w w . j a v a2 s. c o m if (rights_.getRightsHolder() != null) { rightsRowCount++; } } if (rightsRowCount == 0) { empty = true; return; } final Table table = new Table(); table.addContainerProperty("caption", String.class, null); table.addContainerProperty("text", String.class, null); table.setCellStyleGenerator(new CellStyleGenerator() { @Override public String getStyle(final Table source, final Object itemId, final Object propertyId) { return propertyId != null ? "rights-" + propertyId.toString() : null; } }); // rootTable.addGeneratedColumn("text", new ColumnGenerator() { // @Override // public Object generateCell(final Table source, final Object itemId, // final Object columnId) { // final Object value = // source.getItem(itemId).getItemProperty(columnId).getValue(); // if (value == null) { // return null; // } // return value; // } // }); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setPageLength(rightsRowCount); table.setStyleName("rights-table"); boolean empty = true; for (final RightsBean rights_ : model.getElements()) { String typeCaption; String typeText; switch (rights_.getType()) { case COPYRIGHTED: typeCaption = "Copyright"; typeText = rights_.getText().trim(); break; case LICENSED: typeCaption = "License"; // if (rights_.getLicenseVocabRef() != null && // rights_.getLicenseVocabRef().getUri() instanceof Url) { // typeText = new Link(rights_.getText().trim(), // new // ExternalResource(rights_.getLicenseVocabRef().getUri().toString())); // } else { typeText = rights_.getText().trim(); // } break; case OTHER: continue; case PUBLIC_DOMAIN: typeCaption = "License"; typeText = "public domain"; break; case UNDETERMINED: continue; default: throw new UnsupportedOperationException(); } table.addItem(new Object[] { typeCaption, typeText }, null); empty = false; if (rights_.getRightsHolder() != null) { table.addItem(new Object[] { "Rights holder", rights_.getRightsHolder() }, null); } } this.empty = empty; if (empty) { return; } final Panel panel = new Panel(); panel.setCaption(entity + " rights"); panel.setContent(table); setCompositionRoot(panel); addStyleName("rights-layout"); }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableLayout.java
License:Open Source License
private void buildLayout() { setSizeFull();//from ww w . j av a 2s .c o m setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout tableHeaderLayout = new VerticalLayout(); tableHeaderLayout.setSizeFull(); tableHeaderLayout.setSpacing(false); tableHeaderLayout.setMargin(false); tableHeaderLayout.setStyleName("table-layout"); tableHeaderLayout.addComponent(tableHeader); tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER); if (isShortCutKeysRequired()) { final Panel tablePanel = new Panel(); tablePanel.setStyleName("table-panel"); tablePanel.setHeight(100.0F, Unit.PERCENTAGE); tablePanel.setContent(table); tablePanel.addActionHandler(getShortCutKeysHandler(i18n)); tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS); tableHeaderLayout.addComponent(tablePanel); tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(tablePanel, 1.0F); } else { tableHeaderLayout.addComponent(table); tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(table, 1.0F); } addComponent(tableHeaderLayout); addComponent(detailsLayout); setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER); setComponentAlignment(detailsLayout, Alignment.TOP_CENTER); setExpandRatio(tableHeaderLayout, 1.0F); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.AuthenticationConfigurationView.java
License:Open Source License
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull();//from w w w .ja v a 2s . co m 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); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.DefaultDistributionSetTypeLayout.java
License:Open Source License
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement, final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n, final SpPermissionChecker permChecker) { this.systemManagement = systemManagement; combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag"); changeIcon = new Label(); if (!permChecker.hasReadRepositoryPermission()) { return;/*from w ww . j a va 2s .com*/ } 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.defaultdistributionset.title")); header.addStyleName("config-panel-header"); vlayout.addComponent(header); final DistributionSetType currentDistributionSetType = getCurrentDistributionSetType(); currentDefaultDisSetType = currentDistributionSetType.getId(); final HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true); hlayout.setImmediate(true); final Label configurationLabel = new LabelBuilder() .name(i18n.getMessage("configuration.defaultdistributionset.select.label")).buildLabel(); hlayout.addComponent(configurationLabel); final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement .findAll(PageRequest.of(0, 100)); combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX); combobox.setNullSelectionAllowed(false); for (final DistributionSetType distributionSetType : distributionSetTypeCollection) { combobox.addItem(distributionSetType.getId()); combobox.setItemCaption(distributionSetType.getId(), distributionSetType.getKey() + " (" + distributionSetType.getName() + ")"); if (distributionSetType.getId().equals(currentDistributionSetType.getId())) { combobox.select(distributionSetType.getId()); } } combobox.setImmediate(true); combobox.addValueChangeListener(event -> selectDistributionSetValue()); hlayout.addComponent(combobox); changeIcon.setIcon(FontAwesome.CHECK); hlayout.addComponent(changeIcon); changeIcon.setVisible(false); vlayout.addComponent(hlayout); rootPanel.setContent(vlayout); setCompositionRoot(rootPanel); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.PollingConfigurationView.java
License:Open Source License
PollingConfigurationView(final VaadinMessageSource i18n, final ControllerPollProperties controllerPollProperties, final TenantConfigurationManagement tenantConfigurationManagement) { this.tenantConfigurationManagement = tenantConfigurationManagement; final Duration minDuration = DurationHelper .formattedStringToDuration(controllerPollProperties.getMinPollingTime()); final Duration maxDuration = DurationHelper .formattedStringToDuration(controllerPollProperties.getMaxPollingTime()); final Duration globalPollTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class)); final Duration globalOverdueTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class)); final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement .getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class); if (!pollTimeConfValue.isGlobal()) { tenantPollTime = DurationHelper.formattedStringToDuration(pollTimeConfValue.getValue()); }/*from w ww. j a v a 2s .c o m*/ final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement .getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class); if (!overdueTimeConfValue.isGlobal()) { tenantOverdueTime = DurationHelper.formattedStringToDuration(overdueTimeConfValue.getValue()); } final Panel rootPanel = new Panel(); rootPanel.setSizeFull(); rootPanel.addStyleName("config-panel"); final VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(true); final Label headerDisSetType = new Label(i18n.getMessage("configuration.polling.title")); headerDisSetType.addStyleName("config-panel-header"); vLayout.addComponent(headerDisSetType); fieldPollTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_POLLING) .caption(i18n.getMessage("configuration.polling.time")) .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")) .range(minDuration, maxDuration).globalDuration(globalPollTime).tenantDuration(tenantPollTime) .build(); fieldPollTime.addChangeListener(this); vLayout.addComponent(fieldPollTime); fieldPollingOverdueTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_OVERDUE) .caption(i18n.getMessage("configuration.polling.overduetime")) .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")) .range(minDuration, maxDuration).globalDuration(globalOverdueTime).tenantDuration(tenantOverdueTime) .build(); fieldPollingOverdueTime.addChangeListener(this); vLayout.addComponent(fieldPollingOverdueTime); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.RepositoryConfigurationView.java
License:Open Source License
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull();// w w w . ja va 2 s . co m 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(2, 2); gridLayout.setSpacing(true); gridLayout.setImmediate(true); gridLayout.setColumnExpandRatio(1, 1.0F); gridLayout.setSizeFull(); actionAutocloseCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, ""); actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX); actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled()); actionAutocloseCheckBox.addValueChangeListener(this); actionAutocloseConfigurationItem.addChangeListener(this); gridLayout.addComponent(actionAutocloseCheckBox, 0, 0); gridLayout.addComponent(actionAutocloseConfigurationItem, 1, 0); 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, 1); gridLayout.addComponent(actionAutocleanupConfigurationItem, 1, 1); vLayout.addComponent(gridLayout); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.RolloutConfigurationView.java
License:Open Source License
private void init() { final Panel rootPanel = new Panel(); rootPanel.setSizeFull();/* w w w . j ava 2 s. c o m*/ 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 HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSpacing(true); hLayout.setImmediate(true); approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, ""); approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX); approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled()); approvalCheckbox.addValueChangeListener(this); approvalConfigurationItem.addChangeListener(this); hLayout.addComponent(approvalCheckbox); hLayout.addComponent(approvalConfigurationItem); final Link linkToApprovalHelp = SPUIComponentProvider.getHelpLink(i18n, uiProperties.getLinks().getDocumentation().getRollout()); hLayout.addComponent(linkToApprovalHelp); hLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT); vLayout.addComponent(hLayout); rootPanel.setContent(vLayout); setCompositionRoot(rootPanel); }
From source file:org.eclipse.hawkbit.ui.tenantconfiguration.TenantConfigurationDashboardView.java
License:Open Source License
/** * Init method adds all Configuration Views to the list of Views. *//*from w w w. ja v a 2 s .co m*/ @PostConstruct public void init() { if (defaultDistributionSetTypeLayout.getComponentCount() > 0) { configurationViews.add(defaultDistributionSetTypeLayout); } configurationViews.add(repositoryConfigurationView); configurationViews.add(rolloutConfigurationView); configurationViews.add(authenticationConfigurationView); configurationViews.add(pollingConfigurationView); if (customConfigurationViews != null) { configurationViews.addAll(customConfigurationViews.stream().filter(ConfigurationGroup::show) .collect(Collectors.toList())); } final Panel rootPanel = new Panel(); rootPanel.setStyleName("tenantconfig-root"); final VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); rootLayout.setMargin(true); rootLayout.setSpacing(true); configurationViews.forEach(rootLayout::addComponent); final HorizontalLayout buttonContent = saveConfigurationButtonsLayout(); rootLayout.addComponent(buttonContent); rootLayout.setComponentAlignment(buttonContent, Alignment.BOTTOM_LEFT); rootPanel.setContent(rootLayout); setCompositionRoot(rootPanel); configurationViews.forEach(view -> view.addChangeListener(this)); }
From source file:org.escidoc.browser.controller.ContentModelView.java
License:Open Source License
private Panel buildMetaViewsPanel() { // common part: create layout Panel metaViewsPanel = new Panel(); metaViewsPanel.setImmediate(false);//from w ww .ja va 2s . c o m metaViewsPanel.setWidth("100.0%"); metaViewsPanel.setHeight("100.0%"); metaViewsPanel.setStyleName(Runo.PANEL_LIGHT); // hlMetaViews HorizontalLayout hlMetaViews = buildHlMetaViews(); metaViewsPanel.setContent(hlMetaViews); return metaViewsPanel; }