private Button customFilterDistributionSetButton(final Long itemId) { final Item row1 = getItem(itemId); final ProxyDistribution distSet = (ProxyDistribution) row1.getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET).getValue(); final String buttonId = "distSetButton"; Button updateIcon; if (distSet == null) { updateIcon = SPUIComponentProvider.getButton( buttonId, i18n.get("button.no.auto.assignment"), i18n.get("button.auto.assignment.desc"), null, false, null, SPUIButtonStyleSmallNoBorder.class); } else { updateIcon = SPUIComponentProvider.getButton( buttonId, distSet.getNameVersion(), i18n.get("button.auto.assignment.desc"), null, false, null, SPUIButtonStyleSmallNoBorder.class); } updateIcon.addClickListener(this::onClickOfDistributionSetButton); updateIcon.setData(row1); updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link"); return updateIcon; }
private void onDelete(final ClickEvent event) { /* Display the confirmation */ final ConfirmationDialog confirmDialog = new ConfirmationDialog( i18n.get("caption.filter.delete.confirmbox"), i18n.get("message.delete.filter.confirm"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> { if (ok) { final Long rowId = (Long) ((Button) event.getComponent()).getData(); final String deletedFilterName = targetFilterQueryManagement.findTargetFilterQueryById(rowId).getName(); targetFilterQueryManagement.deleteTargetFilterQuery(rowId); /* * Refresh the custom filter table to show latest change * of the deleted custom filter. */ notification.displaySuccess( i18n.get("message.delete.filter.success", new Object[] {deletedFilterName})); refreshContainer(); } }); UI.getCurrent().addWindow(confirmDialog.getWindow()); confirmDialog.getWindow().bringToFront(); }
/** * Display message. * * @param distId as dist ID */ private void displayCountLabel(final Long distId) { final Long targetsWithAssigedDsCount = targetManagement.countTargetByAssignedDistributionSet(distId); final Long targetsWithInstalledDsCount = targetManagement.countTargetByInstalledDistributionSet(distId); final StringBuilder message = new StringBuilder(i18n.get("label.target.count")); message.append("<span class=\"assigned-count-message\">"); message.append(i18n.get("label.assigned.count", new Object[] {targetsWithAssigedDsCount})); message.append("</span>, <span class=\"installed-count-message\"> "); message.append(i18n.get("label.installed.count", new Object[] {targetsWithInstalledDsCount})); message.append("</span>"); setValue(message.toString()); }
private void displayTargetCountStatus() { final TargetTableFilters targFilParams = managementUIState.getTargetTableFilters(); final StringBuilder message = getTotalTargetMessage(); if (targFilParams.hasFilter()) { message.append(HawkbitCommonUtil.SP_STRING_PIPE); message.append(i18n.get("label.filter.targets")); if (managementUIState.getTargetsTruncated() != null) { message.append(targetTable.size() + managementUIState.getTargetsTruncated()); } else { message.append(targetTable.size()); } message.append(HawkbitCommonUtil.SP_STRING_PIPE); final String status = i18n.get("label.filter.status"); final String overdue = i18n.get("label.filter.overdue"); final String tags = i18n.get("label.filter.tags"); final String text = i18n.get("label.filter.text"); final String dists = i18n.get("label.filter.dist"); final String custom = i18n.get("label.filter.custom"); final StringBuilder filterMesgBuf = new StringBuilder(i18n.get("label.filter")); filterMesgBuf.append(HawkbitCommonUtil.SP_STRING_SPACE); filterMesgBuf.append(getStatusMsg(targFilParams.getClickedStatusTargetTags(), status)); filterMesgBuf.append(getOverdueStateMsg(targFilParams.isOverdueFilterEnabled(), overdue)); filterMesgBuf.append( getTagsMsg(targFilParams.isNoTagSelected(), targFilParams.getClickedTargetTags(), tags)); filterMesgBuf.append( targFilParams .getSearchText() .map(search -> text) .orElse(HawkbitCommonUtil.SP_STRING_SPACE)); filterMesgBuf.append( targFilParams .getDistributionSet() .map(set -> dists) .orElse(HawkbitCommonUtil.SP_STRING_SPACE)); filterMesgBuf.append( targFilParams .getTargetFilterQuery() .map(query -> custom) .orElse(HawkbitCommonUtil.SP_STRING_SPACE)); final String filterMesageChk = filterMesgBuf.toString().trim(); String filterMesage = filterMesageChk; if (filterMesage.endsWith(",")) { filterMesage = filterMesageChk.substring(0, filterMesageChk.length() - 1); } message.append(filterMesage); } if ((targetTable.size() + Optional.fromNullable(managementUIState.getTargetsTruncated()).or(0L)) > SPUIDefinitions.MAX_TABLE_ENTRIES) { message.append(HawkbitCommonUtil.SP_STRING_PIPE); message.append(i18n.get("label.filter.shown")); message.append(SPUIDefinitions.MAX_TABLE_ENTRIES); } setCaption(message.toString()); }
private void createConfirmDialog() { confirmDialog = new ConfirmationDialog( i18n.get("caption.confirm.abort.action"), i18n.get("message.abort.upload"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> { if (ok) { eventBus.publish(this, UploadStatusEventType.ABORT_UPLOAD); uploadAborted = true; errorOccured = true; minimizeButton.setEnabled(false); closeButton.setEnabled(false); } }); }
private void setGridColumnProperties() { grid.getColumn(STATUS).setRenderer(new StatusRenderer()); grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer()); grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, SPUILabelDefinitions.NAME_VERSION, REASON); setColumnWidth(); grid.getColumn(SPUILabelDefinitions.NAME_VERSION) .setHeaderCaption(i18n.get("upload.swModuleTable.header")); grid.setFrozenColumnCount(5); }
private void saveConfiguration() { defaultDistributionSetTypeLayout.save(); authenticationConfigurationView.save(); // More methods saveConfigurationBtn.setEnabled(false); undoConfigurationBtn.setEnabled(false); uINotification.displaySuccess(i18n.get("notification.configuration.save")); }
private StringBuilder getTotalTargetMessage() { if (managementUIState.getTargetsTruncated() != null) { // set the icon setIcon(FontAwesome.INFO_CIRCLE); setDescription( i18n.get( "label.target.filter.truncated", managementUIState.getTargetsTruncated(), SPUIDefinitions.MAX_TABLE_ENTRIES)); } else { setIcon(null); setDescription(null); } final StringBuilder message = new StringBuilder(i18n.get("label.target.filter.count")); message.append(managementUIState.getTargetsCountAll()); return message; }
/* * (non-Javadoc) * * @see * com.vaadin.ui.TabSheet.SelectedTabChangeListener#selectedTabChange(com * .vaadin.ui.TabSheet.SelectedTabChangeEvent) */ @Override public void selectedTabChange(final SelectedTabChangeEvent event) { if (i18n.get("caption.filter.simple").equals(getSelectedTab().getCaption())) { managementUIState.setCustomFilterSelected(false); eventBus.publish(this, ManagementUIEvent.RESET_TARGET_FILTER_QUERY); } else { managementUIState.setCustomFilterSelected(true); eventBus.publish(this, ManagementUIEvent.RESET_SIMPLE_FILTERS); } }
private void init() { final Label label = new Label(i18n.get("label.auto.assign.description")); checkBox = new CheckBox(i18n.get("label.auto.assign.enable")); checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID); checkBox.setImmediate(true); checkBox.addValueChangeListener(this); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.addComponent(label); verticalLayout.addComponent(checkBox); verticalLayout.addComponent(dsTable); window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW) .caption(i18n.get("caption.select.auto.assign.dist")) .content(verticalLayout) .layout(verticalLayout) .i18n(i18n) .saveDialogCloseListener(this) .buildCommonDialogWindow(); window.setId(UIComponentIdProvider.DIST_SET_SELECT_WINDOW_ID); }
private HorizontalLayout saveConfigurationButtonsLayout() { final HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true); saveConfigurationBtn = SPUIComponentProvider.getButton( SPUIComponetIdProvider.SYSTEM_CONFIGURATION_SAVE, "", "", "", true, FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class); saveConfigurationBtn.setEnabled(false); saveConfigurationBtn.setDescription(i18n.get("configuration.savebutton.tooltip")); saveConfigurationBtn.addClickListener(event -> saveConfiguration()); hlayout.addComponent(saveConfigurationBtn); undoConfigurationBtn = SPUIComponentProvider.getButton( SPUIComponetIdProvider.SYSTEM_CONFIGURATION_CANCEL, "", "", "", true, FontAwesome.UNDO, SPUIButtonStyleSmallNoBorder.class); undoConfigurationBtn.setEnabled(false); undoConfigurationBtn.setDescription(i18n.get("configuration.cancellbutton.tooltip")); undoConfigurationBtn.addClickListener(event -> undoConfiguration()); hlayout.addComponent(undoConfigurationBtn); final Link linkToSystemConfigHelp = DocumentationPageLink.SYSTEM_CONFIGURATION_VIEW.getLink(); hlayout.addComponent(linkToSystemConfigHelp); return hlayout; }
private void createMandatoryLabel() { if (!shouldMandatoryLabelShown()) { return; } final Label mandatoryLabel = new Label(i18n.get("label.mandatory.field")); mandatoryLabel.addStyleName( SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_TINY); if (content instanceof TargetAddUpdateWindowLayout) { ((TargetAddUpdateWindowLayout) content).getFormLayout().addComponent(mandatoryLabel); } else if (content instanceof SoftwareModuleAddUpdateWindow) { ((SoftwareModuleAddUpdateWindow) content).getFormLayout().addComponent(mandatoryLabel); } else if (content instanceof AbstractCreateUpdateTagLayout) { ((AbstractCreateUpdateTagLayout) content).getMainLayout().addComponent(mandatoryLabel); } mainLayout.addComponent(mandatoryLabel); }
private Component getSimpleFilterTab() { simpleFilterTab = new VerticalLayout(); final VerticalLayout targetTagTableLayout = new VerticalLayout(); targetTagTableLayout.setSizeFull(); if (null != config) { targetTagTableLayout.addComponent(config); targetTagTableLayout.setComponentAlignment(config, Alignment.TOP_RIGHT); } targetTagTableLayout.addComponent(filterByButtons); targetTagTableLayout.setComponentAlignment(filterByButtons, Alignment.MIDDLE_CENTER); targetTagTableLayout.setId(UIComponentIdProvider.TARGET_TAG_DROP_AREA_ID); targetTagTableLayout.setExpandRatio(filterByButtons, 1.0F); simpleFilterTab.setCaption(i18n.get("caption.filter.simple")); simpleFilterTab.addComponent(targetTagTableLayout); simpleFilterTab.setExpandRatio(targetTagTableLayout, 1.0F); simpleFilterTab.addComponent(filterByStatusFotter); simpleFilterTab.setComponentAlignment(filterByStatusFotter, Alignment.MIDDLE_CENTER); simpleFilterTab.setSizeFull(); simpleFilterTab.addStyleName(SPUIStyleDefinitions.SIMPLE_FILTER_HEADER); return simpleFilterTab; }
private List<TableColumn> getVisbleColumns() { final List<TableColumn> columnList = new ArrayList<>(7); columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.2F)); columnList.add( new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.1F)); columnList.add( new TableColumn( SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.2F)); columnList.add( new TableColumn(SPUILabelDefinitions.VAR_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F)); columnList.add( new TableColumn( SPUILabelDefinitions.VAR_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.2F)); columnList.add( new TableColumn( SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET, i18n.get("header.auto.assignment.ds"), 0.1F)); columnList.add( new TableColumn(SPUIDefinitions.CUSTOM_FILTER_DELETE, i18n.get("header.delete"), 0.1F)); return columnList; }
private Component getComplexFilterTab() { targetFilterQueryButtonsTab.setCaption(i18n.get("caption.filter.custom")); return targetFilterQueryButtonsTab; }