Created the busy indicator component

This commit is contained in:
Lennart Hensler committed 2012-02-06 17:51:51 +01:00
1 parent ebbffda80e
commit 046c42fa1f
7 files changed
+91 -31

No files matched your search

@@ -66,6 +66,7 @@ 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;
/**
* A leaderboard essentially consists of a table widget that in its columns displays the entries.
@@ -1524,4 +1525,16 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
leaderboardSelectionModel.setSelected(row, false);
}
}
@Override
public BusyIndicator getBusyIndicator() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean hasBusyIndicator() {
// TODO Auto-generated method stub
return false;
}
}
@@ -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.
*/
@@ -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();
}
@@ -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
*/
abstract void setBusy(boolean busy);
public boolean isBusy() {
return busy;
}
}
@@ -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();
}
@@ -0,0 +1,34 @@
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
void setBusy(boolean busy) {
this.busy = busy;
busyIndicator.setVisible(busy);
}
}