mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 19:20:04 +00:00
removed "MULTI" device configuration stuff which was unused
Change-Id: Ie27a13acdf84c6978f26ecef362df58f3514e967
This commit is contained in:
1 parent
cb3e6aa94e
commit
c0f30fd545
16 files changed
+53
-338
No files matched your search
+1
-1
@@ -2,7 +2,7 @@ package com.sap.sailing.domain.common.configuration;
|
||||
|
||||
public enum DeviceConfigurationMatcherType {
|
||||
|
||||
SINGLE(1), MULTI(2);
|
||||
SINGLE(1);
|
||||
|
||||
private int matchingRank;
|
||||
|
||||
|
||||
-6
@@ -75,7 +75,6 @@ import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.base.configuration.RegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherMulti;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherSingle;
|
||||
import com.sap.sailing.domain.base.impl.FleetImpl;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
@@ -115,7 +114,6 @@ import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.TypeBasedServiceFinder;
|
||||
import com.sap.sse.common.TypeBasedServiceFinderFactory;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.shared.media.ImageDescriptor;
|
||||
import com.sap.sse.shared.media.VideoDescriptor;
|
||||
@@ -1277,10 +1275,6 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
BasicDBList client = new BasicDBList();
|
||||
client.add(((DeviceConfigurationMatcherSingle)matcher).getClientIdentifier());
|
||||
matcherObject.put(FieldNames.CONFIGURATION_MATCHER_CLIENTS.name(), client);
|
||||
} else if (matcher instanceof DeviceConfigurationMatcherMulti) {
|
||||
BasicDBList clients = new BasicDBList();
|
||||
Util.addAll(((DeviceConfigurationMatcherMulti)matcher).getClientIdentifiers(), clients);
|
||||
matcherObject.put(FieldNames.CONFIGURATION_MATCHER_CLIENTS.name(), clients);
|
||||
}
|
||||
return matcherObject;
|
||||
}
|
||||
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package com.sap.sailing.domain.base.configuration.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationIdentifier;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.common.configuration.DeviceConfigurationMatcherType;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
|
||||
/**
|
||||
* Matches a set of {@link DeviceConfigurationIdentifier}s.
|
||||
*/
|
||||
public class DeviceConfigurationMatcherMulti implements DeviceConfigurationMatcher {
|
||||
|
||||
private static final long serialVersionUID = 2372299957258702516L;
|
||||
|
||||
private final List<String> clientIdentifiers;
|
||||
|
||||
public DeviceConfigurationMatcherMulti(List<String> matchingClientIdentifiers) {
|
||||
this.clientIdentifiers = new ArrayList<String>(matchingClientIdentifiers);
|
||||
Collections.sort(this.clientIdentifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceConfigurationMatcherType getMatcherType() {
|
||||
return DeviceConfigurationMatcherType.MULTI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMatchingRank() {
|
||||
return getMatcherType().getRank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(DeviceConfigurationIdentifier identifier) {
|
||||
return this.clientIdentifiers.contains(identifier.getClientIdentifier());
|
||||
}
|
||||
|
||||
public Iterable<String> getClientIdentifiers() {
|
||||
return clientIdentifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getMatcherIdentifier() {
|
||||
return String.format("%s%s", DeviceConfigurationMatcherMulti.class.getSimpleName(), clientIdentifiers.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeviceConfigurationMatcherMulti [clientIdentifiers=" + clientIdentifiers + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IsManagedByCache<SharedDomainFactory> resolve(SharedDomainFactory domainFactory) {
|
||||
return domainFactory.getOrCreateDeviceConfigurationMatcher(getMatcherType(), clientIdentifiers);
|
||||
}
|
||||
|
||||
}
|
||||
-4
@@ -27,7 +27,6 @@ import com.sap.sailing.domain.base.Nationality;
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherMulti;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherSingle;
|
||||
import com.sap.sailing.domain.common.BoatClassMasterdata;
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
@@ -367,9 +366,6 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
case SINGLE:
|
||||
matcher = new DeviceConfigurationMatcherSingle(clientIdentifiers.get(0));
|
||||
break;
|
||||
case MULTI:
|
||||
matcher = new DeviceConfigurationMatcherMulti(clientIdentifiers);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown matcher type: " + type);
|
||||
}
|
||||
|
||||
-180
@@ -1,180 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.PushButton;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.configuration.DeviceConfigurationMatcherType;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.DeviceConfigurationMatcherDTO;
|
||||
import com.sap.sse.gwt.client.IconResources;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
public class DeviceConfigurationCreateMatcherDialog extends DataEntryDialog<DeviceConfigurationMatcherDTO> {
|
||||
|
||||
public static class MatcherValidator implements Validator<DeviceConfigurationMatcherDTO> {
|
||||
|
||||
private List<DeviceConfigurationMatcherDTO> allMatchers;
|
||||
|
||||
public MatcherValidator(List<DeviceConfigurationMatcherDTO> allMatchers) {
|
||||
this.allMatchers = allMatchers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(DeviceConfigurationMatcherDTO valueToValidate) {
|
||||
for (DeviceConfigurationMatcherDTO existingMatcher : allMatchers) {
|
||||
if (existingMatcher.type.equals(valueToValidate.type)) {
|
||||
switch (valueToValidate.type) {
|
||||
case SINGLE:
|
||||
if (existingMatcher.clients.containsAll(valueToValidate.clients)) {
|
||||
return "There is already a configuration for such a matcher.";
|
||||
}
|
||||
break;
|
||||
case MULTI:
|
||||
if (existingMatcher.clients.containsAll(valueToValidate.clients) &&
|
||||
valueToValidate.clients.containsAll(existingMatcher.clients)) {
|
||||
return "There is already a configuration for such a matcher.";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String identifier : valueToValidate.clients) {
|
||||
if (identifier.isEmpty()) {
|
||||
return "Enter an identifier name";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ListBox typeBox;
|
||||
private final List<TextBox> devicesBoxes;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public DeviceConfigurationCreateMatcherDialog(StringMessages stringMessages,
|
||||
Validator<DeviceConfigurationMatcherDTO> validator,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<DeviceConfigurationMatcherDTO> callback) {
|
||||
super(stringMessages.createDeviceConfiguration(), stringMessages.forWhichDevicesShouldConfigurationApply(),
|
||||
stringMessages.create(), stringMessages.cancel(), validator, callback);
|
||||
this.devicesBoxes = new ArrayList<TextBox>();
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final Grid valueGrid = new Grid(2, 2);
|
||||
|
||||
valueGrid.setWidget(0, 0, createLabel(stringMessages.matcherType()));
|
||||
typeBox = createListBox(false);
|
||||
typeBox.addItem(DeviceConfigurationMatcherType.SINGLE.name());
|
||||
typeBox.addItem(DeviceConfigurationMatcherType.MULTI.name());
|
||||
valueGrid.setWidget(0, 1, typeBox);
|
||||
valueGrid.setWidget(1, 0, createLabel(stringMessages.matchingDevices()));
|
||||
|
||||
final Grid devicesGrid = new Grid(2, 2);
|
||||
TextBox firstDeviceBox = createTextBox("");
|
||||
devicesGrid.setWidget(0, 0, firstDeviceBox);
|
||||
devicesBoxes.add(firstDeviceBox);
|
||||
|
||||
final Button addDeviceButton = new Button(stringMessages.addDevice());
|
||||
addDeviceButton.setVisible(false);
|
||||
addDeviceButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
devicesGrid.insertRow(0);
|
||||
TextBox deviceBox = createTextBox("");
|
||||
devicesBoxes.add(deviceBox);
|
||||
devicesGrid.setWidget(0, 0, deviceBox);
|
||||
devicesGrid.setWidget(0, 1, createRemoveButton(devicesGrid));
|
||||
}
|
||||
});
|
||||
devicesGrid.setWidget(1, 0, addDeviceButton);
|
||||
valueGrid.setWidget(1, 1, devicesGrid);
|
||||
|
||||
typeBox.addChangeHandler(new ChangeHandler() {
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
DeviceConfigurationMatcherType type = DeviceConfigurationMatcherType.valueOf(typeBox.getValue(typeBox.getSelectedIndex()));
|
||||
switch (type) {
|
||||
case SINGLE:
|
||||
valueGrid.getWidget(1, 0).setVisible(true);
|
||||
valueGrid.getWidget(1, 1).setVisible(true);
|
||||
devicesGrid.getWidget(0, 0).setVisible(true);
|
||||
devicesGrid.getWidget(1, 0).setVisible(false);
|
||||
for (int i = 0; i < devicesGrid.getRowCount() - 2; i++) {
|
||||
devicesGrid.getWidget(i, 0).setVisible(false);
|
||||
devicesGrid.getWidget(i, 1).setVisible(false);
|
||||
}
|
||||
break;
|
||||
case MULTI:
|
||||
valueGrid.getWidget(1, 0).setVisible(true);
|
||||
valueGrid.getWidget(1, 1).setVisible(true);
|
||||
devicesGrid.getWidget(0, 0).setVisible(true);
|
||||
devicesGrid.getWidget(1, 0).setVisible(true);
|
||||
for (int i = 0; i < devicesGrid.getRowCount() - 2; i++) {
|
||||
devicesGrid.getWidget(i, 0).setVisible(true);
|
||||
devicesGrid.getWidget(i, 1).setVisible(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
valueGrid.getWidget(1, 0).setVisible(false);
|
||||
valueGrid.getWidget(1, 1).setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return valueGrid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeviceConfigurationMatcherDTO getResult() {
|
||||
DeviceConfigurationMatcherDTO dto = new DeviceConfigurationMatcherDTO();
|
||||
dto.type = DeviceConfigurationMatcherType.valueOf(typeBox.getValue(typeBox.getSelectedIndex()));
|
||||
switch (dto.type) {
|
||||
case SINGLE:
|
||||
dto.clients = Arrays.asList(devicesBoxes.get(0).getText());
|
||||
break;
|
||||
case MULTI:
|
||||
dto.clients = new ArrayList<String>();
|
||||
for (TextBox textBox : devicesBoxes) {
|
||||
dto.clients.add(textBox.getText());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dto.clients = Collections.emptyList();
|
||||
break;
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
private PushButton createRemoveButton(final Grid devicesGrid) {
|
||||
PushButton removeButton = new PushButton(new Image(IconResources.INSTANCE.removeIcon()));
|
||||
removeButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
int rowToBeRemoved = devicesGrid.getCellForEvent(event).getRowIndex();
|
||||
devicesBoxes.remove(devicesGrid.getWidget(rowToBeRemoved, 0));
|
||||
devicesGrid.removeRow(rowToBeRemoved);
|
||||
}
|
||||
});
|
||||
return removeButton;
|
||||
}
|
||||
|
||||
}
|
||||
+36
-2
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
@@ -12,13 +13,46 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
public class DeviceConfigurationCreateSingleMatcherDialog extends DataEntryDialog<DeviceConfigurationMatcherDTO> {
|
||||
|
||||
public static class MatcherValidator implements Validator<DeviceConfigurationMatcherDTO> {
|
||||
|
||||
private List<DeviceConfigurationMatcherDTO> allMatchers;
|
||||
|
||||
public MatcherValidator(List<DeviceConfigurationMatcherDTO> allMatchers) {
|
||||
this.allMatchers = allMatchers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(DeviceConfigurationMatcherDTO valueToValidate) {
|
||||
for (DeviceConfigurationMatcherDTO existingMatcher : allMatchers) {
|
||||
if (existingMatcher.type.equals(valueToValidate.type)) {
|
||||
switch (valueToValidate.type) {
|
||||
case SINGLE:
|
||||
if (existingMatcher.clients.containsAll(valueToValidate.clients)) {
|
||||
return "There is already a configuration for such a matcher.";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String identifier : valueToValidate.clients) {
|
||||
if (identifier.isEmpty()) {
|
||||
return "Enter an identifier name";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TextBox identifierBox;
|
||||
|
||||
public DeviceConfigurationCreateSingleMatcherDialog(StringMessages stringMessages,
|
||||
Validator<DeviceConfigurationMatcherDTO> validator,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<DeviceConfigurationMatcherDTO> callback) {
|
||||
super("Create Device Configuration", "Specify for which device the new configuration should apply",
|
||||
"Create", stringMessages.cancel(), validator, callback);
|
||||
super(stringMessages.createDeviceConfiguration(), stringMessages.forWhichDeviceShouldConfigurationApply(),
|
||||
stringMessages.create(), stringMessages.cancel(), validator, callback);
|
||||
this.identifierBox = createTextBox("");
|
||||
}
|
||||
|
||||
|
||||
-7
@@ -65,19 +65,15 @@ public class DeviceConfigurationDetailComposite extends Composite {
|
||||
private CheckBox overwriteRegattaConfigurationBox;
|
||||
private RegattaConfigurationDTO currentRegattaConfiguration;
|
||||
|
||||
|
||||
public DeviceConfigurationDetailComposite(final SailingServiceAsync sailingService, final ErrorReporter errorReporter, final StringMessages stringMessages,
|
||||
final DeviceConfigurationCloneListener listener) {
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.stringMessages = stringMessages;
|
||||
|
||||
this.cloneListener = listener;
|
||||
|
||||
this.matcher = null;
|
||||
this.originalConfiguration = null;
|
||||
this.currentRegattaConfiguration = null;
|
||||
|
||||
captionPanel = new CaptionPanel(stringMessages.configuration());
|
||||
VerticalPanel verticalPanel = new VerticalPanel();
|
||||
contentPanel = new VerticalPanel();
|
||||
@@ -97,14 +93,11 @@ public class DeviceConfigurationDetailComposite extends Composite {
|
||||
}
|
||||
});
|
||||
verticalPanel.add(contentPanel);
|
||||
|
||||
verticalPanel.add(new HTML("<hr style=\"width:100%;\" />"));
|
||||
|
||||
HorizontalPanel actionPanel = new HorizontalPanel();
|
||||
actionPanel.add(cloneButton);
|
||||
actionPanel.add(updateButton);
|
||||
verticalPanel.add(actionPanel);
|
||||
|
||||
captionPanel.add(verticalPanel);
|
||||
initWidget(captionPanel);
|
||||
}
|
||||
|
||||
+2
-48
@@ -1,13 +1,10 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
@@ -22,7 +19,7 @@ import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.celltable.EntityIdentityComparator;
|
||||
import com.sap.sse.gwt.client.celltable.RefreshableMultiSelectionModel;
|
||||
|
||||
public class DeviceConfigurationListComposite extends Composite {
|
||||
public abstract class DeviceConfigurationListComposite extends Composite {
|
||||
|
||||
protected static AdminConsoleTableResources tableResource = GWT.create(AdminConsoleTableResources.class);
|
||||
|
||||
@@ -102,50 +99,7 @@ public class DeviceConfigurationListComposite extends Composite {
|
||||
});
|
||||
}
|
||||
|
||||
protected CellTable<DeviceConfigurationMatcherDTO> createConfigurationTable() {
|
||||
CellTable<DeviceConfigurationMatcherDTO> table = new CellTable<DeviceConfigurationMatcherDTO>(
|
||||
/* pageSize */10000, tableResource);
|
||||
configurationsDataProvider.addDataDisplay(table);
|
||||
table.setWidth("100%");
|
||||
|
||||
ListHandler<DeviceConfigurationMatcherDTO> columnSortHandler =
|
||||
new ListHandler<DeviceConfigurationMatcherDTO>(configurationsDataProvider.getList());
|
||||
table.addColumnSortHandler(columnSortHandler);
|
||||
|
||||
TextColumn<DeviceConfigurationMatcherDTO> identifierTypeColumn =
|
||||
new TextColumn<DeviceConfigurationMatcherDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceConfigurationMatcherDTO identifier) {
|
||||
return identifier.type.name();
|
||||
}
|
||||
};
|
||||
identifierTypeColumn.setSortable(true);
|
||||
columnSortHandler.setComparator(identifierTypeColumn, new Comparator<DeviceConfigurationMatcherDTO>() {
|
||||
@Override
|
||||
public int compare(DeviceConfigurationMatcherDTO r1, DeviceConfigurationMatcherDTO r2) {
|
||||
return new Integer(r1.rank).compareTo(r2.rank);
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<DeviceConfigurationMatcherDTO> identifierNameColumn =
|
||||
new TextColumn<DeviceConfigurationMatcherDTO>() {
|
||||
@Override
|
||||
public String getValue(DeviceConfigurationMatcherDTO identifier) {
|
||||
return DeviceConfigurationPanel.renderIdentifiers(identifier.clients, stringMessages);
|
||||
}
|
||||
};
|
||||
identifierNameColumn.setSortable(true);
|
||||
columnSortHandler.setComparator(identifierNameColumn, new Comparator<DeviceConfigurationMatcherDTO>() {
|
||||
@Override
|
||||
public int compare(DeviceConfigurationMatcherDTO r1, DeviceConfigurationMatcherDTO r2) {
|
||||
return r1.toString().compareTo(r2.toString());
|
||||
}
|
||||
});
|
||||
|
||||
table.addColumn(identifierTypeColumn, stringMessages.matcher());
|
||||
table.addColumn(identifierNameColumn, stringMessages.device());
|
||||
return table;
|
||||
}
|
||||
abstract protected CellTable<DeviceConfigurationMatcherDTO> createConfigurationTable();
|
||||
|
||||
public RefreshableMultiSelectionModel<DeviceConfigurationMatcherDTO> getSelectionModel() {
|
||||
return refreshableConfigurationSelectionModel;
|
||||
|
||||
+8
-14
@@ -27,7 +27,7 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator;
|
||||
|
||||
public class DeviceConfigurationPanel extends SimplePanel implements DeviceConfigurationCloneListener {
|
||||
public abstract class DeviceConfigurationPanel extends SimplePanel implements DeviceConfigurationCloneListener {
|
||||
|
||||
public static String renderIdentifiers(List<String> clientIdentifiers, StringMessages stringMessages) {
|
||||
if (clientIdentifiers.size() == 1) {
|
||||
@@ -152,7 +152,7 @@ public class DeviceConfigurationPanel extends SimplePanel implements DeviceConfi
|
||||
|
||||
private void createConfiguration(final List<DeviceConfigurationMatcherDTO> allMatchers, final DeviceConfigurationDTO configuration) {
|
||||
getCreateDialog(stringMessages,
|
||||
new DeviceConfigurationCreateMatcherDialog.MatcherValidator(allMatchers),
|
||||
new DeviceConfigurationCreateSingleMatcherDialog.MatcherValidator(allMatchers),
|
||||
new DialogCallback<DeviceConfigurationMatcherDTO>() {
|
||||
@Override
|
||||
public void ok(DeviceConfigurationMatcherDTO createdMatcher) {
|
||||
@@ -177,21 +177,15 @@ public class DeviceConfigurationPanel extends SimplePanel implements DeviceConfi
|
||||
}).show();
|
||||
}
|
||||
|
||||
protected DataEntryDialog<DeviceConfigurationMatcherDTO> getCreateDialog(final StringMessages stringMessages,
|
||||
abstract protected DataEntryDialog<DeviceConfigurationMatcherDTO> getCreateDialog(final StringMessages stringMessages,
|
||||
final Validator<DeviceConfigurationMatcherDTO> validator,
|
||||
final DialogCallback<DeviceConfigurationMatcherDTO> callback) {
|
||||
return new DeviceConfigurationCreateMatcherDialog(stringMessages, validator, callback);
|
||||
}
|
||||
final DialogCallback<DeviceConfigurationMatcherDTO> callback);
|
||||
|
||||
protected DeviceConfigurationListComposite createListComposite(SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter, StringMessages stringMessages) {
|
||||
return new DeviceConfigurationListComposite(sailingService, errorReporter, stringMessages);
|
||||
}
|
||||
abstract protected DeviceConfigurationListComposite createListComposite(SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter, StringMessages stringMessages);
|
||||
|
||||
protected DeviceConfigurationDetailComposite createDetailComposite(SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter, StringMessages stringMessages, DeviceConfigurationCloneListener cloneListener) {
|
||||
return new DeviceConfigurationDetailComposite(sailingService, errorReporter, stringMessages, cloneListener);
|
||||
}
|
||||
abstract protected DeviceConfigurationDetailComposite createDetailComposite(SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter, StringMessages stringMessages, DeviceConfigurationCloneListener cloneListener);
|
||||
|
||||
private void removeConfiguration() {
|
||||
detailComposite.setConfiguration(null);
|
||||
|
||||
+1
-1
@@ -1470,6 +1470,6 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c
|
||||
String matchingDevices();
|
||||
String addDevice();
|
||||
String createDeviceConfiguration();
|
||||
String forWhichDevicesShouldConfigurationApply();
|
||||
String forWhichDeviceShouldConfigurationApply();
|
||||
String create();
|
||||
}
|
||||
+1
-1
@@ -1437,5 +1437,5 @@ matcherType=Matcher type
|
||||
matchingDevices=Matching devices
|
||||
addDevice=Add Device
|
||||
createDeviceConfiguration=Create Device Configuration
|
||||
forWhichDevicesShouldConfigurationApply=Specify for which devices the new configuration should apply
|
||||
forWhichDeviceShouldConfigurationApply=Specify for which device the new configuration should apply
|
||||
create=Create
|
||||
+1
-1
@@ -1428,5 +1428,5 @@ matcherType=Matcher-Typ
|
||||
matchingDevices=Passende Geräte
|
||||
addDevice=Gerät hinzufügen
|
||||
createDeviceConfiguration=Gerätekonfiguration anlegen
|
||||
forWhichDevicesShouldConfigurationApply=Für welche Geräte soll die neue Konfiguration gelten?
|
||||
forWhichDeviceShouldConfigurationApply=Für welches Gerät soll die neue Konfiguration gelten?
|
||||
create=Anlegen
|
||||
+1
-1
@@ -1359,5 +1359,5 @@ matcherType=Matcher type
|
||||
matchingDevices=Matching devices
|
||||
addDevice=Add Device
|
||||
createDeviceConfiguration=Create Device Configuration
|
||||
forWhichDevicesShouldConfigurationApply=Specify for which devices the new configuration should apply
|
||||
forWhichDeviceShouldConfigurationApply=Specify for which device the new configuration should apply
|
||||
create=Create
|
||||
+1
-1
@@ -1374,5 +1374,5 @@ matcherType=Matcher type
|
||||
matchingDevices=Matching devices
|
||||
addDevice=Add Device
|
||||
createDeviceConfiguration=Create Device Configuration
|
||||
forWhichDevicesShouldConfigurationApply=Specify for which devices the new configuration should apply
|
||||
forWhichDeviceShouldConfigurationApply=Specify for which device the new configuration should apply
|
||||
create=Create
|
||||
-5
@@ -122,7 +122,6 @@ import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.base.configuration.RegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationImpl;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherMulti;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherSingle;
|
||||
import com.sap.sailing.domain.base.configuration.impl.ESSConfigurationImpl;
|
||||
import com.sap.sailing.domain.base.configuration.impl.GateStartConfigurationImpl;
|
||||
@@ -4734,13 +4733,9 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
private DeviceConfigurationMatcherDTO convertToDeviceConfigurationMatcherDTO(DeviceConfigurationMatcher matcher) {
|
||||
List<String> clients = new ArrayList<String>();
|
||||
|
||||
if (matcher instanceof DeviceConfigurationMatcherSingle) {
|
||||
clients.add(((DeviceConfigurationMatcherSingle)matcher).getClientIdentifier());
|
||||
} else if (matcher instanceof DeviceConfigurationMatcherMulti) {
|
||||
Util.addAll(((DeviceConfigurationMatcherMulti)matcher).getClientIdentifiers(), clients);
|
||||
}
|
||||
|
||||
DeviceConfigurationMatcherDTO dto = new DeviceConfigurationMatcherDTO(
|
||||
matcher.getMatcherType(),
|
||||
clients,
|
||||
|
||||
+1
-4
@@ -10,7 +10,6 @@ import org.junit.Test;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationImpl;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherMulti;
|
||||
import com.sap.sailing.domain.base.configuration.impl.DeviceConfigurationMatcherSingle;
|
||||
import com.sap.sailing.domain.base.configuration.impl.RegattaConfigurationImpl;
|
||||
|
||||
@@ -18,12 +17,10 @@ public class DeviceConfigurationReplicationTest extends AbstractServerReplicatio
|
||||
|
||||
@Test
|
||||
public void testCreateConfiguration() throws InterruptedException {
|
||||
DeviceConfigurationMatcher matcher = new DeviceConfigurationMatcherMulti(Arrays.asList("a", "b"));
|
||||
DeviceConfigurationMatcher matcher = new DeviceConfigurationMatcherSingle("a");
|
||||
DeviceConfigurationImpl configuration = new DeviceConfigurationImpl(new RegattaConfigurationImpl());
|
||||
|
||||
master.createOrUpdateDeviceConfiguration(matcher, configuration);
|
||||
Thread.sleep(1000);
|
||||
|
||||
Map<DeviceConfigurationMatcher, DeviceConfiguration> configurationMap = replica.getAllDeviceConfigurations();
|
||||
assertEquals(1, configurationMap.size());
|
||||
assertEquals(matcher.getMatcherType(), configurationMap.keySet().iterator().next().getMatcherType());
|
||||
|
||||
Reference in new issue
Block a user