Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java @ 870:d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
flys-client/trunk@2690 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 09 Sep 2011 15:08:15 +0000 |
parents | 43f520f923a8 |
children | d7c322a3bb32 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java Thu Sep 08 12:49:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java Fri Sep 09 15:08:15 2011 +0000 @@ -1,34 +1,44 @@ package de.intevation.flys.client.client.ui; +import java.util.List; + import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.Positioning; +import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSImages; import de.intevation.flys.client.client.services.DescribeArtifactService; import de.intevation.flys.client.client.services.DescribeArtifactServiceAsync; import de.intevation.flys.client.shared.model.Artifact; +import de.intevation.flys.client.shared.model.CalculationMessage; public class LoadingPanel extends Canvas { - public static final int UPDATE_INTERVAL = 1000 * 10; + public static final int UPDATE_INTERVAL = 1000 * 3; public static final DescribeArtifactServiceAsync describe = GWT.create(DescribeArtifactService.class); + private FLYSImages IMAGES = GWT.create(FLYSImages.class); + protected CollectionView parent; protected Artifact artifact; - protected HLayout dialog; + protected VLayout dialog; protected Label msg; + protected Label title; protected int i; @@ -38,7 +48,8 @@ this.parent = parent; this.artifact = artifact; - this.msg = new Label(); + this.msg = new Label(""); + this.title = new Label(""); this.dialog = createDialog(); this.i = 0; @@ -67,19 +78,38 @@ } - protected HLayout createDialog() { + protected VLayout createDialog() { + title.setStyleName("loading-title"); + title.setHeight(25); + title.setWidth100(); + msg.setStyleName("loading-message"); - msg.setWidth(200); + msg.setValign(VerticalAlignment.TOP); + msg.setWidth100(); msg.setHeight(100); - dialog = new HLayout(); + ImageResource res = IMAGES.loading(); + Img img = new Img(res.getURL(), 25, 25); + + VLayout box = new VLayout(); + box.setStyleName("loading-box"); + box.setAlign(VerticalAlignment.TOP); + box.setDefaultLayoutAlign(VerticalAlignment.TOP); + box.addMember(title); + box.addMember(msg); + box.setMembersMargin(0); + box.setHeight(125); + box.setWidth(275); + + dialog = new VLayout(); + dialog.setAlign(Alignment.CENTER); dialog.setDefaultLayoutAlign(Alignment.CENTER); - dialog.setAlign(Alignment.CENTER); + dialog.setMembersMargin(5); + dialog.setHeight100(); dialog.setWidth100(); - dialog.setHeight100(); - dialog.setBorder("1px solid green"); - dialog.addMember(msg); + dialog.addMember(img); + dialog.addMember(box); return dialog; } @@ -97,7 +127,7 @@ protected void update() { - msg.setContents("This is update -> " + String.valueOf(i++)); + updateMessage(); final Config config = Config.getInstance(); final String url = config.getServerUrl(); @@ -126,6 +156,24 @@ } + protected void updateMessage() { + List<CalculationMessage> messages = artifact.getBackgroundMessages(); + if (messages != null && messages.size() > 0) { + CalculationMessage calcMsg = messages.get(0); + title.setContents(getStepTitle(calcMsg)); + msg.setContents(calcMsg.getMessage()); + } + else { + title.setContents("Berechnung wurde gestartet."); + } + } + + + protected String getStepTitle(CalculationMessage msg) { + return "Schritt " + msg.getCurrentStep() + "/" + msg.getSteps(); + } + + private void finish() { parent.removeChild(this); parent.removeChild(dialog);