mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-07 21:01:03 +00:00
Updated the StatisticProvider of the data mining UI
This commit is contained in:
1 parent
b2d079324b
commit
f0bef8977a
24 files changed
+294
-461
No files matched your search
+3
-4
@@ -6,19 +6,18 @@ import java.util.Map;
|
||||
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
import com.sap.sse.datamining.shared.components.GrouperType;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
|
||||
public interface QueryDefinitionDeprecated extends Serializable {
|
||||
|
||||
public String getLocaleInfoName();
|
||||
|
||||
public FunctionDTO getExtractionFunction();
|
||||
|
||||
public GrouperType getGrouperType();
|
||||
|
||||
public StatisticType getStatisticType();
|
||||
|
||||
public AggregatorType getAggregatorType();
|
||||
|
||||
public DataTypes getDataType();
|
||||
|
||||
public List<DimensionIdentifier> getDimensionsToGroupBy();
|
||||
|
||||
public Map<DimensionIdentifier, Iterable<? extends Serializable>> getSelection();
|
||||
|
||||
+6
-14
@@ -6,22 +6,20 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.DimensionIdentifier;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
import com.sap.sse.datamining.shared.components.GrouperType;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
|
||||
public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated {
|
||||
private static final long serialVersionUID = 8408302866342877839L;
|
||||
|
||||
private String localeInfoName;
|
||||
|
||||
private FunctionDTO extractionFunction;
|
||||
private GrouperType grouperType;
|
||||
private StatisticType statisticType;
|
||||
private AggregatorType aggregatorType;
|
||||
private DataTypes dataType;
|
||||
|
||||
private List<DimensionIdentifier> dimensionsToGroupBy;
|
||||
private Map<DimensionIdentifier, Iterable<? extends Serializable>> selectionMappedByDimension;
|
||||
@@ -32,12 +30,11 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
|
||||
@Deprecated
|
||||
QueryDefinitionDeprecatedImpl() { }
|
||||
|
||||
public QueryDefinitionDeprecatedImpl(String localeInfoName, GrouperType grouperType, StatisticType statisticType, AggregatorType aggregatorType, DataTypes dataType) {
|
||||
public QueryDefinitionDeprecatedImpl(String localeInfoName, GrouperType grouperType, FunctionDTO extractionFunction, AggregatorType aggregatorType) {
|
||||
this.localeInfoName = localeInfoName;
|
||||
this.grouperType = grouperType;
|
||||
this.statisticType = statisticType;
|
||||
this.extractionFunction = extractionFunction;
|
||||
this.aggregatorType = aggregatorType;
|
||||
this.dataType = dataType;
|
||||
|
||||
dimensionsToGroupBy = new ArrayList<DimensionIdentifier>();
|
||||
selectionMappedByDimension = new HashMap<DimensionIdentifier, Iterable<? extends Serializable>>();
|
||||
@@ -54,8 +51,8 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticType getStatisticType() {
|
||||
return statisticType;
|
||||
public FunctionDTO getExtractionFunction() {
|
||||
return extractionFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,11 +60,6 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
|
||||
return aggregatorType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataTypes getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DimensionIdentifier> getDimensionsToGroupBy() {
|
||||
return dimensionsToGroupBy;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ public class QueryDefinitionConverter {
|
||||
|
||||
public static QueryDefinition convertDeprecatedQueryDefinition(QueryDefinitionDeprecated queryDefinitionDeprecated) {
|
||||
QueryDefinitionImpl queryDefinition = new QueryDefinitionImpl(queryDefinitionDeprecated.getLocaleInfoName(),
|
||||
DeprecatedEnumsToFunctionDTOConverter.getFunctionDTOFor(queryDefinitionDeprecated.getStatisticType()),
|
||||
queryDefinitionDeprecated.getExtractionFunction(),
|
||||
queryDefinitionDeprecated.getAggregatorType());
|
||||
|
||||
for (Entry<DimensionIdentifier, Iterable<? extends Serializable>> filterSelectionEntry : queryDefinitionDeprecated.getSelection()
|
||||
|
||||
@@ -210,7 +210,3 @@ input.magnifier {
|
||||
-webkit-border-radius: 0px 3px 3px 0px;
|
||||
border-radius: 0px 3px 3px 0px;
|
||||
}
|
||||
|
||||
.dataTypeLabel {
|
||||
font-weight: bold;
|
||||
}
|
||||
+1
-2
@@ -969,9 +969,8 @@ public interface StringMessages extends Messages {
|
||||
String rerunQueryAfterRefreshTooltip();
|
||||
String queryDefinitionProvider();
|
||||
String statisticProvider();
|
||||
String toCalculateThe();
|
||||
String calculateThe();
|
||||
String groupingProvider();
|
||||
String use();
|
||||
String releaseNotes();
|
||||
String hasSplitFleetContiguousScoring();
|
||||
String eventOverview();
|
||||
|
||||
+1
-2
@@ -955,8 +955,7 @@ runAutomaticallyTooltip=Run the query automatically, after you changed e.g. the
|
||||
rerunQueryAfterRefreshTooltip=Reruns the query after the tables have been refreshed.
|
||||
queryDefinitionProvider=Query Definition Provider
|
||||
statisticProvider=Statistic Provider
|
||||
toCalculateThe=to calculate the
|
||||
use=Use
|
||||
calculateThe=Calculate the
|
||||
groupingProvider=Grouping Provider
|
||||
releaseNotes=News and Release History
|
||||
hasSplitFleetContiguousScoring=Split fleets scored contiguously
|
||||
|
||||
+1
-2
@@ -951,8 +951,7 @@ runAutomaticallyTooltip=Führe die Anfrage automatisch durch, wenn zum Beispiel
|
||||
rerunQueryAfterRefreshTooltip=Wiederholt die Anfrage nachdem die Tabellen aktualisiert wurden.
|
||||
queryDefinitionProvider=Anfragen-Definitions-Versorger
|
||||
statisticProvider=Statistik-Versorger
|
||||
toCalculateThe=zur Berechnung von
|
||||
use=Verwende
|
||||
calculateThe=Berechne die
|
||||
groupingProvider=Gruppierungs-Versorger
|
||||
releaseNotes=Neuigkeiten und Änderungshistorie
|
||||
hasSplitFleetContiguousScoring=Gruppen durchgängig bepunkten
|
||||
|
||||
+1
-2
@@ -947,8 +947,7 @@ runAutomaticallyTooltip=Запустить запрос автоматическ
|
||||
rerunQueryAfterRefreshTooltip=Повторно запускает запрос после обновления таблиц.
|
||||
queryDefinitionProvider=Поставщик определения запроса
|
||||
statisticProvider=Поставщик статистических данных
|
||||
toCalculateThe=для расчета
|
||||
use=Использовать
|
||||
calculateThe=Calculate the
|
||||
groupingProvider=Поставщик группировки
|
||||
releaseNotes=Новости и история выпусков
|
||||
hasSplitFleetContiguousScoring=Разделить флоты, имеющие близкие количества очков
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.components;
|
||||
|
||||
import com.google.gwt.text.shared.AbstractRenderer;
|
||||
|
||||
public abstract class AbstractObjectRenderer<T> extends AbstractRenderer<T> {
|
||||
|
||||
@Override
|
||||
public String render(T object) {
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
return convertObjectToString(object);
|
||||
}
|
||||
|
||||
protected abstract String convertObjectToString(T nonNullObject);
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.components;
|
||||
|
||||
/**
|
||||
* Simple renderer, that uses the objects toString method to render.
|
||||
*/
|
||||
public class SimpleObjectRenderer<T> extends AbstractObjectRenderer<T> {
|
||||
|
||||
@Override
|
||||
protected String convertObjectToString(T object) {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.components;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gwt.text.shared.Renderer;
|
||||
import com.google.gwt.user.client.ui.ValueListBox;
|
||||
|
||||
/**
|
||||
* A simple implementation of {@link ValueListBox}, that uses the <code>toString()</code>-Method to render it's content.
|
||||
*
|
||||
* @author Lennart
|
||||
* @see Renderer
|
||||
*/
|
||||
public class SimpleValueListBox<T> extends ValueListBox<T> {
|
||||
|
||||
public SimpleValueListBox() {
|
||||
super(new Renderer<T>() {
|
||||
@Override
|
||||
public String render(T object) {
|
||||
if (object == null) {
|
||||
return "";
|
||||
}
|
||||
return object.toString();
|
||||
}
|
||||
@Override
|
||||
public void render(T object, Appendable appendable) throws IOException {
|
||||
appendable.append(render(object));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+11
-17
@@ -4,7 +4,6 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.i18n.client.LocaleInfo;
|
||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
@@ -15,10 +14,6 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.RootLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.SplitLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.DimensionIdentifier;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sailing.datamining.shared.impl.QueryDefinitionDeprecatedImpl;
|
||||
import com.sap.sailing.gwt.ui.client.AbstractEntryPoint;
|
||||
import com.sap.sailing.gwt.ui.client.GlobalNavigationPanel;
|
||||
import com.sap.sailing.gwt.ui.client.LogoAndTitlePanel;
|
||||
@@ -32,8 +27,6 @@ import com.sap.sailing.gwt.ui.datamining.presentation.ResultsChart;
|
||||
import com.sap.sailing.gwt.ui.datamining.selection.QueryDefinitionProviderWithControls;
|
||||
import com.sap.sailing.gwt.ui.datamining.settings.QueryRunnerSettings;
|
||||
import com.sap.sailing.gwt.ui.datamining.settings.RefreshingSelectionTablesSettings;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
import com.sap.sse.datamining.shared.components.GrouperType;
|
||||
import com.sap.sse.gwt.client.EntryPointHelper;
|
||||
|
||||
public class DataMiningEntryPoint extends AbstractEntryPoint {
|
||||
@@ -56,24 +49,25 @@ public class DataMiningEntryPoint extends AbstractEntryPoint {
|
||||
|
||||
DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX);
|
||||
dockPanel.addNorth(createLogoAndTitlePanel(), 68);
|
||||
QueryDefinitionProviderWithControls queryDefinitionProviderWithControls = new QueryDefinitionProviderWithControls(stringMessages, sailingService, this);
|
||||
QueryDefinitionProvider queryDefinitionProvider = queryDefinitionProviderWithControls;
|
||||
queryDefinitionProvider.getEntryWidget().addStyleName("dataMiningPanel");
|
||||
dockPanel.add(queryDefinitionProvider.getEntryWidget());
|
||||
QueryDefinitionProviderWithControls queryDefinitionProviderWithControls = new QueryDefinitionProviderWithControls(stringMessages, sailingService, dataMiningService, this);
|
||||
queryDefinitionProviderWithControls.getEntryWidget().addStyleName("dataMiningPanel");
|
||||
dockPanel.add(queryDefinitionProviderWithControls.getEntryWidget());
|
||||
|
||||
ResultsPresenter<Number> resultsPresenter = new ResultsChart(stringMessages);
|
||||
splitPanel.addSouth(resultsPresenter.getWidget(), 400);
|
||||
|
||||
splitPanel.add(dockPanel);
|
||||
|
||||
QueryRunner queryRunner = new SimpleQueryRunner(stringMessages, dataMiningService, this, queryDefinitionProvider, resultsPresenter);
|
||||
QueryRunner queryRunner = new SimpleQueryRunner(stringMessages, dataMiningService, this, queryDefinitionProviderWithControls, resultsPresenter);
|
||||
queryDefinitionProviderWithControls.addControl(queryRunner.getEntryWidget());
|
||||
queryDefinitionProviderWithControls.addControl(createSettingsControlWidget(queryRunner, queryDefinitionProvider));
|
||||
queryDefinitionProviderWithControls.addControl(createSettingsControlWidget(queryRunner, queryDefinitionProviderWithControls));
|
||||
|
||||
QueryDefinitionDeprecatedImpl queryDefinition = new QueryDefinitionDeprecatedImpl(LocaleInfo.getCurrentLocale().getLocaleName(), GrouperType.Dimensions, StatisticType.Speed, AggregatorType.Average, DataTypes.GPSFix);
|
||||
queryDefinition.appendDimensionToGroupBy(DimensionIdentifier.RegattaName);
|
||||
queryDefinitionProvider.applyQueryDefinition(queryDefinition);
|
||||
queryRunner.run(queryDefinitionProvider.getQueryDefinition());
|
||||
//TODO Is it possible to define a 'standard' query, when the available query definition parts are fetched from the server?
|
||||
|
||||
// QueryDefinitionDeprecatedImpl queryDefinition = new QueryDefinitionDeprecatedImpl(LocaleInfo.getCurrentLocale().getLocaleName(), GrouperType.Dimensions, StatisticType.Speed, AggregatorType.Average, DataTypes.GPSFix);
|
||||
// queryDefinition.appendDimensionToGroupBy(DimensionIdentifier.RegattaName);
|
||||
// queryDefinitionProviderWithControls.applyQueryDefinition(queryDefinition);
|
||||
// queryRunner.run(queryDefinitionProviderWithControls.getQueryDefinition());
|
||||
}
|
||||
|
||||
private LogoAndTitlePanel createLogoAndTitlePanel() {
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ public interface QueryDefinitionProvider extends Component<Object> {
|
||||
|
||||
public Iterable<String> validateQueryDefinition(QueryDefinitionDeprecated queryDefinition);
|
||||
public QueryDefinitionDeprecated getQueryDefinition();
|
||||
|
||||
public void applyQueryDefinition(QueryDefinitionDeprecated queryDefinition);
|
||||
|
||||
public void addQueryDefinitionChangedListener(QueryDefinitionChangedListener listener);
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
package com.sap.sailing.gwt.ui.datamining;
|
||||
|
||||
import com.sap.sailing.gwt.ui.datamining.selection.SimpleStatistic;
|
||||
|
||||
public interface StatisticChangedListener {
|
||||
|
||||
public void statisticChanged(SimpleStatistic newStatistic);
|
||||
public void statisticChanged();
|
||||
|
||||
}
|
||||
+2
-6
@@ -1,18 +1,14 @@
|
||||
package com.sap.sailing.gwt.ui.datamining;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.datamining.selection.SimpleStatistic;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
|
||||
public interface StatisticProvider extends Component<Object> {
|
||||
|
||||
public StatisticType getStatisticType();
|
||||
public FunctionDTO getExtractionFunction();
|
||||
public AggregatorType getAggregatorType();
|
||||
public DataTypes getDataType();
|
||||
public SimpleStatistic getStatistic();
|
||||
|
||||
public void addStatisticChangedListener(StatisticChangedListener listener);
|
||||
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.datamining;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.gwt.ui.datamining.selection.ComplexStatistic;
|
||||
|
||||
public interface StatisticsManager {
|
||||
|
||||
public void addStatistic(ComplexStatistic statistic);
|
||||
|
||||
public ComplexStatistic getStatistic(DataTypes dataType);
|
||||
public Collection<ComplexStatistic> getAllStatistics();
|
||||
|
||||
public Set<DataTypes> getRegisteredBaseDataTypes();
|
||||
|
||||
}
|
||||
+9
-2
@@ -10,6 +10,7 @@ import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.datamining.DataMiningServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.datamining.QueryDefinitionChangedListener;
|
||||
import com.sap.sailing.gwt.ui.datamining.QueryDefinitionProvider;
|
||||
import com.sap.sse.datamining.shared.components.GrouperType;
|
||||
@@ -18,15 +19,17 @@ public abstract class AbstractQueryDefinitionProvider implements QueryDefinition
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final DataMiningServiceAsync dataMiningService;
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
private boolean blockChangeNotification;
|
||||
private final Set<QueryDefinitionChangedListener> listeners;
|
||||
|
||||
public AbstractQueryDefinitionProvider(StringMessages stringMessages, SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter) {
|
||||
DataMiningServiceAsync dataMiningService, ErrorReporter errorReporter) {
|
||||
this.stringMessages = stringMessages;
|
||||
this.sailingService = sailingService;
|
||||
this.dataMiningService = dataMiningService;
|
||||
this.errorReporter = errorReporter;
|
||||
|
||||
blockChangeNotification = false;
|
||||
@@ -73,7 +76,7 @@ public abstract class AbstractQueryDefinitionProvider implements QueryDefinition
|
||||
}
|
||||
|
||||
private String validateStatisticAndAggregator(QueryDefinitionDeprecated queryDefinition) {
|
||||
return queryDefinition.getStatisticType() == null || queryDefinition.getAggregatorType() == null ? stringMessages.noStatisticSelectedError() : null;
|
||||
return queryDefinition.getExtractionFunction() == null || queryDefinition.getAggregatorType() == null ? stringMessages.noStatisticSelectedError() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +110,10 @@ public abstract class AbstractQueryDefinitionProvider implements QueryDefinition
|
||||
return sailingService;
|
||||
}
|
||||
|
||||
protected DataMiningServiceAsync getDataMiningService() {
|
||||
return dataMiningService;
|
||||
}
|
||||
|
||||
protected ErrorReporter getErrorReporter() {
|
||||
return errorReporter;
|
||||
}
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
|
||||
public class ComplexStatistic {
|
||||
|
||||
private final DataTypes baseDataType;
|
||||
private final Set<StatisticType> possibleStatistics;
|
||||
private final Set<AggregatorType> possibleAggregators;
|
||||
|
||||
public ComplexStatistic(DataTypes baseDataType, Collection<StatisticType> possibleStatistics, Collection<AggregatorType> possibleAggregators) {
|
||||
this.baseDataType = baseDataType;
|
||||
this.possibleAggregators = new HashSet<AggregatorType>(possibleAggregators);
|
||||
this.possibleStatistics = new HashSet<StatisticType>(possibleStatistics);
|
||||
}
|
||||
|
||||
public DataTypes getBaseDataType() {
|
||||
return baseDataType;
|
||||
}
|
||||
|
||||
public Set<StatisticType> getPossibleStatistics() {
|
||||
return possibleStatistics;
|
||||
}
|
||||
|
||||
public Set<AggregatorType> getPossibleAggregators() {
|
||||
return possibleAggregators;
|
||||
}
|
||||
|
||||
}
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ValueListBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SimpleValueListBox;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticChangedListener;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticProvider;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticsManager;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
|
||||
public class ComplexStatisticProvider implements StatisticProvider {
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private final StatisticsManager statisticsManager;
|
||||
private Set<StatisticChangedListener> listeners;
|
||||
|
||||
private final HorizontalPanel mainPanel;
|
||||
private final ValueListBox<StatisticType> statisticListBox;
|
||||
private final ValueListBox<AggregatorType> aggregatorListBox;
|
||||
private final ValueListBox<DataTypes> dataTypeListBox;
|
||||
|
||||
public ComplexStatisticProvider(StringMessages stringMessages, StatisticsManager statisticsManager) {
|
||||
this.stringMessages = stringMessages;
|
||||
this.statisticsManager = statisticsManager;
|
||||
listeners = new HashSet<StatisticChangedListener>();
|
||||
|
||||
mainPanel = new HorizontalPanel();
|
||||
mainPanel.setSpacing(5);
|
||||
|
||||
Label dataTypeLabel = new Label(this.stringMessages.use());
|
||||
dataTypeLabel.addStyleName("dataTypeLabel");
|
||||
mainPanel.add(dataTypeLabel);
|
||||
dataTypeListBox = createDataTypeListBox();
|
||||
mainPanel.add(dataTypeListBox);
|
||||
|
||||
mainPanel.add(new Label(this.stringMessages.toCalculateThe()));
|
||||
statisticListBox = createStatisticToCalculateListBox();
|
||||
mainPanel.add(statisticListBox);
|
||||
|
||||
aggregatorListBox = createAggregatorListBox();
|
||||
HorizontalPanel aggregatorPanel = surroundAggregatorListBoxWithBraces(aggregatorListBox);
|
||||
mainPanel.add(aggregatorPanel);
|
||||
|
||||
applyStatistic(getStandardStatistic());
|
||||
}
|
||||
|
||||
private ValueListBox<DataTypes> createDataTypeListBox() {
|
||||
ValueListBox<DataTypes> dataTypeListBox = new SimpleValueListBox<DataTypes>();
|
||||
dataTypeListBox.setValue(getStandardStatistic().getBaseDataType(), false);
|
||||
dataTypeListBox.setAcceptableValues(this.statisticsManager.getRegisteredBaseDataTypes());
|
||||
dataTypeListBox.addValueChangeHandler(new ValueChangeHandler<DataTypes>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<DataTypes> event) {
|
||||
applyStatistic(ComplexStatisticProvider.this.statisticsManager.getStatistic(event.getValue()));
|
||||
notifyHandlers();
|
||||
}
|
||||
});
|
||||
return dataTypeListBox;
|
||||
}
|
||||
|
||||
private HorizontalPanel surroundAggregatorListBoxWithBraces(ValueListBox<AggregatorType> aggregatorListBox) {
|
||||
HorizontalPanel aggregatorPanel = new HorizontalPanel();
|
||||
aggregatorPanel.setSpacing(1);
|
||||
aggregatorPanel.add(new Label("("));
|
||||
|
||||
aggregatorPanel.add(aggregatorListBox);
|
||||
aggregatorPanel.add(new Label(")"));
|
||||
return aggregatorPanel;
|
||||
}
|
||||
|
||||
private ValueListBox<AggregatorType> createAggregatorListBox() {
|
||||
ValueListBox<AggregatorType> aggregatorListBox = new SimpleValueListBox<AggregatorType>();
|
||||
aggregatorListBox.addValueChangeHandler(new ValueChangeHandler<AggregatorType>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<AggregatorType> event) {
|
||||
notifyHandlers();
|
||||
}
|
||||
});
|
||||
return aggregatorListBox;
|
||||
}
|
||||
|
||||
private ValueListBox<StatisticType> createStatisticToCalculateListBox() {
|
||||
ValueListBox<StatisticType> statisticListBox = new SimpleValueListBox<StatisticType>();
|
||||
statisticListBox.addValueChangeHandler(new ValueChangeHandler<StatisticType>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<StatisticType> event) {
|
||||
notifyHandlers();
|
||||
}
|
||||
});
|
||||
return statisticListBox;
|
||||
}
|
||||
|
||||
private ComplexStatistic getStandardStatistic() {
|
||||
return this.statisticsManager.getAllStatistics().iterator().next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyQueryDefinition(QueryDefinitionDeprecated queryDefinition) {
|
||||
applyStatistic(statisticsManager.getStatistic(queryDefinition.getDataType()));
|
||||
aggregatorListBox.setValue(queryDefinition.getAggregatorType(), false);
|
||||
dataTypeListBox.setValue(queryDefinition.getDataType(), false);
|
||||
}
|
||||
|
||||
private void applyStatistic(ComplexStatistic statistic) {
|
||||
dataTypeListBox.setValue(statistic.getBaseDataType(), false);
|
||||
|
||||
aggregatorListBox.setAcceptableValues(Arrays.asList(AggregatorType.values()));
|
||||
aggregatorListBox.setValue(statistic.getPossibleAggregators().iterator().next(), false);
|
||||
aggregatorListBox.setAcceptableValues(statistic.getPossibleAggregators());
|
||||
|
||||
statisticListBox.setAcceptableValues(Arrays.asList(StatisticType.values()));
|
||||
statisticListBox.setValue(statistic.getPossibleStatistics().iterator().next(), false);
|
||||
statisticListBox.setAcceptableValues(statistic.getPossibleStatistics());
|
||||
}
|
||||
|
||||
private void notifyHandlers() {
|
||||
SimpleStatistic newStatistic = getStatistic();
|
||||
for (StatisticChangedListener listener : listeners) {
|
||||
listener.statisticChanged(newStatistic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStatistic getStatistic() {
|
||||
return new SimpleStatistic(getDataType(), getStatisticType(), getAggregatorType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatisticChangedListener(StatisticChangedListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticType getStatisticType() {
|
||||
return statisticListBox.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AggregatorType getAggregatorType() {
|
||||
return aggregatorListBox.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataTypes getDataType() {
|
||||
return dataTypeListBox.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.statisticProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getEntryWidget() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return mainPanel.isVisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visibility) {
|
||||
mainPanel.setVisible(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<Object> getSettingsDialogComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(Object newSettings) { }
|
||||
|
||||
}
|
||||
+37
-37
@@ -21,6 +21,7 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.gwt.ui.client.shared.panels.ResizingFlowPanel;
|
||||
import com.sap.sailing.gwt.ui.datamining.DataMiningControls;
|
||||
import com.sap.sailing.gwt.ui.datamining.DataMiningServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.datamining.GroupingChangedListener;
|
||||
import com.sap.sailing.gwt.ui.datamining.GroupingProvider;
|
||||
import com.sap.sailing.gwt.ui.datamining.SelectionChangedListener;
|
||||
@@ -39,8 +40,8 @@ public class QueryDefinitionProviderWithControls extends AbstractQueryDefinition
|
||||
|
||||
private GroupingProvider groupBySelectionPanel;
|
||||
|
||||
public QueryDefinitionProviderWithControls(StringMessages stringMessages, SailingServiceAsync sailingService, ErrorReporter errorReporter) {
|
||||
super(stringMessages, sailingService, errorReporter);
|
||||
public QueryDefinitionProviderWithControls(StringMessages stringMessages, SailingServiceAsync sailingService, DataMiningServiceAsync dataMiningService, ErrorReporter errorReporter) {
|
||||
super(stringMessages, sailingService, dataMiningService, errorReporter);
|
||||
|
||||
mainPanel = new ResizingFlowPanel() {
|
||||
@Override
|
||||
@@ -65,47 +66,14 @@ public class QueryDefinitionProviderWithControls extends AbstractQueryDefinition
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryDefinitionDeprecated getQueryDefinition() {
|
||||
QueryDefinitionDeprecatedImpl queryDTO = new QueryDefinitionDeprecatedImpl(LocaleInfo.getCurrentLocale().getLocaleName(), groupBySelectionPanel.getGrouperType(),
|
||||
statisticProvider.getStatisticType(), statisticProvider.getAggregatorType(),
|
||||
statisticProvider.getDataType());
|
||||
|
||||
switch (queryDTO.getGrouperType()) {
|
||||
case Dimensions:
|
||||
default:
|
||||
for (DimensionIdentifier dimension : groupBySelectionPanel.getDimensionsToGroupBy()) {
|
||||
queryDTO.appendDimensionToGroupBy(dimension);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (Entry<DimensionIdentifier, Collection<? extends Serializable>> selectionEntry : selectionProvider.getSelection().entrySet()) {
|
||||
queryDTO.setSelectionFor(selectionEntry.getKey(), selectionEntry.getValue());
|
||||
}
|
||||
|
||||
return queryDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyQueryDefinition(QueryDefinitionDeprecated queryDefinition) {
|
||||
setBlockChangeNotification(true);
|
||||
selectionProvider.applySelection(queryDefinition);
|
||||
groupBySelectionPanel.applyQueryDefinition(queryDefinition);
|
||||
statisticProvider.applyQueryDefinition(queryDefinition);
|
||||
setBlockChangeNotification(false);
|
||||
|
||||
notifyQueryDefinitionChanged();
|
||||
}
|
||||
|
||||
private Widget createFunctionsPanel() {
|
||||
HorizontalPanel functionsPanel = new HorizontalPanel();
|
||||
functionsPanel.setSpacing(5);
|
||||
|
||||
statisticProvider = new ComplexStatisticProvider(getStringMessages(), SimpleStatisticsManager.createManagerWithStandardStatistics());
|
||||
statisticProvider = new SimpleStatisticProvider(getStringMessages(), getDataMiningService(), getErrorReporter());
|
||||
statisticProvider.addStatisticChangedListener(new StatisticChangedListener() {
|
||||
@Override
|
||||
public void statisticChanged(SimpleStatistic newStatistic) {
|
||||
public void statisticChanged() {
|
||||
notifyQueryDefinitionChanged();
|
||||
}
|
||||
});
|
||||
@@ -136,6 +104,38 @@ public class QueryDefinitionProviderWithControls extends AbstractQueryDefinition
|
||||
return functionsPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryDefinitionDeprecated getQueryDefinition() {
|
||||
QueryDefinitionDeprecatedImpl queryDTO = new QueryDefinitionDeprecatedImpl(LocaleInfo.getCurrentLocale().getLocaleName(), groupBySelectionPanel.getGrouperType(),
|
||||
statisticProvider.getExtractionFunction(), statisticProvider.getAggregatorType());
|
||||
|
||||
switch (queryDTO.getGrouperType()) {
|
||||
case Dimensions:
|
||||
default:
|
||||
for (DimensionIdentifier dimension : groupBySelectionPanel.getDimensionsToGroupBy()) {
|
||||
queryDTO.appendDimensionToGroupBy(dimension);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (Entry<DimensionIdentifier, Collection<? extends Serializable>> selectionEntry : selectionProvider.getSelection().entrySet()) {
|
||||
queryDTO.setSelectionFor(selectionEntry.getKey(), selectionEntry.getValue());
|
||||
}
|
||||
|
||||
return queryDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyQueryDefinition(QueryDefinitionDeprecated queryDefinition) {
|
||||
setBlockChangeNotification(true);
|
||||
selectionProvider.applySelection(queryDefinition);
|
||||
groupBySelectionPanel.applyQueryDefinition(queryDefinition);
|
||||
statisticProvider.applyQueryDefinition(queryDefinition);
|
||||
setBlockChangeNotification(false);
|
||||
|
||||
notifyQueryDefinitionChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addControl(Widget controlWidget) {
|
||||
controlsPanel.add(controlWidget);
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import com.sap.sailing.datamining.shared.DimensionIdentifier.OrdinalComparator;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SimpleValueListBox;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SimpleObjectRenderer;
|
||||
import com.sap.sailing.gwt.ui.datamining.GroupingChangedListener;
|
||||
import com.sap.sailing.gwt.ui.datamining.GroupingProvider;
|
||||
import com.sap.sse.datamining.shared.components.GrouperType;
|
||||
@@ -48,7 +48,7 @@ public class RestrictedGroupingProvider implements GroupingProvider {
|
||||
}
|
||||
|
||||
private ValueListBox<DimensionIdentifier> createDimensionToGroupByBox() {
|
||||
ValueListBox<DimensionIdentifier> dimensionToGroupByBox = new SimpleValueListBox<DimensionIdentifier>();
|
||||
ValueListBox<DimensionIdentifier> dimensionToGroupByBox = new ValueListBox<DimensionIdentifier>(new SimpleObjectRenderer<DimensionIdentifier>());
|
||||
dimensionToGroupByBox.addValueChangeHandler(new ValueChangeHandler<DimensionIdentifier>() {
|
||||
private boolean firstChange = true;
|
||||
|
||||
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
|
||||
public class SimpleStatistic {
|
||||
|
||||
private DataTypes dataType;
|
||||
private StatisticType statisticType;
|
||||
private AggregatorType aggregatorType;
|
||||
|
||||
public SimpleStatistic(DataTypes dataType, StatisticType statisticType, AggregatorType aggregatorType) {
|
||||
this.dataType = dataType;
|
||||
this.statisticType = statisticType;
|
||||
this.aggregatorType = aggregatorType;
|
||||
}
|
||||
|
||||
public DataTypes getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public StatisticType getStatisticType() {
|
||||
return statisticType;
|
||||
}
|
||||
|
||||
public AggregatorType getAggregatorType() {
|
||||
return aggregatorType;
|
||||
}
|
||||
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ValueListBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.AbstractObjectRenderer;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.gwt.ui.client.shared.components.SimpleObjectRenderer;
|
||||
import com.sap.sailing.gwt.ui.datamining.DataMiningServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticChangedListener;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticProvider;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
|
||||
public class SimpleStatisticProvider implements StatisticProvider {
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private final DataMiningServiceAsync dataMiningService;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final Set<StatisticChangedListener> listeners;
|
||||
|
||||
private final HorizontalPanel mainPanel;
|
||||
private final ValueListBox<FunctionDTO> extractionFunctionListBox;
|
||||
private final ValueListBox<AggregatorType> aggregatorListBox;
|
||||
|
||||
public SimpleStatisticProvider(StringMessages stringMessages, DataMiningServiceAsync dataMiningService, ErrorReporter errorReporter) {
|
||||
this.stringMessages = stringMessages;
|
||||
this.dataMiningService = dataMiningService;
|
||||
this.errorReporter = errorReporter;
|
||||
listeners = new HashSet<StatisticChangedListener>();
|
||||
|
||||
mainPanel = new HorizontalPanel();
|
||||
mainPanel.setSpacing(5);
|
||||
|
||||
mainPanel.add(new Label(this.stringMessages.calculateThe()));
|
||||
extractionFunctionListBox = createExtractionFunctionListBox();
|
||||
mainPanel.add(extractionFunctionListBox);
|
||||
|
||||
aggregatorListBox = createAggregatorListBox();
|
||||
HorizontalPanel aggregatorPanel = surroundAggregatorListBoxWithBraces(aggregatorListBox);
|
||||
mainPanel.add(aggregatorPanel);
|
||||
|
||||
updateExtractionFunctions();
|
||||
}
|
||||
|
||||
private void updateExtractionFunctions() {
|
||||
dataMiningService.getAllStatistics(new AsyncCallback<Collection<FunctionDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Collection<FunctionDTO> extractionFunctions) {
|
||||
if (!extractionFunctions.isEmpty()) {
|
||||
FunctionDTO extractionFunction = getExtractionFunction();
|
||||
FunctionDTO valueToBeSelected = extractionFunctions.contains(extractionFunction) ? extractionFunction
|
||||
: extractionFunctions.iterator().next();
|
||||
extractionFunctionListBox.setValue(valueToBeSelected);
|
||||
extractionFunctionListBox.setAcceptableValues(extractionFunctions);
|
||||
} else {
|
||||
extractionFunctionListBox.setValue(null);
|
||||
extractionFunctionListBox.setAcceptableValues(new ArrayList<FunctionDTO>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error fetching the available statistics from the server: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ValueListBox<FunctionDTO> createExtractionFunctionListBox() {
|
||||
ValueListBox<FunctionDTO> extractionFunctionListBox = new ValueListBox<FunctionDTO>(new AbstractObjectRenderer<FunctionDTO>() {
|
||||
@Override
|
||||
protected String convertObjectToString(FunctionDTO function) {
|
||||
return function.getDisplayName();
|
||||
}
|
||||
});
|
||||
extractionFunctionListBox.addValueChangeHandler(new ValueChangeHandler<FunctionDTO>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<FunctionDTO> event) {
|
||||
notifyHandlers();
|
||||
}
|
||||
});
|
||||
return extractionFunctionListBox;
|
||||
}
|
||||
|
||||
private ValueListBox<AggregatorType> createAggregatorListBox() {
|
||||
ValueListBox<AggregatorType> aggregatorListBox = new ValueListBox<AggregatorType>(new SimpleObjectRenderer<AggregatorType>());
|
||||
aggregatorListBox.addValueChangeHandler(new ValueChangeHandler<AggregatorType>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<AggregatorType> event) {
|
||||
notifyHandlers();
|
||||
}
|
||||
});
|
||||
|
||||
List<AggregatorType> acceptableValues = Arrays.asList(AggregatorType.values());
|
||||
aggregatorListBox.setAcceptableValues(acceptableValues);
|
||||
aggregatorListBox.setValue(acceptableValues.get(0), false);
|
||||
aggregatorListBox.setAcceptableValues(acceptableValues);
|
||||
|
||||
return aggregatorListBox;
|
||||
}
|
||||
|
||||
private HorizontalPanel surroundAggregatorListBoxWithBraces(ValueListBox<AggregatorType> aggregatorListBox) {
|
||||
HorizontalPanel aggregatorPanel = new HorizontalPanel();
|
||||
aggregatorPanel.setSpacing(1);
|
||||
aggregatorPanel.add(new Label("("));
|
||||
|
||||
aggregatorPanel.add(aggregatorListBox);
|
||||
aggregatorPanel.add(new Label(")"));
|
||||
return aggregatorPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyQueryDefinition(QueryDefinitionDeprecated queryDefinition) {
|
||||
extractionFunctionListBox.setValue(queryDefinition.getExtractionFunction(), false);
|
||||
aggregatorListBox.setValue(queryDefinition.getAggregatorType(), false);
|
||||
}
|
||||
|
||||
private void notifyHandlers() {
|
||||
for (StatisticChangedListener listener : listeners) {
|
||||
listener.statisticChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatisticChangedListener(StatisticChangedListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionDTO getExtractionFunction() {
|
||||
return extractionFunctionListBox.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AggregatorType getAggregatorType() {
|
||||
return aggregatorListBox.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.statisticProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getEntryWidget() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return mainPanel.isVisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visibility) {
|
||||
mainPanel.setVisible(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<Object> getSettingsDialogComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(Object newSettings) { }
|
||||
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DataTypes;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sailing.gwt.ui.datamining.StatisticsManager;
|
||||
import com.sap.sse.datamining.shared.components.AggregatorType;
|
||||
|
||||
public class SimpleStatisticsManager implements StatisticsManager {
|
||||
|
||||
private HashMap<DataTypes, ComplexStatistic> statisticsMap;
|
||||
|
||||
public SimpleStatisticsManager() {
|
||||
statisticsMap = new HashMap<DataTypes, ComplexStatistic>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatistic(ComplexStatistic statistic) {
|
||||
statisticsMap.put(statistic.getBaseDataType(), statistic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexStatistic getStatistic(DataTypes dataType) {
|
||||
return statisticsMap.get(dataType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ComplexStatistic> getAllStatistics() {
|
||||
return statisticsMap.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTypes> getRegisteredBaseDataTypes() {
|
||||
return statisticsMap.keySet();
|
||||
}
|
||||
|
||||
public static StatisticsManager createManagerWithStandardStatistics() {
|
||||
StatisticsManager manager = new SimpleStatisticsManager();
|
||||
|
||||
manager.addStatistic(new ComplexStatistic(DataTypes.GPSFix,
|
||||
Arrays.asList(StatisticType.Speed),
|
||||
Arrays.asList(AggregatorType.Average)));
|
||||
manager.addStatistic(new ComplexStatistic(DataTypes.TrackedLegOfCompetitor,
|
||||
Arrays.asList(StatisticType.Distance),
|
||||
Arrays.asList(AggregatorType.Average, AggregatorType.Sum)));
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user