[isidorus-cvs] r546 - 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 11:33:23 UTC 2011
Author: lgiessmann
Date: Fri Jul 1 04:33:23 2011
New Revision: 546
Log:
gdl-frontend: Widgets: implemented a method that gets the GDL cursor property;
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.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
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 04:01:40 2011 (r545)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 04:33:23 2011 (r546)
@@ -11,6 +11,7 @@
import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue;
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 us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Style.Display;
@@ -174,7 +175,7 @@
if(clearOcc != null){
try{
- return ClearValue.valueOf(clearOcc.getValue().toLowerCase());
+ return ClearValue.valueOf(clearOcc.getValue().toUpperCase());
}catch(IllegalArgumentException e){
throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlFloat + " must be set to one of \"none\", \"left\", \"right\" or \"both\", but is \"" + clearOcc.getValue() + "\"");
}
@@ -462,7 +463,12 @@
} else if(styleOcc == null) {
return BorderStyle.NONE;
} else {
- return BorderStyle.valueOf(styleOcc.getValue());
+ try{
+ return BorderStyle.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());
+ }
}
}
@@ -484,7 +490,12 @@
} else if(styleOcc == null) {
return BorderStyle.NONE;
} else {
- return BorderStyle.valueOf(styleOcc.getValue());
+ try{
+ return BorderStyle.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());
+ }
}
}
@@ -506,7 +517,12 @@
} else if(styleOcc == null) {
return BorderStyle.NONE;
} else {
- return BorderStyle.valueOf(styleOcc.getValue());
+ try{
+ return BorderStyle.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());
+ }
}
}
@@ -528,7 +544,12 @@
} else if(styleOcc == null) {
return BorderStyle.NONE;
} else {
- return BorderStyle.valueOf(styleOcc.getValue());
+ try{
+ return BorderStyle.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());
+ }
}
}
@@ -550,7 +571,12 @@
} else if(styleOcc == null) {
return BorderStyle.NONE;
} else {
- return BorderStyle.valueOf(styleOcc.getValue());
+ try{
+ return BorderStyle.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());
+ }
}
}
@@ -1017,13 +1043,37 @@
}
+ // 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 = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlCursor, styleClass);
+ } else {
+ cursorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.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());
+ }
+ }
+ }
-
- // gdlCursor [gdl:hover | gdl:focus | gdl:active]
-
// gdlBackgroundColor [gdl:hover | gdl:focus | gdl:active]
// gdlOverflow [gdl:hover | gdl:focus | gdl:active]
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 04:01:40 2011 (r545)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 04:33:23 2011 (r546)
@@ -3,6 +3,8 @@
import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
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.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@@ -45,5 +47,7 @@
mainPanel.add(requestButton);
+
+
}
}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.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/CursorValue.java Fri Jul 1 04:33:23 2011 (r546)
@@ -0,0 +1,21 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public enum CursorValue {
+ AUTO,
+ DEFAULT,
+ CROSSHAIR,
+ POINTER,
+ MOVE,
+ N_RESIZE,
+ NE_RESIZE,
+ NW_RESIZE,
+ E_RESIZE,
+ SE_RESIZE,
+ S_RESIZE,
+ SW_RESIZE,
+ W_RESIZE,
+ TEXT,
+ WAIT,
+ HELP,
+ PROGRESS
+}
More information about the Isidorus-cvs
mailing list