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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Fri Jul 1 16:05:04 UTC 2011


Author: lgiessmann
Date: Fri Jul  1 09:05:04 2011
New Revision: 549

Log:
gdl-frontend: Widgets: implemented some methods that set the element's [id, float, clear, background-color] property; added the interface CssValue and created an inheritance to all other self-defined value-classes

Added:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java
      - copied, changed from r543, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CssValue.java
Deleted:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java
Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
   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/values/AbsoluteNumValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -7,7 +7,7 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
 import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue;
-import us.isidor.gdl.anaToMia.Widgets.values.BorderStyle;
+import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue;
 import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue;
 import us.isidor.gdl.anaToMia.Widgets.values.ClearValue;
 import us.isidor.gdl.anaToMia.Widgets.values.ColorValue;
@@ -18,6 +18,7 @@
 import com.google.gwt.dom.client.Style.Float;
 import com.google.gwt.dom.client.Style.Overflow;
 import com.google.gwt.dom.client.Style.VerticalAlign;
+import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.AbsolutePanel;
 import com.google.gwt.user.client.ui.Composite;
 
@@ -28,11 +29,13 @@
 	protected TopicMap tm = null;
 	
 	
-	@SuppressWarnings("unused")
-	private GdlVisibleObject() {}
+	private GdlVisibleObject() {
+		initWidget(this.mainPanel);
+	}
 	
 	
 	public GdlVisibleObject(Topic tmRepresentative) throws InvalidGdlSchemaException{
+		this();
 		this.tmRepresentative = tmRepresentative;
 		this.tm = this.tmRepresentative.getTopicMap();
 		
@@ -451,7 +454,7 @@
 	// 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 BorderStyle getBorderStyle(String styleClass) throws InvalidGdlSchemaException {
+	public BorderStyleValue getBorderStyle(String styleClass) throws InvalidGdlSchemaException {
 		Occurrence styleOcc = null;
 		if(styleClass != null){
 			styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderStyle, styleClass);
@@ -462,10 +465,10 @@
 		if(styleOcc == null && styleClass != null){
 			return null;
 		} else if(styleOcc == null) {
-			return BorderStyle.NONE;
+			return BorderStyleValue.NONE;
 		} else {
 			try{
-				return BorderStyle.valueOf(styleOcc.getValue());
+				return BorderStyleValue.valueOf(styleOcc.getValue());
 			}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());
@@ -478,7 +481,7 @@
 	// 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 BorderStyle getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException {
+	public BorderStyleValue getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException {
 		Occurrence styleOcc = null;
 		if(styleClass != null){
 			styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle, styleClass);
@@ -489,10 +492,10 @@
 		if(styleOcc == null && styleClass != null){
 			return null;
 		} else if(styleOcc == null) {
-			return BorderStyle.NONE;
+			return BorderStyleValue.NONE;
 		} else {
 			try{
-				return BorderStyle.valueOf(styleOcc.getValue());
+				return BorderStyleValue.valueOf(styleOcc.getValue());
 			}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());
@@ -505,7 +508,7 @@
 	// 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 BorderStyle getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException {
+	public BorderStyleValue getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException {
 		Occurrence styleOcc = null;
 		if(styleClass != null){
 			styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle, styleClass);
@@ -516,10 +519,10 @@
 		if(styleOcc == null && styleClass != null){
 			return null;
 		} else if(styleOcc == null) {
-			return BorderStyle.NONE;
+			return BorderStyleValue.NONE;
 		} else {
 			try{
-				return BorderStyle.valueOf(styleOcc.getValue());
+				return BorderStyleValue.valueOf(styleOcc.getValue());
 			}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());
@@ -532,7 +535,7 @@
 	// 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 BorderStyle getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException {
+	public BorderStyleValue getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException {
 		Occurrence styleOcc = null;
 		if(styleClass != null){
 			styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle, styleClass);
@@ -543,10 +546,10 @@
 		if(styleOcc == null && styleClass != null){
 			return null;
 		} else if(styleOcc == null) {
-			return BorderStyle.NONE;
+			return BorderStyleValue.NONE;
 		} else {
 			try{
-				return BorderStyle.valueOf(styleOcc.getValue());
+				return BorderStyleValue.valueOf(styleOcc.getValue());
 			}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());
@@ -559,7 +562,7 @@
 	// 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 BorderStyle getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException {
+	public BorderStyleValue getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException {
 		Occurrence styleOcc = null;
 		if(styleClass != null){
 			styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle, styleClass);
@@ -570,10 +573,10 @@
 		if(styleOcc == null && styleClass != null){
 			return null;
 		} else if(styleOcc == null) {
-			return BorderStyle.NONE;
+			return BorderStyleValue.NONE;
 		} else {
 			try{
-				return BorderStyle.valueOf(styleOcc.getValue());
+				return BorderStyleValue.valueOf(styleOcc.getValue());
 			}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());
@@ -1126,6 +1129,54 @@
 	}
 	
 	
+	// sets the background-color style property of this element by using the GWT DOM class
+	public void setBackgroundColor(ColorValue value){
+		if(value != null){
+			DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue());
+		}
+	}
+	
+	
+	// sets the id property of this element by using the GWT DOM class
+	public void setId(String id){
+		if(id != null){
+			DOM.setElementProperty(this.getElement(), "id", id);
+		}
+	}
+	
+	
+	// sets the display style property of this element by using the GWT DOM class
+	public void setDisplay(Display display){
+		if(display != null){
+			DOM.setStyleAttribute(this.getElement(), "display", display.getCssName());
+		}
+	}
+	
+	
+	// sets the z-index style property of this element by using the GWT DOM class
+	public void setZindex(AutoNumValue value){
+		if(value != null){
+			DOM.setStyleAttribute(this.getElement(), "zIndex", value.getCssValue());
+		}
+	}
+	
+	
+	// sets the float style property of this element by using the GWT DOM class
+	public void setFloat(Float value){
+		if(value != null){
+			DOM.setStyleAttribute(this.getElement(), "float", value.getCssName());
+		}
+	}
+	
+	
+	// sets the clear style property of this element by using the GWT DOM class
+	public void setClear(ClearValue value){
+		if(value != null){
+			DOM.setStyleAttribute(this.getElement(), "clear", value.getCssValue());
+		}
+	}
+	
+	
 	public void setGdlStyle(){
 		// TODO: implement
 	}

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	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -1,11 +1,14 @@
 package us.isidor.gdl.anaToMia.Widgets.base;
 
 import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
+import us.isidor.gdl.anaToMia.Widgets.values.ClearValue;
 import us.isidor.gdl.anaToMia.Widgets.values.ColorValue;
 import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
 
 import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.dom.client.Style.Display;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.DOM;
@@ -49,5 +52,23 @@
 		
 		
 		
+		
+		// only for testing
+		try{
+			Topic tmpRepresentative = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator("http://test.org/test-top"));
+			Topic gdlBackgroundColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBackgroundColor));
+			tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null);
+			
+			GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative) {
+			};
+			
+			tmp.setPixelSize(300, 300);
+			//DOM.setStyleAttribute(tmp.getElement(), "backgroundColor", "lime");
+			
+			this.mainPanel.add(tmp);
+			Window.alert(CursorValue.CROSSHAIR.getCssValue());
+		}catch(Exception e){
+			Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage());
+		}
 	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -2,7 +2,7 @@
 
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
-public class AbsoluteNumValue extends NumUnitValue {
+public class AbsoluteNumValue extends NumUnitValue{
 	public AbsoluteNumValue() throws InvalidGdlSchemaException{
 		super("0px");
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -2,7 +2,7 @@
 
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
-public class AutoNumUnitValue extends NumUnitValue {
+public class AutoNumUnitValue extends NumUnitValue{
 	public AutoNumUnitValue(){
 		super.unit = null; // if unit is null, the default value is auto
 		super.value = 0f;
@@ -30,11 +30,11 @@
 	
 	
 	@Override
-	public String getStringValue() {
+	public String getCssValue() {
 		if(super.unit == null){
 			return "auto";
 		} else {
-			return super.getStringValue();
+			return super.getCssValue();
 		}
 	}
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -3,7 +3,7 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
 
-public class AutoNumValue {
+public class AutoNumValue implements CssValue{
 	private Integer intValue = null;
 	
 	
@@ -28,7 +28,7 @@
 	
 	// return a string that contains either an integer as a string value
 	// or the string auto
-	public String getStringValue(){
+	public String getCssValue(){
 		if(intValue == null){
 			return "auto";
 		}else {

Copied and modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java (from r543, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java)
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java	Fri Jul  1 03:10:46 2011	(r543, copy source)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -1,6 +1,6 @@
 package us.isidor.gdl.anaToMia.Widgets.values;
 
-public enum BorderStyle {
+public enum BorderStyleValue implements CssValue{
 	NONE,
 	HIDDEN,
 	DOTTED,
@@ -10,5 +10,9 @@
 	GROOVE,
 	RIDGE,
 	INSET,
-	OUTSET
+	OUTSET;
+	
+	public String getCssValue(){
+		return this.toString().toLowerCase();
+	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -1,8 +1,12 @@
 package us.isidor.gdl.anaToMia.Widgets.values;
 
-public enum ClearValue {
+public enum ClearValue implements CssValue{
 	NONE,
 	LEFT,
 	RIGHT,
-	BOTH
+	BOTH;
+	
+	public String getCssValue(){
+		return this.toString().toLowerCase();
+	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -2,7 +2,7 @@
 
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
-public class ColorValue {
+public class ColorValue implements CssValue{
 	private String stringValue = null;
 	
 	
@@ -88,7 +88,7 @@
 	
 	
 	// returns a string of the format #RRGGBB
-	public String getStringValue(){
+	public String getCssValue(){
 		return this.stringValue;
 	}
 	
@@ -150,7 +150,7 @@
 	
 	// represents the color key words that are defined in CSS chapter 4.3.6
 	// (http://www.w3.org/TR/CSS21/syndata.html#value-def-color)
-	public enum CssColor{
+	public enum CssColor implements CssValue{
 		MAROON,
 		RED,
 		ORANGE,
@@ -167,6 +167,10 @@
 		TEAL,
 		BLACK,
 		SILVER,
-		GRAY
+		GRAY;
+		
+		public String getCssValue(){
+			return this.toString().toLowerCase();
+		}
 	}
 }

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CssValue.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/CssValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -0,0 +1,5 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public interface CssValue {
+	public String getCssValue();
+}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -1,6 +1,6 @@
 package us.isidor.gdl.anaToMia.Widgets.values;
 
-public enum CursorValue {
+public enum CursorValue implements CssValue{
 	AUTO,
 	DEFAULT,
 	CROSSHAIR,
@@ -17,5 +17,10 @@
 	TEXT,
 	WAIT,
 	HELP,
-	PROGRESS
+	PROGRESS;
+	
+	
+	public String getCssValue(){
+		return this.toString().toLowerCase();
+	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java	Fri Jul  1 08:06:19 2011	(r548)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java	Fri Jul  1 09:05:04 2011	(r549)
@@ -2,7 +2,7 @@
 
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
-public class NumUnitValue {
+public class NumUnitValue implements CssValue{
 	protected CssUnit unit = CssUnit.PIXEL;
 	protected float value = 0f;
 	
@@ -46,7 +46,7 @@
 	
 	
 	// returns the value represented by this instance as a css string
-	public String getStringValue(){
+	public String getCssValue(){
 		switch(this.unit){
 		case PIXEL: return (int)this.value + "px";
 		case POINT: return (int)this.value + "pt";
@@ -68,9 +68,14 @@
 	
 	
 	// a subset of CSS units that are supported by the GDL
-	public enum CssUnit {
+	public enum CssUnit implements CssValue{
 		POINT,
 		PIXEL,
-		PERCENTAGE
+		PERCENTAGE;
+		
+		
+		public String getCssValue(){
+			return this.toString().toLowerCase();
+		}
 	}
 }




More information about the Isidorus-cvs mailing list