Merge remote-tracking branch 'origin/master' into maneuver_refactoring

This commit is contained in:
Vladislav Chumak committed 2018-03-29 20:15:37 +02:00
commit 0ba9e2b019
9 files changed
+66 -101

No files matched your search

@@ -113,7 +113,7 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.gwtplugins.gwt.eclipse.core.moduleClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-incremental -war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9876 -startupUrl /gwt/Home.html -startupUrl /gwt/AdminConsole.html -startupUrl /gwt/PairingList.html -startupUrl /gwt/LeaderboardEditing.html -startupUrl /gwt/Leaderboard.html -startupUrl /gwt/Spectator.html -startupUrl /gwt/EmbeddedMapAndWindChart -startupUrl /gwt/RaceBoard.html -startupUrl /gwt/RegattaOverview.html -startupUrl /gwt/DataMining.html -startupUrl /gwt/Simulator.html -startupUrl /gwt/VideoPopup.html -startupUrl /gwt/AutoPlay.html -startupUrl /gwt/YoutubePopup.html com.sap.sailing.gwt.home.Home com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.PairingList com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.Spectator com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart com.sap.sailing.gwt.ui.RaceBoard com.sap.sailing.gwt.regattaoverview.RegattaOverview com.sap.sailing.gwt.ui.DataMining com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.VideoPopup com.sap.sailing.gwt.ui.YoutubePopup com.sap.sailing.gwt.autoplay.AutoPlay"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-style PRETTY -incremental -war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9876 -startupUrl /gwt/Home.html -startupUrl /gwt/AdminConsole.html -startupUrl /gwt/PairingList.html -startupUrl /gwt/LeaderboardEditing.html -startupUrl /gwt/Leaderboard.html -startupUrl /gwt/Spectator.html -startupUrl /gwt/EmbeddedMapAndWindChart -startupUrl /gwt/RaceBoard.html -startupUrl /gwt/RegattaOverview.html -startupUrl /gwt/DataMining.html -startupUrl /gwt/Simulator.html -startupUrl /gwt/VideoPopup.html -startupUrl /gwt/AutoPlay.html -startupUrl /gwt/YoutubePopup.html com.sap.sailing.gwt.home.Home com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.PairingList com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.Spectator com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart com.sap.sailing.gwt.ui.RaceBoard com.sap.sailing.gwt.regattaoverview.RegattaOverview com.sap.sailing.gwt.ui.DataMining com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.VideoPopup com.sap.sailing.gwt.ui.YoutubePopup com.sap.sailing.gwt.autoplay.AutoPlay"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+UseG1GC -XX:+UseStringDeduplication -Dgwt.watchFileChanges=false -Xmx2048m -Dgwt-usearchives=false -Dgwt.persistentunitcache=false"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.sap.sailing.gwt.ui}/.tmp/gwt-work"/>
@@ -229,7 +229,6 @@ public abstract class AbstractLeaderboardConfigPanel extends FormPanel implement
trackedRacesPanel.add(trackedRacesListComposite);
trackedRacesListComposite.addTrackedRaceChangeListener(this);
trackedRaceListHandler = new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Set<RaceDTO> selectedRaces = refreshableTrackedRaceSelectionModel.getSelectedSet();
@@ -261,19 +260,17 @@ public abstract class AbstractLeaderboardConfigPanel extends FormPanel implement
}
}
private boolean hasLink(RaceColumnDTOAndFleetDTOWithNameBasedEquality selectedRaceColumnAndFleetName) {
return selectedRaceColumnAndFleetName.getA()
.getRaceIdentifier(selectedRaceColumnAndFleetName.getB()) != null;
}
private boolean isLinkedToRace(RaceColumnDTOAndFleetDTOWithNameBasedEquality selectedRaceColumnAndFleetName, RaceDTO selectedRace){
return selectedRaceColumnAndFleetName.getA().getRaceIdentifier(selectedRaceColumnAndFleetName.getB()).equals(selectedRace.getRaceIdentifier());
}
private boolean hasLink(RaceColumnDTOAndFleetDTOWithNameBasedEquality selectedRaceColumnAndFleetName) {
return selectedRaceColumnAndFleetName.getA()
.getRaceIdentifier(selectedRaceColumnAndFleetName.getB()) != null;
}
private boolean isLinkedToRace(RaceColumnDTOAndFleetDTOWithNameBasedEquality selectedRaceColumnAndFleetName, RaceDTO selectedRace){
return selectedRaceColumnAndFleetName.getA().getRaceIdentifier(selectedRaceColumnAndFleetName.getB()).equals(selectedRace.getRaceIdentifier());
}
};
trackedRaceListHandlerRegistration = refreshableTrackedRaceSelectionModel.addSelectionChangeHandler(trackedRaceListHandler);
Button reloadAllRaceLogs = new Button(stringMessages.reloadAllRaceLogs());
reloadAllRaceLogs.ensureDebugId("ReloadAllRaceLogsButton");
reloadAllRaceLogs.addClickHandler(new ClickHandler() {
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Set;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Unit;
@@ -18,6 +17,7 @@ import com.google.gwt.event.dom.client.DomEvent;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.TextColumn;
@@ -40,8 +40,6 @@ import com.sap.sailing.gwt.ui.client.RegattaRefresher;
import com.sap.sailing.gwt.ui.client.RegattasDisplayer;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.controls.FlushableCellTable;
import com.sap.sailing.gwt.ui.client.shared.controls.SelectionCheckboxColumn;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sse.common.Util;
@@ -49,9 +47,7 @@ import com.sap.sse.common.filter.Filter;
import com.sap.sse.common.util.NaturalComparator;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.gwt.client.celltable.EntityIdentityComparator;
import com.sap.sse.gwt.client.celltable.RefreshableSelectionModel;
import com.sap.sse.gwt.client.celltable.RefreshableSingleSelectionModel;
import com.sap.sse.gwt.client.panels.CustomizableFilterablePanel;
import com.sap.sse.gwt.client.shared.components.AbstractCompositeComponent;
import com.sap.sse.gwt.client.shared.components.Component;
@@ -67,9 +63,7 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
protected RefreshableSelectionModel<RaceDTO> refreshableSelectionModel;
private SelectionCheckboxColumn<RaceDTO> selectionCheckboxColumn;
protected FlushableCellTable<RaceDTO> raceTable;
protected CellTable<RaceDTO> raceTable;
private ListDataProvider<RaceDTO> raceList;
@@ -127,8 +121,6 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
}
protected void createUI() {
AdminConsoleTableResources tableResources = GWT.create(AdminConsoleTableResources.class);
raceList = new ListDataProvider<>();
settings = new TrackedRacesSettings();
settings.setDelayToLiveInSeconds(DEFAULT_LIVE_DELAY_IN_MILLISECONDS / 1000l);
VerticalPanel panel = new VerticalPanel();
@@ -139,8 +131,9 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
noTrackedRacesLabel = new Label(stringMessages.noRacesYet());
noTrackedRacesLabel.setWordWrap(false);
panel.add(noTrackedRacesLabel);
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
raceTable = new FlushableCellTable<RaceDTO>(/* pageSize */10000, tableRes);
TableWrapper<RaceDTO, RefreshableSelectionModel<RaceDTO>> raceTableWrapper = new TrackedRacesTableWrapper(sailingService, stringMessages, errorReporter, multiSelection, /* enablePager */ true);
raceTable = raceTableWrapper.getTable();
raceTable.setPageSize(1000);
raceTable.ensureDebugId("TrackedRacesCellTable");
Label lblFilterRaces = new Label(stringMessages.filterRaces()+":");
@@ -149,7 +142,7 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
lblFilterRaces.getElement().getStyle().setMarginRight(10, Unit.PX);
filterPanel.add(lblFilterRaces);
filterPanel.setCellVerticalAlignment(lblFilterRaces, HasVerticalAlignment.ALIGN_MIDDLE);
raceList = raceTableWrapper.getDataProvider();
filterablePanelRaces = new CustomizableFilterablePanel<RaceDTO>(allRaces, raceTable, raceList) {
@Override
public List<String> getSearchableStrings(RaceDTO t) {
@@ -160,6 +153,7 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
return strings;
}
};
raceTableWrapper.registerSelectionModelOnNewDataProvider(filterablePanelRaces.getAllListDataProvider());
Label lblFilterByRegatta = new Label(stringMessages.filterByRegatta());
lblFilterByRegatta.setWordWrap(false);
listBoxRegattas = new ListBox();
@@ -189,38 +183,13 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
filterPanel.add(filterablePanelRaces);
filterPanel.setCellVerticalAlignment(filterablePanelRaces, HasVerticalAlignment.ALIGN_MIDDLE);
final EntityIdentityComparator<RaceDTO> entityIdentityComparator = new EntityIdentityComparator<RaceDTO>() {
@Override
public boolean representSameEntity(RaceDTO dto1, RaceDTO dto2) {
return dto1.getRaceIdentifier().equals(dto2.getRaceIdentifier());
}
@Override
public int hashCode(RaceDTO t) {
return t.getRaceIdentifier().hashCode();
}
};
if (multiSelection) {
this.selectionCheckboxColumn = new SelectionCheckboxColumn<RaceDTO>(
tableResources.cellTableStyle().cellTableCheckboxSelected(),
tableResources.cellTableStyle().cellTableCheckboxDeselected(),
tableResources.cellTableStyle().cellTableCheckboxColumnCell(), entityIdentityComparator,
filterablePanelRaces.getAllListDataProvider(), raceTable);
refreshableSelectionModel = selectionCheckboxColumn.getSelectionModel();
raceTable.setSelectionModel(refreshableSelectionModel, this.selectionCheckboxColumn.getSelectionManager());
} else {
refreshableSelectionModel = new RefreshableSingleSelectionModel<RaceDTO>(entityIdentityComparator,
filterablePanelRaces.getAllListDataProvider());
raceTable.setSelectionModel(refreshableSelectionModel);
}
ListHandler<RaceDTO> columnSortHandler = setupTableColumns(stringMessages);
refreshableSelectionModel = raceTableWrapper.getSelectionModel();
setupTableColumns(stringMessages, raceTableWrapper.getColumnSortHandler());
raceTable.setWidth("300px");
raceTable.setVisible(false);
panel.add(raceTable);
raceList.addDataDisplay(raceTable);
raceTable.addColumnSortHandler(columnSortHandler);
raceTable.getSelectionModel().addSelectionChangeHandler(new Handler() {
panel.add(raceTableWrapper);
refreshableSelectionModel.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Set<RaceDTO> selectedRaces = refreshableSelectionModel.getSelectedSet();
@@ -250,8 +219,7 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
abstract protected void addControlButtons(HorizontalPanel trackedRacesButtonPanel);
private ListHandler<RaceDTO> setupTableColumns(final StringMessages stringMessages) {
ListHandler<RaceDTO> columnSortHandler = new ListHandler<RaceDTO>(raceList.getList());
private void setupTableColumns(final StringMessages stringMessages, ListHandler<RaceDTO> columnSortHandler) {
TextColumn<RaceDTO> regattaNameColumn = new TextColumn<RaceDTO>() {
@Override
public String getValue(RaceDTO raceDTO) {
@@ -413,10 +381,6 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
return race.isTracked && race.trackedRace != null ? race.trackedRace.delayToLiveInMs : null;
}
});
if (multiSelection) {
columnSortHandler.setComparator(selectionCheckboxColumn, selectionCheckboxColumn.getComparator());
raceTable.addColumn(selectionCheckboxColumn, selectionCheckboxColumn.getHeader());
}
raceTable.addColumn(regattaNameColumn, stringMessages.regatta());
raceTable.addColumn(boatClassNameColumn, stringMessages.boatClass());
raceTable.addColumn(raceNameColumn, stringMessages.race());
@@ -425,8 +389,6 @@ public abstract class AbstractTrackedRacesListComposite extends AbstractComposit
raceTable.addColumn(hasGPSDataColumn, stringMessages.gpsData());
raceTable.addColumn(raceStatusColumn, stringMessages.status());
raceTable.addColumn(raceLiveDelayColumn, stringMessages.delayInSeconds());
return columnSortHandler;
}
@Override
@@ -53,7 +53,6 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
private void showSetDelayToLiveDialog() {
TrackedRacesSettings settings = new TrackedRacesSettings();
settings.setDelayToLiveInSeconds(DEFAULT_LIVE_DELAY_IN_MILLISECONDS);
SettingsDialog<TrackedRacesSettings> settingsDialog = new SettingsDialog<TrackedRacesSettings>(this, stringMessages);
settingsDialog.show();
}
@@ -111,8 +110,6 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
@Override
protected void addControlButtons(HorizontalPanel trackedRacesButtonPanel) {
if(actionButtonsEnabled) {
btnUntrack = new Button(stringMessages.stopTracking());
btnUntrack.ensureDebugId("StopTrackingButton");
btnUntrack.addClickHandler(new ClickHandler() {
@@ -0,0 +1,25 @@
package com.sap.sailing.gwt.ui.adminconsole;
import com.sap.sailing.domain.common.dto.RaceDTO;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.celltable.EntityIdentityComparator;
import com.sap.sse.gwt.client.celltable.RefreshableSelectionModel;
public class TrackedRacesTableWrapper extends TableWrapper<RaceDTO, RefreshableSelectionModel<RaceDTO>> {
public TrackedRacesTableWrapper(SailingServiceAsync sailingService, StringMessages stringMessages,
ErrorReporter errorReporter, boolean multiSelection, boolean enablePager) {
super(sailingService, stringMessages, errorReporter, multiSelection, enablePager, new EntityIdentityComparator<RaceDTO>() {
@Override
public boolean representSameEntity(RaceDTO dto1, RaceDTO dto2) {
return dto1.getRaceIdentifier().equals(dto2.getRaceIdentifier());
}
@Override
public int hashCode(RaceDTO t) {
return t.getRaceIdentifier().hashCode();
}
});
}
}
@@ -14,6 +14,13 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8&quot; javaProject=&quot;com.sap.sailing.selenium.test&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.sap.sailing.selenium.test&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.targetplatform.base/plugins/target-base/jcl-over-slf4j-1.6.4.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.targetplatform.base/plugins/target-base/slf4j-api-1.6.4.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.selenium.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dselenium.test.environment.configuration=local-test-environment.xml"/>
@@ -369,12 +369,10 @@ public class SettingsTest extends AbstractSeleniumTest {
}
private void initTrackingForBmwCupRace(AdminConsolePage adminConsole) {
TrackableRaceDescriptor trackableRace = new TrackableRaceDescriptor(BMW_CUP_EVENT, String.format(BMW_RACE, 1),
BMW_CUP_BOAT_CLASS);
TrackedRaceDescriptor trackedRace = new TrackedRaceDescriptor(BMW_CUP_REGATTA, BMW_CUP_BOAT_CLASS,
String.format(BMW_RACE, 1));
TracTracEventManagementPanelPO tracTracEvents = adminConsole.goToTracTracEvents();
tracTracEvents.listTrackableRaces(BMW_CUP_JSON_URL);
RegattaDescriptor bmwCupDescriptor = new RegattaDescriptor(BMW_CUP_EVENT, BMW_CUP_BOAT_CLASS);
@@ -384,7 +382,6 @@ public class SettingsTest extends AbstractSeleniumTest {
TrackedRacesListPO trackedRacesList = tracTracEvents.getTrackedRacesList();
trackedRacesList.waitForTrackedRace(trackedRace, Status.FINISHED, 600); // with the TracAPI, REPLAY races
// status FINISHED when done loading
LeaderboardConfigurationPanelPO leaderboard = adminConsole.goToLeaderboardConfiguration();
LeaderboardDetailsPanelPO details = leaderboard.getLeaderboardDetails(BMW_CUP_REGATTA);
Assert.assertTrue(details != null);
@@ -499,7 +496,7 @@ public class SettingsTest extends AbstractSeleniumTest {
}
/**
* Verifies that the leaderboard displays the configurated details in the leaderboard table as columns. Furthermore,
* Verifies that the leaderboard displays the configured details in the leaderboard table as columns. Furthermore,
* the chart presence is verified when the corresponding settings in admin console has been checked. In order to get
* the race details displayed, a tracked race is used.
*/
@@ -86,12 +86,13 @@ public class RefreshableSingleSelectionModel<T> extends SingleSelectionModel<T>
}
/**
* Refreshes the {@link RefreshableSingleSelectionModel} with the <code>newObjects</code>. If the current selected
* object {@link EntityIdentityComparator#representSameEntity(Object, Object) represent the same entity} as an
* object from <code>newObjects</code> it will be reselected. All others are de-selected. That means a selected
* object is not contained in <code>newObjects</code> the object wouldn't be selected anymore. If this selection
* model has no {@link EntityIdentityComparator} set, this method will use the {@link #equals(Object)} method to
* compare. If an object is reselected it will be replaced with the new version of it.
* Refreshes the {@link RefreshableSingleSelectionModel} with the <code>newObjects</code>. If the currently selected
* object {@link EntityIdentityComparator#representSameEntity(Object, Object) represents the same entity} as an
* object from <code>newObjects</code> it will be reselected. All others are de-selected. That means if a selected
* object is not contained (based on {@link EntityIdentityComparator#representSameEntity(Object, Object)}) in
* <code>newObjects</code> the object wouldn't be selected anymore. If this selection model has no
* {@link EntityIdentityComparator} set, this method will use the {@link #equals(Object)} method to compare. If an
* object is reselected it will be replaced with the new version of it.
* <p>
*
* When the selection is refreshed this method triggers a
@@ -19,10 +19,7 @@ import com.sap.sse.common.Util;
import com.sap.sse.common.filter.AbstractKeywordFilter;
import com.sap.sse.common.filter.AbstractListFilter;
import com.sap.sse.common.filter.Filter;
import com.sap.sse.gwt.client.celltable.EntityIdentityComparator;
import com.sap.sse.gwt.client.celltable.RefreshableMultiSelectionModel;
import com.sap.sse.gwt.client.celltable.RefreshableSelectionModel;
import com.sap.sse.gwt.client.celltable.RefreshableSingleSelectionModel;
/**
* This Panel contains a text box. Text entered into the text box filters the {@link CellTable} passed to the
@@ -37,7 +34,11 @@ import com.sap.sse.gwt.client.celltable.RefreshableSingleSelectionModel;
*
* Note that this panel does <em>not</em> contain the table that it filters. With this, this class's clients are free to
* position the table wherever they want, not necessarily related to the text box provided by this panel in any specific
* way.
* way.<p>
*
* It is recommended to use the {@link #getAllListDataProvider()} as the data provider for the table's selection model.
* This way, when the filter reduces the elements displayed in the table the selection will still refer to all elements
* and will not be modified solely by the act of filtering.
*
* @param <T>
* @author Nicolas Klose, Axel Uhl
@@ -225,28 +226,6 @@ public abstract class AbstractFilterablePanel<T> extends HorizontalPanel {
return all.getList();
}
/**
* Registers a {@link RefreshableSelectionModel} on the all data structure. So the selection can be maintained when
* the {@link CellTable} is filtered. You can use the {@link RefreshableSelectionModel} returned by this method e.g.
* for a {@link CellTable} using {@link CellTable#setSelectionModel(com.google.gwt.view.client.SelectionModel)}
*
* @param comp
* {@link EntityIdentityComparator Comperator} to create the {@link RefreshableSelectionModel selection
* model}
* @param multiselection
* set <code>true</code> when the {@link RefreshableSelectionModel selection model} should be a
* {@link RefreshableMultiSelectionModel}. When it's set <code>false</code> the
* {@link RefreshableSelectionModel selection model} will be a {@link RefreshableSingleSelectionModel}.
*/
public RefreshableSelectionModel<T> registerSelectionModelOnAllElements(EntityIdentityComparator<T> comp,
boolean multiselection) {
if (multiselection) {
return new RefreshableMultiSelectionModel<>(comp, all);
} else {
return new RefreshableSingleSelectionModel<>(comp, all);
}
}
/**
* You can use this method to get the {@link ListDataProvider} that represents the all data structure. On this
* {@link ListDataProvider} a {@link RefreshableSelectionModel} can be registered. So the selection can also be