Changed the way the busy indicator of the LeaderboardPanel is handled in case it's shown outside of the Panel.

A new BusyStateChangeListener is used instead of making the BusyIndicator public.
This commit is contained in:
fmittag committed 2015-11-26 17:37:47 +01:00
1 parent 84b744c7d0
commit 60645aebaf
19 files changed
+147 -63

No files matched your search

@@ -8,6 +8,8 @@ import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.shared.partials.fullscreen.FullscreenContainer;
import com.sap.sse.common.Color;
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
public abstract class AbstractLeaderboardFullscreenViewer<T extends Widget> extends FullscreenContainer<T> implements
LeaderboardDelegate<T> {
@@ -19,11 +21,13 @@ public abstract class AbstractLeaderboardFullscreenViewer<T extends Widget> exte
private final Label lastScoringUpdateText = new Label();
protected final Label lastScoringComment = new Label();
protected final Label scoringScheme = new Label();
protected final BusyIndicator busyIndicator = new SimpleBusyIndicator();
public AbstractLeaderboardFullscreenViewer() {
showLogo();
showBorder();
addToolbarInfo(createPanel(lastScoringUpdateText, lastScoringUpdateTime));
addToolbarBusyIndicator(busyIndicator);
addToolbarAction(autoRefreshControl);
addToolbarAction(settingsControl);
}
@@ -88,4 +92,8 @@ public abstract class AbstractLeaderboardFullscreenViewer<T extends Widget> exte
return scoringScheme.getElement();
}
@Override
public Element getBusyIndicatorElement() {
return busyIndicator.getElement();
}
}
@@ -106,6 +106,9 @@
background-color: #f0ab00;
}
.regattaleaderboard_meta_busyindicator {
}
.regattaleaderboard_meta_liverace {
color: red;
font-weight: 600;
@@ -30,6 +30,7 @@ public interface EventRegattaLeaderboardResources extends ClientBundle {
String regattaleaderboard_meta_update_type();
String regattaleaderboard_meta_scoring_timestamp();
String regattaleaderboard_meta_update_timestamp();
String regattaleaderboard_meta_busyindicator();
String regattaleaderboard_meta_scoring_text();
String regattaleaderboard_meta_update_text();
String regattaleaderboard_meta_reload();
@@ -24,4 +24,5 @@ public interface LeaderboardDelegate<T extends Widget> {
Element getScoringSchemeElement();
Element getBusyIndicatorElement();
}
@@ -31,12 +31,15 @@ import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.leaderboard.ScoringSchemeTypeFormatter;
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
import com.sap.sse.gwt.client.controls.busyindicator.BusyStateChangeListener;
import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.player.Timer.PlayModes;
import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.shared.components.SettingsDialog;
public class OldLeaderboard extends Composite {
public class OldLeaderboard extends Composite implements BusyStateChangeListener {
private static OldLeaderboardUiBinder uiBinder = GWT.create(OldLeaderboardUiBinder.class);
interface OldLeaderboardUiBinder extends UiBinder<Widget, OldLeaderboard> {
@@ -58,6 +61,7 @@ public class OldLeaderboard extends Composite {
private LeaderboardPanel leaderboardPanel;
private Timer autoRefreshTimer;
private final OldLeaderboardDelegate delegate;
private final BusyIndicator busyIndicator = new SimpleBusyIndicator();
public OldLeaderboard() {
this(null);
@@ -70,6 +74,7 @@ public class OldLeaderboard extends Composite {
settingsAnchor.setTitle(StringMessages.INSTANCE.settings());
autoRefreshAnchor.setTitle(StringMessages.INSTANCE.refresh());
fullscreenAnchor.setTitle(StringMessages.INSTANCE.openFullscreenView());
busyIndicatorDiv.appendChild(busyIndicator.getElement());
this.delegate = delegate;
this.setupFullscreenDelegate();
}
@@ -167,7 +172,7 @@ public class OldLeaderboard extends Composite {
this.autoRefreshTimer = timer;
this.leaderboardPanel = leaderboardPanel;
oldLeaderboardPanel.add(leaderboardPanel);
busyIndicatorDiv.appendChild(leaderboardPanel.getBusyIndicator().getElement());
leaderboardPanel.addBusyStateChangeListener(this);
}
public void updatedLeaderboard(LeaderboardDTO leaderboard) {
@@ -219,8 +224,14 @@ public class OldLeaderboard extends Composite {
}
lastScoringUpdateTimeDiv.getStyle().setVisibility(Visibility.HIDDEN);
}
@Override
public void onBusyStateChange(boolean busyState) {
busyIndicator.setBusy(busyState);
}
public interface OldLeaderboardDelegate extends LeaderboardDelegate<LeaderboardPanel> {
Element getHasLiveRaceElement();
}
}
@@ -10,8 +10,8 @@
<div ui:field="hasLiveRaceDiv" class="{local_res.css.regattaleaderboard_meta_liverace}"></div>
<div ui:field="scoringSchemeDiv" class="{local_res.css.regattaleaderboard_meta_scoring_type}"></div>
</div>
<div class="{res.mediaCss.small1} {res.mediaCss.column}">
<div ui:field="busyIndicatorDiv">&nbsp;</div>
<div class="{res.mediaCss.small1} {res.mediaCss.column} {local_res.css.regattaleaderboard_meta_busyindicator}">
<div ui:field="busyIndicatorDiv"></div>
</div>
<div class="{res.mediaCss.small5} {res.mediaCss.column} {local_res.css.regattaleaderboard_meta_settings}">
<div class="{local_res.css.regattaleaderboard_meta_update}">
@@ -4,7 +4,6 @@ import java.util.Date;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
@@ -29,16 +28,19 @@ import com.sap.sailing.gwt.ui.client.DebugIdHelper;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
import com.sap.sailing.gwt.ui.leaderboard.SelectedLeaderboardChangeListener;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.leaderboard.MultiLeaderboardPanel;
import com.sap.sailing.gwt.ui.leaderboard.ScoringSchemeTypeFormatter;
import com.sap.sailing.gwt.ui.leaderboard.SelectedLeaderboardChangeListener;
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
import com.sap.sse.gwt.client.controls.busyindicator.BusyStateChangeListener;
import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.player.Timer.PlayModes;
import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.shared.components.SettingsDialog;
public class OldMultiLeaderboard extends Composite implements SelectedLeaderboardChangeListener {
public class OldMultiLeaderboard extends Composite implements SelectedLeaderboardChangeListener, BusyStateChangeListener {
private static OldMultiLeaderboardUiBinder uiBinder = GWT.create(OldMultiLeaderboardUiBinder.class);
interface OldMultiLeaderboardUiBinder extends UiBinder<Widget, OldMultiLeaderboard> {
@@ -59,8 +61,8 @@ public class OldMultiLeaderboard extends Composite implements SelectedLeaderboar
private MultiLeaderboardPanel multiLeaderboardPanel;
private Timer autoRefreshTimer;
private final OldMultiLeaderboardDelegate delegate;
private final DivElement emptyDivElement;
private final BusyIndicator busyIndicator = new SimpleBusyIndicator();
private LeaderboardPanel lastSelectedLeaderboardPanel;
public OldMultiLeaderboard() {
this(null);
@@ -75,8 +77,8 @@ public class OldMultiLeaderboard extends Composite implements SelectedLeaderboar
fullscreenAnchor.setTitle(StringMessages.INSTANCE.openFullscreenView());
this.delegate = delegate;
this.setupFullscreenDelegate();
emptyDivElement = Document.get().createDivElement();
emptyDivElement.setInnerHTML("&nbsp;");
busyIndicatorDiv.appendChild(busyIndicator.getElement());
lastSelectedLeaderboardPanel = null;
}
private void setupFullscreenDelegate() {
@@ -208,11 +210,18 @@ public class OldMultiLeaderboard extends Composite implements SelectedLeaderboar
}
}
@Override
public void onBusyStateChange(boolean busyState) {
busyIndicator.setBusy(busyState);
}
@Override
public void onSelectedLeaderboardChanged(LeaderboardPanel selectedLeaderboard) {
busyIndicatorDiv.removeAllChildren();
busyIndicatorDiv.appendChild(selectedLeaderboard.getBusyIndicator().getElement());
busyIndicatorDiv.appendChild(emptyDivElement);
if(lastSelectedLeaderboardPanel != null) {
lastSelectedLeaderboardPanel.removeBusyStateChangeListener(this);
}
selectedLeaderboard.addBusyStateChangeListener(this);
lastSelectedLeaderboardPanel = selectedLeaderboard;
}
public interface OldMultiLeaderboardDelegate extends LeaderboardDelegate<MultiLeaderboardPanel>{
@@ -9,8 +9,8 @@
<div ui:field="lastScoringCommentDiv" class="{local_res.css.regattaleaderboard_meta_scoring_comment}"></div>
<div ui:field="scoringSchemeDiv" class="{local_res.css.regattaleaderboard_meta_scoring_type}"></div>
</div>
<div class="{res.mediaCss.small1} {res.mediaCss.column}">
<div ui:field="busyIndicatorDiv">&nbsp;</div>
<div class="{res.mediaCss.small1} {res.mediaCss.column} {local_res.css.regattaleaderboard_meta_busyindicator}">
<div ui:field="busyIndicatorDiv"></div>
</div>
<div class="{res.mediaCss.small5} {res.mediaCss.column} {local_res.css.regattaleaderboard_meta_settings}">
<div class="{local_res.css.regattaleaderboard_meta_update}">
@@ -37,6 +37,7 @@ public class FullscreenContainer<T extends Widget> {
String popup();
String toolbarInfo();
String toolbarAction();
String toolbarBusyIndicator();
String content();
String contentBorder();
}
@@ -88,7 +89,12 @@ public class FullscreenContainer<T extends Widget> {
widget.addStyleName(style.toolbarAction());
toolbarUi.add(widget);
}
public void addToolbarBusyIndicator(Widget widget) {
widget.addStyleName(style.toolbarBusyIndicator());
toolbarUi.add(widget);
}
public void addToolbarInfo(Widget widget) {
widget.addStyleName(style.toolbarInfo());
toolbarUi.add(widget);
@@ -50,6 +50,9 @@
cursor: pointer;
padding: 10px;
}
.toolbarBusyIndicator {
display: inline-block;
}
.toolbarAction:hover {
background-color: #d79900;
}
@@ -149,15 +149,15 @@ public abstract class ExpandableSortableColumn<C> extends LeaderboardSortableCol
*/
public void toggleExpansion() {
if (isExpansionEnabled()) {
final boolean oldBusyState = getLeaderboardPanel().getBusyIndicator().isBusy();
getLeaderboardPanel().getBusyIndicator().setBusy(true);
final boolean oldBusyState = getLeaderboardPanel().isBusy();
getLeaderboardPanel().setBusyState(true);
setTogglingInProcess(true);
final CellTable<LeaderboardRowDTO> table = getLeaderboardPanel().getLeaderboardTable();
if (isExpanded()) {
for (AbstractSortableColumnWithMinMax<LeaderboardRowDTO, ?> column : getAllVisibleChildren()) {
getLeaderboardPanel().removeColumn(column); // removes only the children currently displayed
}
getLeaderboardPanel().getBusyIndicator().setBusy(false);
getLeaderboardPanel().setBusyState(false);
setTogglingInProcess(false);
// important: toggle expanded state after asking for all visible children
setExpanded(!isExpanded());
@@ -177,7 +177,7 @@ public abstract class ExpandableSortableColumn<C> extends LeaderboardSortableCol
}
getLeaderboardPanel().getLeaderboardTable().redraw();
}
getLeaderboardPanel().getBusyIndicator().setBusy(oldBusyState);
getLeaderboardPanel().setBusyState(oldBusyState);
setTogglingInProcess(false);
}
});
@@ -102,6 +102,8 @@ import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
import com.sap.sse.gwt.client.controls.busyindicator.BusyStateChangeListener;
import com.sap.sse.gwt.client.controls.busyindicator.BusyStateProvider;
import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
import com.sap.sse.gwt.client.player.PlayStateListener;
import com.sap.sse.gwt.client.player.TimeListener;
@@ -122,7 +124,8 @@ import com.sap.sse.gwt.client.useragent.UserAgentDetails;
*
*/
public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayStateListener, DisplayedLeaderboardRowsProvider,
Component<LeaderboardSettings>, IsEmbeddableComponent, CompetitorSelectionChangeListener, LeaderboardFetcher {
Component<LeaderboardSettings>, IsEmbeddableComponent, CompetitorSelectionChangeListener, LeaderboardFetcher,
BusyStateProvider {
public static final String LOAD_LEADERBOARD_DATA_CATEGORY = "loadLeaderboardData";
protected static final NumberFormat scoreFormat = NumberFormat.getFormat("0.##");
@@ -296,6 +299,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
private ImageResource playIcon;
private final BusyIndicator busyIndicator;
private final Set<BusyStateChangeListener> busyStateChangeListeners;
/**
* Tells whether the leaderboard settings were explicitly changed by an external call to
@@ -477,8 +481,8 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
break;
}
final boolean oldBusyState = getBusyIndicator().isBusy();
getBusyIndicator().setBusy(true);
final boolean oldBusyState = isBusy();
setBusyState(true);
Runnable doWhenNecessaryDetailHasBeenLoaded = new Runnable() {
@Override
public void run() {
@@ -501,7 +505,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
getLeaderboardTable().sortColumn(raceColumnByRaceName, /* ascending */true);
}
}
getBusyIndicator().setBusy(oldBusyState);
setBusyState(oldBusyState);
}
};
if (oldShallAddOverallDetails == shallAddOverallDetails() || oldShallAddOverallDetails || getLeaderboard().hasOverallDetails()) {
@@ -1824,7 +1828,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
contentPanel.setStyleName(STYLE_LEADERBOARD_CONTENT);
busyIndicator = new SimpleBusyIndicator(false, 0.8f);
busyIndicator.ensureDebugId("BusyIndicator");
busyStateChangeListeners = new HashSet<>();
// the information panel
if (!isEmbedded) {
@@ -1920,7 +1924,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
filterClearButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
getBusyIndicator().setBusy(true);
setBusyState(true);
competitorFilterPanel.clearAllActiveFilters();
timeChanged(new Date(), null);
}
@@ -2237,19 +2241,19 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
@Override
public void onSuccess(LeaderboardDTO result) {
updateLeaderboard(result);
getBusyIndicator().setBusy(false);
setBusyState(false);
}
@Override
public void onFailure(Throwable caught) {
getBusyIndicator().setBusy(false);
setBusyState(false);
getErrorReporter()
.reportError("Error trying to obtain leaderboard contents: " + caught.getMessage(),
true /* silentMode */);
}
});
} else {
getBusyIndicator().setBusy(false);
setBusyState(false);
}
}
@@ -2424,7 +2428,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
liveRaceLabel.setVisible(hasLiveRace);
}
informLeaderboardUpdateListenersAboutLeaderboardUpdated(leaderboard);
getBusyIndicator().setBusy(false);
setBusyState(false);
}
}
@@ -3146,16 +3150,6 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
leaderboardSelectionModel.setSelected(row, false);
}
}
@Override
public BusyIndicator getBusyIndicator() {
return busyIndicator;
}
@Override
public boolean hasBusyIndicator() {
return true;
}
private Iterable<LeaderboardRowDTO> getSelectedRows() {
return leaderboardSelectionModel.getSelectedSet();
@@ -3277,4 +3271,29 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
public String getDependentCssClassName() {
return "leaderboard";
}
@Override
public void addBusyStateChangeListener(BusyStateChangeListener listener) {
busyStateChangeListeners.add(listener);
}
@Override
public void removeBusyStateChangeListener(BusyStateChangeListener listener) {
busyStateChangeListeners.remove(listener);
}
@Override
public boolean isBusy() {
return busyIndicator.isBusy();
}
@Override
public void setBusyState(boolean isBusy) {
if (busyIndicator.isBusy() != isBusy) {
busyIndicator.setBusy(isBusy);
for (BusyStateChangeListener listener : busyStateChangeListeners) {
listener.onBusyStateChange(isBusy);
}
}
}
}
@@ -319,13 +319,13 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
final RowUpdateWhiteboard<LeaderboardRowDTO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDTO>(
EditableLeaderboardPanel.this.getData());
getWhiteboardOwner().whiteboardProduced(whiteboard);
getBusyIndicator().setBusy(true);
setBusyState(true);
getSailingService().updateLeaderboardMaxPointsReason(getLeaderboardName(), row.competitor.getIdAsString(),
raceColumnName, value == null || value.trim().length() == 0 ? null : MaxPointsReason.valueOf(value.trim()),
getLeaderboardDisplayDate(), new AsyncCallback<Util.Triple<Double, Double, Boolean>>() {
@Override
public void onFailure(Throwable t) {
getBusyIndicator().setBusy(false);
setBusyState(false);
getErrorReporter().reportError(
"Error trying to update max points reason for competitor "
+ row.competitor.getName() + " in leaderboard " + getLeaderboardName()
@@ -334,7 +334,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
@Override
public void onSuccess(Util.Triple<Double, Double, Boolean> newNetAndTotalPointsAndIsCorrected) {
getBusyIndicator().setBusy(false);
setBusyState(false);
row.fieldsByRaceColumnName.get(raceColumnName).reasonForMaxPoints = value == null
|| value.length() == 0 ? null : MaxPointsReason.valueOf(value.trim());
row.fieldsByRaceColumnName.get(raceColumnName).netPoints = newNetAndTotalPointsAndIsCorrected.getA();
@@ -444,14 +444,14 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
final RowUpdateWhiteboard<LeaderboardRowDTO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDTO>(
EditableLeaderboardPanel.this.getData());
getWhiteboardOwner().whiteboardProduced(whiteboard);
getBusyIndicator().setBusy(true);
setBusyState(true);
getSailingService().updateLeaderboardScoreCorrection(getLeaderboardName(), row.competitor.getIdAsString(), raceColumnName,
value == null || value.trim().length() == 0 ? null : value.trim().equals("n/a") ? null
: Double.valueOf(value.trim()), getLeaderboardDisplayDate(),
new AsyncCallback<Util.Triple<Double, Double, Boolean>>() {
@Override
public void onFailure(Throwable t) {
getBusyIndicator().setBusy(false);
setBusyState(false);
getErrorReporter().reportError("Error trying to update score correction for competitor "+
row.competitor.getName()+" in leaderboard "+getLeaderboardName()+
" for race "+raceColumnName+": "+t.getMessage()+
@@ -460,7 +460,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
@Override
public void onSuccess(Util.Triple<Double, Double, Boolean> newNetAndTotalPointsAndIsCorrected) {
getBusyIndicator().setBusy(false);
setBusyState(false);
final LeaderboardEntryDTO leaderboardEntryDTO = row.fieldsByRaceColumnName.get(raceColumnName);
leaderboardEntryDTO.netPoints = value == null || value.length() == 0 ? newNetAndTotalPointsAndIsCorrected
.getA() : Double.valueOf(value.trim());
@@ -523,13 +523,13 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
row.fieldsByRaceColumnName.get(raceColumnName).netPoints, new DialogCallback<Util.Pair<MaxPointsReason, Double>>() {
@Override
public void ok(final Util.Pair<MaxPointsReason, Double> editedObject) {
getBusyIndicator().setBusy(true);
setBusyState(true);
getSailingService().updateLeaderboardScoreCorrection(getLeaderboardName(), row.competitor.getIdAsString(), raceColumnName,
editedObject.getB(), getLeaderboardDisplayDate(),
new AsyncCallback<Util.Triple<Double, Double, Boolean>>() {
@Override
public void onFailure(Throwable t) {
getBusyIndicator().setBusy(false);
setBusyState(false);
getErrorReporter().reportError("Error trying to update score correction for competitor "+
row.competitor.getName()+" in leaderboard "+getLeaderboardName()+
" for race "+raceColumnName+": "+t.getMessage()+
@@ -543,7 +543,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
new AsyncCallback<Util.Triple<Double, Double, Boolean>>() {
@Override
public void onFailure(Throwable t) {
getBusyIndicator().setBusy(false);
setBusyState(false);
getErrorReporter().reportError("Error trying to update score correction for competitor "+
row.competitor.getName()+" in leaderboard "+getLeaderboardName()+
" for race "+raceColumnName+": "+t.getMessage()+
@@ -552,7 +552,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
@Override
public void onSuccess(Util.Triple<Double, Double, Boolean> newNetAndTotalPointsAndIsCorrected) {
getBusyIndicator().setBusy(false);
setBusyState(false);
final LeaderboardEntryDTO leaderboardEntryDTO = row.fieldsByRaceColumnName.get(raceColumnName);
leaderboardEntryDTO.reasonForMaxPoints = editedObject.getA();
leaderboardEntryDTO.netPoints = newNetAndTotalPointsAndIsCorrected.getA();
@@ -409,11 +409,11 @@ public class MatchAndApplyScoreCorrectionsDialog extends DataEntryDialog<BulkSco
@Override
public void ok(final BulkScoreCorrectionDTO result) {
leaderboardPanel.getBusyIndicator().setBusy(true);
leaderboardPanel.setBusyState(true);
sailingService.updateLeaderboardScoreCorrectionsAndMaxPointsReasons(result, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
leaderboardPanel.getBusyIndicator().setBusy(false);
leaderboardPanel.setBusyState(false);
errorReporter.reportError(stringMessages.errorUpdatingScoresForLeaderboard(result.getLeaderboardName(),
caught.getMessage()));
}
@@ -214,19 +214,19 @@ public class ResultSelectionAndApplyDialog extends DataEntryDialog<Util.Triple<S
final String eventName = providerNameAndEventNameBoatClassNameCapturedWhen.getB();
final String boatClassName = providerNameAndEventNameBoatClassNameCapturedWhen.getC().getA();
final Date timePointWhenResultPublished = providerNameAndEventNameBoatClassNameCapturedWhen.getC().getB();
leaderboardPanel.getBusyIndicator().setBusy(true);
leaderboardPanel.setBusyState(true);
sailingService.getScoreCorrections(scoreCorrectionProviderName, eventName, boatClassName, timePointWhenResultPublished,
new AsyncCallback<RegattaScoreCorrectionDTO>() {
@Override
public void onFailure(Throwable caught) {
leaderboardPanel.getBusyIndicator().setBusy(false);
leaderboardPanel.setBusyState(false);
errorReporter.reportError(stringMessages.errorObtainingScoreCorrections(scoreCorrectionProviderName,
eventName, boatClassName, timePointWhenResultPublished.toString(), caught.getMessage()));
}
@Override
public void onSuccess(RegattaScoreCorrectionDTO result) {
leaderboardPanel.getBusyIndicator().setBusy(false);
leaderboardPanel.setBusyState(false);
new MatchAndApplyScoreCorrectionsDialog(leaderboardPanel, stringMessages, sailingService,
errorReporter, result).show();
}
@@ -0,0 +1,14 @@
package com.sap.sse.gwt.client.controls.busyindicator;
/**
* Allows UI components to observe the busy state of an operation.
*/
public interface BusyStateChangeListener {
/**
* @param busyState the new busy state
*/
void onBusyStateChange(boolean busyState);
}
@@ -0,0 +1,13 @@
package com.sap.sse.gwt.client.controls.busyindicator;
public interface BusyStateProvider {
void addBusyStateChangeListener(BusyStateChangeListener listener);
void removeBusyStateChangeListener(BusyStateChangeListener listener);
void setBusyState(boolean isBusy);
boolean isBusy();
}
@@ -1,5 +1,6 @@
package com.sap.sse.gwt.client.controls.busyindicator;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Image;
@@ -39,6 +40,6 @@ public class SimpleBusyIndicator extends BusyIndicator {
@Override
public void setBusy(boolean busy) {
super.setBusy(busy);
busyIndicator.setVisible(busy);
busyIndicator.getElement().getStyle().setVisibility(busy ? Visibility.VISIBLE : Visibility.HIDDEN);
}
}
@@ -1,7 +1,6 @@
package com.sap.sse.gwt.client.shared.components;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sse.gwt.client.controls.busyindicator.BusyIndicator;
public interface IsEmbeddableComponent {
@@ -13,11 +12,7 @@ public interface IsEmbeddableComponent {
Widget getLegendWidget();
BusyIndicator getBusyIndicator();
boolean isEmbedded();
boolean hasToolbar();
boolean hasBusyIndicator();
}