@Override public void filterTable(String filter) { // store list only for first time if (fullBackup.isEmpty() || fullBackup == null) { fullBackup.addAll(getList()); } // always clear selected items selectionModel.clear(); list.clear(); if (filter.equalsIgnoreCase("")) { list.addAll(fullBackup); } else { for (ExtSource src : fullBackup) { // store ext source if name or type matches if ((src.getName().toLowerCase().startsWith(filter.toLowerCase())) || renameContent(src.getType()).toLowerCase().startsWith(filter.toLowerCase())) { list.add(src); } } } if (list.isEmpty() && !filter.isEmpty()) { loaderImage.setEmptyResultMessage("No external source matching '" + filter + "' found."); } else { loaderImage.setEmptyResultMessage("No external sources found in Perun."); } dataProvider.flush(); dataProvider.refresh(); loaderImage.loadingFinished(); }
public void filterProcessList(String filter) { if (filter.equals("")) { if (currentProcessInstances != null) { dataProvider.getList().clear(); dataProvider .getList() .addAll(new ArrayList<ProcessInstanceSummary>(currentProcessInstances)); dataProvider.refresh(); } } else { if (currentProcessInstances != null) { List<ProcessInstanceSummary> processes = new ArrayList<ProcessInstanceSummary>(currentProcessInstances); List<ProcessInstanceSummary> filteredProcesses = new ArrayList<ProcessInstanceSummary>(); for (ProcessInstanceSummary ps : processes) { if (ps.getProcessName().toLowerCase().contains(filter.toLowerCase()) || ps.getInitiator().toLowerCase().contains(filter.toLowerCase())) { filteredProcesses.add(ps); } } dataProvider.getList().clear(); dataProvider.getList().addAll(filteredProcesses); dataProvider.refresh(); } } }
public void filterTasks(String text) { if (text.equals("")) { if (allTaskSummaries != null) { dataProvider.getList().clear(); dataProvider.setList(new ArrayList<TaskSummary>(allTaskSummaries)); dataProvider.refresh(); } if (currentDayTasks != null) { view.getTaskListMultiDayBox().clear(); for (Day day : currentDayTasks.keySet()) { view.getTaskListMultiDayBox() .addTasksByDay(day, new ArrayList<TaskSummary>(currentDayTasks.get(day))); } view.getTaskListMultiDayBox().refresh(); } } else { if (allTaskSummaries != null) { List<TaskSummary> tasks = new ArrayList<TaskSummary>(allTaskSummaries); List<TaskSummary> filteredTasksSimple = new ArrayList<TaskSummary>(); for (TaskSummary ts : tasks) { if (ts.getName().toLowerCase().contains(text.toLowerCase())) { filteredTasksSimple.add(ts); } } dataProvider.getList().clear(); dataProvider.setList(filteredTasksSimple); dataProvider.refresh(); } if (currentDayTasks != null) { Map<Day, List<TaskSummary>> tasksCalendar = new HashMap<Day, List<TaskSummary>>(currentDayTasks); Map<Day, List<TaskSummary>> filteredTasksCalendar = new HashMap<Day, List<TaskSummary>>(); view.getTaskListMultiDayBox().clear(); for (Day d : tasksCalendar.keySet()) { if (filteredTasksCalendar.get(d) == null) { filteredTasksCalendar.put(d, new ArrayList<TaskSummary>()); } for (TaskSummary ts : tasksCalendar.get(d)) { if (ts.getName().toLowerCase().contains(text.toLowerCase())) { filteredTasksCalendar.get(d).add(ts); } } } for (Day day : filteredTasksCalendar.keySet()) { view.getTaskListMultiDayBox() .addTasksByDay(day, new ArrayList<TaskSummary>(filteredTasksCalendar.get(day))); } view.getTaskListMultiDayBox().refresh(); } } }
private void onDataObjectChange(@Observes DataObjectChangeEvent event) { if (event.isFromContext(context != null ? context.getContextId() : null)) { if (event.getChangeType() == ChangeType.CLASS_NAME_CHANGE || event.getChangeType() == ChangeType.PACKAGE_NAME_CHANGE || event.getChangeType() == ChangeType.OBJECT_NAME_CHANGE || MainDomainAnnotations.LABEL_ANNOTATION.equals(event.getAnnotationClassName())) { refreshObjectSelector(dataObject); // For self references: in case name or package changes redraw properties table skipNextFieldNotification = true; dataObjectPropertiesProvider.refresh(); dataObjectPropertiesTable.redraw(); Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { selectCurrentObject(false); } }); } } }
@Override public void renderRows(List<EntityModalPresenter.VariableValueRow> rows) { dataProvider.setList(rows); pager.firstPage(); dataProvider.refresh(); pager.setPagerVisible(dataProvider.getList().size() > pager.getPageSize()); }
public void insertToTable(int index, ExtSource object) { list.add(index, object); oracle.add(object.getName()); oracle.add(renameContent(object.getType())); dataProvider.flush(); dataProvider.refresh(); }
/** * Add object as new row to table * * @param object ExtSource to be added as new row */ public void addToTable(ExtSource object) { list.add(object); oracle.add(object.getName()); oracle.add(renameContent(object.getType())); dataProvider.flush(); dataProvider.refresh(); }
private void addDataObjectProperty( DataObject dataObject, final String propertyName, final String propertyLabel, final String propertyType, final Boolean isMultiple) { AddPropertyCommand command = commandBuilder.buildAddPropertyCommand( getContext(), DataModelerEvent.DATA_OBJECT_BROWSER, dataObject, propertyName, propertyLabel, propertyType, isMultiple); command.execute(); ObjectProperty property = command.getProperty(); dataObjectPropertiesProvider.getList().add(property); dataObjectPropertiesProvider.flush(); dataObjectPropertiesProvider.refresh(); dataObjectPropertiesTable.setKeyboardSelectedRow( dataObjectPropertiesProvider.getList().size() - 1); executePostCommandProcessing(command); }
/** Clear all table content */ public void clearTable() { loaderImage.loadingStart(); list.clear(); selectionModel.clear(); dataProvider.flush(); dataProvider.refresh(); }
private void setDataObject(DataObject dataObject) { this.dataObject = dataObject; refreshObjectSelector(dataObject); // We create a new selection model due to a bug found in GWT when we change e.g. from one data // object with 9 rows // to one with 3 rows and the table was sorted. // Several tests has been done and the final workaround (not too bad) we found is to // 1) sort the table again // 2) create a new selection model // 3) populate the table with new items // 3) select the first row SingleSelectionModel selectionModel2 = new SingleSelectionModel<ObjectProperty>(); dataObjectPropertiesTable.setSelectionModel(selectionModel2); selectionModel2.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { ObjectProperty selectedProperty = ((SingleSelectionModel<ObjectProperty>) dataObjectPropertiesTable.getSelectionModel()) .getSelectedObject(); notifyFieldSelected(selectedProperty); } }); List<ObjectProperty> dataObjectProperties = (dataObject != null) ? DataModelerUtils.getManagedProperties(dataObject) : Collections.<ObjectProperty>emptyList(); ArrayList<ObjectProperty> sortBuffer = new ArrayList<ObjectProperty>(); if (dataObject != null) { sortBuffer.addAll(dataObjectProperties); } Collections.sort(sortBuffer, new ObjectPropertyComparator("name")); dataObjectPropertiesProvider.getList().clear(); dataObjectPropertiesProvider.getList().addAll(sortBuffer); dataObjectPropertiesProvider.flush(); dataObjectPropertiesProvider.refresh(); dataObjectPropertiesTable .getColumnSortList() .push(new ColumnSortList.ColumnSortInfo(dataObjectPropertiesTable.getColumn(2), true)); if (dataObjectProperties.size() > 0) { dataObjectPropertiesTable.setKeyboardSelectedRow(0); selectionModel2.setSelected(sortBuffer.get(0), true); } // set the first row selected again. Sounds crazy, but's part of the workaround, don't remove // this line. if (dataObjectProperties.size() > 0) { dataObjectPropertiesTable.setKeyboardSelectedRow(0); } }
/** Sorts table by objects Name */ public void sortTable() { if (service == null) { list = new TableSorter<Destination>().sortByFacilityName(getList()); } else { list = new TableSorter<Destination>().sortByService(getList()); } dataProvider.flush(); dataProvider.refresh(); }
@Override public void afterRenderRows() { dataProvider.refresh(); boolean enableItem = table.getRowCount() > 0; pager.setVisible(table.getRowCount() > Table.DEFAULT_PAGESIZE); downloadDictionary.setEnabled(enableItem); exportData.setDisabled(!enableItem); copyData.setDisabled(!enableItem); table.hideLoadingIndicator(); }
public void setList(ArrayList<ExtSource> list) { clearTable(); this.list.addAll(list); for (ExtSource object : list) { oracle.add(object.getName()); oracle.add(renameContent(object.getType())); } dataProvider.flush(); dataProvider.refresh(); }
public void insertToTable(int index, Destination object) { list.add(index, object); oracle.add(object.getDestination()); if (service == null) { oracle.add(object.getService().getName()); } else { oracle.add(object.getFacility().getName()); } dataProvider.flush(); dataProvider.refresh(); }
public void setList(ArrayList<Destination> list) { clearTable(); this.list.addAll(list); for (Destination d : list) { oracle.add(d.getDestination()); if (service == null) { oracle.add(d.getService().getName()); } else { oracle.add(d.getFacility().getName()); } } dataProvider.flush(); dataProvider.refresh(); }
@Override public void onSuccess(List<AnamnesisCheckProxy> response) { Log.debug("setQuestionTableData() - sueccess and response size = " + response.size()); Log.debug("dataProvider.getList().size() = " + dataProvider.getList().size()); dataProvider.getList().clear(); dataProvider.getList().addAll(response); // AnamnesisCheckActivity.this.view.getTable().setPageSize(dataProvider.getList().size()); AnamnesisCheckActivity.this.view.setTableSize(dataProvider.getList().size()); Log.info("page size--" + AnamnesisCheckActivity.this.view.getTable().getPageSize()); AnamnesisCheckActivity.this.view.getTable().redraw(); dataProvider.refresh(); AnamnesisCheckActivity.this.view.getTable().redraw(); // innerSystemStartView.getTable().cellTable.setPageSize(25); // anamnesisCheckTable.cellTable.setPageSize(25); Log.info("data provider--" + dataProvider.getList().size()); }
public void filterTable(String text) { // store list only for first time if (fullBackup.isEmpty() || fullBackup == null) { fullBackup.addAll(list); } // always clear selected items selectionModel.clear(); list.clear(); if (text.equalsIgnoreCase("")) { list.addAll(fullBackup); } else { for (Destination dst : fullBackup) { // store facility by filter if (service == null) { if (dst.getDestination().toLowerCase().contains(text.toLowerCase()) || dst.getService().getName().toLowerCase().contains(text.toLowerCase())) { list.add(dst); } } else { if (dst.getDestination().toLowerCase().contains(text.toLowerCase()) || dst.getFacility().getName().toLowerCase().contains(text.toLowerCase())) { list.add(dst); } } } } if (list.isEmpty() && !text.isEmpty()) { loaderImage.setEmptyResultMessage("No destination matching '" + text + "' found."); } else { if (showFac) { loaderImage.setEmptyResultMessage("Service has no destination."); } else { loaderImage.setEmptyResultMessage( "Facility has no services destinations. Service configuration can't be propagated."); } } dataProvider.flush(); dataProvider.refresh(); loaderImage.loadingFinished(); }
@SuppressWarnings("ParameterHidesMemberVariable") public void populate(List<ValueMapEntry> valueMapEntries, @Nullable List<String> valueChoices) { this.valueMapEntries = valueMapEntries; this.valueChoices = valueChoices; //noinspection ConstantConditions if (hasValueChoices() && !valueChoices.contains("")) { valueChoices.add(0, ""); } if (dataProvider == null) { initializeTable(); dataProvider = new ListDataProvider<ValueMapEntry>(valueMapEntries); dataProvider.addDataDisplay(table); } else { dataProvider.setList(valueMapEntries); } pager.setVisible(valueMapEntries.size() > pager.getPageSize()); dataProvider.refresh(); // remove loading remove(loading); // addStyleName("value-map"); }
private void deleteDataObjectProperty(final ObjectProperty objectProperty, final int index) { if (dataObject != null) { dataObject.getProperties().remove(objectProperty); dataObjectPropertiesProvider.getList().remove(index); dataObjectPropertiesProvider.flush(); dataObjectPropertiesProvider.refresh(); getContext() .getHelper() .dataObjectUnReferenced(objectProperty.getClassName(), dataObject.getClassName()); notifyFieldDeleted(objectProperty); if (dataObjectPropertiesProvider.getList().size() == 0) { context.setObjectProperty(null); dataModelerWBContextEvent.fire(new DataModelerWorkbenchContextChangeEvent()); } else if (dataObjectPropertiesProvider.getList().size() == 1) { // BZ-1255449 tricky bug. Considerable time was spent, and it was no direct to find an // optimal/better solution. // Since in this use case the Data Object will have just one field, it's acceptable to // reload the list. setDataObject(dataObject); } } }
/** Sorts table by objects Name */ public void sortTable() { list = new TableSorter<Attribute>().sortByAttrNameTranslation(getList()); dataProvider.flush(); dataProvider.refresh(); }
/** * Removes object as row from table * * @param object Publication to be removed as row */ public void removeFromTable(Publication object) { list.remove(object); selectionModel.getSelectedSet().remove(object); dataProvider.flush(); dataProvider.refresh(); }
/** * Add object as new row to table * * @param object Publication to be added as new row */ public void addToTable(Publication object) { list.add(object); dataProvider.flush(); dataProvider.refresh(); }
/** Sorts table by objects Name */ public void sortTable() { list = new TableSorter<Publication>().sortByPublicationTitle(getList()); dataProvider.flush(); dataProvider.refresh(); }
public void refreshData() { dataProvider.refresh(); }
/** Sorts table by objects Name */ public void sortTable() { list = new TableSorter<ExtSource>().sortByName(getList()); dataProvider.flush(); dataProvider.refresh(); }
public void insertToTable(int index, Attribute object) { list.add(index, object); dataProvider.flush(); dataProvider.refresh(); }
public void insertToTable(int index, Publication object) { list.add(index, object); dataProvider.flush(); dataProvider.refresh(); }
public DataObjectBrowser() { initWidget(uiBinder.createAndBindUi(this)); objectButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { selectCurrentObject(true); } }); dataObjectPropertiesProvider.setList(new ArrayList<ObjectProperty>()); // Init data objects table dataObjectPropertiesTable.setEmptyTableWidget( new Label(Constants.INSTANCE.objectBrowser_emptyTable())); // Init property name column final TextColumn<ObjectProperty> propertyNameColumn = new TextColumn<ObjectProperty>() { @Override public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) { SafeHtml startDiv = new SafeHtml() { @Override public String asString() { return "<div style=\"cursor: pointer;\">"; } }; SafeHtml endDiv = new SafeHtml() { @Override public String asString() { return "</div>"; } }; sb.append(startDiv); super.render(context, object, sb); sb.append(endDiv); } @Override public String getValue(final ObjectProperty objectProperty) { return objectProperty.getName(); } }; propertyNameColumn.setSortable(true); dataObjectPropertiesTable.addColumn( propertyNameColumn, Constants.INSTANCE.objectBrowser_columnName()); // dataObjectPropertiesTable.setColumnWidth(propertyNameColumn, 100, Style.Unit.PX); dataObjectPropertiesTable.setColumnWidth(propertyNameColumn, 30, Style.Unit.PCT); ColumnSortEvent.ListHandler<ObjectProperty> propertyNameColHandler = new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList()); propertyNameColHandler.setComparator(propertyNameColumn, new ObjectPropertyComparator("name")); dataObjectPropertiesTable.addColumnSortHandler(propertyNameColHandler); // Init property Label column final TextColumn<ObjectProperty> propertyLabelColumn = new TextColumn<ObjectProperty>() { @Override public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) { SafeHtml startDiv = new SafeHtml() { @Override public String asString() { return "<div style=\"cursor: pointer;\">"; } }; SafeHtml endDiv = new SafeHtml() { @Override public String asString() { return "</div>"; } }; sb.append(startDiv); super.render(context, object, sb); sb.append(endDiv); } @Override public String getValue(final ObjectProperty objectProperty) { return AnnotationValueHandler.getStringValue( objectProperty, MainDomainAnnotations.LABEL_ANNOTATION, MainDomainAnnotations.VALUE_PARAM); } }; propertyLabelColumn.setSortable(true); dataObjectPropertiesTable.addColumn( propertyLabelColumn, Constants.INSTANCE.objectBrowser_columnLabel()); dataObjectPropertiesTable.setColumnWidth(propertyLabelColumn, 30, Style.Unit.PCT); ColumnSortEvent.ListHandler<ObjectProperty> propertyLabelColHandler = new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList()); propertyNameColHandler.setComparator( propertyLabelColumn, new ObjectPropertyComparator("label")); dataObjectPropertiesTable.addColumnSortHandler(propertyLabelColHandler); // Init property type browsing column ClickableImageResourceCell typeImageCell = new ClickableImageResourceCell(true, 25); // final TooltipCellDecorator<ImageResource> typeImageDecorator = new // TooltipCellDecorator<ImageResource>( typeImageCell ); // typeImageDecorator.setText( // Constants.INSTANCE.objectBrowser_action_goToDataObjectDefinition() ); final Column<ObjectProperty, ImageResource> typeImageColumn = new Column<ObjectProperty, ImageResource>(typeImageCell) { @Override public ImageResource getValue(final ObjectProperty property) { if (!property.isBaseType() && !getDataObject().getClassName().equals(property.getClassName()) && !getDataModel().isExternal(property.getClassName())) { return ImagesResources.INSTANCE.BrowseObject(); } else { return null; } } }; typeImageColumn.setFieldUpdater( new FieldUpdater<ObjectProperty, ImageResource>() { public void update( final int index, final ObjectProperty property, final ImageResource value) { onTypeCellSelection(property); } }); dataObjectPropertiesTable.addColumn(typeImageColumn); // Init property type column final TextColumn<ObjectProperty> propertyTypeColumn = new TextColumn<ObjectProperty>() { @Override public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) { SafeHtml startDiv = new SafeHtml() { @Override public String asString() { return "<div style=\"cursor: pointer;\">"; } }; SafeHtml endDiv = new SafeHtml() { @Override public String asString() { return "</div>"; } }; sb.append(startDiv); super.render(context, object, sb); sb.append(endDiv); } @Override public String getValue(final ObjectProperty objectProperty) { return propertyTypeDisplay(objectProperty); } }; propertyTypeColumn.setSortable(true); dataObjectPropertiesTable.addColumn( propertyTypeColumn, Constants.INSTANCE.objectBrowser_columnType()); dataObjectPropertiesTable.setColumnWidth(propertyTypeColumn, 40, Style.Unit.PCT); // Init delete column final Column<ObjectProperty, String> deletePropertyColumnImg = new Column<ObjectProperty, String>(deleteCell) { @Override public String getValue(final ObjectProperty global) { return "Remove"; } }; deletePropertyColumnImg.setFieldUpdater( new FieldUpdater<ObjectProperty, String>() { public void update(final int index, final ObjectProperty property, final String value) { if (!isReadonly()) { checkAndDeleteDataObjectProperty(property, index); } } }); dataObjectPropertiesTable.addColumn(deletePropertyColumnImg); ColumnSortEvent.ListHandler<ObjectProperty> propertyTypeColHandler = new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList()); propertyTypeColHandler.setComparator( propertyTypeColumn, new ObjectPropertyComparator("className")); dataObjectPropertiesTable.addColumnSortHandler(propertyTypeColHandler); dataObjectPropertiesTable.getColumnSortList().push(propertyNameColumn); // Init the selection model SingleSelectionModel<ObjectProperty> selectionModel = new SingleSelectionModel<ObjectProperty>(); dataObjectPropertiesTable.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { ObjectProperty selectedProperty = ((SingleSelectionModel<ObjectProperty>) dataObjectPropertiesTable.getSelectionModel()) .getSelectedObject(); notifyFieldSelected(selectedProperty); } }); dataObjectPropertiesTable.setKeyboardSelectionPolicy( HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.BOUND_TO_SELECTION); dataObjectPropertiesTable.addCellPreviewHandler( new CellPreviewEvent.Handler<ObjectProperty>() { @Override public void onCellPreview(CellPreviewEvent<ObjectProperty> event) { if (showingObject && "click".equals(event.getNativeEvent().getType())) { int selectedRow = dataObjectPropertiesTable.getKeyboardSelectedRow(); if (lastSelectedRow >= 0 && lastSelectedRow == selectedRow) { ObjectProperty selectedProperty = dataObjectPropertiesProvider.getList().get(selectedRow); ((SingleSelectionModel<ObjectProperty>) dataObjectPropertiesTable.getSelectionModel()) .setSelected(selectedProperty, true); } showingObject = false; } } }); dataObjectPropertiesProvider.addDataDisplay(dataObjectPropertiesTable); dataObjectPropertiesProvider.refresh(); newPropertyButton.setIcon(IconType.PLUS); setReadonly(true); }
public void setList(ArrayList<Publication> list) { clearTable(); this.list.addAll(list); dataProvider.flush(); dataProvider.refresh(); }
/** * Add object as new row to table * * @param object Attribute to be added as new row */ public void addToTable(Attribute object) { list.add(object); dataProvider.flush(); dataProvider.refresh(); }