mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-22 12:03:58 +00:00
replaced RegattaSelectionModel
This commit is contained in:
1 parent
a9a83680af
commit
82067741a8
4 files changed
+53
-36
No files matched your search
+16
-21
@@ -10,7 +10,6 @@ import java.util.List;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.cell.client.FieldUpdater;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
@@ -23,7 +22,6 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
@@ -41,7 +39,6 @@ import com.sap.sse.common.Util;
|
||||
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.RefreshableMultiSelectionModel;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
import com.sap.sse.gwt.client.panels.LabeledAbstractFilterablePanel;
|
||||
@@ -53,7 +50,7 @@ import com.sap.sse.gwt.client.panels.LabeledAbstractFilterablePanel;
|
||||
*/
|
||||
public class RegattaListComposite extends Composite implements RegattasDisplayer {
|
||||
//TODO remove regattaSelectionModel
|
||||
protected final MultiSelectionModel<RegattaDTO> regattaSelectionModel;
|
||||
// protected final MultiSelectionModel<RegattaDTO> regattaSelectionModel;
|
||||
protected final CellTable<RegattaDTO> regattaTable;
|
||||
protected final ListDataProvider<RegattaDTO> regattaListDataProvider;
|
||||
private List<RegattaDTO> allRegattas;
|
||||
@@ -100,7 +97,7 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
panel.add(noRegattasLabel);
|
||||
|
||||
regattaListDataProvider = new ListDataProvider<RegattaDTO>();
|
||||
regattaTable = createRegattaTable();
|
||||
regattaTable = createRegattaTable(this.refreshableRegattaMultiSelectionModel);
|
||||
regattaTable.ensureDebugId("RegattasCellTable");
|
||||
regattaTable.setVisible(false);
|
||||
|
||||
@@ -118,12 +115,12 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
};
|
||||
filterablePanelRegattas.getTextBox().ensureDebugId("RegattasFilterTextBox");
|
||||
panel.add(filterablePanelRegattas);
|
||||
|
||||
/*
|
||||
@SuppressWarnings("unchecked")
|
||||
MultiSelectionModel<RegattaDTO> multiSelectionModel = (MultiSelectionModel<RegattaDTO>) regattaTable.getSelectionModel();
|
||||
regattaSelectionModel = multiSelectionModel;
|
||||
|
||||
regattaSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
*/
|
||||
this.refreshableRegattaMultiSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
/* List<RegattaDTO> selectedRegattas = getSelectedRegattas();
|
||||
@@ -132,30 +129,25 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
selectedRaceIdentifiers.add(selectedRegatta.getRegattaIdentifier());
|
||||
}
|
||||
RegattaListComposite.this.regattaSelectionProvider.setSelection(selectedRaceIdentifiers);*/
|
||||
refreshableRegattaMultiSelectionModel.refreshSelectionModel(getSelectedRegattas());
|
||||
refreshableRegattaMultiSelectionModel.refreshSelectionModel(allRegattas);
|
||||
}
|
||||
});
|
||||
panel.add(regattaTable);
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
/*
|
||||
public HandlerRegistration addSelectionChangeHandler(SelectionChangeEvent.Handler handler) {
|
||||
return regattaSelectionModel.addSelectionChangeHandler(handler);
|
||||
return refreshableRegattaMultiSelectionModel.addSelectionChangeHandler(handler);
|
||||
}
|
||||
|
||||
protected CellTable<RegattaDTO> createRegattaTable() {
|
||||
*/
|
||||
protected CellTable<RegattaDTO> createRegattaTable(RefreshableMultiSelectionModel<RegattaDTO> selectionmodel) {
|
||||
CellTable<RegattaDTO> table = new CellTable<RegattaDTO>(/* pageSize */10000, tableRes);
|
||||
regattaListDataProvider.addDataDisplay(table);
|
||||
table.setWidth("100%");
|
||||
|
||||
SelectionCheckboxColumn<RegattaDTO> regattaSelectionCheckboxColumn = new SelectionCheckboxColumn<RegattaDTO>(tableRes.cellTableStyle().cellTableCheckboxSelected(),
|
||||
SelectionCheckboxColumn<RegattaDTO> regattaSelectionCheckboxColumn = new SelectionCheckboxColumn<RegattaDTO>(selectionmodel, tableRes.cellTableStyle().cellTableCheckboxSelected(),
|
||||
tableRes.cellTableStyle().cellTableCheckboxDeselected(),
|
||||
tableRes.cellTableStyle().cellTableCheckboxColumnCell(), new EntityIdentityComparator<RegattaDTO>() {
|
||||
@Override
|
||||
public boolean representSameEntity(RegattaDTO dto1, RegattaDTO dto2) {
|
||||
return dto1.getRegattaIdentifier().equals(dto2.getRegattaIdentifier());
|
||||
}
|
||||
} /* entityIdentityComparator to create a RefreshableSelectionModel */) {
|
||||
tableRes.cellTableStyle().cellTableCheckboxColumnCell()) {
|
||||
@Override
|
||||
protected ListDataProvider<RegattaDTO> getListDataProvider() {
|
||||
return regattaListDataProvider;
|
||||
@@ -355,15 +347,18 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
}
|
||||
|
||||
protected List<RegattaDTO> getSelectedRegattas() {
|
||||
/*
|
||||
List<RegattaDTO> result = new ArrayList<RegattaDTO>();
|
||||
if (regattaListDataProvider != null) {
|
||||
for (RegattaDTO regatta : regattaListDataProvider.getList()) {
|
||||
if (regattaSelectionModel.isSelected(regatta)) {
|
||||
if (refreshableRegattaMultiSelectionModel.isSelected(regatta)) {
|
||||
result.add(regatta);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
*/
|
||||
return new ArrayList<RegattaDTO>(refreshableRegattaMultiSelectionModel.getSelectedSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-7
@@ -7,7 +7,6 @@ import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.RegattasDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -15,6 +14,7 @@ import com.sap.sailing.gwt.ui.client.shared.controls.SelectionCheckboxColumn;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sse.common.util.NaturalComparator;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.celltable.RefreshableMultiSelectionModel;
|
||||
|
||||
public class StructureImportListComposite extends RegattaListComposite implements RegattasDisplayer {
|
||||
|
||||
@@ -26,23 +26,24 @@ public class StructureImportListComposite extends RegattaListComposite implement
|
||||
}
|
||||
|
||||
public StructureImportListComposite(final SailingServiceAsync sailingService,
|
||||
final RegattaSelectionProvider regattaSelectionProvider, RegattaRefresher regattaRefresher,
|
||||
final RefreshableMultiSelectionModel<RegattaDTO> refreshableRegattaSelectionModel, RegattaRefresher regattaRefresher,
|
||||
RegattaStructureProvider regattaStructureProvider, final ErrorReporter errorReporter,
|
||||
final StringMessages stringMessages) {
|
||||
super(sailingService, regattaSelectionProvider, regattaRefresher, errorReporter, stringMessages);
|
||||
super(sailingService, refreshableRegattaSelectionModel, regattaRefresher, errorReporter, stringMessages);
|
||||
this.regattaStructureProvider = regattaStructureProvider;
|
||||
}
|
||||
|
||||
// create Regatta Table in StructureImportManagementPanel
|
||||
@Override
|
||||
protected CellTable<RegattaDTO> createRegattaTable() {
|
||||
protected CellTable<RegattaDTO> createRegattaTable(RefreshableMultiSelectionModel<RegattaDTO> refreshableRegattaSelectionModel) {
|
||||
CellTable<RegattaDTO> table = new CellTable<RegattaDTO>(/* pageSize */10000, tableRes);
|
||||
regattaListDataProvider.addDataDisplay(table);
|
||||
table.setWidth("100%");
|
||||
|
||||
this.selectionCheckboxColumn = new SelectionCheckboxColumn<RegattaDTO>(tableRes.cellTableStyle()
|
||||
.cellTableCheckboxSelected(), tableRes.cellTableStyle().cellTableCheckboxDeselected(),
|
||||
tableRes.cellTableStyle().cellTableCheckboxColumnCell(), null /*entityIdentityComparator to create a RefreshableSelectionModel*/) {
|
||||
this.selectionCheckboxColumn = new SelectionCheckboxColumn<RegattaDTO>(refreshableRegattaSelectionModel,
|
||||
tableRes.cellTableStyle().cellTableCheckboxSelected(),
|
||||
tableRes.cellTableStyle().cellTableCheckboxDeselected(),
|
||||
tableRes.cellTableStyle().cellTableCheckboxColumnCell()) {
|
||||
@Override
|
||||
protected ListDataProvider<RegattaDTO> getListDataProvider() {
|
||||
return regattaListDataProvider;
|
||||
|
||||
+12
-5
@@ -29,14 +29,11 @@ import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||
import com.sap.sailing.domain.common.RankingMetrics;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.StructureImportListComposite.RegattaStructureProvider;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaSelectionModel;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
@@ -46,6 +43,8 @@ import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.celltable.EntityIdentityComparator;
|
||||
import com.sap.sse.gwt.client.celltable.RefreshableMultiSelectionModel;
|
||||
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
|
||||
import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
@@ -103,8 +102,14 @@ public class StructureImportManagementPanel extends SimplePanel implements Regat
|
||||
this.errorReporter = errorReporter;
|
||||
this.stringMessages = stringMessages;
|
||||
this.regattaRefresher = regattaRefresher;
|
||||
this.regattaListComposite = new StructureImportListComposite(this.sailingService, new RegattaSelectionModel(
|
||||
true), this.regattaRefresher, this, this.errorReporter, this.stringMessages);
|
||||
this.regattaListComposite = new StructureImportListComposite(this.sailingService,
|
||||
new RefreshableMultiSelectionModel<RegattaDTO>(new EntityIdentityComparator<RegattaDTO>() {
|
||||
|
||||
@Override
|
||||
public boolean representSameEntity(RegattaDTO dto1, RegattaDTO dto2) {
|
||||
return dto1.getRegattaIdentifier().equals(dto2.getRegattaIdentifier());
|
||||
}
|
||||
}), this.regattaRefresher, this, this.errorReporter, this.stringMessages);
|
||||
regattaListComposite.ensureDebugId("RegattaListComposite");
|
||||
|
||||
VerticalPanel mainPanel = new VerticalPanel();
|
||||
@@ -112,6 +117,7 @@ public class StructureImportManagementPanel extends SimplePanel implements Regat
|
||||
mainPanel.setWidth("100%");
|
||||
|
||||
createUI(mainPanel);
|
||||
/*
|
||||
regattaListComposite.addSelectionChangeHandler(new Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
@@ -119,6 +125,7 @@ public class StructureImportManagementPanel extends SimplePanel implements Regat
|
||||
updateImportRegattasButtonEnabledness();
|
||||
}
|
||||
});
|
||||
*/
|
||||
regattaStructureGrid = new FlexTable();
|
||||
}
|
||||
|
||||
|
||||
+17
-3
@@ -60,11 +60,25 @@ public abstract class SelectionCheckboxColumn<T> extends AbstractSortableColumnW
|
||||
* @param entityIdentityComparator
|
||||
* {@link EntityIdentityComparator} to create a {@link RefreshableMultiSelectionModel}.
|
||||
*/
|
||||
protected SelectionCheckboxColumn(String selectedCheckboxCSSClass,
|
||||
String deselectedCheckboxCSSClass, String checkboxColumnCellCSSClass, EntityIdentityComparator<T> entityIdentityComparator) {
|
||||
this(new BetterCheckboxCell(selectedCheckboxCSSClass, deselectedCheckboxCSSClass), checkboxColumnCellCSSClass, entityIdentityComparator);
|
||||
protected SelectionCheckboxColumn(RefreshableMultiSelectionModel<T> selectionmodel, String selectedCheckboxCSSClass,
|
||||
String deselectedCheckboxCSSClass, String checkboxColumnCellCSSClass) {
|
||||
this(selectionmodel, new BetterCheckboxCell(selectedCheckboxCSSClass, deselectedCheckboxCSSClass), checkboxColumnCellCSSClass);
|
||||
}
|
||||
|
||||
protected SelectionCheckboxColumn(String selectedCheckboxCSSClass, String checkboxColumnCellCSSClass,
|
||||
String deselectedCheckboxCSSClass, EntityIdentityComparator<T> entityIdentityComparator) {
|
||||
this(new BetterCheckboxCell(selectedCheckboxCSSClass, deselectedCheckboxCSSClass), checkboxColumnCellCSSClass,
|
||||
entityIdentityComparator);
|
||||
}
|
||||
|
||||
private SelectionCheckboxColumn(RefreshableMultiSelectionModel<T> selectionModel, BetterCheckboxCell checkboxCell, String checkboxColumnCellCSSClass) {
|
||||
super(checkboxCell, SortingOrder.DESCENDING);
|
||||
this.cell = checkboxCell;
|
||||
this.checkboxColumnCellCSSClass = checkboxColumnCellCSSClass;
|
||||
this.selectionEventTranslator = createSelectionEventTranslator();
|
||||
this.selectionModel = selectionModel;
|
||||
}
|
||||
|
||||
private SelectionCheckboxColumn(BetterCheckboxCell checkboxCell, String checkboxColumnCellCSSClass, EntityIdentityComparator<T> entityIdentityComparator) {
|
||||
super(checkboxCell, SortingOrder.DESCENDING);
|
||||
this.cell = checkboxCell;
|
||||
|
||||
Reference in new issue
Block a user