private void refreshTree(TreeNode node) { int childCount = node.getChildCount(); for (int i = 0; i < childCount; i++) { if (!node.isChildLeaf(i) && node.isChildOpen(i)) { node.setChildOpen(i, false); TreeNode child = node.setChildOpen(i, true); if (child != null) { refreshTree(child); } } } }
@Override protected float constructActions(DataGrid<T> table, float prefWidth) { float result = 0; if (downloadSchemaColumn == null || table.getColumnIndex(downloadSchemaColumn) == -1) { Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordSchema())); downloadSchemaColumn = constructDownloadSchemaColumn(); table.addColumn(downloadSchemaColumn, downloadRecordSchemaHeader); table.setColumnWidth(downloadSchemaColumn, 60, Unit.PX); result += 60; } return result; }
/** * Update data. */ public void updateData() { List<T> filteredData = dataGrid.filter(data); if (dataFilter != null) { List<T> newFilteredData = new ArrayList<>(); for (T value : filteredData) { if (dataFilter.accept(value)) { newFilteredData.add(value); } } filteredData = newFilteredData; } updateRowCount(filteredData.size(), true); ColumnSortList sortList = dataGrid.getDataGrid().getColumnSortList(); Column<?, ?> column = (sortList == null || sortList.size() == 0) ? null : sortList.get(0).getColumn(); boolean isSortAscending = !(sortList == null || sortList.size() == 0) && sortList.get(0).isAscending(); if (column != null) { dataGrid.sort(filteredData, column, isSortAscending); } updateRowData(0, filteredData); }
Header<SafeHtml> actionHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.action())); table.addColumn(actionColumn, actionHeader); actionColumn.setFieldUpdater( new FieldUpdater<ApplicationEventMapDto, ApplicationEventAction>() { @Override table.setColumnWidth(actionColumn, 80, Unit.PX); prefWidth += 80; } else {
/** * The constructor. */ public AbstractDataProvider(AbstractGrid<T, K> dataGrid, HasErrorMessage hasErrorMessage, boolean addDisplay) { this.dataGrid = dataGrid; callback = new LoadCallback(hasErrorMessage); dataGrid.getDataGrid().addColumnSortHandler(this); dataGrid.addColumnFilterEventHandler(this); if (addDisplay) { addDataDisplay(dataGrid.getDataGrid()); } }
/** * Instantiates a new NavigationViewImpl. */ public NavigationViewImpl() { treeModel = new NavigationTreeViewModel(); menuTree = new CellTree(treeModel, null); kaaAdminStyle = Utils.kaaAdminStyle; initWidget(uiBinder.createAndBindUi(this)); }
/** * Updates endpoint profile data. */ public void update() { reset(); dataGrid.getDataGrid().setVisibleRangeAndClearData( new Range(0, dataGrid.getPageSize()), true); }
@Override public void onColumnFilter(ColumnFilterEvent event) { dataGrid.getDataGrid().setPageStart(0); updateData(); }
private void refreshTree() { TreeNode node = navigationView.getMenuTree().getRootTreeNode(); refreshTree(node); }
@SuppressWarnings("unchecked") private K getObjectId(T value) { return (K) dataGrid.getDataGrid().getKeyProvider().getKey(value); }
@Override protected float constructActions(DataGrid<T> table, float prefWidth) { float result = 0; if (!embedded && (downloadSchemaColumn == null || table.getColumnIndex(downloadSchemaColumn) == -1)) { Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordSchema())); downloadSchemaColumn = constructDownloadSchemaColumn(""); table.addColumn(downloadSchemaColumn, downloadRecordSchemaHeader); table.setColumnWidth(downloadSchemaColumn, ACTION_COLUMN_WIDTH, Unit.PX); result += ACTION_COLUMN_WIDTH; } return result; }
private boolean openNode(TreeNode node, TreePlace place) { int childCount = node.getChildCount(); for (int i = 0; i < childCount; i++) { if (node.getChildValue(i).equals(place)) { //node.setChildOpen(i, true, true); return true; } else if (!node.isChildLeaf(i)) { boolean wasOpen = node.isChildOpen(i); TreeNode child = node.setChildOpen(i, true); if (child != null && openNode(child, place)) { return true; } else if (!wasOpen) { node.setChildOpen(i, false); } } } return false; }
@Override protected CTLSchemaScopeDto getCurrentScope() { listView.getListWidget().getDataGrid().setPageStart(0); return CTLSchemaScopeDto.APPLICATION; }
private void selectPlace(TreePlace place) { TreeNode node = navigationView.getMenuTree().getRootTreeNode(); if (openNode(node, place)) { navigationView.getSelectionModel().setSelected(place, true); pendingPlace = null; } else { navigationView.getSelectionModel().clear(); } }
@Override protected float constructActions(DataGrid<T> table, float prefWidth) { float result = 0; if (!embedded && (downloadPropsColumn == null || table.getColumnIndex(downloadPropsColumn) == -1)) { Header<SafeHtml> downloadRecordSchemaHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.configuration())); downloadPropsColumn = constructDownloadSchemaColumn(""); table.addColumn(downloadPropsColumn, downloadRecordSchemaHeader); table.setColumnWidth(downloadPropsColumn, ACTION_COLUMN_WIDTH, Unit.PX); result += ACTION_COLUMN_WIDTH; } result += super.constructActions(table, prefWidth); return result; }
@Override protected float constructActions(DataGrid<EndpointProfileDto> table, float prefWidth) { if (enableActions) { float result = 0; if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) { Header<SafeHtml> deleteHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant( embedded ? Utils.constants.remove() : Utils.constants.delete())); deleteColumn = constructDeleteColumn(""); table.addColumn(deleteColumn, deleteHeader); table.setColumnWidth(deleteColumn, 40, Style.Unit.PX); result += 40; } return result; } else { return 0; } }
@Override protected float constructActions(DataGrid<ConfigurationSchemaDto> table, float prefWidth) { float result = super.constructActions(table, prefWidth); if (!embedded && (downloadBaseSchemaColumn == null || table.getColumnIndex(downloadBaseSchemaColumn) == -1)) { Header<SafeHtml> downloadBaseSchemaHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadBaseSchema())); downloadBaseSchemaColumn = constructDownloadBaseSchemaColumnColumn(""); table.addColumn(downloadBaseSchemaColumn, downloadBaseSchemaHeader); table.setColumnWidth(downloadBaseSchemaColumn, ACTION_COLUMN_WIDTH, Style.Unit.PX); result += ACTION_COLUMN_WIDTH; } if (!embedded && (downloadOverrideSchemaColumn == null || table.getColumnIndex(downloadOverrideSchemaColumn) == -1)) { Header<SafeHtml> downloadOverrideSchemaHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadOverrideSchema())); downloadOverrideSchemaColumn = constructDownloadOverrideSchemaColumnColumn(""); table.addColumn(downloadOverrideSchemaColumn, downloadOverrideSchemaHeader); table.setColumnWidth(downloadOverrideSchemaColumn, ACTION_COLUMN_WIDTH, Style.Unit.PX); result += ACTION_COLUMN_WIDTH; } return result; }
@Override protected float constructActions(DataGrid<TopicDto> table, float prefWidth) { if (enableActions) { float result = 0; if (!embedded && (sendNotificationColumn == null || table.getColumnIndex(sendNotificationColumn) == -1)) { Header<SafeHtml> sendNotificationHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.sendNotification())); sendNotificationColumn = constructSendNotificationColumn(""); table.addColumn(sendNotificationColumn, sendNotificationHeader); table.setColumnWidth(sendNotificationColumn, 40, Unit.PX); result += 40; } if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) { Header<SafeHtml> deleteHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(embedded ? Utils.constants.remove() : Utils.constants.delete())); deleteColumn = constructDeleteColumn(""); table.addColumn(deleteColumn, deleteHeader); table.setColumnWidth(deleteColumn, 40, Unit.PX); result += 40; } return result; } else { return 0; } }
@Override protected float constructActions(DataGrid<SdkProfileDto> table, float prefWidth) { float result = 0; if (enableActions) { if (generateSdkColumn == null || table.getColumnIndex(generateSdkColumn) == -1) { Header<SafeHtml> generateSdkHeader; generateSdkHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.generateSdk())); generateSdkColumn = constructGenerateSdkColumn(""); table.addColumn(generateSdkColumn, generateSdkHeader); table.setColumnWidth(generateSdkColumn, 40, Unit.PX); result += 40; } if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) { Header<SafeHtml> deleteHeader; if (embedded) { deleteHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.remove())); } else { deleteHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.delete())); } deleteColumn = constructDeleteColumn(""); table.addColumn(deleteColumn, deleteHeader); table.setColumnWidth(deleteColumn, 40, Unit.PX); result += 40; } } return result; }
@Override protected float constructActions(DataGrid<LogSchemaDto> table, float prefWidth) { float result = super.constructActions(table, prefWidth); if (!embedded && (downloadLibraryColumn == null || table.getColumnIndex(downloadLibraryColumn) == -1)) { Header<SafeHtml> downloadLibraryHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant(Utils.constants.downloadRecordLibrary())); downloadLibraryColumn = constructDownloadLibraryColumn(""); table.addColumn(downloadLibraryColumn, downloadLibraryHeader); table.setColumnWidth(downloadLibraryColumn, ACTION_COLUMN_WIDTH, Unit.PX); result += ACTION_COLUMN_WIDTH; } if (enableActions) { if (deleteColumn == null || table.getColumnIndex(deleteColumn) == -1) { Header<SafeHtml> deleteHeader = new SafeHtmlHeader( SafeHtmlUtils.fromSafeConstant( embedded ? Utils.constants.remove() : Utils.constants.delete())); deleteColumn = constructDeleteColumn(""); table.addColumn(deleteColumn, deleteHeader); table.setColumnWidth(deleteColumn, ACTION_COLUMN_WIDTH, Unit.PX); result += ACTION_COLUMN_WIDTH; } } return result; }