private Table createTable() { Table table = new Table(); table.setSizeFull(); table.setPageLength(0); table.setSelectable(false); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Value", String.class, null); // initializing email table with empty values table.addItem(new Object[] { "Outgoing Mail Server (SMTP): ", "" }, new Integer(1)); table.addItem(new Object[] { "Port: ", "" }, new Integer(2)); table.addItem(new Object[] { "Email Id: ", "" }, new Integer(3)); return table; }
@Override protected DropHandler getFilterButtonDropHandler() { return new DropHandler() { private static final long serialVersionUID = 1L; @Override public AcceptCriterion getAcceptCriterion() { return managementViewClientCriterion; } @Override public void drop(final DragAndDropEvent event) { if (validate(event) && isNoTagAssigned(event)) { final TableTransferable tbl = (TableTransferable) event.getTransferable(); final Table source = tbl.getSourceComponent(); if (source.getId().equals(UIComponentIdProvider.TARGET_TABLE_ID)) { UI.getCurrent().access(() -> processTargetDrop(event)); } } } }; }
@SuppressWarnings("unchecked") @Override public String getStyle(Table source, final Object itemId, final Object propertyId) { return requireDataSource().get(itemId).map(i -> { if (propertyId == null) { // row style if (!rowStyleGenerators.isEmpty()) { return generateRowStyle(i); } } else { // property (cell) style return generatePropertyStyle((P) propertyId, i); } return null; }).orElse(null); }
/** Ajoute une case a cocher a la place de O et N * @param property */ public void addBooleanColumn(String property, Boolean alignCenter){ addGeneratedColumn(property, new Table.ColumnGenerator() { /**serialVersionUID**/ private static final long serialVersionUID = -3483685206189347289L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { try { Object value = PropertyUtils.getProperty(itemId,(String)columnId); if (value instanceof Boolean){ return new IconLabel((Boolean)value,alignCenter); }else{ return value; } } catch (Exception e) { return null; } } }); }
@SuppressWarnings("serial") protected Panel getOptionTable() { this.optionTable = new Table(); this.optionTable.setPageLength(3); this.optionTable.setSizeFull(); this.optionTable.setImmediate(true); this.optionTable.addGeneratedColumn("Enabled", new CheckBoxGenerator()); this.optionTable.addContainerProperty("Name", String.class, null); this.optionTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { optionTableClicked(event); } }); this.optionPanel = new Panel(); this.optionPanel.addStyleName(StyleConstants.FORM_PANEL); this.optionPanel.setWidth(100, Sizeable.Unit.PERCENTAGE); this.optionPanel.setContent(this.optionTable); return this.optionPanel; }
private void colorizeValidUntilRows() { final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, this.CERT_MONTHLY_THRESHOLD); this.sslConfigTable.setCellStyleGenerator((Table.CellStyleGenerator) (table, itemId, propertyId) -> { if (propertyId != null) { return null; } Item item = this.sslConfigTable.getItem(itemId); Date validUntil = (Date) item.getItemProperty("Valid until").getValue(); if (validUntil.before(calendar.getTime())) { return "highlight-warning"; } else { return null; } }); }
private Table createNetworkTable() { Table table = new Table(); table.setSizeFull(); table.setPageLength(0); table.setSelectable(false); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Value", String.class, null); // initializing network table with empty values table.addItem(new Object[] { "IPv4 Address: ", "" }, new Integer(1)); table.addItem(new Object[] { "Netmask:", "" }, new Integer(2)); table.addItem(new Object[] { "Default Gateway: ", "" }, new Integer(3)); table.addItem(new Object[] { "Primary DNS Server: ", "" }, new Integer(4)); table.addItem(new Object[] { "Secondary DNS Server: ", "" }, new Integer(5)); return table; }
private Table createNATTable() { Table table = new Table(); table.setSizeFull(); table.setPageLength(0); table.setSelectable(false); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Value", String.class, null); // initializing network table with empty values table.addItem(new Object[] { "Public IPv4 Address: ", "" }, new Integer(1)); return table; }
private void addCommonTableItems(Table statusTable) { statusTable.setImmediate(true); statusTable.setStyleName(ValoTheme.TABLE_COMPACT); statusTable.addContainerProperty("Property", String.class, ""); statusTable.addContainerProperty("Value", String.class, ""); statusTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); statusTable.setPageLength(0); statusTable.setReadOnly(true); statusTable.addItem(new Object[] { "Name: ", "" }, new Integer(1)); statusTable.addItem(new Object[] { "Local IP: ", "" }, new Integer(2)); statusTable.addItem(new Object[] { "Public IP: ", "" }, new Integer(3)); statusTable.addItem(new Object[] { "V.Server: ", "" }, new Integer(4)); statusTable.addItem(new Object[] { "Manager IP: ", "" }, new Integer(5)); }
protected Panel getAttributesPanel() { this.sharedKey = new PasswordField(); this.sharedKey.setRequiredError("shared secret key cannot be empty"); this.sharedKey.setRequired(true); // best show/hide this conditionally based on Manager type. this.sharedKey.setValue("dummy1234"); this.attributes = new Table(); this.attributes.setPageLength(0); this.attributes.setSelectable(true); this.attributes.setSizeFull(); this.attributes.setImmediate(true); this.attributes.addContainerProperty("Attribute Name", String.class, null); this.attributes.addContainerProperty("Value", PasswordField.class, null); this.attributes.addItem(new Object[] { "Shared Secret key", this.sharedKey }, new Integer(1)); // creating panel to store attributes table this.attributePanel = new Panel("Common Appliance Configuration Attributes:"); this.attributePanel.addStyleName("form_Panel"); this.attributePanel.setWidth(100, Sizeable.Unit.PERCENTAGE); this.attributePanel.setContent(this.attributes); return this.attributePanel; }
public TableReporteConductores() { this.setSizeFull(); this.setSelectable(true); this.setMultiSelect(true); this.setImmediate(true); setColumnHeaderMode(Table.ColumnHeaderMode.EXPLICIT); addContainerProperty("nroConductor", String.class, null); setColumnHeader("nroConductor", "Nro Conductor"); setColumnAlignment("nroConductor", Table.Align.CENTER); setVisibleColumns(new Object[] { "nroConductor" }); setColumnReorderingAllowed(true); setColumnCollapsingAllowed(true); setHeight(40.0f, Unit.PERCENTAGE); }
@Override public void handleAction(final Action action, final Object sender, final Object target) { if (action == report) { createNewReportFromSelection(); } else if (action == discard) { Notification.show("Not implemented in this demo"); } else if (action == details) { Item item = ((Table) sender).getItem(target); if (item != null) { Long movieId = (Long) item.getItemProperty("movieId") .getValue(); MovieDetailsWindow.open(DashboardUI.getDataProvider() .getMovie(movieId), null, null); } } }
private void generateUi() { logger.debug("GenerateUi aufgerufen"); headerLabel = new Label("Direkte Eingabe der Cash-Flows (in EUR)"); gap = new Label(); inputTable = new Table(); expandingGap = new Label(); headerLabel.setStyleName("periodHeaderLabel"); gap.setHeight("15px"); inputTable.setWidth(100, UNITS_PERCENTAGE); inputTable.setStyleName("fcfTable"); inputTable.setPageLength(3); expandingGap.setHeight(100, UNITS_PERCENTAGE); addComponent(headerLabel); addComponent(gap); addComponent(inputTable); addComponent(expandingGap); setExpandRatio(expandingGap, 1.0f); }
public static Table.Align convertColumnAlignment(com.haulmont.cuba.gui.components.Table.ColumnAlignment alignment) { if (alignment == null) { return null; } switch (alignment) { case LEFT: return Table.Align.LEFT; case CENTER: return Table.Align.CENTER; case RIGHT: return Table.Align.RIGHT; default: throw new UnsupportedOperationException(); } }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(false); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // tableResolvers tableResolvers = new Table(); tableResolvers.setCaption("Resolvers"); tableResolvers.setImmediate(false); tableResolvers.setWidth("-1px"); tableResolvers.setHeight("-1px"); mainLayout.addComponent(tableResolvers); return mainLayout; }
@Override protected Table createList() { taskTable = new Table(); taskTable.addStyleName(ExplorerLayout.STYLE_TASK_LIST); taskTable.addStyleName(ExplorerLayout.STYLE_SCROLLABLE); // Listener to change right panel when clicked on a task taskTable.addListener(getListSelectionListener()); this.lazyLoadingQuery = createLazyLoadingQuery(); this.taskListContainer = new LazyLoadingContainer(lazyLoadingQuery, 10); taskTable.setContainerDataSource(taskListContainer); // Create column header taskTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.TASK_22)); taskTable.setColumnWidth("icon", 22); taskTable.addContainerProperty("name", String.class, null); taskTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); return taskTable; }
public void applyTo(Table t) { final Object[] saved; saved = t.getVisibleColumns(); if (saved.length != visibleColumns.length) return; try { t.setVisibleColumns(visibleColumns); } catch (IllegalArgumentException nothing) { t.setVisibleColumns(saved); return; } for (int i = 0; i < visibleColumns.length; i++) { t.setColumnWidth(visibleColumns[i], widths[i]); t.setColumnCollapsed(visibleColumns[i], collapsed[i]); } }
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(false); // top-level component properties setWidth("100.0%"); setHeight("-1px"); // horizontalLayoutToolbar horizontalLayoutToolbar = buildHorizontalLayoutToolbar(); mainLayout.addComponent(horizontalLayoutToolbar); // tableUsers tableUsers = new Table(); tableUsers.setImmediate(false); tableUsers.setWidth("100.0%"); tableUsers.setHeight("-1px"); mainLayout.addComponent(tableUsers); return mainLayout; }
protected void initAttachmentTable() { contentLayout = new VerticalLayout(); addComponent(contentLayout); table = new Table(); table.setWidth(100, UNITS_PERCENTAGE); table.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_LIST); // Invisible by default, only shown when attachments are present table.setVisible(false); table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); addContainerProperties(); // Get the related content for this task refreshTaskAttachments(); contentLayout.addComponent(table); }
protected void initGroupTable() { groupTable = new Table(); groupTable.setNullSelectionAllowed(false); groupTable.setSelectable(true); groupTable.setMultiSelect(true); groupTable.setSortDisabled(true); groupTable.setWidth(460, UNITS_PIXELS); groupTable.setHeight(275, UNITS_PIXELS); addComponent(groupTable); GroupSelectionQuery query = new GroupSelectionQuery(identityService, userId); LazyLoadingContainer container = new LazyLoadingContainer(query, 10); groupTable.setContainerDataSource(container); groupTable.addContainerProperty("id", String.class, null); groupTable.addContainerProperty("name", String.class, null); groupTable.addContainerProperty("type", String.class, null); }
@Override public void prepareTable() { iTable.setStyleName(ValoTheme.TABLE_BORDERLESS); iTable.addContainerProperty("id", String.class, null, "ID", null, Table.Align.LEFT); iTable.addContainerProperty("taskPriority", TaskModel.TASK_PRIORITY.class, null, "Priority", null, Table.Align.LEFT); iTable.addContainerProperty("taskType", TaskModel.TASK_TYPE.class, null, "Type", null, Table.Align.LEFT); iTable.addContainerProperty("taskUser", String.class, null, "Task user", null, Table.Align.LEFT); iTable.addContainerProperty("status", TaskModel.STATUS.class, null, "Status", null, Table.Align.LEFT); iTable.addContainerProperty("taskTitle", String.class, null, "Task", null, Table.Align.LEFT); iTable.setColumnExpandRatio("taskTitle", 1f); iTable.addGeneratedColumn("taskTitle", new OpenTaskColumnGenerator(this)); iTable.addContainerProperty("startDate", Date.class, null, "Start", null, Table.Align.LEFT); iTable.addContainerProperty("finishDate", Date.class, null, "Finish", null, Table.Align.LEFT); iTable.addContainerProperty("updateDate", Date.class, null, "Update", null, Table.Align.LEFT); iTable.setColumnWidth("updateDate", 150); iTable.setColumnWidth("finishDate", 150); iTable.setColumnWidth("startDate", 150); iTable.addGeneratedColumn("startDate", new DateColumnGenerator()); iTable.addGeneratedColumn("finishDate", new DateColumnGenerator()); iTable.addGeneratedColumn("updateDate", new DateColumnGenerator()); iTable.addGeneratedColumn("taskPriority", new PriorityColumnGenerator()); iTable.setColumnWidth("id", 80); iTable.setColumnWidth("taskPriority", 35); iTable.setVisibleColumns("id", "taskTitle", "taskUser", "startDate", "updateDate", "finishDate", "taskType", "status", "taskPriority"); }
@Override public Object generateCell(Table table, Object obj, Object colId) { // cast the params User user = (User) obj; String colName = colId.toString(); // create the button Button btn = new Button(); btn.addClickListener(new UserButtonClickListener(user.getUserId())); // update the caption if (FIELD_FULLNAME.equals(colName)) { btn.setCaption(user.getFullName()); } else if (FIELD_SCREENNAME.equals(colName)) { btn.setCaption(user.getScreenName()); } else if (FIELD_EMAILADDRESS.equals(colName)) { btn.setCaption(user.getEmailAddress()); } else { btn.setCaption(String.valueOf(user.getUserId())); } btn.setStyleName(Runo.BUTTON_LINK); return btn; }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { final Item jcrItem = getJcrItem(source, itemId); if (jcrItem != null && jcrItem.isNode()) { final Node node = (Node) jcrItem; try { if (NodeUtil.isNodeType(node, NodeTypes.ContentNode.NAME)) { // Get identifier from the items name propertyName: eg. sitePageMap final String pageId = PropertyUtil.getString(node, definition.getPropertyName(), StringUtils.EMPTY); // Find page in website and return page path if (StringUtils.isNotEmpty(pageId)) { final Node page = NodeUtil.getNodeByIdentifier(RepositoryConstants.WEBSITE, pageId); final String pagePath = page.getPath(); final StringBuilder nameBuilder = new StringBuilder(); nameBuilder.append(pagePath); return nameBuilder.toString().trim(); } } } catch (RepositoryException e) { log.warn("Unable to get name of contact for column", e); } } return StringUtils.EMPTY; }
/** * Apply style for status label in target table. * * @param targetTable * target table * @param pinBtn * pin button used for status display and pin on mouse over * @param itemId * id of the tabel row */ public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) { final Item item = targetTable.getItem(itemId); if (item != null) { final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue(); pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue"); if (updateStatus == TargetUpdateStatus.ERROR) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED); } else if (updateStatus == TargetUpdateStatus.UNKNOWN) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE); } else if (updateStatus == TargetUpdateStatus.IN_SYNC) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN); } else if (updateStatus == TargetUpdateStatus.PENDING) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW); } else if (updateStatus == TargetUpdateStatus.REGISTERED) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE); } } }
private void createComponents() { closeBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.UPLOAD_ARTIFACT_RESULT_CLOSE, SPUILabelDefinitions.CLOSE, SPUILabelDefinitions.CLOSE, ValoTheme.BUTTON_PRIMARY, false, null, SPUIButtonStyleTiny.class); closeBtn.addClickListener(this); uploadResultTable = new Table(); uploadResultTable.addStyleName("artifact-table"); uploadResultTable.setSizeFull(); uploadResultTable.setImmediate(true); uploadResultTable.setId(UIComponentIdProvider.UPLOAD_RESULT_TABLE); uploadResultTable.addStyleName(ValoTheme.TABLE_BORDERLESS); uploadResultTable.addStyleName(ValoTheme.TABLE_SMALL); uploadResultTable.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); uploadResultTable.addStyleName("accordion-tab-table-style"); populateUploadResultTable(); }
protected boolean isDropValid(final DragAndDropEvent dragEvent) { final Transferable transferable = dragEvent.getTransferable(); final Component compsource = transferable.getSourceComponent(); if (!hasDropPermission()) { notification.displayValidationError(i18n.getMessage("message.permission.insufficient")); return false; } if (compsource instanceof Table) { return validateTable((Table) compsource) && validateDropList(getDraggedTargetList((TableTransferable) transferable, (Table) compsource)); } if (compsource instanceof DragAndDropWrapper) { return validateDragAndDropWrapper((DragAndDropWrapper) compsource) && validateDropList(getDraggedTargetList(dragEvent)); } notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG)); return false; }
private static void addGeneratedColumn(final Table table) { table.addGeneratedColumn(CREATE_MODIFIED_DATE_UPLOAD, new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public String generateCell(final Table source, final Object itemId, final Object columnId) { final Long createdDate = (Long) table.getContainerDataSource().getItem(itemId) .getItemProperty(CREATED_DATE).getValue(); final Long modifiedDATE = (Long) table.getContainerDataSource().getItem(itemId) .getItemProperty(LAST_MODIFIED_DATE).getValue(); if (modifiedDATE != null) { return SPDateTimeUtil.getFormattedDate(modifiedDATE); } return SPDateTimeUtil.getFormattedDate(createdDate); } }); }
private void addGeneratedColumnButton(final Table table) { table.addGeneratedColumn(ACTION, new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Button generateCell(final Table source, final Object itemId, final Object columnId) { final String fileName = (String) table.getContainerDataSource().getItem(itemId) .getItemProperty(PROVIDED_FILE_NAME).getValue(); final Button deleteIcon = SPUIComponentProvider.getButton( fileName + "-" + UIComponentIdProvider.UPLOAD_FILE_DELETE_ICON, "", SPUILabelDefinitions.DISCARD, ValoTheme.BUTTON_TINY + " " + "blueicon", true, FontAwesome.TRASH_O, SPUIButtonStyleSmallNoBorder.class); deleteIcon.setData(itemId); deleteIcon.addClickListener(event -> confirmAndDeleteArtifact((Long) itemId, fileName)); return deleteIcon; } }); }
private void setTableColumnDetails(final Table table) { table.setColumnHeader(PROVIDED_FILE_NAME, i18n.getMessage("upload.file.name")); table.setColumnHeader(SIZE, i18n.getMessage("upload.size")); if (fullWindowMode) { table.setColumnHeader(SHA1HASH, i18n.getMessage("upload.sha1")); table.setColumnHeader(MD5HASH, i18n.getMessage("upload.md5")); } table.setColumnHeader(CREATE_MODIFIED_DATE_UPLOAD, i18n.getMessage("upload.last.modified.date")); if (!readOnly) { table.setColumnHeader(ACTION, i18n.getMessage("upload.action")); } table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F); table.setColumnExpandRatio(SIZE, 2F); if (fullWindowMode) { table.setColumnExpandRatio(SHA1HASH, 2.8F); table.setColumnExpandRatio(MD5HASH, 2.4F); } table.setColumnExpandRatio(CREATE_MODIFIED_DATE_UPLOAD, 3F); if (!readOnly) { table.setColumnExpandRatio(ACTION, 2.5F); } table.setVisibleColumns(getVisbleColumns().toArray()); }
protected void initMembersTable() { LazyLoadingQuery query = new GroupMembersQuery(group.getId(), this); if (query.size() > 0) { membersTable = new Table(); membersTable.setWidth(100, UNITS_PERCENTAGE); membersTable.setHeight(400, UNITS_PIXELS); membersTable.setEditable(false); membersTable.setSelectable(false); membersTable.setSortDisabled(false); LazyLoadingContainer container = new LazyLoadingContainer(query, 10); membersTable.setContainerDataSource(container); membersTable.addContainerProperty("id", Button.class, null); membersTable.addContainerProperty("firstName", String.class, null); membersTable.addContainerProperty("lastName", String.class, null); membersTable.addContainerProperty("email", String.class, null); membersTable.addContainerProperty("actions", Component.class, null); membersLayout.addComponent(membersTable); } else { noMembersTable = new Label(i18nManager.getMessage(Messages.GROUP_NO_MEMBERS)); membersLayout.addComponent(noMembersTable); } }
@Override protected void addCustomGeneratedColumns() { addGeneratedColumn(SPUILabelDefinitions.PIN_COLUMN, new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final HorizontalLayout iconLayout = new HorizontalLayout(); final String nameVersionStr = getNameAndVerion(itemId); final Button manageMetaDataBtn = createManageMetadataButton(nameVersionStr); manageMetaDataBtn.addClickListener(event -> showMetadataDetails(itemId)); iconLayout.addComponent((Button) getPinButton(itemId)); iconLayout.addComponent(manageMetaDataBtn); return iconLayout; } }); }
private void assignDsTag(final DragAndDropEvent event) { final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails(); final Table distTable = (Table) taregtDet.getTarget(); final Set<Long> distsSelected = getTableValue(distTable); final Set<Long> distList = new HashSet<>(); final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails(); final Object distItemId = dropData.getItemIdOver(); if (!distsSelected.contains(distItemId)) { distList.add((Long) distItemId); } else { distList.addAll(distsSelected); } final String distTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(), SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS); final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distList, distTagName); notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n)); if (result.getAssigned() >= 1 && managementUIState.getDistributionTableFilters().isNoTagSelected()) { refreshFilter(); } }
private void filterByDroppedDist(final DragAndDropEvent event) { if (doValidations(event)) { final TableTransferable tableTransferable = (TableTransferable) event.getTransferable(); final Table source = tableTransferable.getSourceComponent(); if (!UIComponentIdProvider.DIST_TABLE_ID.equals(source.getId())) { return; } final Set<Long> distributionIdSet = getDropppedDistributionDetails(tableTransferable); if (CollectionUtils.isEmpty(distributionIdSet)) { return; } final Long distributionSetId = distributionIdSet.iterator().next(); final Optional<DistributionSet> distributionSet = distributionSetManagement .get(distributionSetId); if (!distributionSet.isPresent()) { notification.displayWarning(i18n.getMessage("distributionset.not.exists")); return; } final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distributionSet.get()); getManagementUIState().getTargetTableFilters().setDistributionSet(distributionSetIdName); addFilterTextField(distributionSetIdName); } }
/** * Validation for drag event. * * @param dragEvent * @return */ private Boolean doValidations(final DragAndDropEvent dragEvent) { final Component compsource = dragEvent.getTransferable().getSourceComponent(); Boolean isValid = Boolean.TRUE; if (compsource instanceof Table && !isComplexFilterViewDisplayed) { final TableTransferable transferable = (TableTransferable) dragEvent.getTransferable(); final Table source = transferable.getSourceComponent(); if (!source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) { notification.displayValidationError(i18n.getMessage("message.action.not.allowed")); isValid = Boolean.FALSE; } else { if (getDropppedDistributionDetails(transferable).size() > 1) { notification.displayValidationError(i18n.getMessage("message.onlyone.distribution.dropallowed")); isValid = Boolean.FALSE; } } } else { notification.displayValidationError(i18n.getMessage("message.action.not.allowed")); isValid = Boolean.FALSE; } return isValid; }
protected void initMatchingUsersTable() { matchingUsersTable = new Table(); matchingUsersTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); matchingUsersTable.setSelectable(true); matchingUsersTable.setEditable(false); matchingUsersTable.setImmediate(true); matchingUsersTable.setNullSelectionAllowed(false); matchingUsersTable.setSortDisabled(true); if (multiSelect) { matchingUsersTable.setMultiSelect(true); } matchingUsersTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.USER_16)); matchingUsersTable.setColumnWidth("icon", 16); matchingUsersTable.addContainerProperty("userName", String.class, null); matchingUsersTable.setWidth(300, UNITS_PIXELS); matchingUsersTable.setHeight(200, UNITS_PIXELS); userSelectionLayout.addComponent(matchingUsersTable); }
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) { final AbstractTable<?> distTable = (AbstractTable<?>) sourceTable; final Set<Long> ids = distTable.getDeletedEntityByTransferable(transferable); final Long dsInBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload().getDsNameAndVersion(); if (isDsInUseInBulkUpload(ids, dsInBulkUpload)) { ids.remove(dsInBulkUpload); } if (ids.isEmpty()) { return; } final List<DistributionSet> findDistributionSetAllById = distributionSetManagement.get(ids); if (findDistributionSetAllById.isEmpty()) { notification.displayWarning(i18n.getMessage("distributionsets.not.exists")); return; } final Set<DistributionSetIdName> distributionIdNameSet = findDistributionSetAllById.stream() .map(distributionSet -> new DistributionSetIdName(distributionSet)).collect(Collectors.toSet()); checkDeletedDistributionSets(distributionIdNameSet); }
@Override protected void addCustomGeneratedColumns() { addGeneratedColumn(SPUILabelDefinitions.ARTIFACT_ICON, new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final HorizontalLayout iconLayout = new HorizontalLayout(); // add artifactory details popup final String nameVersionStr = getNameAndVerion(itemId); final Button showArtifactDtlsBtn = createShowArtifactDtlsButton(nameVersionStr); final Button manageMetaDataBtn = createManageMetadataButton(nameVersionStr); showArtifactDtlsBtn.addClickListener(event -> showArtifactDetailsWindow((Long) itemId, nameVersionStr)); manageMetaDataBtn.addClickListener(event -> showMetadataDetails((Long) itemId)); iconLayout.addComponent(showArtifactDtlsBtn); iconLayout.addComponent(manageMetaDataBtn); return iconLayout; } }); }
private void buildSelectedTable() { selectedTable = new Table(); selectedTable.setId(SPUIDefinitions.TWIN_TABLE_SELECTED_ID); selectedTable.setSelectable(true); selectedTable.setMultiSelect(true); selectedTable.setSortEnabled(false); selectedTable.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); selectedTable.addStyleName(ValoTheme.TABLE_NO_STRIPES); selectedTable.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES); selectedTable.addStyleName(ValoTheme.TABLE_SMALL); selectedTable.addStyleName("dist_type_twin-table"); selectedTable.setSizeFull(); createSelectedTableContainer(); selectedTable.setContainerDataSource(selectedTableContainer); addTooltTipToSelectedTable(); selectedTable.setImmediate(true); selectedTable.setVisibleColumns(DIST_TYPE_NAME, DIST_TYPE_MANDATORY); selectedTable.setColumnHeaders(i18n.getMessage("header.dist.twintable.selected"), STAR); selectedTable.setColumnExpandRatio(DIST_TYPE_NAME, 0.75F); selectedTable.setColumnExpandRatio(DIST_TYPE_MANDATORY, 0.25F); selectedTable.setRequired(true); }
@Override protected void processDroppedComponent(final DragAndDropEvent event) { final Component sourceComponent = event.getTransferable().getSourceComponent(); if (sourceComponent instanceof Table) { final Table sourceTable = (Table) event.getTransferable().getSourceComponent(); if (isDistributionTable(sourceTable)) { addInDeleteDistributionList(sourceTable, (TableTransferable) event.getTransferable()); updateDSActionCount(); } else if (isSoftwareModuleTable(sourceTable)) { addToSWDeleteList(sourceTable, (TableTransferable) event.getTransferable()); updateDSActionCount(); } } else if (sourceComponent.getId().startsWith(SPUIDefinitions.DISTRIBUTION_SET_TYPE_ID_PREFIXS)) { processDeleteDitSetType(sourceComponent.getId()); } else if (sourceComponent.getId().startsWith(SPUIDefinitions.SOFTWARE_MODULE_TAG_ID_PREFIXS)) { processDeleteSWType(sourceComponent.getId()); } }
protected void addComponentListeners() { // avoid duplicate registration removeListeners(); for (final AbstractField<?> field : allComponents) { if (field instanceof TextChangeNotifier) { ((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field)); } if (field instanceof Table) { ((Table) field).addItemSetChangeListener(new ChangeListener(field)); } field.addValueChangeListener(new ChangeListener(field)); } }