@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(); }
private void makeSelectionOnTaskDataGrid( MultiSelectionModel<TaskDataDto> model, List<TaskDataDto> tests) { if (selectTests) { if (!previousSelectedSet.isEmpty()) { for (TaskDataDto taskDataDto : tests) { for (TaskDataDto taskDataPrevious : previousSelectedSet) { if (taskDataDto.getTaskName().equals(taskDataPrevious.getTaskName())) { model.setSelected(taskDataDto, true); } } } SelectionChangeEvent.fire(testDataGrid.getSelectionModel()); } } else { Set<TestsMetrics> testsMetrics = place.getSelectedTestsMetrics(); for (TaskDataDto taskDataDto : tests) { for (TestsMetrics testMetric : testsMetrics) { if (testMetric.getTestName().equals(taskDataDto.getTaskName())) { model.setSelected(taskDataDto, true); } } } model.addSelectionChangeHandler(new TestSelectChangeHandler()); SelectionChangeEvent.fire(model); } previousSelectedSet.clear(); }
public void bind() { eventBus.addHandler(PlaceChangeEvent.TYPE, this); eventBus.addHandler(TestbedSelectedEvent.TYPE, this); eventBus.addHandler(ThrowableEvent.TYPE, this); eventBus.addHandler(WisemlLoadedEvent.TYPE, this); nodeSelectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { final Set<Node> nodes = nodeSelectionModel.getSelectedSet(); onNodeSelection(nodes); } }); nodeGroupSelectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { final Set<NodeGroup> nodeGroups = nodeGroupSelectionModel.getSelectedSet(); String selectedNodeGroups = "Selected node groups: { "; for (NodeGroup nodeGroup : nodeGroups) { selectedNodeGroups += nodeGroup.getName() + ";"; } selectedNodeGroups += " }"; GWT.log(selectedNodeGroups); onNodeGroupSelection(nodeGroups); } }); }
@Override public void setSelectedRow(SearchResultRow row) { boolean selected = true; Set<SearchResultRow> set = selection.getSelectedSet(); if (set != null && set.contains(row)) { selected = false; } clearSelection(); selection.setSelected(row, selected); updateSearchResultButtonStatus(); }
// TODO Provide consistent user interface for node selection private void onNodeSelection(final Set<Node> nodes) { for (Node node : nodes) { for (NodeGroup nodeGroup : nodeGroupSelectionModel.getSelectedSet()) { if (node.getNodeType().equals(nodeGroup.getName())) { nodeGroupSelectionModel.setSelected(nodeGroup, false); break; } } } eventBus.fireEvent(new UpdateNodesSelectedEvent(nodes)); }
private void selection(Boolean select) { if (dataProvider.getFilter() != null && !dataProvider.getFilter().isEmpty()) { selectionModel.clear(); for (int i = 0; i < dataProvider.resulted.size(); i++) { selectionModel.setSelected(dataProvider.resulted.get(i), select); } } else { selectionModel.clear(); for (int i = 0; i < data.size(); i++) { selectionModel.setSelected(data.get(i), select); } } }
public DeviceDiskViewImpl() { initWidget(uiBinder.createAndBindUi(this)); for (String pageSize : DevicePageSize.getPageSizeList()) { pageSizeList.addItem(pageSize); } pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex()); pageSizeList.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { DevicePageSize.setPageSizeSelectedIndex(pageSizeList.getSelectedIndex()); if (table != null) { table.setPageSize(DevicePageSize.getPageSize()); } } }); selection = new MultiSelectionModel<SearchResultRow>(SearchResultRow.KEY_PROVIDER); selection.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { updateSearchResultButtonStatus(); presenter.onSelectionChange(selection.getSelectedSet()); } }); updateSearchResultButtonStatus(); popup.setAutoHideEnabled(true); }
private void updateSearchResultButtonStatus() { int size = selection.getSelectedSet().size(); buttonAddDisk.setEnabled(true); buttonDeleteDisk.setEnabled(size != 0 && presenter.canDeleteDisk()); buttonModifyDisk.setEnabled(size == 1 && presenter.canModifyDisk()); buttonClearSelection.setEnabled(size != 0); }
/** Clear all table content */ public void clearTable() { loaderImage.loadingStart(); list.clear(); selectionModel.clear(); dataProvider.flush(); dataProvider.refresh(); }
@Override public void onSelectionChange(SelectionChangeEvent event) { Set<TaskDataDto> selected = ((MultiSelectionModel<TaskDataDto>) event.getSource()).getSelectedSet(); List<TaskDataDto> result = new ArrayList<TaskDataDto>(selected); TaskDataTreeViewModel taskDataTreeViewModel = (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel(); MultiSelectionModel<PlotNameDto> plotNameSelectionModel = taskDataTreeViewModel.getSelectionModel(); // chosen plots Set<PlotNameDto> plotTempSet = plotNameSelectionModel.getSelectedSet(); // chosen metrics Set<MetricNameDto> metricTempSet = metricPanel.getSelected(); chosenPlots.clear(); // Clear markings dto map markingsMap.clear(); taskDataTreeViewModel.clear(); plotNameSelectionModel.clear(); metricPanel.updateTests(result); taskDataTreeViewModel.populateTaskList(result); // Populate available plots tree level for each task for selected session for (TaskDataDto taskDataDto : result) { taskDataTreeViewModel .getPlotNameDataProviders() .put( taskDataDto, new TaskPlotNamesAsyncDataProvider(taskDataDto, summaryPanel.getSessionIds())); } summaryPanel.updateTests(result); if (selectTests) { makeSelectionForMetricPanel(metricTempSet, metricPanel, result); makeSelectionForTaskDetailsTree(plotTempSet, plotNameSelectionModel, result); } else { selectTests = true; ifItWasLink(result, metricPanel, taskDataTreeViewModel); } metricTempSet.clear(); plotTempSet.clear(); }
// TODO Provide consistent user interface for node selection private void onNodeGroupSelection(Set<NodeGroup> nodeGroups) { // Set the group's sub-nodes as selected for (NodeGroup nodeGroup : nodeGroups) { List<Node> nodes = nodeGroup.getNodes(); for (Node node : nodes) { nodeSelectionModel.setSelected(node, true); } } }
@Override public void init(ProcessDefinitionListPresenter presenter) { this.presenter = presenter; listContainer.add(processdefListGrid); listContainer.add(pager); processdefListGrid.setHeight("350px"); // Set the message to display when the table is empty. processdefListGrid.setEmptyTableWidget(new Label(constants.No_Process_Definitions_Available())); // Attach a column sort handler to the ListDataProvider to sort the list. sortHandler = new ListHandler<ProcessSummary>(presenter.getDataProvider().getList()); processdefListGrid.addColumnSortHandler(sortHandler); // Create a Pager to control the table. pager.setDisplay(processdefListGrid); pager.setPageSize(10); // Add a selection model so we can select cells. final MultiSelectionModel<ProcessSummary> selectionModel = new MultiSelectionModel<ProcessSummary>(); selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { selectedProcessDef = selectionModel.getSelectedSet(); for (ProcessSummary pd : selectedProcessDef) { processSelection.fire(new ProcessDefSelectionEvent(pd.getId())); } } }); processdefListGrid.setSelectionModel( selectionModel, DefaultSelectionEventManager.<ProcessSummary>createCheckboxManager()); initTableColumns(selectionModel); presenter.addDataDisplay(processdefListGrid); }
@Override public void clear() { setReadOnly(false); if (selection != null) { selection.clear(); } selectedPersons.clear(); personList.clear(); acceptableValues.clear(); person.setValue(null); person.setAcceptableValues(acceptableValues); }
private void updateTests(List<TaskDataDto> tests) { MultiSelectionModel<TaskDataDto> model = (MultiSelectionModel) testDataGrid.getSelectionModel(); previousSelectedSet.addAll(model.getSelectedSet()); model.clear(); testDataGrid.redraw(); testDataGrid.setRowData(tests); if (chosenSessions.size() == 1) { metricPanel.getSelectionModel().clear(); final boolean selectTestsFinal = selectTests; final String sessionId = chosenSessions.get(0); PlotProviderService.Async.getInstance() .getSessionScopePlotList( sessionId, new AsyncCallback<Set<String>>() { @Override public void onFailure(Throwable throwable) { throwable.printStackTrace(); } @Override public void onSuccess(Set<String> plotNames) { sessionPlotPanel.update(sessionId, plotNames); if (!selectTestsFinal) { sessionPlotPanel.setSelected(place.getSessionTrends()); } sessionPlotPanel .getSelectionModel() .addSelectionChangeHandler(new SessionScopePlotSelectionChangedHandler()); SelectionChangeEvent.fire(sessionPlotPanel.getSelectionModel()); } }); } makeSelectionOnTaskDataGrid(model, tests); }
@Override public void setPersons(List<Person> persons) { acceptableValues.clear(); if (persons != null) { acceptableValues.addAll(persons); } if (acceptableValues.size() > 0) { person.setValue(acceptableValues.get(0)); } person.setAcceptableValues(acceptableValues); if (selection != null) { selection.clear(); } selectedPersons.clear(); personList.clear(); }
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(); }
@UiHandler("add") public void onAdd(ClickEvent event) { Person pp = person.getValue(); if (pp == null) { return; } acceptableValues.remove(pp); if (acceptableValues.size() <= 0) { person.setValue(null); } else { person.setValue(acceptableValues.get(0)); } person.setAcceptableValues(acceptableValues); if (selection != null) { selection.setSelected(pp, true); } selectedPersons.add(pp); personList.setPersons(selectedPersons); }
/** Clears list of selected items */ public void clearTableSelectedSet() { selectionModel.clear(); }
/** * Return selected items from list * * @return return list of checked items */ public ArrayList<Publication> getTableSelectedList() { return JsonUtils.setToList(selectionModel.getSelectedSet()); }
/** * 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(); }
public void actualizarGrid() { this.setVisibleRangeAndClearData(this.getVisibleRange(), true); selectionModel.clear(); }
/** * Return selected items from list * * @return return list of checked items */ public ArrayList<TaskResult> getTableSelectedList() { return JsonUtils.setToList(selectionModel.getSelectedSet()); }
public void refresh() { selectionModel.clear(); cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(), true); }
@Override public Set<SearchResultRow> getSelectedSet() { return selection.getSelectedSet(); }
@UiHandler("getHyperlink") void getHyperlink(ClickEvent event) { MultiSelectionModel<SessionDataDto> sessionModel = (MultiSelectionModel) sessionsDataGrid.getSelectionModel(); MultiSelectionModel<TaskDataDto> testModel = (MultiSelectionModel) testDataGrid.getSelectionModel(); Set<SessionDataDto> sessions = sessionModel.getSelectedSet(); Set<TaskDataDto> tests = testModel.getSelectedSet(); Set<MetricNameDto> metrics = metricPanel.getSelected(); TaskDataTreeViewModel taskDataTreeViewModel = (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel(); Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet(); HashSet<String> sessionsIds = new HashSet<String>(); HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size()); HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size()); for (SessionDataDto session : sessions) { sessionsIds.add(session.getSessionId()); } for (TaskDataDto taskDataDto : tests) { TestsMetrics testsMetrics = new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>()); testsMetricses.add(testsMetrics); map.put(taskDataDto.getTaskName(), testsMetrics); } for (MetricNameDto metricNameDto : metrics) { map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName()); } for (PlotNameDto plotNameDto : trends) { map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName()); } TrendsPlace newPlace = new TrendsPlace( mainTabPanel.getSelectedIndex() == 0 ? NameTokens.SUMMARY : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS); newPlace.setSelectedSessionIds(sessionsIds); newPlace.setSelectedTestsMetrics(testsMetricses); newPlace.setSessionTrends(sessionPlotPanel.getSelected()); String linkText = Window.Location.getHost() + Window.Location.getPath() + Window.Location.getQueryString() + "#" + new JaggerPlaceHistoryMapper().getToken(newPlace); linkText = URL.encode(linkText); // create a dialog for copy link final DialogBox dialog = new DialogBox(false, true); dialog.setText("Share link"); dialog.setModal(true); dialog.setAutoHideEnabled(true); dialog.setPopupPosition(event.getClientX(), event.getClientY()); final TextArea textArea = new TextArea(); textArea.setText(linkText); textArea.setWidth("300px"); textArea.setHeight("40px"); // select text Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { textArea.setVisible(true); textArea.setFocus(true); textArea.selectAll(); } }); dialog.add(textArea); dialog.show(); }
@Override public void clearSelection() { selection.clear(); }
@Override public Boolean getValue(PrecioItemProxy object) { // Get the value from the selection model. return selectionModel.isSelected(object); }
@UiHandler("uncheckSessionsButton") void handleUncheckSessionsButtonClick(ClickEvent e) { MultiSelectionModel model = (MultiSelectionModel<?>) sessionsDataGrid.getSelectionModel(); model.clear(); }