mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Merge remote-tracking branch 'server/gwt' into gwt
This commit is contained in:
commit
e2578e8cc4
8 files changed
+108
-35
No files matched your search
+3
@@ -145,11 +145,13 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
*/
|
||||
public void toggleExpansion() {
|
||||
if (isExpansionEnabled()) {
|
||||
getLeaderboardPanel().getBusyIndicator().setBusy(true);
|
||||
final CellTable<LeaderboardRowDTO> table = getLeaderboardPanel().getLeaderboardTable();
|
||||
if (isExpanded()) {
|
||||
for (SortableColumn<LeaderboardRowDTO, ?> column : getAllVisibleChildren()) {
|
||||
getLeaderboardPanel().removeColumn(column); // removes only the children currently displayed
|
||||
}
|
||||
getLeaderboardPanel().getBusyIndicator().setBusy(false);
|
||||
// important: toggle expanded state after asking for all visible children
|
||||
setExpanded(!isExpanded());
|
||||
} else {
|
||||
@@ -168,6 +170,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
}
|
||||
getLeaderboardPanel().getLeaderboardTable().redraw();
|
||||
}
|
||||
getLeaderboardPanel().getBusyIndicator().setBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+25
-4
@@ -66,6 +66,8 @@ import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.IsEmbeddableComponent;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.gwt.ui.shared.panels.BusyIndicator;
|
||||
import com.sap.sailing.gwt.ui.shared.panels.SimpleBusyIndicator;
|
||||
|
||||
/**
|
||||
* A leaderboard essentially consists of a table widget that in its columns displays the entries.
|
||||
@@ -174,6 +176,8 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private final ImageResource pauseIcon;
|
||||
private final ImageResource playIcon;
|
||||
|
||||
private final BusyIndicator busyIndicator;
|
||||
|
||||
private class SettingsClickHandler implements ClickHandler {
|
||||
private final StringMessages stringConstants;
|
||||
@@ -847,10 +851,19 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
listHandler = new ListHandler<LeaderboardRowDTO>(getData().getList());
|
||||
getLeaderboardTable().addColumnSortHandler(listHandler);
|
||||
loadCompleteLeaderboard(getLeaderboardDisplayDate());
|
||||
|
||||
|
||||
if(preSelectedRace == null) {
|
||||
isEmbedded = false;
|
||||
} else {
|
||||
isEmbedded = true;
|
||||
}
|
||||
contentPanel = new VerticalPanel();
|
||||
headerPanel = new DockPanel();
|
||||
DockPanel toolbarPanel = new DockPanel();
|
||||
busyIndicator = new SimpleBusyIndicator();
|
||||
if (!isEmbedded) {
|
||||
toolbarPanel.add(busyIndicator, DockPanel.WEST);
|
||||
}
|
||||
headerPanel.setWidth("100%");
|
||||
headerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
toolbarPanel.setWidth("100%");
|
||||
@@ -901,11 +914,9 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
refreshAndSettingsPanel.add(refreshPanel);
|
||||
refreshAndSettingsPanel.add(settingsAnchor);
|
||||
toolbarPanel.add(refreshAndSettingsPanel, DockPanel.EAST);
|
||||
if(preSelectedRace == null) {
|
||||
if(!isEmbedded) {
|
||||
contentPanel.add(headerPanel);
|
||||
contentPanel.add(toolbarPanel);
|
||||
} else {
|
||||
isEmbedded = true;
|
||||
}
|
||||
contentPanel.add(getLeaderboardTable());
|
||||
setWidget(contentPanel);
|
||||
@@ -1524,4 +1535,14 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
leaderboardSelectionModel.setSelected(row, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BusyIndicator getBusyIndicator() {
|
||||
return busyIndicator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBusyIndicator() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+1
-31
@@ -45,37 +45,7 @@ public final class CollapsablePanel extends Composite implements HasWidgets.ForI
|
||||
HasOpenHandlers<CollapsablePanel>, HasCloseHandlers<CollapsablePanel> {
|
||||
|
||||
private static ComponentResources resources = GWT.create(ComponentResources.class);
|
||||
|
||||
/**
|
||||
* Used to wrap widgets in the header to provide click support. Effectively wraps the widget in an
|
||||
* <code>anchor</code> to get automatic keyboard access.
|
||||
*/
|
||||
/*
|
||||
private final class ClickableHeader extends SimplePanel {
|
||||
|
||||
private ClickableHeader() {
|
||||
// Anchor is used to allow keyboard access.
|
||||
super(DOM.createAnchor());
|
||||
Element elem = getElement();
|
||||
DOM.setElementProperty(elem, "href", "javascript:void(0);");
|
||||
// Avoids layout problems from having blocks in inlines.
|
||||
DOM.setStyleAttribute(elem, "display", "block");
|
||||
sinkEvents(Event.ONCLICK);
|
||||
setStyleName(STYLENAME_HEADER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
// no need to call super.
|
||||
switch (DOM.eventGetType(event)) {
|
||||
case Event.ONCLICK:
|
||||
// Prevent link default action.
|
||||
DOM.eventPreventDefault(event);
|
||||
setOpen(!isOpen);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* An {@link Animation} used to open the content.
|
||||
*/
|
||||
|
||||
+5
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.shared.components;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.shared.panels.BusyIndicator;
|
||||
|
||||
public interface IsEmbeddableComponent {
|
||||
|
||||
@@ -10,7 +11,11 @@ public interface IsEmbeddableComponent {
|
||||
|
||||
Widget getToolbarWidget();
|
||||
|
||||
BusyIndicator getBusyIndicator();
|
||||
|
||||
boolean isEmbedded();
|
||||
|
||||
boolean hasToolbar();
|
||||
|
||||
boolean hasBusyIndicator();
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.sap.sailing.gwt.ui.shared.panels;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
||||
/**
|
||||
* A widget to show if something is currently busy.
|
||||
* @author Lennart Hensler (D054527)
|
||||
*/
|
||||
public abstract class BusyIndicator extends FlowPanel {
|
||||
|
||||
protected final static String STYLE_NAME_PREFIX = "busyIndicator-";
|
||||
protected final static SharedPanelsResources RESOURCES = GWT.create(SharedPanelsResources.class);
|
||||
|
||||
protected boolean busy;
|
||||
|
||||
/**
|
||||
* Sets the <code>busy</code> state of the BusyIndicator, which displays or hides the busy indicator.
|
||||
* @param busy The new <code>busy</code> state
|
||||
*/
|
||||
public abstract void setBusy(boolean busy);
|
||||
|
||||
public boolean isBusy() {
|
||||
return busy;
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.sap.sailing.gwt.ui.shared.panels;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface SharedPanelsResources extends ClientBundle {
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/busy_indicator_circle.gif")
|
||||
ImageResource busyIndicatorCircle();
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.sap.sailing.gwt.ui.shared.panels;
|
||||
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
public class SimpleBusyIndicator extends BusyIndicator {
|
||||
|
||||
private Image busyIndicator;
|
||||
|
||||
/**
|
||||
* Creates a new SimpleBusyIndicator with the <code>busy</code> state <code>false</code>.<br />
|
||||
* The busy indicator component is a circling GIF.
|
||||
*/
|
||||
public SimpleBusyIndicator() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SimpleBusyIndicator with a custom <code>busy</code> state.<br />
|
||||
* The busy indicator component is a circling GIF.
|
||||
*/
|
||||
public SimpleBusyIndicator(boolean busy) {
|
||||
busyIndicator = new Image(RESOURCES.busyIndicatorCircle());
|
||||
busyIndicator.setStyleName(STYLE_NAME_PREFIX + "busyIndicatorCircle");
|
||||
add(busyIndicator);
|
||||
setBusy(busy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBusy(boolean busy) {
|
||||
this.busy = busy;
|
||||
busyIndicator.setVisible(busy);
|
||||
// Element elem = busyIndicator.getElement();
|
||||
// DOM.setStyleAttribute(elem, "visibility", busy ? "visible" : "hidden");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user