Author: lgiessmann
Date: Tue Sep 20 02:20:51 2011
New Revision: 933
Log:
gdl-frontend: Widgets: make the classes LoadSchemaCallback and GdlWebPage using LoadScreenPanel to signal the user that the system is busy
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Sep 20 02:00:21 2011 (r932)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Sep 20 02:20:51 2011 (r933)
@@ -5,7 +5,6 @@
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
@@ -23,7 +22,6 @@
@Override
public void run() {
lsp.removeFromParent();
- Window.alert("timer fired event!");
}
};
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java Tue Sep 20 02:00:21 2011 (r932)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java Tue Sep 20 02:20:51 2011 (r933)
@@ -37,6 +37,7 @@
private Button createNewButton = new Button("create new");
private PsiContainer psiContainer = null;
private GdlPanel gdlPanel = null;
+ private LoadScreenPanel loadScreenPanel = null;
private final String GDL_PANEL_STYLE_NAME = "gdl_panel";
private final String CREATE_NEW_BUTTON_STYLE_NAME = "create_new_button";
@@ -73,6 +74,7 @@
public void resetPage() {
+ this.removeLoadScreenPanel();
if(gdlPanel != null) this.gdlPanel.removeFromParent();
if(this.psiContainer != null) this.psiContainer.removeFromParent();
if(this.createNewButton != null) this.createNewButton.removeFromParent();
@@ -87,6 +89,18 @@
}
+ public void removeLoadScreenPanel(){
+ if(this.loadScreenPanel != null) this.loadScreenPanel.removeFromParent();
+ }
+
+
+ public void createLoadScreenPanel(String title, String message){
+ this.removeLoadScreenPanel();
+ this.loadScreenPanel = new LoadScreenPanel(title, message);
+ RootPanel.get().add(this.loadScreenPanel);
+ }
+
+
private void requestPsis() throws ExecutionException {
String url = null;
String postData = null;
@@ -110,6 +124,7 @@
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
try{
+ this.createLoadScreenPanel("Wating for data", "Requesting all PSIs of instances of " + GdlWebPage.this.topicTypePsi + " from " + url);
builder.sendRequest(postData, new PsiRequest());
}catch(RequestException e){
e.printStackTrace();
@@ -129,7 +144,7 @@
GdlWebPage.this.gdlPanel = new GdlPanel(null, topicsToCreate, 362, 160);
GdlWebPage.this.mainPanel.add(gdlPanel);
gdlPanel.setTmEngine(new JtmsTmEngine());
- gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());
+ gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback(GdlWebPage.this));
gdlPanel.setCommitCallback(new CommitCallback());
gdlPanel.setDeleteCallback(new DeleteCallback());
gdlPanel.addStyleName(GdlWebPage.this.GDL_PANEL_STYLE_NAME);
@@ -154,7 +169,7 @@
GdlWebPage.this.gdlPanel = new GdlPanel(new Pair<String, TopicIdentifierTypes>(source.getText(), TopicIdentifierTypes.SubjectIdentifier), null, 362, 160);
GdlWebPage.this.mainPanel.add(gdlPanel);
gdlPanel.setTmEngine(new JtmsTmEngine());
- gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());
+ gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback(GdlWebPage.this));
gdlPanel.setCommitCallback(new CommitCallback());
gdlPanel.setDeleteCallback(new DeleteCallback());
gdlPanel.loadSchema();
@@ -216,6 +231,7 @@
} else {
Window.alert("could not request existing instances of " + GdlWebPage.this.topicTypePsi + ", because(" + response.getStatusCode() + "): " + response.getStatusText());
}
+ GdlWebPage.this.removeLoadScreenPanel();
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Tue Sep 20 02:00:21 2011 (r932)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Tue Sep 20 02:20:51 2011 (r933)
@@ -25,9 +25,15 @@
private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
private Pair<String, TopicIdentifierTypes> requestedTopicToEdit = null;
private RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, isidorusUrl);
+ private GdlWebPage gdlWebPage = null;
+ @SuppressWarnings("unused")
+ private LoadSchemaCallback(){}
- public LoadSchemaCallback(){}
+
+ public LoadSchemaCallback(GdlWebPage gdlWebPage){
+ this.gdlWebPage = gdlWebPage;
+ }
// this method is invoked as a callback method
@@ -35,6 +41,7 @@
public void loadSchema(GdlPanel panel, Pair<String, TopicIdentifierTypes> requestedTopicToEdit , ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate)throws RequestException {
this.requestedTopicsToCreate = requestedTopicsToCreate;
this.requestedTopicToEdit = requestedTopicToEdit;
+ this.gdlWebPage.createLoadScreenPanel("Requesting and Processing GDL data", "requesting a GDL-Schema from " + IsidorusConstants.GET_SCHEMA_REQUEST_URL + " and creating the corresponding UI-fragment");
requestBuilder.sendRequest(null, new RequestCallbackImpl(panel));
}
@@ -89,6 +96,7 @@
dialog.center();
}
+ LoadSchemaCallback.this.gdlWebPage.removeLoadScreenPanel();
}
@@ -115,6 +123,7 @@
});
dialog.center();
+ LoadSchemaCallback.this.gdlWebPage.removeLoadScreenPanel();
}
}
}