[isidorus-cvs] r906 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/isidorus war war/gdl_widgets

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Thu Sep 15 08:58:58 UTC 2011


Author: lgiessmann
Date: Thu Sep 15 01:58:58 2011
New Revision: 906

Log:
gdl-frontend: Widgets: started to implement the acutl frontend for hash-objects

Added:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectUi.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/PsiContainer.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/HashObjectPsis.json
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/textgrid_large.jpg   (contents, props changed)
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/textgrid_small.png   (contents, props changed)
Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/GDL_Widgets.html

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml	Wed Sep 14 05:49:14 2011	(r905)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml	Thu Sep 15 01:58:58 2011	(r906)
@@ -18,8 +18,8 @@
   <inherits name="com.google.gwt.http.HTTP" />
   
   <!-- Specify the app entry point class.                         -->
-  <entry-point class='us.isidor.gdl.anaToMia.Widgets.base.TestClass'/>
-  
+  <!-- <entry-point class='us.isidor.gdl.anaToMia.Widgets.base.TestClass'/> -->
+  <entry-point class="us.isidor.gdl.anaToMia.Widgets.isidorus.HashObjectUi"/>
 
   <!-- Specify the paths for translatable code                    -->
   <source path="base"/>

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectUi.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectUi.java	Thu Sep 15 01:58:58 2011	(r906)
@@ -0,0 +1,103 @@
+package us.isidor.gdl.anaToMia.Widgets.isidorus;
+
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONString;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+
+public class HashObjectUi implements EntryPoint {
+	private HorizontalPanel mainPanel = new HorizontalPanel();
+	private VerticalPanel navigationPanel = new VerticalPanel();
+	private Button createNewButton = new Button("create new");
+	private PsiContainer psiContainer = new PsiContainer();
+	//private Image textGridLogo = new Image(IsidorusConstants.TEXTGRID_LOGO_URL);
+	
+	
+	@Override
+	public void onModuleLoad() {
+		RootPanel.get("GWT_Content").add(this.mainPanel);
+		mainPanel.add(this.navigationPanel);
+		mainPanel.setBorderWidth(1);
+		mainPanel.setPixelSize(1024, 700);
+		navigationPanel.add(createNewButton);
+		this.requestHashObjectPsis();
+	}
+		
+	
+	private void requestHashObjectPsis(){
+		String url = URL.encode(IsidorusConstants.GET_HASH_OBJECT_PSIS_URL);
+		RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
+		try{
+			builder.sendRequest(null, new PsiRequest());
+		}catch(RequestException e){
+			e.printStackTrace();
+			Window.alert("could not request existing instances of http://textgrid.org/serviceregistry/model/types/Hash-Object, because(" + e.getClass() + "): " + e.getMessage());
+		}
+	}
+	
+	
+	public void resetPage(){
+		// TODO: implement
+	}
+	
+	
+	
+	
+	
+	
+	private class PsiRequest implements RequestCallback {
+		public PsiRequest(){}
+		
+
+		@Override
+		public void onResponseReceived(Request request, Response response) {
+			if (200 == response.getStatusCode()) {
+				JSONValue psiVals = JSONParser.parseStrict(response.getText());
+				JSONArray psis = null;
+				if(psiVals != null) psis = psiVals.isArray();
+				if(psis == null){
+					Window.alert("got bad json, an array of strings was expected, but got: " + response.getText());
+					HashObjectUi.this.resetPage();
+				}
+				for(int psisIdx = 0; psisIdx != psis.size(); ++psisIdx){
+					JSONValue psiVal = psis.get(psisIdx);
+					JSONString psiString = null;
+					if(psiVal != null) psiString = psiVal.isString();
+					HashObjectUi.this.psiContainer.addPsi(psiString);
+				}
+				
+				HashObjectUi.this.psiContainer.insertIn(HashObjectUi.this.navigationPanel);
+			} else {
+				Window.alert("could not request existing instances of http://textgrid.org/serviceregistry/model/types/Hash-Object, because(" + response.getStatusCode() + "): " + response.getStatusText());
+				HashObjectUi.this.resetPage();
+			}
+		}
+		
+
+		@Override
+		public void onError(Request request, Throwable exception) {
+			String message = null;
+			Class<? extends Throwable> eClass = null;
+			if(exception != null){
+				message = exception.getMessage();
+				eClass = exception.getClass();
+			}
+			Window.alert("could not request existing instances of http://textgrid.org/serviceregistry/model/types/Hash-Object, because(" + eClass + "): " + message);
+			HashObjectUi.this.resetPage();
+		}
+	}
+}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java	Wed Sep 14 05:49:14 2011	(r905)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java	Thu Sep 15 01:58:58 2011	(r906)
@@ -14,4 +14,6 @@
 	public final static String GET_FRAGMENT_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/fragment/";
 	//public final static String GET_SCHEMA_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/schema";
 	public final static String GET_SCHEMA_REQUEST_URL = GWT.getModuleBaseURL() + "TextGrid_ServiceRegistry_required_TMCL_and_GDL_Schema_with_test_data.jtm";
+	public final static String GET_HASH_OBJECT_PSIS_URL = GWT.getModuleBaseURL() + "HashObjectPsis.json";
+	public final static String TEXTGRID_LOGO_URL = GWT.getModuleBaseURL() + "textgrid_small.png";
 }

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/PsiContainer.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/PsiContainer.java	Thu Sep 15 01:58:58 2011	(r906)
@@ -0,0 +1,54 @@
+package us.isidor.gdl.anaToMia.Widgets.isidorus;
+
+import java.util.ArrayList;
+import com.google.gwt.json.client.JSONString;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+
+public class PsiContainer {
+	private ArrayList<Label> psiLabels = new ArrayList<Label>();
+	private VerticalPanel containerPanel = new VerticalPanel();
+	
+	
+	public PsiContainer(){}
+	
+	
+	public void addPsi(String psi){
+		if(psi == null) return;
+		
+		Label lbl = new Label(psi);
+		this.psiLabels.add(lbl);
+		
+		int widgetIdx = 0;
+		for( ; widgetIdx != this.containerPanel.getWidgetCount(); ++widgetIdx){
+			Widget wdgt = this.containerPanel.getWidget(widgetIdx);
+			if((wdgt instanceof Label) && ((Label)wdgt).getText().compareTo(psi) >= 0){
+				this.containerPanel.insert(lbl, widgetIdx);
+				break;
+			}
+		}
+		if(widgetIdx == this.containerPanel.getWidgetCount()) this.containerPanel.add(lbl);
+	}
+	
+	
+	public void addPsi(JSONString psi){
+		if(psi != null)	this.addPsi(psi.stringValue());
+	}
+	
+	
+	public ArrayList<String> getPsis(){
+		ArrayList<String> result = new ArrayList<String>();
+		for (Label lbl : this.psiLabels) result.add(lbl.getText());
+		
+		return result;
+	}
+	
+	
+	public void insertIn(Panel panel){
+		if(panel == null) return;
+		panel.add(this.containerPanel);
+	}
+}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/GDL_Widgets.html
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/GDL_Widgets.html	Wed Sep 14 05:49:14 2011	(r905)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/GDL_Widgets.html	Thu Sep 15 01:58:58 2011	(r906)
@@ -47,6 +47,7 @@
 
 	<center>
  		<div id="GWT_Content"/>
+ 		<image style="position:fixed; bottom:0px; right:0px" src="http://127.0.0.1:8888/gdl_widgets/textgrid_small.png"/>
  	</center>
   </body>
 </html>

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/HashObjectPsis.json
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/HashObjectPsis.json	Thu Sep 15 01:58:58 2011	(r906)
@@ -0,0 +1,103 @@
+[
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash1",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash2",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash3",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash4",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash5",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash6",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash7",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash8",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash9",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash10",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash11",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash12",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash13",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash14",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash15",
+    "http://textgrid.org/serviceregistry/test-hash-2",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash16",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash17",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash18",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash19",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash20",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash21",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash22",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash23",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash24",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash25",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash26",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash27",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash28",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash29",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash30",
+    "http://textgrid.org/serviceregistry/test-hash-31",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash32",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash33",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash34",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash35",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash36",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash37",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash38",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash39",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash40",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash41",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash42",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash43",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash44",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash45",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash46",
+    "http://textgrid.org/serviceregistry/test-hash-47",
+    
+    
+    
+    
+    
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash1",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash2",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash3",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash4",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash5",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash6",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash7",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash8",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash9",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash10",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash11",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash12",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash13",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash14",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash15",
+    "http://textgrid.org/serviceregistry/test-hash-2",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash16",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash17",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash18",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash19",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash20",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash21",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash22",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash23",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash24",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash25",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash26",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash27",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash28",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash29",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash30",
+    "http://textgrid.org/serviceregistry/test-hash-31",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash32",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash33",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash34",
+    "http://textgrid.org/serviceregistry/hash-object/environment-4/hash35",
+    "http://textgrid.org/serviceregistry/hash-object/environment-3/hash36",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash37",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash38",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash39",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash40",
+    "http://textgrid.org/serviceregistry/hash-object/environment-2/hash41",
+    "http://textgrid.org/serviceregistry/hash-object/environment-1/hash42",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash43",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash44",
+    "http://textgrid.org/serviceregistry/hash-object/environment-5/hash45",
+    "http://textgrid.org/serviceregistry/hash-object/environment-6/hash46",
+    "http://textgrid.org/serviceregistry/test-hash-47"
+]
\ No newline at end of file

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/textgrid_large.jpg
==============================================================================
Binary file. No diff available.

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/textgrid_small.png
==============================================================================
Binary file. No diff available.




More information about the Isidorus-cvs mailing list