annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java @ 1270:ea9a73782de4

Bugfix: #321 Refresh the parameter list after a calculation is finished. flys-client/trunk@2838 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Sep 2011 13:27:08 +0000
parents a9dd792444a1
children 748e7c828d03
rev   line source
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
3 import java.util.List;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
4
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import com.google.gwt.core.client.GWT;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
6 import com.google.gwt.resources.client.ImageResource;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.google.gwt.user.client.Timer;
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
8 import com.google.gwt.user.client.rpc.AsyncCallback;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.types.Alignment;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.types.Positioning;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
12 import com.smartgwt.client.types.VerticalAlignment;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.Canvas;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
14 import com.smartgwt.client.widgets.Img;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.Label;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
16 import com.smartgwt.client.widgets.layout.VLayout;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
18 import de.intevation.flys.client.client.Config;
878
d7c322a3bb32 Introduced i18n for the loading panel used during floodmap calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
19 import de.intevation.flys.client.client.FLYSConstants;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
20 import de.intevation.flys.client.client.FLYSImages;
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
21 import de.intevation.flys.client.client.services.DescribeArtifactService;
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
22 import de.intevation.flys.client.client.services.DescribeArtifactServiceAsync;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.client.shared.model.Artifact;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
24 import de.intevation.flys.client.shared.model.CalculationMessage;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public class LoadingPanel extends Canvas {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
29 public static final int UPDATE_INTERVAL = 1000 * 3;
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
30
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
31 public static final DescribeArtifactServiceAsync describe =
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
32 GWT.create(DescribeArtifactService.class);
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
33
878
d7c322a3bb32 Introduced i18n for the loading panel used during floodmap calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
34 private FLYSImages IMAGES = GWT.create(FLYSImages.class);
d7c322a3bb32 Introduced i18n for the loading panel used during floodmap calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
35 private FLYSConstants MSG = GWT.create(FLYSConstants.class);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
36
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 protected CollectionView parent;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 protected Artifact artifact;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
41 protected VLayout dialog;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 protected Label msg;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
43 protected Label title;
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 protected int i;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 public LoadingPanel(CollectionView parent, Artifact artifact) {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 super();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 this.parent = parent;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 this.artifact = artifact;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
53 this.msg = new Label("");
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
54 this.title = new Label("");
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 this.dialog = createDialog();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 this.i = 0;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 initLayout();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 startTimer();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 private void initLayout() {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 setWidth("100%");
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 setHeight("98%");
898
a9dd792444a1 Changed style for loading panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 878
diff changeset
67 setBackgroundColor("#7f7f7f");
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 setOpacity(50);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 setPosition(Positioning.RELATIVE);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 parent.addChild(this);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 parent.addChild(dialog);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 dialog.moveTo(0, 20);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 moveTo(0, 7);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
78 public void setArtifact(Artifact artifact) {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
79 this.artifact = artifact;
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
80 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
81
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
82
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
83 protected VLayout createDialog() {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
84 title.setStyleName("loading-title");
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
85 title.setHeight(25);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
86 title.setWidth100();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
87
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 msg.setStyleName("loading-message");
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
89 msg.setValign(VerticalAlignment.TOP);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
90 msg.setWidth100();
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 msg.setHeight(100);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
93 ImageResource res = IMAGES.loading();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
94 Img img = new Img(res.getURL(), 25, 25);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
95
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
96 VLayout box = new VLayout();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
97 box.setStyleName("loading-box");
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
98 box.setAlign(VerticalAlignment.TOP);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
99 box.setDefaultLayoutAlign(VerticalAlignment.TOP);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
100 box.addMember(title);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
101 box.addMember(msg);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
102 box.setMembersMargin(0);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
103 box.setHeight(125);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
104 box.setWidth(275);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
105
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
106 dialog = new VLayout();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
107 dialog.setAlign(Alignment.CENTER);
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 dialog.setDefaultLayoutAlign(Alignment.CENTER);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
109 dialog.setMembersMargin(5);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
110 dialog.setHeight100();
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 dialog.setWidth100();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
113 dialog.addMember(img);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
114 dialog.addMember(box);
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 return dialog;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 private void startTimer() {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 Timer t = new Timer() {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 @Override
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 public void run() {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 update();
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 };
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 t.schedule(UPDATE_INTERVAL);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
131 protected void update() {
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
132 updateMessage();
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
134 final Config config = Config.getInstance();
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
135 final String url = config.getServerUrl();
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
136 final String locale = config.getLocale();
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
138 describe.describe(url, locale, artifact, new AsyncCallback<Artifact>() {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
139 public void onFailure(Throwable t) {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
140 GWT.log("Error while DESCRIBE artifact: " + t.getMessage());
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
141 // SC.warn()...
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
142 startTimer();
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
143 }
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144
865
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
145 public void onSuccess(Artifact artifact) {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
146 GWT.log("Successfully DESCRIBE artifact.");
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
147
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
148 setArtifact(artifact);
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
149
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
150 if (artifact.isInBackground()) {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
151 startTimer();
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
152 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
153 else {
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
154 finish();
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
155 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
156 }
43f520f923a8 Remove the loading panel when its Artifact's background process is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
157 });
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
161 protected void updateMessage() {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
162 List<CalculationMessage> messages = artifact.getBackgroundMessages();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
163 if (messages != null && messages.size() > 0) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
164 CalculationMessage calcMsg = messages.get(0);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
165 title.setContents(getStepTitle(calcMsg));
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
166 msg.setContents(calcMsg.getMessage());
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
167 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
168 else {
878
d7c322a3bb32 Introduced i18n for the loading panel used during floodmap calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
169 title.setContents(MSG.calculationStarted());
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
170 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
171 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
172
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
173
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
174 protected String getStepTitle(CalculationMessage msg) {
878
d7c322a3bb32 Introduced i18n for the loading panel used during floodmap calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
175 return MSG.step() + " " + msg.getCurrentStep() + "/" + msg.getSteps();
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
176 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
177
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 865
diff changeset
178
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 private void finish() {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 parent.removeChild(this);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 parent.removeChild(dialog);
1270
ea9a73782de4 Bugfix: #321 Refresh the parameter list after a calculation is finished.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 898
diff changeset
182 parent.setArtifact(artifact);
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org