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(); } } }
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); }
public void setNavigationTreeModel(List<NavigationTreeElement> navigationTreeRootElements) { if (rootDataProvider != null) { rootDataProvider.getList().clear(); for (NavigationTreeElement navigationTreeRootElement : navigationTreeRootElements) { rootDataProvider.getList().addAll(navigationTreeRootElement.getChildren()); } } }
public void setFBAResultData(KBWorkspaceObjectData fbaResultData) { if (fbaResultData == null) return; fbaDataProvider.getList().clear(); fbaDataProvider.getList().add(fbaResultData); fbaTableSelection = fbaDataProvider.getList().get(0); setState(State.FBA_SELECTED); }
public void setModelData(KBWorkspaceObjectData modelData) { if (modelData == null) return; modelDataProvider.getList().clear(); modelDataProvider.getList().add(modelData); modelTableSelection = modelDataProvider.getList().get(0); setState(State.MODEL_SELECTED); }
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(); } } }
@UiHandler("buttonBuy") public void acceptBuy(ClickEvent e) { // RootPanel.get("page2"); Window.alert( "Le système de paiement est actuellement en maintenance, merci de votre compréhension."); List<Reservation> l = new ArrayList<Reservation>(); for (Offre o : listOffers.getList()) { Reservation r = new Reservation(); r.setIdOffre(o.getId()); r.setIdUtilisateur(4); l.add(r); } service.doReservation( "", l, "09090909090", new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub } @Override public void onSuccess(Void result) {} }); }
@SuppressWarnings("unchecked") @Override protected void createColumns( DefaultCellTable<ArtifactReference> table, ListDataProvider<ArtifactReference> dataProvider) { final TextColumn<ArtifactReference> nameColumn = new TextColumn<ArtifactReference>() { @Override public String getValue(ArtifactReference reference) { return reference.getName(); } }; nameColumn.setSortable(true); final TextColumn<ArtifactReference> urlColumn = new TextColumn<ArtifactReference>() { @Override public String getValue(ArtifactReference reference) { return reference.getUrl(); } }; urlColumn.setSortable(true); ColumnSortEvent.ListHandler<ArtifactReference> sortHandler = new ColumnSortEvent.ListHandler<ArtifactReference>(dataProvider.getList()); sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn)); sortHandler.setComparator(urlColumn, createColumnCommparator(urlColumn)); table.addColumn(nameColumn, "Name"); table.addColumn(urlColumn, "URL"); table.addColumnSortHandler(sortHandler); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(urlColumn); table.getColumnSortList().push(nameColumn); }
@Override public void renderRows(List<EntityModalPresenter.VariableValueRow> rows) { dataProvider.setList(rows); pager.firstPage(); dataProvider.refresh(); pager.setPagerVisible(dataProvider.getList().size() > pager.getPageSize()); }
@UiHandler("btnRefresh") void refreshRecords(ClickEvent e) { recordStore.getList().clear(); clientApi .iitemsApi() .list( new MethodCallback<List<InputItem>>() { @Override public void onFailure(Method method, Throwable e) { md.error(MDS, "Error loading user data", e); } @Override public void onSuccess(Method method, List<InputItem> recs) { Collections.sort( recs, new Comparator<InputItem>() { @Override public int compare(InputItem o1, InputItem o2) { return o1.getName().compareTo(o2.getName()); } }); recordStore.getList().addAll(recs); md.clear(MDS); } }); // TODO not sure it should be here (or: should it be loaded in sequential way ?) loadInputsList(); loadTxFormsList(); }
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); } }
public void select(String key) { for (Property property : dataProvider.getList()) { if (property.getName().equals(key)) { selectionModel.setSelected(property, true); break; } } }
public void showReport(final AnalysisReport report) { currentReport = report; if (!report.getAnalysisData().isEmpty()) { placeManager.goTo(IDENTIFIER); } else { placeManager.closePlace(IDENTIFIER); } dataProvider.setList(report.getAnalysisData()); if (dataProvider.getList().isEmpty()) { view.clearIssue(); } else { view.show(dataProvider.getList().get(0)); } }
@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()); }
/** * Query all contacts for the specified category. * * @param category the category * @return the list of contacts in the category */ public List<ContactInfo> queryContactsByCategory(Category category) { List<ContactInfo> matches = new ArrayList<ContactInfo>(); for (ContactInfo contact : dataProvider.getList()) { if (contact.getCategory() == category) { matches.add(contact); } } return matches; }
@EventHandler("createButton") public void createButton(ClickEvent e) { presenter.createJob( jobNameText.getText(), UTCDateBox.utc2date(jobDueDate.getValue() + jobDueDateTime.getValue()), jobTypeText.getText(), dataTriesNumber.getValue(), dataProvider.getList()); }
public void updateDirectory(Entry dir, List<Entry> entries) { // keep a history history.push(dir); fileSystemProvider.getList().clear(); fileSystemProvider.getList().addAll(entries); updateBreadcrump(); }
@UiHandler("btnCancel") void cancelChanges(ClickEvent e) { recordStore.getList().clear(); changedRecs.clear(); removedRecs.clear(); editMode(false); refreshRecords(e); md.clear(MDS); }
public void onSave(SaveCommand saveCommand) { data.content = ""; for (EnumRow enumRow : dataProvider.getList()) { data.content += enumRow.getText() + "\n"; } saveCommand.save(); }
@UiHandler("btnRemove") void removeRecord(ClickEvent e) { InputItem user = selectionModel.getSelectedObject(); if (user != null) { changedRecs.remove(user.getId()); removedRecs.put(user.getId(), user); recordStore.getList().remove(user); editMode(true); } }
/** * Query all contacts for the specified category that begin with the specified first name prefix. * * @param category the category * @param firstNamePrefix the prefix of the first name * @return the list of contacts in the category */ public List<ContactInfo> queryContactsByCategoryAndFirstName( Category category, String firstNamePrefix) { List<ContactInfo> matches = new ArrayList<ContactInfo>(); for (ContactInfo contact : dataProvider.getList()) { if (contact.getCategory() == category && contact.getFirstName().startsWith(firstNamePrefix)) { matches.add(contact); } } return matches; }
@Override public void updateDeploymentInfo(List<DeploymentRecord> deployments) { dataProvider.getList().clear(); dataProvider.getList().addAll(deployments); dataProvider.flush(); deploymentTable.selectDefaultEntity(); filter.reset(true); }
private void initMockData( final Pagination pagination, final SimplePager simplePager, final ListDataProvider<TableTestPojo> dataProvider) { for (int i = 0; i < 25; i++) { dataProvider.getList().add(new TableTestPojo("Test " + i, "Test " + i, "Test " + i)); } dataProvider.flush(); pagination.rebuild(simplePager); }
public void setLoadingData(ListDataProvider<T> dataProvider, Collection<? extends T> data) { if (data == null) { setEmptyTableWidget(getLoadingIndicator()); dataProvider.getList().clear(); } else { setEmptyTableWidget(emptyTableWidget); ClientUtils.replaceListDataProviderContents(dataProvider, data); ColumnSortEvent.fire(this, getColumnSortList()); } redraw(); }
@Override public void onReset() { super.onReset(); DataTable data = getStatisticsData(phenotypeDataProvider.getList()); DataView value_view = DataView.create(data); value_view.setColumns(new int[] {0, 1}); DataView info_view = DataView.create(data); info_view.setColumns(new int[] {0, 2, 3, 4}); getView().clearStatistics(); getView().drawValueStatistics(value_view); getView().drawInfoStatistics(info_view); }
@Override protected void createColumns( DefaultCellTable<Transformer> table, ListDataProvider<Transformer> dataProvider) { TextColumn<Transformer> fromColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getFrom(); } }; fromColumn.setSortable(true); TextColumn<Transformer> toColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getTo(); } }; toColumn.setSortable(true); TextColumn<Transformer> typeColumn = new TextColumn<Transformer>() { @Override public String getValue(Transformer transform) { return transform.getType(); } }; typeColumn.setSortable(true); ColumnSortEvent.ListHandler<Transformer> sortHandler = new ColumnSortEvent.ListHandler<Transformer>(dataProvider.getList()); sortHandler.setComparator(fromColumn, createColumnCommparator(fromColumn)); sortHandler.setComparator(toColumn, createColumnCommparator(toColumn)); sortHandler.setComparator(typeColumn, createColumnCommparator(typeColumn)); table.addColumn(fromColumn, "From"); table.addColumn(toColumn, "To"); table.addColumn(typeColumn, "Type"); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(typeColumn); table.getColumnSortList().push(toColumn); table.getColumnSortList().push(fromColumn); table.setWidth("100%", false); table.setColumnWidth(fromColumn, 45, Style.Unit.PCT); table.setColumnWidth(toColumn, 45, Style.Unit.PCT); table.setColumnWidth(typeColumn, 10, Style.Unit.PCT); }
public void update(Property prop) { permissionMapping = prop.getName(); if (prop.getValue().hasDefined("permissions")) { List<ModelNode> models = prop.getValue().get("permissions").asList(); table.setRowCount(models.size(), true); List<ModelNode> dataList = dataProvider.getList(); dataList.clear(); // cannot call setList() as that breaks the sort handler dataList.addAll(models); } else { clearValues(); } selectionModel.clear(); }
/** * Return table widget with external sources * * @return table widget containing ext sources */ public CellTable<ExtSource> getTable() { // retrieve data retrieveData(); // Table data provider. dataProvider = new ListDataProvider<ExtSource>(list); // Cell table table = new PerunTable<ExtSource>(list); // Connect the table to the data provider. dataProvider.addDataDisplay(table); // Sorting ListHandler<ExtSource> columnSortHandler = new ListHandler<ExtSource>(dataProvider.getList()); table.addColumnSortHandler(columnSortHandler); // table selection table.setSelectionModel( selectionModel, DefaultSelectionEventManager.<ExtSource>createCheckboxManager()); // set empty content & loader table.setEmptyTableWidget(loaderImage); loaderImage.setEmptyResultMessage("No external sources found in Perun."); // checkable if (this.checkable) { table.addCheckBoxColumn(); } // ID column table.addIdColumn("Ext. source ID", null); // Name column table.addNameColumn(null); // Type column TextColumn<ExtSource> typeColumn = new TextColumn<ExtSource>() { @Override public String getValue(ExtSource extSource) { return String.valueOf(renameContent(extSource.getType())); } }; table.addColumn(typeColumn, "Type"); // return cellTable return table; }
public void update(Property prop) { authContextName = prop.getName(); if (prop.getValue().hasDefined(MATCH_RULES)) { List<ModelNode> models = prop.getValue().get(MATCH_RULES).asList(); table.setRowCount(models.size(), true); List<ModelNode> dataList = dataProvider.getList(); dataList.clear(); dataList.addAll(models); } else { clearValues(); } selectionModel.clear(); }
@UiHandler("btnAdd") void addRecord(ClickEvent e) { InputItem rec = new InputItem(); rec.setName("NEW"); String dt = ClientUtil.TSTAMP_FORMAT0.format(new Date()); rec.setTstart(ClientUtil.parseUnixTime(dt.substring(0, 7) + "-01 09:00:00")); rec.setTstop(ClientUtil.parseUnixTime("2020-01-01 17:00:00")); rec.setActive(1); rec.setTxFormid(0); rec.setInputId(0); rec.setComment(""); recordStore.getList().add(0, rec); changedRecs.put(rec.getId(), rec); editMode(true); }