add missing property from xml 23/13923/1
Antoine ELIAS [Wed, 5 Mar 2014 18:41:47 +0000 (19:41 +0100)]
Change-Id: Icc483245d15352637e48bd4b96fe18103683ecab

scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/xmlloader/GOBuilder.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/xmlloader/XmlLoader.java

index 8dbbc3a..8748351 100644 (file)
@@ -192,6 +192,10 @@ public class GOBuilder {
         if (type == -1) { //label latex
             uic = controller.askObject(GraphicObject.getTypeFromName(__GO_UI_TEXT__));
             controller.setProperty(uic, __GO_UI_STRING__, new String[] {"$$"});
+        } else if (type == -2) {
+            uic = controller.askObject(GraphicObject.getTypeFromName(__GO_UI_EDIT__));
+            controller.setProperty(uic, __GO_UI_MIN__, 0.0);
+            controller.setProperty(uic, __GO_UI_MAX__, 2.0);
         } else {
             uic = controller.askObject(GraphicObject.getTypeFromName(type));
         }
@@ -278,11 +282,21 @@ public class GOBuilder {
                 controller.setProperty(uic, __GO_UI_FONTNAME__, item);
             }
 
+            item = xmlAttributes.get("fontname");
+            if (item != null) {
+                controller.setProperty(uic, __GO_UI_FONTNAME__, item);
+            }
+
             item = xmlAttributes.get("font-size");
             if (item != null) {
                 controller.setProperty(uic, __GO_UI_FONTSIZE__, Double.parseDouble(item));
             }
 
+            item = xmlAttributes.get("fontsize");
+            if (item != null) {
+                controller.setProperty(uic, __GO_UI_FONTSIZE__, Double.parseDouble(item));
+            }
+
 
             if (layout != LayoutType.NONE) {
                 item = xmlAttributes.get("constraint");
@@ -472,6 +486,17 @@ public class GOBuilder {
                 }
                 case __GO_UI_TEXT__: { //label
                     controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
+                    item = xmlAttributes.get("alignment");
+                    if (item != null) {
+                        if (item.equals("left")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
+                        } else if (item.equals("center")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "center");
+                        } else if (item.equals("right")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "right");
+                        }
+                    }
+
                     String[] text = new String[1];
                     text[0] = xmlAttributes.get("text");
                     if (text[0] != null) {
@@ -491,6 +516,18 @@ public class GOBuilder {
                     break;
                 }
                 case __GO_UI_EDIT__ : {
+                    controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
+                    item = xmlAttributes.get("alignment");
+                    if (item != null) {
+                        if (item.equals("left")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
+                        } else if (item.equals("center")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "center");
+                        } else if (item.equals("right")) {
+                            controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "right");
+                        }
+                    }
+
                     item = xmlAttributes.get("columns");
                     if (item != null) {
                         controller.setProperty(uic, __GO_UI_MAX__, Double.parseDouble(item));
index 7cbb701..6041a8b 100644 (file)
@@ -104,7 +104,7 @@ public class XmlLoader extends DefaultHandler {
 
 
         /** sdsdf*/
-        nameToGO.put("UITextarea", __GO_UI_EDIT__);
+        nameToGO.put("UITextarea", -2);
 
         nameToGO.put("UIMenu", __GO_UIMENU__);
         nameToGO.put("UIMenuItem", __GO_UIMENU__);