private ConfirmationTab createSMDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.SW_DELETE_ALL); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage("button.delete.all")); tab.getConfirmAll().addClickListener(event -> deleteSMAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage("button.discard.all")); tab.getDiscardAll().addClickListener(event -> discardSMAll(tab)); // Add items container to the table. tab.getTable().setContainerDataSource(getSWModuleTableContainer()); // Add the discard action column tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardSoftwareDelete(event, itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(SW_MODULE_NAME_MSG, SW_DISCARD_CHGS); tab.getTable().setColumnHeaders(i18n.getMessage("upload.swModuleTable.header"), i18n.getMessage("header.second.deletetarget.table")); tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH); tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER); return tab; }
private ConfirmationTab createSMtypeDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.SAVE_DELETE_SW_MODULE_TYPE); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage("button.delete.all")); tab.getConfirmAll().addClickListener(event -> deleteSMtypeAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage("button.discard.all")); tab.getDiscardAll().addClickListener(event -> discardSMtypeAll(tab)); // Add items container to the table. tab.getTable().setContainerDataSource(getSWModuleTypeTableContainer()); // Add the discard action column tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardSoftwareTypeDelete( (String) ((Button) event.getComponent()).getData(), itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(SW_MODULE_TYPE_NAME, DISCARD); tab.getTable().setColumnHeaders(i18n.getMessage("header.first.delete.swmodule.type.table"), i18n.getMessage("header.second.delete.swmodule.type.table")); tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2); tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER); return tab; }
private ConfirmationTab createAssignmentTab() { assignmentTab = new ConfirmationTab(); assignmentTab.getConfirmAll().setId(UIComponentIdProvider.SAVE_ASSIGNMENT); assignmentTab.getConfirmAll().setIcon(FontAwesome.SAVE); assignmentTab.getConfirmAll().setCaption(i18n.getMessage("button.assign.all")); assignmentTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmentTab)); assignmentTab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); assignmentTab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_ASSIGNMENT); assignmentTab.getDiscardAll().addClickListener(event -> discardAllAssignments(assignmentTab)); // Add items container to the table. assignmentTab.getTable().setContainerDataSource(getAssignmentsTableContainer()); // Add the discard action column assignmentTab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardAssignment((TargetIdName) itemId, assignmentTab); return createDiscardButton(itemId, clickListener); }); assignmentTab.getTable().setColumnExpandRatio(TARGET_NAME, 2); assignmentTab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, 2); assignmentTab.getTable().setColumnExpandRatio(DISCARD_CHANGES, 1); assignmentTab.getTable().setVisibleColumns(TARGET_NAME, DISTRIBUTION_NAME, DISCARD_CHANGES); assignmentTab.getTable().setColumnHeaders(i18n.getMessage("header.first.assignment.table"), i18n.getMessage("header.second.assignment.table"), i18n.getMessage("header.third.assignment.table")); assignmentTab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER); actionTypeOptionGroupLayout.selectDefaultOption(); assignmentTab.addComponent(actionTypeOptionGroupLayout, 1); return assignmentTab; }
private ConfirmationTab createDeletedTargetTab() { final ConfirmationTab tab = new ConfirmationTab(); // TobeDone ? y to set caption every time?? tab.getConfirmAll().setId(UIComponentIdProvider.TARGET_DELETE_ALL); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteAllTargets(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().addClickListener(event -> discardAllTargets(tab)); /* Add items container to the table. */ tab.getTable().setContainerDataSource(getTargetModuleTableContainer()); /* Add the discard action column */ tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardTargetDelete((TargetIdName) itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(TARGET_NAME, DISCARD_CHANGES); tab.getTable().setColumnHeaders(i18n.getMessage("header.first.deletetarget.table"), i18n.getMessage("header.second.deletetarget.table")); tab.getTable().setColumnExpandRatio(TARGET_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH); tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER); return tab; }
private ConfirmationTab createDeletedDistributionTab() { final ConfirmationTab tab = new ConfirmationTab(); // TobeDone ? y to set caption every time?? tab.getConfirmAll().setId(UIComponentIdProvider.DIST_DELETE_ALL); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteAllDistributions(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().addClickListener(event -> discardAllDistributions(tab)); /* Add items container to the table. */ tab.getTable().setContainerDataSource(getDSModuleTableContainer()); /* Add the discard action column */ tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardDSDelete((DistributionSetIdName) itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH); tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setVisibleColumns(DISTRIBUTION_NAME, DISCARD_CHANGES); tab.getTable().setColumnHeaders(i18n.getMessage("header.one.deletedist.table"), i18n.getMessage("header.second.deletedist.table")); tab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER); return tab; }
private ConfirmationTab createSMDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.SW_DELETE_ALL); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteSMAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().addClickListener(event -> discardSMAll(tab)); /* Add items container to the table. */ tab.getTable().setContainerDataSource(getSWModuleTableContainer()); /* Add the discard action column */ tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardSoftwareDelete(event, itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(SW_MODULE_NAME_MSG, SW_DISCARD_CHGS); tab.getTable().setColumnHeaders(i18n.getMessage("upload.swModuleTable.header"), i18n.getMessage("header.second.deletetarget.table")); tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH); tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER); return tab; }
private ConfirmationTab createSMtypeDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.SAVE_DELETE_SW_MODULE_TYPE); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteSMtypeAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_SW_MODULE_TYPE); tab.getDiscardAll().addClickListener(event -> discardSMtypeAll(tab)); // Add items container to the table. tab.getTable().setContainerDataSource(getSWModuleTypeTableContainer()); // Add the discard action column tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> { final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY); style.append(' '); style.append(SPUIStyleDefinitions.REDICON); final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD, style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class); deleteIcon.setData(itemId); deleteIcon.setImmediate(true); deleteIcon.addClickListener(event -> discardSoftwareTypeDelete( (String) ((Button) event.getComponent()).getData(), itemId, tab)); return deleteIcon; }); tab.getTable().setVisibleColumns(SW_MODULE_TYPE_NAME, DISCARD); tab.getTable().setColumnHeaders(i18n.getMessage("header.first.delete.swmodule.type.table"), i18n.getMessage("header.second.delete.swmodule.type.table")); tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2); tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(SW_DISCARD_CHGS, Align.CENTER); return tab; }
private ConfirmationTab createDistDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.DIST_DELETE_ALL); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteDistAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().addClickListener(event -> discardDistAll(tab)); /* Add items container to the table. */ tab.getTable().setContainerDataSource(getDistTableContainer()); /* Add the discard action column */ tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardDistDelete(event, itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(DIST_NAME, DISCARD); tab.getTable().setColumnHeaders(i18n.getMessage("header.one.deletedist.table"), i18n.getMessage("header.second.deletedist.table")); tab.getTable().setColumnExpandRatio(DIST_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH); tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(DISCARD, Align.CENTER); return tab; }
private ConfirmationTab createDistSetTypeDeleteConfirmationTab() { final ConfirmationTab tab = new ConfirmationTab(); tab.getConfirmAll().setId(UIComponentIdProvider.SAVE_DELETE_DIST_SET_TYPE); tab.getConfirmAll().setIcon(FontAwesome.TRASH_O); tab.getConfirmAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DELETE_ALL)); tab.getConfirmAll().addClickListener(event -> deleteDistSetTypeAll(tab)); tab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); tab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_DIST_SET_TYPE); tab.getDiscardAll().addClickListener(event -> discardDistSetTypeAll(tab)); // Add items container to the table. tab.getTable().setContainerDataSource(getDistSetTypeTableContainer()); // Add the discard action column tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> { final ClickListener clickListener = event -> discardDistTypeDelete( (String) ((Button) event.getComponent()).getData(), itemId, tab); return createDiscardButton(itemId, clickListener); }); tab.getTable().setVisibleColumns(DIST_SET_NAME, DISCARD); tab.getTable().setColumnHeaders(i18n.getMessage("header.first.delete.dist.type.table"), i18n.getMessage("header.second.delete.dist.type.table")); tab.getTable().setColumnExpandRatio(DIST_SET_NAME, 2); tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH); tab.getTable().setColumnAlignment(DISCARD, Align.CENTER); return tab; }
/** * Return the Vaadin align attribute * @param attribute * @return */ private Align getAlignValue(String align) { if ("right".equalsIgnoreCase(align)) return Align.RIGHT; else if ("center".equalsIgnoreCase(align)) return Align.CENTER; return Align.LEFT; }
/** * Setup column configuration for given <code>property</code> using its {@link PropertyColumn} definition. * @param property Property to which the column is bound * @param table Table to setup */ protected void setupTablePropertyColumn(P property, Table table) { PropertyColumn<T, P> propertyColumn = getPropertyColumn(property); if (propertyColumn != null) { // header if (propertyColumn.getCaption() != null) { String header = LocalizationContext.translate(propertyColumn.getCaption(), true); if (header != null) { table.setColumnHeader(property, header); } } // alignment if (propertyColumn.getAlignment() != null) { switch (propertyColumn.getAlignment()) { case CENTER: table.setColumnAlignment(property, Align.CENTER); break; case LEFT: table.setColumnAlignment(property, Align.LEFT); break; case RIGHT: table.setColumnAlignment(property, Align.RIGHT); break; default: break; } } // width if (propertyColumn.getWidth() > -1) { table.setColumnWidth(property, propertyColumn.getWidth()); } // expand if (propertyColumn.getTableExpandRatio() > -1) { table.setColumnExpandRatio(property, propertyColumn.getTableExpandRatio()); } // hiding if (propertyColumn.isHidable()) { table.setColumnCollapsible(property, true); if (propertyColumn.isHidden()) { table.setColumnCollapsed(property, true); } } else { table.setColumnCollapsible(property, false); } // icon if (propertyColumn.getIcon() != null) { table.setColumnIcon(property, propertyColumn.getIcon()); } } }
private Table buildTable() { final Table table = new Table() { @Override protected String formatPropertyValue(final Object rowId, final Object colId, final Property<?> property) { String result = super.formatPropertyValue(rowId, colId, property); if (colId.equals("time")) { result = DATEFORMAT.format(((Date) property.getValue())); } else if (colId.equals("price")) { if (property != null && property.getValue() != null) { return "$" + DECIMALFORMAT.format(property.getValue()); } else { return ""; } } return result; } }; table.setSizeFull(); table.addStyleName(ValoTheme.TABLE_BORDERLESS); table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_COMPACT); table.setSelectable(true); table.setColumnCollapsingAllowed(true); table.setColumnCollapsible("time", false); table.setColumnCollapsible("price", false); table.setColumnReorderingAllowed(true); table.setContainerDataSource(new TempTransactionsContainer(DashboardUI .getDataProvider().getRecentTransactions(200))); table.setSortContainerPropertyId("time"); table.setSortAscending(false); table.setColumnAlignment("seats", Align.RIGHT); table.setColumnAlignment("price", Align.RIGHT); table.setVisibleColumns("time", "country", "city", "theater", "room", "title", "seats", "price"); table.setColumnHeaders("Time", "Country", "City", "Theater", "Room", "Title", "Seats", "Price"); table.setFooterVisible(true); table.setColumnFooter("time", "Total"); table.setColumnFooter( "price", "$" + DECIMALFORMAT.format(DashboardUI.getDataProvider() .getTotalSum())); // Allow dragging items to the reports menu table.setDragMode(TableDragMode.MULTIROW); table.setMultiSelect(true); table.addActionHandler(new TransactionsActionHandler()); table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (table.getValue() instanceof Set) { Set<Object> val = (Set<Object>) table.getValue(); createReport.setEnabled(val.size() > 0); } } }); table.setImmediate(true); return table; }
private ConfirmationTab createAssignSWModuleConfirmationTab() { assignmnetTab = new ConfirmationTab(); assignmnetTab.getConfirmAll().setId(UIComponentIdProvider.SAVE_ASSIGNMENT); assignmnetTab.getConfirmAll().setIcon(FontAwesome.SAVE); assignmnetTab.getConfirmAll().setCaption(i18n.getMessage("button.assign.all")); assignmnetTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmnetTab)); assignmnetTab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL)); assignmnetTab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_ASSIGNMENT); assignmnetTab.getDiscardAll().addClickListener(event -> discardAllSWAssignments(assignmnetTab)); // Add items container to the table. assignmnetTab.getTable().setContainerDataSource(getSWAssignmentsTableContainer()); // Add the discard action column assignmnetTab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> { final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY); style.append(' '); style.append(SPUIStyleDefinitions.REDICON); final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD, style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class); deleteIcon.setData(itemId); deleteIcon.setImmediate(true); deleteIcon.addClickListener(event -> discardSWAssignment((String) ((Button) event.getComponent()).getData(), itemId, assignmnetTab)); return deleteIcon; }); assignmnetTab.getTable().setVisibleColumns(DIST_NAME, SOFTWARE_MODULE_NAME, DISCARD); assignmnetTab.getTable().setColumnHeaders(i18n.getMessage("header.dist.first.assignment.table"), i18n.getMessage("header.dist.second.assignment.table"), i18n.getMessage("header.third.assignment.table")); assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2); assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2); assignmnetTab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH); assignmnetTab.getTable().setColumnAlignment(DISCARD, Align.CENTER); return assignmnetTab; }
/** * @return the align */ public Align getAlign() { return align; }
/** * @param align the align to set */ public void setAlign(Align align) { this.align = align; }