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); }
@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)); }
@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(); }
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); }
/** * 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(); }
/** * Return selected items from list * * @return return list of checked items */ public ArrayList<TaskResult> getTableSelectedList() { return JsonUtils.setToList(selectionModel.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 Set<SearchResultRow> getSelectedSet() { return selection.getSelectedSet(); }