[isidorus-cvs] r1034 - in trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base view

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Nov 22 14:56:18 UTC 2011


Author: lgiessmann
Date: Tue Nov 22 06:56:14 2011
New Revision: 1034

Log:
gdl-frontend: Widgets: refactoring of GdlVisibleObject => implemented the class GdlVisbleObjectCssService for getting the css properties defined via the GDL

Added:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectCssService.java
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Thu Nov 17 01:54:38 2011	(r1033)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Tue Nov 22 06:56:14 2011	(r1034)
@@ -1,7 +1,10 @@
+* test GdlCechkBox
+* test GdlRadioButton
+
 * implement export of Fragments, e.g. exportJTM11Fragment(ArrayList<Topic> topics, ArrayList<Association> associaitions),
      e.i. the passed topics and associations must be exported with all characteristics and associations,
      and all referenced topics must be exported as stubs
-* finalise GdltopicView.getContent()
+* finalise GdlTopicView.getContent()
 * finalise GdlPanel.doValidate()
 * finalise GdlCheckBox
 * finalise GdlCommitButton

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Thu Nov 17 01:54:38 2011	(r1033)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Tue Nov 22 06:56:14 2011	(r1034)
@@ -80,6 +80,7 @@
 	protected Panel containerPanel = null;
 	protected Topic tmRepresentative = null;
 	protected TopicMap tm = null;
+	protected GdlVisibleObjectCssService cssService = null;
 	protected ArrayList<Pair<String, String>> activeCssNamesAndStyles = new ArrayList<Pair<String,String>>();
 	protected ArrayList<Pair<String, String>> focusCssNamesAndStyles = new ArrayList<Pair<String,String>>();
 	protected ArrayList<Pair<String, String>> hoverCssNamesAndStyles = new ArrayList<Pair<String,String>>();
@@ -132,6 +133,8 @@
 		if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && !(receivedData instanceof Name) && !(receivedData instanceof Variant) && !(receivedData instanceof Occurrence) && !(receivedData instanceof Role) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic, Association, Topic-Name, Name-Variant, Topic-Occurrence or Association-Role, but is: " + receivedData.getClass());
 		this.receivedData = receivedData;
 
+		this.cssService = new GdlVisibleObjectCssService(this);
+		
 		this.setId(this.getId());
 		this.setGdlStyle();
 	}
@@ -223,67 +226,27 @@
 	}
 
 
-	// a helper method that returns all occurrences of the type bound to the passed PSI
-	@SuppressWarnings("unchecked")
-	protected JsArray<Occurrence> getOccurrences(String occurrenceType){
-		Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType));
-		if(occType == null) return (JsArray<Occurrence>)JsArray.createArray();
-		else return tmRepresentative.getOccurrences(occType);
-	}
-
 
 	// a helper method that returns one occurrence of the type bound to the passed PSI.
 	// If more than one occurrence is available an InvalidGdlSchemaException is thrown.
 	// If nor occurrence is available the return value is null
 	protected Occurrence getNoneOrOneUnscopedOccurrence(String occurrenceType) throws InvalidGdlSchemaException{
-		JsArray<Occurrence> occs = getOccurrences(occurrenceType);
-		ArrayList<Occurrence> unscopedOccs = new ArrayList<Occurrence>();
-		for(int i = 0; i != occs.length(); ++i){
-			if(occs.get(i).getScope().length() == 0) unscopedOccs.add(occs.get(i));
-		}
-
-		if(unscopedOccs.size() > 1){
-			throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to none or one unscoped occurrence of the type " + occurrenceType + ", but is bound " + unscopedOccs.size() + " times to it");
-		} else if(unscopedOccs.size() == 1){
-			return unscopedOccs.get(0);
-		} else {
-			return null;
-		}
+		return TmHelper.getNoneOrOneUnscopedOccurrence(this.tmRepresentative, occurrenceType);
 	}
 
 
 	// a helper method that returns one occurrence of the type bound to the passed PSI and scoped
 	// by the theme bound to the passed PSI. If no such occurrence exist, the default value is null
 	protected Occurrence getNoneOrOneScopedOccurrence(String occurrenceType, String theme) throws InvalidGdlSchemaException{
-		Topic themeTopic = tm.getTopicBySubjectIdentifier(tm.createLocator(theme));
-		if(themeTopic == null){
-			return null;
-		} else {
-			JsArray<Occurrence> occurrences = getOccurrences(occurrenceType);
-			ArrayList<Occurrence> matchedOccurrences = new ArrayList<Occurrence>();
-			for(int i = 0; i != occurrences.length(); ++i){
-				for(int j = 0; j != occurrences.get(i).getScope().length(); ++j){
-					if(occurrences.get(i).getScope().get(j).equals(themeTopic)){
-						matchedOccurrences.add(occurrences.get(i));
-						break;
-					}
-				}
-			}
-
-			if(matchedOccurrences.size() > 1){
-				throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to none or one occurrence of the type " + occurrenceType + " and the scope " + theme + " but is bound " + matchedOccurrences.size() + " times to it");
-			} else if(matchedOccurrences.size() == 1){
-				return matchedOccurrences.get(0);
-			} else {
-				return null;
-			}
-		}
+		return TmHelper.getNoneOrOneScopedOccurrence(this.tmRepresentative, occurrenceType, theme);
 	}
 
 
 	// returns the string value of a gdl:id occurrence
 	public String getId() throws InvalidGdlSchemaException {
-		JsArray<Occurrence> idOccs = getOccurrences(PSIs.GDL.OccurrenceType.gdlId);
+		TopicMap tm = this.tmRepresentative.getTopicMap();
+		Topic idOccType = TmHelper.getTopicByPsi(PSIs.GDL.OccurrenceType.gdlId, tm);
+		JsArray<Occurrence> idOccs = this.tmRepresentative.getOccurrences(idOccType);
 		if(idOccs.length() != 1){
 			throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to exactly one occurrence of the type " + PSIs.GDL.OccurrenceType.gdlId + ", but is bound " + idOccs.length() + " times to it");
 		} else {
@@ -295,92 +258,35 @@
 	// returns a Display instance of a gdl:display occurrence.
 	// If no gdl:display occurrence is set, the default value is returned
 	public Display getDisplay() throws InvalidGdlSchemaException {
-		Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlDisplay);
-
-		if(displayOcc != null){
-			String value = displayOcc.getValue().toLowerCase();
-			if(value.equals("none")){
-				return Display.NONE;
-			} else if (value.equals("inline")){
-				return Display.INLINE;
-			} else if (value.equals("inline-block")){
-				return Display.INLINE_BLOCK;
-			} else if(value.equals("block")){
-				return Display.BLOCK;
-			} else {
-				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlDisplay + " must be set to one of \"none\", \"inline\", \"inline-block\" or \"block\", but is \"" + displayOcc.getValue() + "\"");
-			}
-		} else {
-			return Display.INLINE_BLOCK;
-		}
+		return this.cssService.getDisplay();
 	}
 
 
 	// returns an AutoNumValue instance of a gdl:z-index occurrence.
 	// If no gdl:z-index occurrence is set, the default value is returned
 	public AutoNumValue getZindex() throws InvalidGdlSchemaException {
-		Occurrence zOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlZindex);
-		if(zOcc != null){
-			return new AutoNumValue(zOcc.getValue());
-		} else {
-			return new AutoNumValue();
-		}
+		return this.cssService.getZindex();
 	}
 
 
 	// returns a Float instance of a gdl:float occurrence or the default value for
 	// this property if no gdl:float occurrence is available
 	public Float getFloat() throws InvalidGdlSchemaException {
-		Occurrence floatOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlFloat);
-
-		if(floatOcc != null){
-			String value = floatOcc.getValue().toLowerCase();
-			if(value.equals("none")){
-				return Float.NONE;
-			} else if (value.equals("left")){
-				return Float.LEFT;
-			} else if (value.equals("right")){
-				return Float.RIGHT;
-			} else {
-				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlFloat + " must be set to one of \"none\", \"left\" or \"right\", but is \"" + floatOcc.getValue() + "\"");
-			}
-		} else {
-			return Float.NONE;
-		}
+		return this.cssService.getFloat();
 	}
 
 
 	// returns a ClearValue instance of a gdl:clear occurrence or the default value for
 	// this property if no gdl:clear occurrence is available
 	public ClearValue getClear() throws InvalidGdlSchemaException {
-		Occurrence clearOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlClear);
-
-		if(clearOcc != null){
-			try{
-				return ClearValue.valueOf(clearOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlClear + " must be set to one of \"none\", \"left\", \"right\" or \"both\", but is \"" + clearOcc.getValue() + "\"");
-			}
-		} else {
-			return ClearValue.NONE;
-		}
+		return this.cssService.getClear();
 	}
 
 
 	// returns a ContentOrientationValue instance of a gdl:content-orientation occurrence or the default value for
 	// this property if no gdl:content-orientation occurrence is available
 	public ContentOrientationValue getContentOrientation() throws InvalidGdlSchemaException {
-		Occurrence orientationOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlContentOrientation);
-
-		if(orientationOcc != null){
-			try{
-				return ContentOrientationValue.valueOf(orientationOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlContentOrientation + " must be set to one of \"horizontal\" or \"vertical\", but is \"" + orientationOcc.getValue() + "\"");
-			}
-		} else {
-			return ContentOrientationValue.VERTICAL;
-		}
+		return this.cssService.getContentOrientation();
 	}
 
 
@@ -389,39 +295,7 @@
 	// is available. The styleClass attribute is used as scope for expressing
 	// a css pseudo-class, if styleClass is null the occurrence must be unscoped
 	public VerticalAlign getVerticalAlign(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence vaOcc = null;
-		if(styleClass != null){
-			vaOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlVerticalAlign, styleClass);
-		} else {
-			vaOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlVerticalAlign);
-		}
-
-		if(vaOcc == null && styleClass != null){
-			return null;
-		} else if(vaOcc == null) {
-			return VerticalAlign.BASELINE;
-		}else {
-			String value = vaOcc.getValue().toLowerCase();
-			if(value.equals("baseline")){
-				return VerticalAlign.BASELINE;
-			} else if(value.equals("sub")){
-				return VerticalAlign.SUB;
-			} else if(value.equals("super")) {
-				return VerticalAlign.SUPER;
-			} else if(value.equals("top")) {
-				return VerticalAlign.TOP;
-			}else if(value.equals("text-top")) {
-				return VerticalAlign.TEXT_TOP;
-			}else if(value.equals("middle")) {
-				return VerticalAlign.MIDDLE;
-			}else if(value.equals("bottom")) {
-				return VerticalAlign.BOTTOM;
-			}else if(value.equals("text-bottom")) {
-				return VerticalAlign.TEXT_BOTTOM;
-			} else {
-				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlVerticalAlign + " must be set to one of \"baseline\", \"sub\", \"super\", \"top\", \"text-top\", \"middle\", \"bottom\" or \"text-bottom\", but is \"" + vaOcc.getValue() + "\"");
-			}
-		}
+		return this.cssService.getVerticalAlign(styleClass);
 	}
 
 
@@ -430,20 +304,7 @@
 	// or null. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public NumUnitValue getMargin(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence marginOcc = null;
-		if(styleClass != null){
-			marginOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMargin, styleClass);
-		} else {
-			marginOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMargin);
-		}
-
-		if(marginOcc == null && styleClass != null){
-			return null;
-		} else if(marginOcc == null) {
-			return new NumUnitValue();
-		} else {
-			return new NumUnitValue(marginOcc.getValue());
-		}
+		return this.cssService.getMargin(styleClass);
 	}
 
 
@@ -451,18 +312,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// or null.
 	public NumUnitValue getMarginTop(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence marginOcc = null;
-		if(styleClass != null){
-			marginOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginTop, styleClass);
-		} else {
-			marginOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginTop);
-		}
-
-		if(marginOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(marginOcc.getValue());
-		}
+		return this.cssService.getMarginTop(styleClass);
 	}
 
 
@@ -470,18 +320,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// or null.
 	public NumUnitValue getMarginRight(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence marginOcc = null;
-		if(styleClass != null){
-			marginOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginRight, styleClass);
-		} else {
-			marginOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginRight);
-		}
-
-		if(marginOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(marginOcc.getValue());
-		}
+		return this.cssService.getMarginRight(styleClass);
 	}
 
 
@@ -489,18 +328,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// or null.
 	public NumUnitValue getMarginBottom(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence marginOcc = null;
-		if(styleClass != null){
-			marginOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginBottom, styleClass);
-		} else {
-			marginOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginBottom);
-		}
-
-		if(marginOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(marginOcc.getValue());
-		}
+		return this.cssService.getMarginBottom(styleClass);
 	}
 
 
@@ -508,18 +336,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// or null.
 	public NumUnitValue getMarginLeft(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence marginOcc = null;
-		if(styleClass != null){
-			marginOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginLeft, styleClass);
-		} else {
-			marginOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMarginLeft);
-		}
-
-		if(marginOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(marginOcc.getValue());
-		}
+		return this.cssService.getMarginLeft(styleClass);
 	}
 
 
@@ -528,20 +345,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public ColorValue getBorderColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderColor);
-		}
-
-		if(colorOcc == null && styleClass != null){
-			return null;
-		} else if(colorOcc == null) {
-			return new ColorValue();
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}
+		return this.cssService.getBorderColor(styleClass);
 	}
 
 
@@ -549,18 +353,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public ColorValue getBorderTopColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopColor);
-		}
-
-		if(colorOcc == null ){
-			return null;
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}
+		return this.cssService.getBorderTopColor(styleClass);
 	}
 
 
@@ -568,18 +361,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public ColorValue getBorderRightColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightColor);
-		}
-
-		if(colorOcc == null ){
-			return null;
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}
+		return this.cssService.getBorderRightColor(styleClass);
 	}
 
 
@@ -587,18 +369,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public ColorValue getBorderBottomColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomColor);
-		}
-
-		if(colorOcc == null ){
-			return null;
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}
+		return this.cssService.getBorderBottomColor(styleClass);
 	}
 
 
@@ -606,18 +377,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public ColorValue getBorderLeftColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftColor);
-		}
-
-		if(colorOcc == null ){
-			return null;
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}
+		return this.cssService.getBorderLeftColor(styleClass);
 	}
 
 
@@ -626,25 +386,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public BorderStyleValue getBorderStyle(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence styleOcc = null;
-		if(styleClass != null){
-			styleOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderStyle, styleClass);
-		} else {
-			styleOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderStyle);
-		}
-
-		if(styleOcc == null && styleClass != null){
-			return null;
-		} else if(styleOcc == null) {
-			return BorderStyleValue.NONE;
-		} else {
-			try{
-				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
-				throw new InvalidGdlSchemaException("border-style must be set to one of " + values + ", but is " + styleOcc.getValue());
-			}
-		}
+		return this.cssService.getBorderStyle(styleClass);
 	}
 
 
@@ -652,23 +394,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public BorderStyleValue getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence styleOcc = null;
-		if(styleClass != null){
-			styleOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopStyle, styleClass);
-		} else {
-			styleOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopStyle);
-		}
-
-		if(styleOcc == null){
-			return null;
-		} else {
-			try{
-				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
-				throw new InvalidGdlSchemaException("border-top-style must be set to one of " + values + ", but is " + styleOcc.getValue());
-			}
-		}
+		return this.cssService.getBorderTopStyle(styleClass);
 	}
 
 
@@ -676,23 +402,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public BorderStyleValue getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence styleOcc = null;
-		if(styleClass != null){
-			styleOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightStyle, styleClass);
-		} else {
-			styleOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightStyle);
-		}
-
-		if(styleOcc == null){
-			return null;
-		} else {
-			try{
-				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
-				throw new InvalidGdlSchemaException("border-right-style must be set to one of " + values + ", but is " + styleOcc.getValue());
-			}
-		}
+		return this.cssService.getBorderRightStyle(styleClass);
 	}
 
 
@@ -700,23 +410,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public BorderStyleValue getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence styleOcc = null;
-		if(styleClass != null){
-			styleOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomStyle, styleClass);
-		} else {
-			styleOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomStyle);
-		}
-
-		if(styleOcc == null){
-			return null;
-		} else {
-			try{
-				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
-				throw new InvalidGdlSchemaException("border-bottom-style must be set to one of " + values + ", but is " + styleOcc.getValue());
-			}
-		}
+		return this.cssService.getBorderBottomStyle(styleClass);
 	}
 
 
@@ -724,23 +418,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public BorderStyleValue getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence styleOcc = null;
-		if(styleClass != null){
-			styleOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftStyle, styleClass);
-		} else {
-			styleOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftStyle);
-		}
-
-		if(styleOcc == null){
-			return null;
-		} else {
-			try{
-				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
-			}catch(IllegalArgumentException e){
-				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
-				throw new InvalidGdlSchemaException("border-left-style must be set to one of " + values + ", but is " + styleOcc.getValue());
-			}
-		}
+		return this.cssService.getBorderLeftStyle(styleClass);
 	}
 
 
@@ -749,20 +427,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AbsoluteNumValue getBorderWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderWidth);
-		}
-
-		if(widthOcc == null && styleClass != null){
-			return null;
-		} else if(widthOcc == null) {
-			return new AbsoluteNumValue();
-		} else {
-			return new AbsoluteNumValue(widthOcc.getValue());
-		}
+		return this.cssService.getBorderWidth(styleClass);
 	}
 
 
@@ -770,18 +435,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public AbsoluteNumValue getBorderTopWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopWidth);
-		}
-
-		if(widthOcc == null){
-			return null;
-		} else {
-			return new AbsoluteNumValue(widthOcc.getValue());
-		}
+		return this.cssService.getBorderTopWidth(styleClass);
 	}
 
 
@@ -789,18 +443,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public AbsoluteNumValue getBorderRightWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRightWidth);
-		}
-
-		if(widthOcc == null){
-			return null;
-		} else {
-			return new AbsoluteNumValue(widthOcc.getValue());
-		}
+		return this.cssService.getBorderRightWidth(styleClass);
 	}
 
 
@@ -808,18 +451,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public AbsoluteNumValue getBorderBottomWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomWidth);
-		}
-
-		if(widthOcc == null){
-			return null;
-		} else {
-			return new AbsoluteNumValue(widthOcc.getValue());
-		}
+		return this.cssService.getBorderBottomWidth(styleClass);
 	}
 
 
@@ -827,18 +459,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public AbsoluteNumValue getBorderLeftWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderLeftWidth);
-		}
-
-		if(widthOcc == null){
-			return null;
-		} else {
-			return new AbsoluteNumValue(widthOcc.getValue());
-		}
+		return this.cssService.getBorderLeftWidth(styleClass);
 	}
 
 
@@ -847,20 +468,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public NumUnitValue getBorderRadius(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence radiusOcc = null;
-		if(styleClass != null){
-			radiusOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRadius, styleClass);
-		} else {
-			radiusOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderRadius);
-		}
-
-		if(radiusOcc == null && styleClass != null){
-			return null;
-		} else if(radiusOcc == null) {
-			return new NumUnitValue();
-		} else {
-			return new NumUnitValue(radiusOcc.getValue());
-		}
+		return this.cssService.getBorderRadius(styleClass);
 	}
 
 
@@ -868,20 +476,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getBorderTopLeftRadius(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence radiusOcc = null;
-		if(styleClass != null){
-			radiusOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopLeftRadius, styleClass);
-		} else {
-			radiusOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopLeftRadius);
-		}
-
-		if(radiusOcc == null && styleClass != null){
-			return null;
-		} else if(radiusOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(radiusOcc.getValue());
-		}
+		return this.cssService.getBorderTopLeftRadius(styleClass);
 	}
 
 
@@ -889,20 +484,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getBorderTopRightRadius(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence radiusOcc = null;
-		if(styleClass != null){
-			radiusOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopRightRadius, styleClass);
-		} else {
-			radiusOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderTopRightRadius);
-		}
-
-		if(radiusOcc == null && styleClass != null){
-			return null;
-		} else if(radiusOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(radiusOcc.getValue());
-		}
+		return this.cssService.getBorderTopRightRadius(styleClass);
 	}
 
 
@@ -910,20 +492,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getBorderBottomLeftRadius(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence radiusOcc = null;
-		if(styleClass != null){
-			radiusOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomLeftRadius, styleClass);
-		} else {
-			radiusOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomLeftRadius);
-		}
-
-		if(radiusOcc == null && styleClass != null){
-			return null;
-		} else if(radiusOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(radiusOcc.getValue());
-		}
+		return this.cssService.getBorderBottomLeftRadius(styleClass);
 	}
 
 
@@ -931,20 +500,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getBorderBottomRightRadius(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence radiusOcc = null;
-		if(styleClass != null){
-			radiusOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomRightRadius, styleClass);
-		} else {
-			radiusOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBorderBottomRightRadius);
-		}
-
-		if(radiusOcc == null && styleClass != null){
-			return null;
-		} else if(radiusOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(radiusOcc.getValue());
-		}
+		return this.cssService.getBorderBottomRightRadius(styleClass);
 	}
 
 
@@ -953,20 +509,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public NumUnitValue getPadding(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence paddingOcc = null;
-		if(styleClass != null){
-			paddingOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlPadding, styleClass);
-		} else {
-			paddingOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlPadding);
-		}
-
-		if(paddingOcc == null && styleClass != null){
-			return null;
-		} else if(paddingOcc == null) {
-			return new NumUnitValue();
-		} else {
-			return new NumUnitValue(paddingOcc.getValue());
-		}		
+		return this.cssService.getPadding(styleClass);
 	}
 
 
@@ -974,18 +517,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getPaddingTop(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence paddingOcc = null;
-		if(styleClass != null){
-			paddingOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingTop, styleClass);
-		} else {
-			paddingOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingTop);
-		}
-
-		if(paddingOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(paddingOcc.getValue());
-		}		
+		return this.cssService.getPaddingTop(styleClass);
 	}
 
 
@@ -993,18 +525,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getPaddingRight(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence paddingOcc = null;
-		if(styleClass != null){
-			paddingOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingRight, styleClass);
-		} else {
-			paddingOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingRight);
-		}
-
-		if(paddingOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(paddingOcc.getValue());
-		}		
+		return this.cssService.getPaddingRight(styleClass);
 	}
 
 
@@ -1012,18 +533,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getPaddingBottom(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence paddingOcc = null;
-		if(styleClass != null){
-			paddingOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingBottom, styleClass);
-		} else {
-			paddingOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingBottom);
-		}
-
-		if(paddingOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(paddingOcc.getValue());
-		}
+		return this.cssService.getPaddingBottom(styleClass);
 	}
 
 
@@ -1031,18 +541,7 @@
 	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
 	// null, null otherwise.
 	public NumUnitValue getPaddingLeft(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence paddingOcc = null;
-		if(styleClass != null){
-			paddingOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingLeft, styleClass);
-		} else {
-			paddingOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlPaddingLeft);
-		}
-
-		if(paddingOcc == null){
-			return null;
-		} else {
-			return new NumUnitValue(paddingOcc.getValue());
-		}		
+		return this.cssService.getPaddingLeft(styleClass);
 	}
 
 
@@ -1051,20 +550,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlWidth);
-		}
-
-		if(widthOcc == null && styleClass != null){
-			return null;
-		} else if(widthOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(widthOcc.getValue());
-		}		
+		return this.cssService.getWidth(styleClass);
 	}
 
 
@@ -1073,20 +559,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getMinWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMinWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMinWidth);
-		}
-
-		if(widthOcc == null && styleClass != null){
-			return null;
-		} else if(widthOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(widthOcc.getValue());
-		}		
+		return this.cssService.getMinWidth(styleClass);
 	}
 
 
@@ -1095,20 +568,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getMaxWidth(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence widthOcc = null;
-		if(styleClass != null){
-			widthOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMaxWidth, styleClass);
-		} else {
-			widthOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMaxWidth);
-		}
-
-		if(widthOcc == null && styleClass != null){
-			return null;
-		} else if(widthOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(widthOcc.getValue());
-		}		
+		return this.cssService.getMaxWidth(styleClass);
 	}
 
 
@@ -1117,20 +577,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getHeight(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence heightOcc = null;
-		if(styleClass != null){
-			heightOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlHeight, styleClass);
-		} else {
-			heightOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlHeight);
-		}
-
-		if(heightOcc == null && styleClass != null){
-			return null;
-		} else if(heightOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(heightOcc.getValue());
-		}		
+		return this.cssService.getHeight(styleClass);
 	}
 
 
@@ -1139,20 +586,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getMinHeight(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence heightOcc = null;
-		if(styleClass != null){
-			heightOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMinHeight, styleClass);
-		} else {
-			heightOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMinHeight);
-		}
-
-		if(heightOcc == null && styleClass != null){
-			return null;
-		} else if(heightOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(heightOcc.getValue());
-		}		
+		return this.cssService.getMinHeight(styleClass);
 	}
 
 
@@ -1161,20 +595,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public AutoNumUnitValue getMaxHeight(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence heightOcc = null;
-		if(styleClass != null){
-			heightOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlMaxHeight, styleClass);
-		} else {
-			heightOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlMaxHeight);
-		}
-
-		if(heightOcc == null && styleClass != null){
-			return null;
-		} else if(heightOcc == null) {
-			return new AutoNumUnitValue();
-		} else {
-			return new AutoNumUnitValue(heightOcc.getValue());
-		}		
+		return this.cssService.getMaxHeight(styleClass);
 	}
 
 
@@ -1183,27 +604,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public CursorValue getCursor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence cursorOcc = null;
-		if(styleClass != null){
-			cursorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlCursor, styleClass);
-		} else {
-			cursorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlCursor);
-		}
-
-		if(cursorOcc == null && styleClass != null){
-			return null;
-		} else if(cursorOcc == null) {
-			return CursorValue.AUTO;
-		} else {
-			try{
-				return CursorValue.valueOf(cursorOcc.getValue().toUpperCase().replace("-", "_"));
-			}catch(IllegalArgumentException e){
-				String values = "auto, default, crosshair, pointer, move, n-resize, ne-resize," +
-				"nw-resize, e-resize, se-resize, s-resize, sw-resize, w-resize," +
-				"text, wait, help, or progress";
-				throw new InvalidGdlSchemaException("cursor must be set to one of " + values + ", but is " + cursorOcc.getValue());
-			}
-		}	
+		return this.cssService.getCursor(styleClass);
 	}
 
 
@@ -1212,20 +613,7 @@
 	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
 	// property is returned.
 	public ColorValue getBackgroundColor(String styleClass) throws InvalidGdlSchemaException {
-		Occurrence colorOcc = null;
-		if(styleClass != null){
-			colorOcc = getNoneOrOneScopedOccurrence(PSIs.GDL.OccurrenceType.gdlBackgroundColor, styleClass);
-		} else {
-			colorOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlBackgroundColor);
-		}
-
-		if(colorOcc == null && styleClass != null){
-			return null;
-		} else if(colorOcc == null) {
-			return new ColorValue("#ffffff");
-		} else {
-			return new ColorValue(colorOcc.getValue());
-		}	
+		return this.cssService.getBackgroundColor(styleClass);
 	}
 
 
@@ -1389,6 +777,7 @@
 		if(value != null) this.setCssProperty(widget, styleClass, "borderTopWidth", value.getCssValue());
 	}
 
+	
 	// sets the border-width style property of this element by using the GWT DOM class at Override
 	public void setBorderRightWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException,	ExecutionException {
 		if(value != null) this.setCssProperty(widget, styleClass, "borderRightWidth", value.getCssValue());

Added: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectCssService.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectCssService.java	Tue Nov 22 06:56:14 2011	(r1034)
@@ -0,0 +1,968 @@
+package us.isidor.gdl.anaToMia.Widgets.base;
+
+import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Float;
+import com.google.gwt.dom.client.Style.VerticalAlign;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+import us.isidor.gdl.anaToMia.Widgets.value.AbsoluteNumValue;
+import us.isidor.gdl.anaToMia.Widgets.value.AutoNumUnitValue;
+import us.isidor.gdl.anaToMia.Widgets.value.AutoNumValue;
+import us.isidor.gdl.anaToMia.Widgets.value.BorderStyleValue;
+import us.isidor.gdl.anaToMia.Widgets.value.ClearValue;
+import us.isidor.gdl.anaToMia.Widgets.value.ColorValue;
+import us.isidor.gdl.anaToMia.Widgets.value.ContentOrientationValue;
+import us.isidor.gdl.anaToMia.Widgets.value.CursorValue;
+import us.isidor.gdl.anaToMia.Widgets.value.NumUnitValue;
+
+public class GdlVisibleObjectCssService {
+	private GdlVisibleObject owner = null;
+	
+	@SuppressWarnings("unused")
+	private GdlVisibleObjectCssService() {}
+	
+	
+	public GdlVisibleObjectCssService(GdlVisibleObject owner) throws ExecutionException{
+		if(owner == null) throw new ExecutionException("owner must not be null");
+		this.owner = owner;
+	}
+	
+	
+	// returns a Display instance of a gdl:display occurrence.
+	// If no gdl:display occurrence is set, the default value is returned
+	public Display getDisplay() throws InvalidGdlSchemaException {
+		Occurrence displayOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlDisplay);
+
+		if(displayOcc != null){
+			String value = displayOcc.getValue().toLowerCase();
+			if(value.equals("none")){
+				return Display.NONE;
+			} else if (value.equals("inline")){
+				return Display.INLINE;
+			} else if (value.equals("inline-block")){
+				return Display.INLINE_BLOCK;
+			} else if(value.equals("block")){
+				return Display.BLOCK;
+			} else {
+				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlDisplay + " must be set to one of \"none\", \"inline\", \"inline-block\" or \"block\", but is \"" + displayOcc.getValue() + "\"");
+			}
+		} else {
+			return Display.INLINE_BLOCK;
+		}
+	}
+
+
+	// returns an AutoNumValue instance of a gdl:z-index occurrence.
+	// If no gdl:z-index occurrence is set, the default value is returned
+	public AutoNumValue getZindex() throws InvalidGdlSchemaException {
+		Occurrence zOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlZindex);
+		if(zOcc != null){
+			return new AutoNumValue(zOcc.getValue());
+		} else {
+			return new AutoNumValue();
+		}
+	}
+	
+	
+	// returns a Float instance of a gdl:float occurrence or the default value for
+	// this property if no gdl:float occurrence is available
+	public Float getFloat() throws InvalidGdlSchemaException {
+		Occurrence floatOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlFloat);
+
+		if(floatOcc != null){
+			String value = floatOcc.getValue().toLowerCase();
+			if(value.equals("none")){
+				return Float.NONE;
+			} else if (value.equals("left")){
+				return Float.LEFT;
+			} else if (value.equals("right")){
+				return Float.RIGHT;
+			} else {
+				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlFloat + " must be set to one of \"none\", \"left\" or \"right\", but is \"" + floatOcc.getValue() + "\"");
+			}
+		} else {
+			return Float.NONE;
+		}
+	}
+
+
+	// returns a ClearValue instance of a gdl:clear occurrence or the default value for
+	// this property if no gdl:clear occurrence is available
+	public ClearValue getClear() throws InvalidGdlSchemaException {
+		Occurrence clearOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlClear);
+
+		if(clearOcc != null){
+			try{
+				return ClearValue.valueOf(clearOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlClear + " must be set to one of \"none\", \"left\", \"right\" or \"both\", but is \"" + clearOcc.getValue() + "\"");
+			}
+		} else {
+			return ClearValue.NONE;
+		}
+	}
+	
+	
+	// returns a ContentOrientationValue instance of a gdl:content-orientation occurrence or the default value for
+	// this property if no gdl:content-orientation occurrence is available
+	public ContentOrientationValue getContentOrientation() throws InvalidGdlSchemaException {
+		Occurrence orientationOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlContentOrientation);
+
+		if(orientationOcc != null){
+			try{
+				return ContentOrientationValue.valueOf(orientationOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlContentOrientation + " must be set to one of \"horizontal\" or \"vertical\", but is \"" + orientationOcc.getValue() + "\"");
+			}
+		} else {
+			return ContentOrientationValue.VERTICAL;
+		}
+	}
+	
+	
+	// returns a VerticalAlign instance of a gdl:vertical-align occurrence
+	// or the default value for this property if no gdl:vertical-align occurrence
+	// is available. The styleClass attribute is used as scope for expressing
+	// a css pseudo-class, if styleClass is null the occurrence must be unscoped
+	public VerticalAlign getVerticalAlign(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence vaOcc = null;
+		if(styleClass != null){
+			vaOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlVerticalAlign, styleClass);
+		} else {
+			vaOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlVerticalAlign);
+		}
+
+		if(vaOcc == null && styleClass != null){
+			return null;
+		} else if(vaOcc == null) {
+			return VerticalAlign.BASELINE;
+		}else {
+			String value = vaOcc.getValue().toLowerCase();
+			if(value.equals("baseline")){
+				return VerticalAlign.BASELINE;
+			} else if(value.equals("sub")){
+				return VerticalAlign.SUB;
+			} else if(value.equals("super")) {
+				return VerticalAlign.SUPER;
+			} else if(value.equals("top")) {
+				return VerticalAlign.TOP;
+			}else if(value.equals("text-top")) {
+				return VerticalAlign.TEXT_TOP;
+			}else if(value.equals("middle")) {
+				return VerticalAlign.MIDDLE;
+			}else if(value.equals("bottom")) {
+				return VerticalAlign.BOTTOM;
+			}else if(value.equals("text-bottom")) {
+				return VerticalAlign.TEXT_BOTTOM;
+			} else {
+				throw new InvalidGdlSchemaException("The occurrence " + PSIs.GDL.OccurrenceType.gdlVerticalAlign + " must be set to one of \"baseline\", \"sub\", \"super\", \"top\", \"text-top\", \"middle\", \"bottom\" or \"text-bottom\", but is \"" + vaOcc.getValue() + "\"");
+			}
+		}
+	}
+	
+	
+	// returns a NumUnitValue instance that represents the margin of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// or null. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public NumUnitValue getMargin(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence marginOcc = null;
+		if(styleClass != null){
+			marginOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMargin, styleClass);
+		} else {
+			marginOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMargin);
+		}
+
+		if(marginOcc == null && styleClass != null){
+			return null;
+		} else if(marginOcc == null) {
+			return new NumUnitValue();
+		} else {
+			return new NumUnitValue(marginOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the margin-top of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// or null.
+	public NumUnitValue getMarginTop(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence marginOcc = null;
+		if(styleClass != null){
+			marginOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginTop, styleClass);
+		} else {
+			marginOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginTop);
+		}
+
+		if(marginOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(marginOcc.getValue());
+		}
+	}
+
+	
+	// returns a NumUnitValue instance that represents the margin-right of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// or null.
+	public NumUnitValue getMarginRight(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence marginOcc = null;
+		if(styleClass != null){
+			marginOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginRight, styleClass);
+		} else {
+			marginOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginRight);
+		}
+
+		if(marginOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(marginOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the margin-bottom of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// or null.
+	public NumUnitValue getMarginBottom(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence marginOcc = null;
+		if(styleClass != null){
+			marginOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginBottom, styleClass);
+		} else {
+			marginOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginBottom);
+		}
+
+		if(marginOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(marginOcc.getValue());
+		}
+	}
+
+	
+	// returns a NumUnitValue instance that represents the margin-left of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// or null.
+	public NumUnitValue getMarginLeft(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence marginOcc = null;
+		if(styleClass != null){
+			marginOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginLeft, styleClass);
+		} else {
+			marginOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMarginLeft);
+		}
+
+		if(marginOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(marginOcc.getValue());
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the color of this element's border.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public ColorValue getBorderColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderColor);
+		}
+
+		if(colorOcc == null && styleClass != null){
+			return null;
+		} else if(colorOcc == null) {
+			return new ColorValue();
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}
+	}
+
+	
+	// returns a ColorValue instance that represents the color of this element's border-top.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public ColorValue getBorderTopColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopColor);
+		}
+
+		if(colorOcc == null ){
+			return null;
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the color of this element's border-right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public ColorValue getBorderRightColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightColor);
+		}
+
+		if(colorOcc == null ){
+			return null;
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}
+	}
+
+	
+	// returns a ColorValue instance that represents the color of this element's border-bottom.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public ColorValue getBorderBottomColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomColor);
+		}
+
+		if(colorOcc == null ){
+			return null;
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the color of this element's border-left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public ColorValue getBorderLeftColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftColor);
+		}
+
+		if(colorOcc == null ){
+			return null;
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}
+	}
+
+	
+	// returns a ColorValue instance that represents the style of this element's border.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public BorderStyleValue getBorderStyle(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence styleOcc = null;
+		if(styleClass != null){
+			styleOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderStyle, styleClass);
+		} else {
+			styleOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderStyle);
+		}
+
+		if(styleOcc == null && styleClass != null){
+			return null;
+		} else if(styleOcc == null) {
+			return BorderStyleValue.NONE;
+		} else {
+			try{
+				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
+				throw new InvalidGdlSchemaException("border-style must be set to one of " + values + ", but is " + styleOcc.getValue());
+			}
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the style of this element's border-top.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public BorderStyleValue getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence styleOcc = null;
+		if(styleClass != null){
+			styleOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopStyle, styleClass);
+		} else {
+			styleOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopStyle);
+		}
+
+		if(styleOcc == null){
+			return null;
+		} else {
+			try{
+				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
+				throw new InvalidGdlSchemaException("border-top-style must be set to one of " + values + ", but is " + styleOcc.getValue());
+			}
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the style of this element's border-right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public BorderStyleValue getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence styleOcc = null;
+		if(styleClass != null){
+			styleOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightStyle, styleClass);
+		} else {
+			styleOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightStyle);
+		}
+
+		if(styleOcc == null){
+			return null;
+		} else {
+			try{
+				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
+				throw new InvalidGdlSchemaException("border-right-style must be set to one of " + values + ", but is " + styleOcc.getValue());
+			}
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the style of this element's border-bottom.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public BorderStyleValue getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence styleOcc = null;
+		if(styleClass != null){
+			styleOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomStyle, styleClass);
+		} else {
+			styleOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomStyle);
+		}
+
+		if(styleOcc == null){
+			return null;
+		} else {
+			try{
+				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
+				throw new InvalidGdlSchemaException("border-bottom-style must be set to one of " + values + ", but is " + styleOcc.getValue());
+			}
+		}
+	}
+
+
+	// returns a ColorValue instance that represents the style of this element's border-left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public BorderStyleValue getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence styleOcc = null;
+		if(styleClass != null){
+			styleOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftStyle, styleClass);
+		} else {
+			styleOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftStyle);
+		}
+
+		if(styleOcc == null){
+			return null;
+		} else {
+			try{
+				return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase());
+			}catch(IllegalArgumentException e){
+				String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset";
+				throw new InvalidGdlSchemaException("border-left-style must be set to one of " + values + ", but is " + styleOcc.getValue());
+			}
+		}
+	}
+
+
+	// returns a AbsoluteNumValue instance that represents the width of this element's border.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AbsoluteNumValue getBorderWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderWidth);
+		}
+
+		if(widthOcc == null && styleClass != null){
+			return null;
+		} else if(widthOcc == null) {
+			return new AbsoluteNumValue();
+		} else {
+			return new AbsoluteNumValue(widthOcc.getValue());
+		}
+	}
+
+
+	// returns a AbsoluteNumValue instance that represents the width of this element's border-top.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public AbsoluteNumValue getBorderTopWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopWidth);
+		}
+
+		if(widthOcc == null){
+			return null;
+		} else {
+			return new AbsoluteNumValue(widthOcc.getValue());
+		}
+	}
+
+
+	// returns a AbsoluteNumValue instance that represents the width of this element's border-right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public AbsoluteNumValue getBorderRightWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRightWidth);
+		}
+
+		if(widthOcc == null){
+			return null;
+		} else {
+			return new AbsoluteNumValue(widthOcc.getValue());
+		}
+	}
+
+
+	// returns a AbsoluteNumValue instance that represents the width of this element's border-bottom.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public AbsoluteNumValue getBorderBottomWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomWidth);
+		}
+
+		if(widthOcc == null){
+			return null;
+		} else {
+			return new AbsoluteNumValue(widthOcc.getValue());
+		}
+	}
+
+
+	// returns a AbsoluteNumValue instance that represents the width of this element's border-left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public AbsoluteNumValue getBorderLeftWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderLeftWidth);
+		}
+
+		if(widthOcc == null){
+			return null;
+		} else {
+			return new AbsoluteNumValue(widthOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the radius of this element's border.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public NumUnitValue getBorderRadius(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence radiusOcc = null;
+		if(styleClass != null){
+			radiusOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRadius, styleClass);
+		} else {
+			radiusOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderRadius);
+		}
+
+		if(radiusOcc == null && styleClass != null){
+			return null;
+		} else if(radiusOcc == null) {
+			return new NumUnitValue();
+		} else {
+			return new NumUnitValue(radiusOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the radius of this element's border-top-left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getBorderTopLeftRadius(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence radiusOcc = null;
+		if(styleClass != null){
+			radiusOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopLeftRadius, styleClass);
+		} else {
+			radiusOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopLeftRadius);
+		}
+
+		if(radiusOcc == null && styleClass != null){
+			return null;
+		} else if(radiusOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(radiusOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the radius of this element's border-top-right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getBorderTopRightRadius(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence radiusOcc = null;
+		if(styleClass != null){
+			radiusOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopRightRadius, styleClass);
+		} else {
+			radiusOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderTopRightRadius);
+		}
+
+		if(radiusOcc == null && styleClass != null){
+			return null;
+		} else if(radiusOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(radiusOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the radius of this element's border-bottom-left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getBorderBottomLeftRadius(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence radiusOcc = null;
+		if(styleClass != null){
+			radiusOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomLeftRadius, styleClass);
+		} else {
+			radiusOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomLeftRadius);
+		}
+
+		if(radiusOcc == null && styleClass != null){
+			return null;
+		} else if(radiusOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(radiusOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the radius of this element's border-bottom-right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getBorderBottomRightRadius(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence radiusOcc = null;
+		if(styleClass != null){
+			radiusOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomRightRadius, styleClass);
+		} else {
+			radiusOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBorderBottomRightRadius);
+		}
+
+		if(radiusOcc == null && styleClass != null){
+			return null;
+		} else if(radiusOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(radiusOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the padding of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public NumUnitValue getPadding(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence paddingOcc = null;
+		if(styleClass != null){
+			paddingOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPadding, styleClass);
+		} else {
+			paddingOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPadding);
+		}
+
+		if(paddingOcc == null && styleClass != null){
+			return null;
+		} else if(paddingOcc == null) {
+			return new NumUnitValue();
+		} else {
+			return new NumUnitValue(paddingOcc.getValue());
+		}		
+	}
+
+
+	// returns a NumUnitValue instance that represents the padding of this element's top.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getPaddingTop(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence paddingOcc = null;
+		if(styleClass != null){
+			paddingOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingTop, styleClass);
+		} else {
+			paddingOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingTop);
+		}
+
+		if(paddingOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(paddingOcc.getValue());
+		}		
+	}
+
+
+	// returns a NumUnitValue instance that represents the padding of this element's right.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getPaddingRight(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence paddingOcc = null;
+		if(styleClass != null){
+			paddingOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingRight, styleClass);
+		} else {
+			paddingOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingRight);
+		}
+
+		if(paddingOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(paddingOcc.getValue());
+		}		
+	}
+
+
+	// returns a NumUnitValue instance that represents the padding of this element's bottom.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getPaddingBottom(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence paddingOcc = null;
+		if(styleClass != null){
+			paddingOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingBottom, styleClass);
+		} else {
+			paddingOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingBottom);
+		}
+
+		if(paddingOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(paddingOcc.getValue());
+		}
+	}
+
+
+	// returns a NumUnitValue instance that represents the padding of this element's left.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise.
+	public NumUnitValue getPaddingLeft(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence paddingOcc = null;
+		if(styleClass != null){
+			paddingOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingLeft, styleClass);
+		} else {
+			paddingOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlPaddingLeft);
+		}
+
+		if(paddingOcc == null){
+			return null;
+		} else {
+			return new NumUnitValue(paddingOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the width of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlWidth);
+		}
+
+		if(widthOcc == null && styleClass != null){
+			return null;
+		} else if(widthOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(widthOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the min-width of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getMinWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMinWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMinWidth);
+		}
+
+		if(widthOcc == null && styleClass != null){
+			return null;
+		} else if(widthOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(widthOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the max-width of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getMaxWidth(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence widthOcc = null;
+		if(styleClass != null){
+			widthOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMaxWidth, styleClass);
+		} else {
+			widthOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMaxWidth);
+		}
+
+		if(widthOcc == null && styleClass != null){
+			return null;
+		} else if(widthOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(widthOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the height of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getHeight(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence heightOcc = null;
+		if(styleClass != null){
+			heightOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlHeight, styleClass);
+		} else {
+			heightOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlHeight);
+		}
+
+		if(heightOcc == null && styleClass != null){
+			return null;
+		} else if(heightOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(heightOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the min-height of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getMinHeight(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence heightOcc = null;
+		if(styleClass != null){
+			heightOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMinHeight, styleClass);
+		} else {
+			heightOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMinHeight);
+		}
+
+		if(heightOcc == null && styleClass != null){
+			return null;
+		} else if(heightOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(heightOcc.getValue());
+		}		
+	}
+
+
+	// returns an AutoNumUnitValue instance that represents the max-height of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public AutoNumUnitValue getMaxHeight(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence heightOcc = null;
+		if(styleClass != null){
+			heightOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMaxHeight, styleClass);
+		} else {
+			heightOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlMaxHeight);
+		}
+
+		if(heightOcc == null && styleClass != null){
+			return null;
+		} else if(heightOcc == null) {
+			return new AutoNumUnitValue();
+		} else {
+			return new AutoNumUnitValue(heightOcc.getValue());
+		}		
+	}
+
+
+	// returns a CursorValue instance that represents the cursor of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public CursorValue getCursor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence cursorOcc = null;
+		if(styleClass != null){
+			cursorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlCursor, styleClass);
+		} else {
+			cursorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlCursor);
+		}
+
+		if(cursorOcc == null && styleClass != null){
+			return null;
+		} else if(cursorOcc == null) {
+			return CursorValue.AUTO;
+		} else {
+			try{
+				return CursorValue.valueOf(cursorOcc.getValue().toUpperCase().replace("-", "_"));
+			}catch(IllegalArgumentException e){
+				String values = "auto, default, crosshair, pointer, move, n-resize, ne-resize," +
+				"nw-resize, e-resize, se-resize, s-resize, sw-resize, w-resize," +
+				"text, wait, help, or progress";
+				throw new InvalidGdlSchemaException("cursor must be set to one of " + values + ", but is " + cursorOcc.getValue());
+			}
+		}	
+	}
+
+
+	// returns a ColorValue instance that represents the background-color of this element.
+	// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+	// null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this
+	// property is returned.
+	public ColorValue getBackgroundColor(String styleClass) throws InvalidGdlSchemaException {
+		Occurrence colorOcc = null;
+		if(styleClass != null){
+			colorOcc = TmHelper.getNoneOrOneScopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBackgroundColor, styleClass);
+		} else {
+			colorOcc = TmHelper.getNoneOrOneUnscopedOccurrence(this.owner.getTmRepresentative(), PSIs.GDL.OccurrenceType.gdlBackgroundColor);
+		}
+
+		if(colorOcc == null && styleClass != null){
+			return null;
+		} else if(colorOcc == null) {
+			return new ColorValue("#ffffff");
+		} else {
+			return new ColorValue(colorOcc.getValue());
+		}	
+	}
+}

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Thu Nov 17 01:54:38 2011	(r1033)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Tue Nov 22 06:56:14 2011	(r1034)
@@ -35,6 +35,67 @@
 	}
 	
 	
+	// a helper method that returns one occurrence of the type bound to the passed PSI and scoped
+	// by the theme bound to the passed PSI. If no such occurrence exist, the default value is null
+	public static Occurrence getNoneOrOneScopedOccurrence(Topic owner, String occurrenceType, String theme) throws InvalidGdlSchemaException{
+		if(owner == null || occurrenceType == null) return null;
+		
+		TopicMap tm = owner.getTopicMap();
+		
+		Topic themeTopic = tm.getTopicBySubjectIdentifier(tm.createLocator(theme));
+		Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType));
+		if(themeTopic == null || occType == null){
+			return null;
+		} else {
+			JsArray<Occurrence> occurrences = owner.getOccurrences(occType);
+			ArrayList<Occurrence> matchedOccurrences = new ArrayList<Occurrence>();
+			for(int i = 0; i != occurrences.length(); ++i){
+				for(int j = 0; j != occurrences.get(i).getScope().length(); ++j){
+					if(occurrences.get(i).getScope().get(j).equals(themeTopic)){
+						matchedOccurrences.add(occurrences.get(i));
+						break;
+					}
+				}
+			}
+
+			if(matchedOccurrences.size() > 1){
+				throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(owner) + "must be bound to none or one occurrence of the type " + occurrenceType + " and the scope " + theme + " but is bound " + matchedOccurrences.size() + " times to it");
+			} else if(matchedOccurrences.size() == 1){
+				return matchedOccurrences.get(0);
+			} else {
+				return null;
+			}
+		}
+	}
+	
+	
+	// a helper method that returns one occurrence of the type bound to the passed PSI.
+	// If more than one occurrence is available an InvalidGdlSchemaException is thrown.
+	// If nor occurrence is available the return value is null
+	public static Occurrence getNoneOrOneUnscopedOccurrence(Topic owner, String occurrenceType) throws InvalidGdlSchemaException{
+		if(owner == null || occurrenceType == null) return null;
+		
+		TopicMap tm = owner.getTopicMap();
+		
+		Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType));
+		if(occType == null) return null;
+		
+		JsArray<Occurrence> occs = owner.getOccurrences(occType);
+		ArrayList<Occurrence> unscopedOccs = new ArrayList<Occurrence>();
+		for(int i = 0; i != occs.length(); ++i){
+			if(occs.get(i).getScope().length() == 0) unscopedOccs.add(occs.get(i));
+		}
+
+		if(unscopedOccs.size() > 1){
+			throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(owner) + " must be bound to none or one unscoped occurrence of the type " + occurrenceType + ", but is bound " + unscopedOccs.size() + " times to it");
+		} else if(unscopedOccs.size() == 1){
+			return unscopedOccs.get(0);
+		} else {
+			return null;
+		}
+	}
+	
+	
 	// a helper that returns the topic bound to the identifier via a subject locator
 	public static Topic getTopicBySl(String subjectLocator, TopicMap tm){
 		if(subjectLocator == null || tm == null) return null;

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Thu Nov 17 01:54:38 2011	(r1033)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Tue Nov 22 06:56:14 2011	(r1034)
@@ -10,6 +10,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlHiddenValue;
@@ -304,12 +305,7 @@
 		
 		// returns the string value of a gdl:id occurrence
 		public String getId() throws InvalidGdlSchemaException {
-			JsArray<Occurrence> idOccs = getOccurrences(PSIs.GDL.OccurrenceType.gdlId);
-			if(idOccs.length() != 1){
-				throw new InvalidGdlSchemaException("The topic " + TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to exactly one occurrence of the type " + PSIs.GDL.OccurrenceType.gdlId + ", but is bound " + idOccs.length() + " times to it");
-			} else {
-				return idOccs.get(0).getValue() + "__GDL_" + this.indexInParent;
-			}
+			return super.getId() + "__GDL_" + this.indexInParent;
 		}
 		
 		




More information about the Isidorus-cvs mailing list