[isidorus-cvs] r559 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text values

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Jul 5 06:59:48 UTC 2011


Author: lgiessmann
Date: Mon Jul  4 23:59:48 2011
New Revision: 559

Log:
gdl-frontend: Widgets: added methods for reading all Topic Maps values define dby the GDL for objects of the type gdl:Text

Added:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/HtmlValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextTypeValue.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/text/GdlTextObject.java

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.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/base/IGdlHasValue.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -0,0 +1,11 @@
+package us.isidor.gdl.anaToMia.Widgets.base;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+
+
+public interface IGdlHasValue {
+	public String getStringValue();
+	public Construct getTmValue();
+	public TopicMapsTypes getTmType(); // null if it is a String value
+}

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	Mon Jul  4 23:22:00 2011	(r558)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -106,11 +106,7 @@
 			
 			
 			
-			GdlTextObject tmp = new GdlTextObject(tmpRepresentative){
-				@Override
-				public String getText() {
-					return "tmp";
-				}};
+			GdlTextObject tmp = new GdlTextObject(tmpRepresentative){};
 			this.mainPanel.add(tmp);
 		}catch(Exception e){
 			e.printStackTrace();

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.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/text/GdlText.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -0,0 +1,160 @@
+package us.isidor.gdl.anaToMia.Widgets.text;
+
+import com.google.gwt.dom.client.Style.Display;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
+import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+import us.isidor.gdl.anaToMia.Widgets.values.TextTypeValue;
+
+public class GdlText extends GdlTextObject implements IGdlHasValue{
+
+	
+	// some constructors
+	protected GdlText(){
+		super();
+	}
+	
+	
+	public GdlText(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
+		super(tmRepresentative);
+	}
+	
+	
+	
+	// returns a TextType instance of a gdl:text-type occurrence.
+	// If no gdl:text-type occurrence is set, the default value is returned
+	public TextTypeValue getTextType() throws InvalidGdlSchemaException {
+		Occurrence typeOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlTextType);
+
+		if(typeOcc != null){
+			try{
+				return TextTypeValue.valueOf(typeOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlTextType + " must be set to one of \"text\" or \"password\", but is \"" + typeOcc.getValue() + "\"");
+			}
+		} else {
+			return TextTypeValue.Text;
+		}
+	}
+	
+	
+	// returns a boolean instance of a gdl:readonly occurrence.
+	// If no gdl:readonly occurrence is set, the default value is returned
+	public boolean getReadnonly() throws InvalidGdlSchemaException {
+		Occurrence readOnlyOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlReadonly);
+
+		if(readOnlyOcc != null){
+			String boolStr = readOnlyOcc.getValue().toUpperCase();
+			if(boolStr.equals("TRUE")){
+				return true;
+			} else if(boolStr.equals("FALSE")) {
+				return false;
+			} else {
+				throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlReadonly + " must be set to one of \"true\" or \"false\", but is \"" + readOnlyOcc.getValue() + "\"");
+			}
+		} else {
+			return true;
+		}
+	}
+	
+	
+	
+	// returns a boolean instance of a gdl:rows occurrence.
+	// If no gdl:rows occurrence is set, the default value is returned
+	public int getRows() throws InvalidGdlSchemaException {
+		Occurrence rowsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlRows);
+
+		if(rowsOcc != null){
+			try{
+				int value = Integer.valueOf(rowsOcc.getValue());
+				if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\""); 
+				else return value;
+			}catch(NumberFormatException e){
+				throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\"");
+			}
+		} else {
+			return 1;
+		}
+	}
+	
+	
+	// returns a boolean instance of a gdl:cols occurrence.
+	// If no gdl:cols occurrence is set, the default value is returned
+	public int getCols() throws InvalidGdlSchemaException {
+		Occurrence colsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCols);
+
+		if(colsOcc != null){
+			try{
+				int value = Integer.valueOf(colsOcc.getValue());
+				if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlCols + " must be set to a positive integer, but is \"" + colsOcc.getValue() + "\""); 
+				else return value;
+			}catch(NumberFormatException e){
+				throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlCols + " must be set to a positive integer, but is \"" + colsOcc.getValue() + "\"");
+			}
+		} else {
+			return 5;
+		}
+	}
+	
+	
+	// returns a boolean instance of a gdl:resize occurrence.
+	// If no gdl:resize occurrence is set, the default value is returned
+	public boolean getResize() throws InvalidGdlSchemaException {
+		Occurrence resizeOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlResize);
+
+		if(resizeOcc != null){
+			String boolStr = resizeOcc.getValue().toUpperCase();
+			if(boolStr.equals("TRUE")){
+				return true;
+			} else if(boolStr.equals("FALSE")) {
+				return false;
+			} else {
+				throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlResize + " must be set to one of \"true\" or \"false\", but is \"" + resizeOcc.getValue() + "\"");
+			}
+		} else {
+			return false;
+		}
+	}
+	
+	
+	// calls the super class's setGdlStyle and additionally calls local statements
+	// to fulfill the style settings
+	@Override
+	protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{
+		super.setGdlStyle();
+
+			// TODO: implement
+			// text-type
+			// readonly
+			// rows
+			// calls
+			// resize
+			
+	}
+	
+
+	@Override
+	public String getStringValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Construct getTmValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public TopicMapsTypes getTmType() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java	Mon Jul  4 23:22:00 2011	(r558)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -365,8 +365,4 @@
 			this.setWordSpacing(this.getWordSpacing(styleClass), styleClass);
 		}
 	}
-	
-	
-	// shall return the objects textual value
-	public abstract String getText(); 
 }

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/HtmlValue.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/values/HtmlValue.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -0,0 +1,5 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public interface HtmlValue {
+	public String getHtmlValue();
+}

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextTypeValue.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/values/TextTypeValue.java	Mon Jul  4 23:59:48 2011	(r559)
@@ -0,0 +1,13 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public enum TextTypeValue implements HtmlValue{
+	Text,
+	Password;
+
+	
+	@Override
+	public String getHtmlValue() {
+		return this.toString().toLowerCase();
+	}
+	
+}




More information about the Isidorus-cvs mailing list