mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-03 01:29:33 +00:00
datamining-reports: added a few comments and did some formatting
This commit is contained in:
1 parent
7250b68253
commit
f0e541bb5f
5 files changed
+34
-24
No files matched your search
-9
@@ -221,7 +221,6 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
ArrayList<StatisticQueryDefinitionDTO> queryDefinitions = new ArrayList<>(StreamSupport
|
||||
.stream(resultsPresenter.getPresenterIds().spliterator(), false)
|
||||
.map(resultsPresenter::getQueryDefinition).filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
|
||||
if (!queryDefinitions.isEmpty()) {
|
||||
for (int i = 0; i < queryDefinitions.size(); i++) {
|
||||
DataRetrieverChainDefinitionDTO retrieverChain = queryDefinitions.get(i).getDataRetrieverChainDefinition();
|
||||
@@ -230,9 +229,7 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
throw new IllegalStateException("The parameters retriever level is not contained by the associated queries data retriever definition");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Check for unused parameters and ask if they should be removed
|
||||
|
||||
return new ModifiableDataMiningReportDTO(queryDefinitions, new ModifiableDataMiningReportParametersDTO(filterParameters));
|
||||
} else {
|
||||
return null;
|
||||
@@ -244,12 +241,10 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
DataMiningReportDTO report = storedReport.getReport();
|
||||
filterParameters = new ModifiableDataMiningReportParametersDTO(report.getParameters());
|
||||
ArrayList<StatisticQueryDefinitionDTO> reportQueries = report.getQueryDefinitions();
|
||||
|
||||
SequentialQueryExecutor executor = new SequentialQueryExecutor(reportQueries);
|
||||
executor.run(results -> {
|
||||
resultsPresenter.showResults(results);
|
||||
DataMiningEventBus.fire(new FilterParametersChangedEvent(filterParameters, resultsPresenter.getCurrentPresenterIndex()));
|
||||
|
||||
showBusyIndicator(false);
|
||||
if (!executor.hasErrorOccurred()) {
|
||||
Notification.notify(
|
||||
@@ -276,17 +271,14 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
oracle.clear();
|
||||
oracle.addAll(collection);
|
||||
oracle.setDefaultSuggestionsFromText(collection);
|
||||
|
||||
loadReportButtonUi.setEnabled(!collection.isEmpty());
|
||||
removeReportButtonUi.setEnabled(!collection.isEmpty());
|
||||
updateSaveLoadButtons();
|
||||
}
|
||||
|
||||
private class SequentialQueryExecutor {
|
||||
|
||||
private final List<StatisticQueryDefinitionDTO> queryDefinitions;
|
||||
private final Collection<Pair<StatisticQueryDefinitionDTO, QueryResultDTO<?>>> queriesWithResults = new ArrayList<>();
|
||||
|
||||
private boolean errorOccurred = false;
|
||||
private Consumer<Collection<Pair<StatisticQueryDefinitionDTO, QueryResultDTO<?>>>> callback;
|
||||
|
||||
@@ -329,6 +321,5 @@ public class DataMiningReportStoreControls extends Composite {
|
||||
public boolean hasErrorOccurred() {
|
||||
return errorOccurred;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-1
@@ -5,7 +5,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public interface DataMiningReportParametersDTO extends Serializable {
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
HashSet<FilterDimensionParameter> getAll();
|
||||
|
||||
-2
@@ -77,7 +77,6 @@ public class ModifiableDataMiningReportParametersDTO implements DataMiningReport
|
||||
if (!parameters.contains(parameter)) {
|
||||
throw new IllegalArgumentException("Cannot add usage of parameter that is not conained");
|
||||
}
|
||||
|
||||
HashSet<FilterDimensionParameter> usages = this.usages.get(key);
|
||||
if (usages == null) {
|
||||
usages = new HashSet<>();
|
||||
@@ -116,5 +115,4 @@ public class ModifiableDataMiningReportParametersDTO implements DataMiningReport
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
}
|
||||
+9
-7
@@ -72,6 +72,13 @@ import com.sap.sse.gwt.client.shared.components.Component;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sse.gwt.client.shared.settings.ComponentContext;
|
||||
|
||||
/**
|
||||
* The UI component that allows the user to select filter values for a single dimension. The component
|
||||
* consists of a label with the dimension's name, a search toggle button that shows/hides a search/filter
|
||||
* text box, and a "data grid" with a check box column and the dimension values that pass all retriever
|
||||
* levels and dimension filters up to the point where this dimension filter occurs in the left-to-right
|
||||
* arrangement of several components of this type.
|
||||
*/
|
||||
public class DimensionFilterSelectionProvider extends AbstractDataMiningComponent<SerializableSettings> {
|
||||
|
||||
private static final DataMiningResources Resources = GWT.create(DataMiningResources.class);
|
||||
@@ -275,7 +282,6 @@ public class DimensionFilterSelectionProvider extends AbstractDataMiningComponen
|
||||
}
|
||||
HashSet<FunctionDTO> dimensions = new HashSet<>();
|
||||
dimensions.add(dimension);
|
||||
|
||||
availableData.clear();
|
||||
counter.increase();
|
||||
contentContainer.remove(dataGrid);
|
||||
@@ -285,25 +291,21 @@ public class DimensionFilterSelectionProvider extends AbstractDataMiningComponen
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void handleSuccess(QueryResultDTO<HashSet<Object>> result) {
|
||||
Map<GroupKey, HashSet<Object>> results = result.getResults();
|
||||
List<Serializable> sortedData = new ArrayList<>();
|
||||
|
||||
final Map<GroupKey, HashSet<Object>> results = result.getResults();
|
||||
final List<Serializable> sortedData = new ArrayList<>();
|
||||
if (!results.isEmpty()) {
|
||||
GroupKey contentKey = new GenericGroupKey<FunctionDTO>(dimension);
|
||||
availableData.addAll((Collection<? extends Serializable>) results.get(contentKey));
|
||||
sortedData.addAll(availableData);
|
||||
sortedData.sort((o1, o2) -> NaturalComparator.compare(o1.toString(), o2.toString()));
|
||||
}
|
||||
|
||||
busyIndicator.setBusy(false);
|
||||
filterPanel.updateAll(sortedData);
|
||||
contentContainer.add(dataGrid);
|
||||
|
||||
internalSetSelection(selectionToBeApplied != null ? selectionToBeApplied : selectionModel.getSelectedSet(),
|
||||
selectionCallback != null ? selectionCallback : m -> { });
|
||||
selectionToBeApplied = null;
|
||||
selectionCallback = null;
|
||||
|
||||
if (callback != null) {
|
||||
callback.run();
|
||||
}
|
||||
|
||||
+25
-5
@@ -70,6 +70,19 @@ import com.sap.sse.gwt.client.shared.components.Component;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sse.gwt.client.shared.settings.ComponentContext;
|
||||
|
||||
/**
|
||||
* A UI component that shows a list with dimensions, grouped by their retriever levels, from which the user can select
|
||||
* those dimensions for which he/she wants to specify filter conditions. For each dimension selected from the list, a
|
||||
* {@link DimensionFilterSelectionProvider} is added dynamically to a horizontally expanding sequence of those dimension
|
||||
* filter controls.
|
||||
* <p>
|
||||
*
|
||||
* As the user adds filter conditions for dimensions, only dimension values that pass those filters are displayed in
|
||||
* those dimension filter controls further to the right. For example, if the user starts out by filtering by boat class
|
||||
* name and selects only the "6mR" boat class, then adds a dimension filter for regatta name, then only those regattas
|
||||
* in the 6mR boat class are displayed in the dimension filter list to the right of the boat class dimension filter
|
||||
* column.
|
||||
*/
|
||||
public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDataMiningComponent<SerializableSettings> implements FilterSelectionProvider {
|
||||
|
||||
private static final String DimensionListSubheaderAttribute = "subheader";
|
||||
@@ -99,6 +112,12 @@ public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDa
|
||||
|
||||
private final AbstractFilterablePanel<DimensionWithContext> filterFilterDimensionsPanel;
|
||||
private final MultiSelectionModel<DimensionWithContext> filterDimensionSelectionModel;
|
||||
|
||||
/**
|
||||
* The list of dimensions from which the user can select for filtering by those dimensions selected;
|
||||
* The grid is split into sections that correspond to retriever levels; each such retriever level
|
||||
* section shows a corresponding heading.
|
||||
*/
|
||||
private final DataGrid<DimensionWithContext> filterDimensionsList;
|
||||
private final Column<DimensionWithContext, Boolean> checkboxColumn;
|
||||
|
||||
@@ -435,7 +454,6 @@ public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDa
|
||||
removeDimensionFilterSelectionProvider(displayedDimension);
|
||||
}
|
||||
}
|
||||
|
||||
for (DimensionWithContext selectedDimension : filterDimensionSelectionModel.getSelectedSet()) {
|
||||
if (!dimensionFilterSelectionProviders.containsKey(selectedDimension)) {
|
||||
addDimensionFilterSelectionProvider(selectedDimension);
|
||||
@@ -443,12 +461,11 @@ public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDa
|
||||
}
|
||||
}
|
||||
|
||||
private DimensionFilterSelectionProvider addDimensionFilterSelectionProvider(DimensionWithContext dimension) {
|
||||
DimensionFilterSelectionProvider selectionProvider = new DimensionFilterSelectionProvider(this, getComponentContext(),
|
||||
private DimensionFilterSelectionProvider addDimensionFilterSelectionProvider(final DimensionWithContext dimension) {
|
||||
final DimensionFilterSelectionProvider selectionProvider = new DimensionFilterSelectionProvider(this, getComponentContext(),
|
||||
dataMiningService, errorReporter, session, retrieverChainProvider, this, dimension.getRetrieverLevel(), dimension.getDimension());
|
||||
selectionProvider.addListener(() -> filterSelectionChanged(dimension));
|
||||
dimensionFilterSelectionProviders.put(dimension, selectionProvider);
|
||||
|
||||
DimensionWithContext nextDimension = null;
|
||||
for (DimensionWithContext displayedDimension : dimensionFilterSelectionProviders.keySet()) {
|
||||
if (displayedDimension.compareTo(dimension) > 0 &&
|
||||
@@ -458,7 +475,6 @@ public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDa
|
||||
}
|
||||
Widget beforeWidget = nextDimension != null ? dimensionFilterSelectionProviders.get(nextDimension).getEntryWidget() : null;
|
||||
dimensionFilterSelectionProvidersPanel.insertWest(selectionProvider.getEntryWidget(), FilterSelectionTableWidth, beforeWidget);
|
||||
|
||||
return selectionProvider;
|
||||
}
|
||||
|
||||
@@ -676,6 +692,10 @@ public class HierarchicalDimensionListFilterSelectionProvider extends AbstractDa
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsible for grouping the dimensions by their retriever level and inserting headings for each
|
||||
* such retriever level
|
||||
*/
|
||||
private class FilterDimensionsListBuilder extends BaseCellTableBuilder<DimensionWithContext> {
|
||||
|
||||
private final String headerStyle;
|
||||
|
||||
Reference in new issue
Block a user