enum type are saved as string instead of int to be more usable 26/14126/4
Antoine ELIAS [Tue, 25 Mar 2014 16:29:31 +0000 (17:29 +0100)]
Change-Id: Ie0538ce0a15655cd522591faa93807f21d7322a7

scilab/modules/atoms/gui/atomsGui.xml
scilab/modules/atoms/macros/atoms_gui/atomsGui.sci
scilab/modules/demo_tools/gui/demo_gui.xml
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/figure/Figure.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/Uicontrol.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/utils/LayoutType.java
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/XMLDomLoader.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/xmlloader/XmlSaver.java

index 4b40490..5504573 100644 (file)
@@ -1,25 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <scilabgui usedeprecatedskin="off" version="1.0">
-    <figure axes_size="900,600" background="33" default_axes="off" dockable="off" figure_position="0,0" icon="software-update-notinstalled" infobar_visible="off" layout="3" menubar="0" tag="atomsFigure" toolbar="0" toolbar_visible="off" visible="off">
-        <frame backgroundcolor="1.0,1.0,1.0" borderoptpadding="5,5" layout="3" tag="MainFrame">
-            <frame backgroundcolor="1.0,1.0,1.0" borderposition="0" borderpreferredsize="0,40" layout="3" margins="5.0,5.0,5.0,5.0" tag="msgFrame">
+    <figure axes_size="900,600" background="33" default_axes="off" dockable="off" figure_position="0,0" icon="software-update-notinstalled" infobar_visible="off" layout="border" menubar="none" tag="atomsFigure" toolbar="none" toolbar_visible="off" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" borderoptpadding="5,5" layout="border" tag="MainFrame">
+            <frame backgroundcolor="1.0,1.0,1.0" borderposition="bottom" borderpreferredsize="0,40" layout="border" margins="5.0,5.0,5.0,5.0" tag="msgFrame">
                 <border style="titled" title="">
                     <title color="black" style="line" thickness="1"/>
                 </border>
                 <text backgroundcolor="1.0,1.0,1.0" fontsize="12.0" horizontalalignment="center" tag="msgText"/>
             </frame>
             <layer tag="LayerFrame">
-                <frame backgroundcolor="1.0,1.0,1.0" layout="3" tag="HomeFrame">
+                <frame backgroundcolor="1.0,1.0,1.0" layout="border" tag="HomeFrame">
                     <border style="titled" title="">
                         <title color="black" style="line" thickness="1"/>
                     </border>
                     <listbox backgroundcolor="1.0,1.0,1.0" callback="cbAtomsGui" callback_type="0" fontsize="12.0" tag="HomeListbox"/>
                 </frame>
-                <frame backgroundcolor="1.0,1.0,1.0" layout="3" tag="DescFrame" visible="off">
+                <frame backgroundcolor="1.0,1.0,1.0" layout="border" tag="DescFrame" visible="off">
                     <border fontangle="normal" fontname="" fontsize="14" fontweight="normal" justification="0" style="titled" title="">
                         <title color="black" style="line" thickness="1"/>
                     </border>
-                    <frame backgroundcolor="1.0,1.0,1.0" borderposition="0" gridoptgrid="1,4" gridoptpadding="20,0" layout="2">
+                    <frame backgroundcolor="1.0,1.0,1.0" borderposition="bottom" gridoptgrid="1,4" gridoptpadding="20,0" layout="grid">
                         <checkbox backgroundcolor="1.0,1.0,1.0" callback="cbAtomsGui" callback_type="0" tag="autoloadCheck"/>
                         <pushbutton callback="cbAtomsGui" callback_type="0" enable="off" tag="installButton"/>
                         <pushbutton callback="cbAtomsGui" callback_type="0" enable="off" tag="removeButton"/>
@@ -28,7 +28,7 @@
                     <text backgroundcolor="1.0,1.0,1.0" fontsize="12.0" max="2.0" sliderstep="0.02,0.2" tag="Desc"/>
                 </frame>
             </layer>
-            <frame backgroundcolor="1.0,1.0,1.0" borderposition="3" borderpreferredsize="300,0" layout="3" tag="LeftFrame">
+            <frame backgroundcolor="1.0,1.0,1.0" borderposition="left" borderpreferredsize="300,0" layout="border" tag="LeftFrame">
                 <border style="titled" title="">
                     <title color="black" style="line" thickness="1"/>
                 </border>
index 0cdfbb0..5ed87a7 100644 (file)
@@ -18,18 +18,18 @@ function atomsGui()
         defaultFontSize = 12;
 
         f = figure( ...
-            "dockable", "off" , ...
-            "infobar_visible", "off", ...
-            "toolbar_visible", "off", ...
-            "toolbar", "none", ...
-            "menubar_visible", "on", ...
-            "menubar", "none", ...
-            "default_axes", "off", ...
-            "tag", "atomsFigure", ...
-            "visible", "off", ...
-            "icon", "software-update-notinstalled", ...
-            "position", [0 0 figwidth figheight], ...
-            "layout", "border");
+        "dockable", "off" , ...
+        "infobar_visible", "off", ...
+        "toolbar_visible", "off", ...
+        "toolbar", "none", ...
+        "menubar_visible", "on", ...
+        "menubar", "none", ...
+        "default_axes", "off", ...
+        "tag", "atomsFigure", ...
+        "visible", "off", ...
+        "icon", "software-update-notinstalled", ...
+        "position", [0 0 figwidth figheight], ...
+        "layout", "border");
 
         h = uimenu( ...
         "parent", f, ...
@@ -67,116 +67,116 @@ function atomsGui()
         "tag", "helpMenu");
 
         MainFrame = uicontrol(f, ...
-            "Style", "frame", ...
-            "background", [1 1 1], ...
-            "Tag", "MainFrame");
-            MainFrame.layout_options = createLayoutOptions("border", [5, 5]);
-            MainFrame.layout = "border";
+        "Style", "frame", ...
+        "background", [1 1 1], ...
+        "Tag", "MainFrame");
+        MainFrame.layout_options = createLayoutOptions("border", [5, 5]);
+        MainFrame.layout = "border";
 
         //Left frame + listbox
         LeftFrame = uicontrol(MainFrame, ...
-            "Style", "frame", ...
-            "background", [1 1 1], ...
-            "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
-            "constraints", createConstraints("border", "left", [300 0]), ...
-            "Tag", "LeftFrame");
-            LeftFrame.layout = "border";
+        "Style", "frame", ...
+        "background", [1 1 1], ...
+        "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
+        "constraints", createConstraints("border", "left", [300 0]), ...
+        "Tag", "LeftFrame");
+        LeftFrame.layout = "border";
 
 
         LeftListbox = uicontrol(LeftFrame, ...
-            "Style" , "listbox", ...
-            "FontSize", defaultFontSize, ...
-            "String", "", ...
-            "Callback", "cbAtomsGui", ...
-            "Tag", "LeftListbox");
+        "Style" , "listbox", ...
+        "FontSize", defaultFontSize, ...
+        "String", "", ...
+        "Callback", "cbAtomsGui", ...
+        "Tag", "LeftListbox");
 
         //layer right frame
         LayerFrame = uicontrol(MainFrame, ...
-            "style", "layer", ...
-            "constraints", createConstraints("border", "center"), ...
-            "tag", "LayerFrame");
+        "style", "layer", ...
+        "constraints", createConstraints("border", "center"), ...
+        "tag", "LayerFrame");
 
         //1st layer, description module
         DescFrame = uicontrol(LayerFrame, ...
-            "style", "frame", ...
-            "background", [1 1 1], ...
-            "border", createBorder("titled", createBorder("line", "black", 1), "", "", "", createBorderFont("", 14, "normal")), ...
-            "layout", "border", ...
-            "tag", "DescFrame");
+        "style", "frame", ...
+        "background", [1 1 1], ...
+        "border", createBorder("titled", createBorder("line", "black", 1), "", "", "", createBorderFont("", 14, "normal")), ...
+        "layout", "border", ...
+        "tag", "DescFrame");
 
         Desc = uicontrol(DescFrame, ...
-            "Style", "text", ...
-            "background", [1 1 1], ...
-            "FontSize", defaultFontSize, ...
-            "string", [""], ...
-            "min", 0, ...
-            "max", 2, ...
-            "Tag", "Desc");
+        "Style", "text", ...
+        "background", [1 1 1], ...
+        "FontSize", defaultFontSize, ...
+        "string", [""], ...
+        "min", 0, ...
+        "max", 2, ...
+        "Tag", "Desc");
 
         ButtonFrame = uicontrol(DescFrame, ...
-            "style", "frame", ...
-            "backgroundcolor", [1 1 1], ...
-            "constraints", createConstraints("border", "bottom"));
-            ButtonFrame.layout_options = createLayoutOptions("grid", [1 4], [20, 0]);
-            ButtonFrame.layout = "grid";
+        "style", "frame", ...
+        "backgroundcolor", [1 1 1], ...
+        "constraints", createConstraints("border", "bottom"));
+        ButtonFrame.layout_options = createLayoutOptions("grid", [1 4], [20, 0]);
+        ButtonFrame.layout = "grid";
 
         backButton = uicontrol(ButtonFrame, ...
-            "Style" , "pushbutton", ...
-            "Callback", "cbAtomsGui", ...
-            "Enable", "on", ...
-            "Tag", "backButton");
+        "Style" , "pushbutton", ...
+        "Callback", "cbAtomsGui", ...
+        "Enable", "on", ...
+        "Tag", "backButton");
 
         removeButton = uicontrol(ButtonFrame, ...
-            "Style" , "pushbutton", ...
-            "Callback", "cbAtomsGui", ...
-            "Enable", "off", ...
-            "Tag", "removeButton");
+        "Style" , "pushbutton", ...
+        "Callback", "cbAtomsGui", ...
+        "Enable", "off", ...
+        "Tag", "removeButton");
 
         installButton = uicontrol(ButtonFrame, ...
-            "Style" , "pushbutton", ...
-            "Callback", "cbAtomsGui", ...
-            "Enable", "off", ...
-            "Tag", "installButton");
+        "Style" , "pushbutton", ...
+        "Callback", "cbAtomsGui", ...
+        "Enable", "off", ...
+        "Tag", "installButton");
 
         autoloadCheck = uicontrol(ButtonFrame, ...
-            "Style" , "checkbox", ...
-            "background", [1 1 1], ...
-            "Callback", "cbAtomsGui", ...
-            "Enable", "on", ...
-            "Tag", "autoloadCheck");
+        "Style" , "checkbox", ...
+        "background", [1 1 1], ...
+        "Callback", "cbAtomsGui", ...
+        "Enable", "on", ...
+        "Tag", "autoloadCheck");
 
         //2nd layer, installed modules
         HomeFrame = uicontrol(LayerFrame, ...
-            "style", "frame", ...
-            "background", [1 1 1], ...
-            "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
-            "layout", "border", ...
-            "tag", "HomeFrame");
+        "style", "frame", ...
+        "background", [1 1 1], ...
+        "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
+        "layout", "border", ...
+        "tag", "HomeFrame");
 
         HomeListbox = uicontrol(HomeFrame,..
-            "Style", "listbox",..
-            "Background", [1 1 1],..
-            "FontSize", defaultFontSize,..
-            "Callback", "cbAtomsGui", ..
-            "Tag", "HomeListbox");
+        "Style", "listbox",..
+        "Background", [1 1 1],..
+        "FontSize", defaultFontSize,..
+        "Callback", "cbAtomsGui", ..
+        "Tag", "HomeListbox");
 
         //message frame
         msgFrame = uicontrol(MainFrame, ...
-            "style", "frame", ...
-            "Background", [1 1 1], ...
-            "layout", "border", ...
-            "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
-            "constraints", createConstraints("border", "bottom", [0, 40]), ...
-            "margins", [5 5 5 5], ...
-            "tag", "msgFrame");
+        "style", "frame", ...
+        "Background", [1 1 1], ...
+        "layout", "border", ...
+        "border", createBorder("titled", createBorder("line", "black", 1), ""), ...
+        "constraints", createConstraints("border", "bottom", [0, 40]), ...
+        "margins", [5 5 5 5], ...
+        "tag", "msgFrame");
 
         msgText = uicontrol(msgFrame, ....
-            "Style", "text", ...
-            "HorizontalAlignment", "center", ...
-            "VerticalAlignment", "middle", ...
-            "FontSize", defaultFontSize, ...
-            "Background", [1 1 1], ...
-            "Tag", "msgText");
+        "Style", "text", ...
+        "HorizontalAlignment", "center", ...
+        "VerticalAlignment", "middle", ...
+        "FontSize", defaultFontSize, ...
+        "Background", [1 1 1], ...
+        "Tag", "msgText");
 
         saveGui(f, SCI + "/modules/atoms/gui/atomsGui.xml");
         delete(f);
index 544791e..cece88e 100644 (file)
@@ -1,70 +1,70 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <scilabgui usedeprecatedskin="off" version="1.0">
-    <figure axes_size="250,526" default_axes="off" dockable="off" figure_id="100000" figure_name="" figure_size="266,565" icon="applications-system" infobar_visible="off" layout="1" menubar="0" menubar_visible="off" tag="scilab_demo_fig" toolbar="0" toolbar_visible="off" visible="off">
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="10,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_10" visible="off">
+    <figure axes_size="250,526" default_axes="off" dockable="off" figure_id="100000" figure_name="" figure_size="266,565" icon="applications-system" infobar_visible="off" layout="gridbag" menubar="none" menubar_visible="off" tag="scilab_demo_fig" toolbar="none" toolbar_visible="off" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="10,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_10" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_10" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_10" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="9,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_9" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="9,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_9" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_9" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_9" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="8,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_8" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="8,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_8" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_8" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_8" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="7,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_7" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="7,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_7" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_7" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_7" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="6,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_6" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="6,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_6" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_6" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_6" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="5,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_5" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="5,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_5" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_5" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_5" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="4,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_4" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="4,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_4" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_4" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_4" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="3,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_3" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="3,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_3" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_3" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_3" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="2,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_2" visible="off">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="2,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_2" visible="off">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_2" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_2" value="3.0"/>
         </frame>
-        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="1,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="1" tag="frame_1">
+        <frame backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="1,1,1,1" gridbagpreferredsize="0,0" gridbagweight="1.0,1.0" layout="gridbag" tag="frame_1">
             <border color="black" fontangle="normal" fontname="" fontsize="12" fontweight="bold" justification="1" style="titled" title="">
                 <title style="empty"/>
             </border>
-            <image backgroundcolor="1.0,1.0,1.0" gridbagfill="3" gridbaggrid="1,5,1,1" gridbagweight="1.0,0.1" horizontalalignment="center" tag="scilab_logo">
+            <image backgroundcolor="1.0,1.0,1.0" gridbagfill="both" gridbaggrid="1,5,1,1" gridbagweight="1.0,0.1" horizontalalignment="center" tag="scilab_logo">
                 <string cols="1" property="string" rows="1">
                     <stringitem value="SCI/modules/demo_tools/images/logo_scilab.png"/>
                 </string>
             </image>
-            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="3" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_1" value="3.0"/>
+            <listbox callback="script_path = demo_gui_update();if ~isempty(script_path) then exec(script_path, -1);end;clear script_path;" callback_type="0" fontsize="12.0" gridbagfill="both" gridbaggrid="1,1,1,4" gridbagweight="1.0,1.0" listboxtop="1" tag="listbox_1" value="3.0"/>
         </frame>
     </figure>
 </scilabgui>
index 39fa574..bccf2c9 100644 (file)
@@ -53,6 +53,7 @@ import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties;
 import org.scilab.modules.graphic_objects.graphicObject.Visitor;
 import org.scilab.modules.graphic_objects.utils.LayoutType;
+
 /**
  * Figure class
  * @author Manuel JULIACHS
@@ -60,93 +61,135 @@ import org.scilab.modules.graphic_objects.utils.LayoutType;
 public class Figure extends GraphicObject implements AxesContainer {
     /** Figure properties names */
     private enum FigureProperty {
-        INFOMESSAGE, COLORMAP, COLORMAPSIZE, BACKGROUND, ROTATIONTYPE,
-        RESIZEFCN, CLOSEREQUESTFCN, RESIZE, TOOLBAR, TOOLBAR_VISIBLE,
-        MENUBAR, MENUBAR_VISIBLE, INFOBAR_VISIBLE, DOCKABLE, LAYOUT, LAYOUT_SET,
-        GRIDOPT_GRID, GRIDOPT_PADDING, BORDEROPT_PADDING, DEFAULT_AXES, ICON
+        INFOMESSAGE, COLORMAP, COLORMAPSIZE, BACKGROUND, ROTATIONTYPE, RESIZEFCN, CLOSEREQUESTFCN, RESIZE, TOOLBAR, TOOLBAR_VISIBLE, MENUBAR, MENUBAR_VISIBLE, INFOBAR_VISIBLE, DOCKABLE, LAYOUT, LAYOUT_SET, GRIDOPT_GRID, GRIDOPT_PADDING, BORDEROPT_PADDING, DEFAULT_AXES, ICON
     };
 
-    /** Specifies whether rotation applies to a single subwindow or to all the figure's subwindows */
-    public enum RotationType { UNARY, MULTIPLE;
-
-                               /**
-                                * Converts an integer to the corresponding enum
-                                * @param intValue the integer value
-                                * @return the rotation type enum
-                                */
-    public static RotationType intToEnum(Integer intValue) {
-        switch (intValue) {
-            case 0:
-                return RotationType.UNARY;
-            case 1:
-                return RotationType.MULTIPLE;
-            default:
-                return null;
+    /**
+     * Specifies whether rotation applies to a single subwindow or to all the
+     * figure's subwindows
+     */
+    public enum RotationType {
+        UNARY, MULTIPLE;
+
+        /**
+         * Converts an integer to the corresponding enum
+         * @param intValue the integer value
+         * @return the rotation type enum
+         */
+        public static RotationType intToEnum(Integer intValue) {
+            switch (intValue) {
+                case 0:
+                    return RotationType.UNARY;
+                case 1:
+                    return RotationType.MULTIPLE;
+                default:
+                    return null;
+            }
+        }
+
+        public static RotationType stringToEnum(String value) {
+            if (value.equals("multiple")) {
+                return MULTIPLE;
+            }
+
+            return UNARY;
+        }
+
+        public static String enumToString(RotationType value) {
+            switch (value) {
+                case MULTIPLE:
+                    return "multiple";
+                case UNARY:
+                default:
+                    return "unary";
+            }
         }
     }
-                             }
-    public enum BarType { NONE, FIGURE;
-    public static BarType intToEnum(Integer intValue) {
-        switch (intValue) {
-            default:
-            case 0:
-                return BarType.NONE;
-            case 1:
-                return BarType.FIGURE;
+
+    public enum BarType {
+        NONE, FIGURE;
+        public static BarType intToEnum(Integer intValue) {
+            switch (intValue) {
+                default:
+                case 0:
+                    return BarType.NONE;
+                case 1:
+                    return BarType.FIGURE;
+            }
+        }
+
+        public static BarType stringToEnum(String value) {
+            if (value.equals("figure")) {
+                return FIGURE;
+            }
+
+            return NONE;
+        }
+
+        public static String enumToString(BarType value) {
+            switch (value) {
+                case FIGURE:
+                    return "figure";
+                case NONE:
+                default:
+                    return "none";
+            }
         }
     }
-                        }
+
     /** Pixel drawing logical operations */
-    private enum PixelDrawingMode { CLEAR, AND, ANDREVERSE, COPY, ANDINVERTED, NOOP, XOR, OR, NOR,
-                                    EQUIV, INVERT, ORREVERSE, COPYINVERTED, ORINVERTED, NAND, SET;
-
-                                    /**
-                                     * Converts an integer to the corresponding enum
-                                     * @param intValue the integer value
-                                     * @return the pixel drawing mode enum
-                                     */
-    public static PixelDrawingMode intToEnum(Integer intValue) {
-        switch (intValue) {
-            case 0:
-                return PixelDrawingMode.CLEAR;
-            case 1:
-                return PixelDrawingMode.AND;
-            case 2:
-                return PixelDrawingMode.ANDREVERSE;
-            case 3:
-                return PixelDrawingMode.COPY;
-            case 4:
-                return PixelDrawingMode.ANDINVERTED;
-            case 5:
-                return PixelDrawingMode.NOOP;
-            case 6:
-                return PixelDrawingMode.XOR;
-            case 7:
-                return PixelDrawingMode.OR;
-            case 8:
-                return PixelDrawingMode.NOR;
-            case 9:
-                return PixelDrawingMode.EQUIV;
-            case 10:
-                return PixelDrawingMode.INVERT;
-            case 11:
-                return PixelDrawingMode.ORREVERSE;
-            case 12:
-                return PixelDrawingMode.COPYINVERTED;
-            case 13:
-                return PixelDrawingMode.ORINVERTED;
-            case 14:
-                return PixelDrawingMode.NAND;
-            case 15:
-                return PixelDrawingMode.SET;
-            default:
-                return null;
+    private enum PixelDrawingMode {
+        CLEAR, AND, ANDREVERSE, COPY, ANDINVERTED, NOOP, XOR, OR, NOR, EQUIV, INVERT, ORREVERSE, COPYINVERTED, ORINVERTED, NAND, SET;
+
+        /**
+         * Converts an integer to the corresponding enum
+         * @param intValue the integer value
+         * @return the pixel drawing mode enum
+         */
+        public static PixelDrawingMode intToEnum(Integer intValue) {
+            switch (intValue) {
+                case 0:
+                    return PixelDrawingMode.CLEAR;
+                case 1:
+                    return PixelDrawingMode.AND;
+                case 2:
+                    return PixelDrawingMode.ANDREVERSE;
+                case 3:
+                    return PixelDrawingMode.COPY;
+                case 4:
+                    return PixelDrawingMode.ANDINVERTED;
+                case 5:
+                    return PixelDrawingMode.NOOP;
+                case 6:
+                    return PixelDrawingMode.XOR;
+                case 7:
+                    return PixelDrawingMode.OR;
+                case 8:
+                    return PixelDrawingMode.NOR;
+                case 9:
+                    return PixelDrawingMode.EQUIV;
+                case 10:
+                    return PixelDrawingMode.INVERT;
+                case 11:
+                    return PixelDrawingMode.ORREVERSE;
+                case 12:
+                    return PixelDrawingMode.COPYINVERTED;
+                case 13:
+                    return PixelDrawingMode.ORINVERTED;
+                case 14:
+                    return PixelDrawingMode.NAND;
+                case 15:
+                    return PixelDrawingMode.SET;
+                default:
+                    return null;
+            }
         }
-    }
-                                  };
+    };
 
     /** FigureDimensions properties names */
-    public enum FigureDimensionsProperty { POSITION, SIZE };
+    public enum FigureDimensionsProperty {
+        POSITION, SIZE
+    };
 
     /**
      * FigureDimensions class
@@ -162,8 +205,8 @@ public class Figure extends GraphicObject implements AxesContainer {
          * Default constructor
          */
         public FigureDimensions() {
-            position = new Integer[] {0, 0};
-            size = new Integer[] {0, 0};
+            position = new Integer[] { 0, 0 };
+            size = new Integer[] { 0, 0 };
         }
 
         /**
@@ -182,7 +225,9 @@ public class Figure extends GraphicObject implements AxesContainer {
     }
 
     /** CanvasProperty properties names */
-    public enum CanvasProperty { AUTORESIZE, VIEWPORT, AXESSIZE };
+    public enum CanvasProperty {
+        AUTORESIZE, VIEWPORT, AXESSIZE
+    };
 
     /**
      * Canvas class
@@ -226,7 +271,9 @@ public class Figure extends GraphicObject implements AxesContainer {
     }
 
     /** FigureName properties names */
-    public enum FigureNameProperty { NAME, ID };
+    public enum FigureNameProperty {
+        NAME, ID
+    };
 
     /**
      * FigureName class
@@ -271,7 +318,9 @@ public class Figure extends GraphicObject implements AxesContainer {
     }
 
     /** RenderingMode properties names */
-    public enum RenderingModeProperty { PIXELDRAWINGMODE, ANTIALIASING, IMMEDIATEDRAWING };
+    public enum RenderingModeProperty {
+        PIXELDRAWINGMODE, ANTIALIASING, IMMEDIATEDRAWING
+    };
 
     /**
      * RenderingMode class
@@ -309,7 +358,9 @@ public class Figure extends GraphicObject implements AxesContainer {
     }
 
     /** EventHandler properties names */
-    public enum EventHandlerProperty { EVENTHANDLER, EVENTHANDLERENABLE };
+    public enum EventHandlerProperty {
+        EVENTHANDLER, EVENTHANDLERENABLE
+    };
 
     /**
      * EventHandler class
@@ -352,8 +403,8 @@ public class Figure extends GraphicObject implements AxesContainer {
     private String infoMessage;
 
     /**
-     * Default ColorMap: (3 x N) matrix, where N is the
-     * number of colors and 3 the number of color channels
+     * Default ColorMap: (3 x N) matrix, where N is the number of colors and 3
+     * the number of color channels
      */
     private ColorMap colorMap;
 
@@ -396,9 +447,9 @@ public class Figure extends GraphicObject implements AxesContainer {
     private LayoutType layout;
 
     /** layout options */
-    private Integer[] gridOptGrid = new Integer[] {0, 0};
-    private Integer[] gridOptPadding = new Integer[] {0, 0};
-    private Integer[] borderOptPadding = new Integer[] {0, 0};
+    private Integer[] gridOptGrid = new Integer[] { 0, 0 };
+    private Integer[] gridOptPadding = new Integer[] { 0, 0 };
+    private Integer[] borderOptPadding = new Integer[] { 0, 0 };
 
     /** default axes management */
     private Boolean defaultAxes;
@@ -443,9 +494,9 @@ public class Figure extends GraphicObject implements AxesContainer {
         copy.renderingMode = new RenderingMode(this.renderingMode);
         copy.eventHandler = new EventHandler(this.eventHandler);
 
-        copy.gridOptGrid = new Integer[] {0, 0};
-        copy.gridOptPadding = new Integer[] {0, 0};
-        copy.borderOptPadding = new Integer[] {0, 0};
+        copy.gridOptGrid = new Integer[] { 0, 0 };
+        copy.gridOptPadding = new Integer[] { 0, 0 };
+        copy.borderOptPadding = new Integer[] { 0, 0 };
         copy.setValid(true);
 
         return copy;
@@ -463,73 +514,73 @@ public class Figure extends GraphicObject implements AxesContainer {
      */
     public Object getPropertyFromName(int propertyName) {
         switch (propertyName) {
-            case __GO_POSITION__ :
+            case __GO_POSITION__:
                 return FigureDimensionsProperty.POSITION;
-            case __GO_SIZE__ :
+            case __GO_SIZE__:
                 return FigureDimensionsProperty.SIZE;
-            case __GO_AUTORESIZE__ :
+            case __GO_AUTORESIZE__:
                 return CanvasProperty.AUTORESIZE;
-            case __GO_VIEWPORT__ :
+            case __GO_VIEWPORT__:
                 return CanvasProperty.VIEWPORT;
-            case __GO_AXES_SIZE__ :
+            case __GO_AXES_SIZE__:
                 return CanvasProperty.AXESSIZE;
-            case __GO_NAME__ :
+            case __GO_NAME__:
                 return FigureNameProperty.NAME;
-            case __GO_ID__ :
+            case __GO_ID__:
                 return FigureNameProperty.ID;
-            case __GO_INFO_MESSAGE__ :
+            case __GO_INFO_MESSAGE__:
                 return FigureProperty.INFOMESSAGE;
-            case __GO_COLORMAP__ :
+            case __GO_COLORMAP__:
                 return FigureProperty.COLORMAP;
-            case __GO_COLORMAP_SIZE__ :
+            case __GO_COLORMAP_SIZE__:
                 return FigureProperty.COLORMAPSIZE;
-            case __GO_PIXEL_DRAWING_MODE__ :
+            case __GO_PIXEL_DRAWING_MODE__:
                 return RenderingModeProperty.PIXELDRAWINGMODE;
-            case __GO_ANTIALIASING__ :
+            case __GO_ANTIALIASING__:
                 return RenderingModeProperty.ANTIALIASING;
-            case __GO_IMMEDIATE_DRAWING__ :
+            case __GO_IMMEDIATE_DRAWING__:
                 return RenderingModeProperty.IMMEDIATEDRAWING;
-            case __GO_BACKGROUND__ :
+            case __GO_BACKGROUND__:
                 return FigureProperty.BACKGROUND;
-            case __GO_EVENTHANDLER_NAME__ :
+            case __GO_EVENTHANDLER_NAME__:
                 return EventHandlerProperty.EVENTHANDLER;
-            case __GO_EVENTHANDLER_ENABLE__ :
+            case __GO_EVENTHANDLER_ENABLE__:
                 return EventHandlerProperty.EVENTHANDLERENABLE;
-            case __GO_ROTATION_TYPE__ :
+            case __GO_ROTATION_TYPE__:
                 return FigureProperty.ROTATIONTYPE;
-            case __GO_RESIZEFCN__ :
+            case __GO_RESIZEFCN__:
                 return FigureProperty.RESIZEFCN;
-            case __GO_CLOSEREQUESTFCN__ :
+            case __GO_CLOSEREQUESTFCN__:
                 return FigureProperty.CLOSEREQUESTFCN;
-            case __GO_RESIZE__ :
+            case __GO_RESIZE__:
                 return FigureProperty.RESIZE;
-            case __GO_TOOLBAR__ :
+            case __GO_TOOLBAR__:
                 return FigureProperty.TOOLBAR;
-            case __GO_TOOLBAR_VISIBLE__ :
+            case __GO_TOOLBAR_VISIBLE__:
                 return FigureProperty.TOOLBAR_VISIBLE;
-            case __GO_MENUBAR__ :
+            case __GO_MENUBAR__:
                 return FigureProperty.MENUBAR;
-            case __GO_MENUBAR_VISIBLE__ :
+            case __GO_MENUBAR_VISIBLE__:
                 return FigureProperty.MENUBAR_VISIBLE;
-            case __GO_INFOBAR_VISIBLE__ :
+            case __GO_INFOBAR_VISIBLE__:
                 return FigureProperty.INFOBAR_VISIBLE;
-            case __GO_DOCKABLE__ :
+            case __GO_DOCKABLE__:
                 return FigureProperty.DOCKABLE;
-            case __GO_LAYOUT__ :
+            case __GO_LAYOUT__:
                 return FigureProperty.LAYOUT;
-            case __GO_LAYOUT_SET__ :
+            case __GO_LAYOUT_SET__:
                 return FigureProperty.LAYOUT_SET;
-            case __GO_GRID_OPT_GRID__ :
+            case __GO_GRID_OPT_GRID__:
                 return FigureProperty.GRIDOPT_GRID;
-            case __GO_GRID_OPT_PADDING__ :
+            case __GO_GRID_OPT_PADDING__:
                 return FigureProperty.GRIDOPT_PADDING;
-            case __GO_BORDER_OPT_PADDING__ :
+            case __GO_BORDER_OPT_PADDING__:
                 return FigureProperty.BORDEROPT_PADDING;
-            case __GO_DEFAULT_AXES__ :
+            case __GO_DEFAULT_AXES__:
                 return FigureProperty.DEFAULT_AXES;
-            case __GO_UI_ICON__ :
+            case __GO_UI_ICON__:
                 return FigureProperty.ICON;
-            default :
+            default:
                 return super.getPropertyFromName(propertyName);
         }
     }
@@ -619,7 +670,7 @@ public class Figure extends GraphicObject implements AxesContainer {
      */
     public UpdateStatus setProperty(Object property, Object value) {
         if (property instanceof FigureProperty) {
-            switch ((FigureProperty)property) {
+            switch ((FigureProperty) property) {
                 case BACKGROUND:
                     return setBackground((Integer) value);
                 case CLOSEREQUESTFCN:
@@ -664,7 +715,7 @@ public class Figure extends GraphicObject implements AxesContainer {
                     break;
             }
         } else if (property instanceof CanvasProperty) {
-            switch ((CanvasProperty)property) {
+            switch ((CanvasProperty) property) {
                 case AUTORESIZE:
                     return setAutoResize((Boolean) value);
                 case AXESSIZE:
@@ -673,21 +724,21 @@ public class Figure extends GraphicObject implements AxesContainer {
                     return setViewport((Integer[]) value);
             }
         } else if (property instanceof FigureDimensionsProperty) {
-            switch ((FigureDimensionsProperty)property) {
+            switch ((FigureDimensionsProperty) property) {
                 case POSITION:
                     return setPosition((Integer[]) value);
                 case SIZE:
                     return setSize((Integer[]) value);
             }
         } else if (property instanceof FigureNameProperty) {
-            switch ((FigureNameProperty)property) {
+            switch ((FigureNameProperty) property) {
                 case ID:
                     return setId((Integer) value);
                 case NAME:
                     return setName((String) value);
             }
         } else if (property instanceof RenderingModeProperty) {
-            switch ((RenderingModeProperty)property) {
+            switch ((RenderingModeProperty) property) {
                 case ANTIALIASING:
                     return setAntialiasing((Integer) value);
                 case IMMEDIATEDRAWING:
@@ -696,7 +747,7 @@ public class Figure extends GraphicObject implements AxesContainer {
                     return setPixelDrawingMode((Integer) value);
             }
         } else if (property instanceof EventHandlerProperty) {
-            switch ((EventHandlerProperty)property) {
+            switch ((EventHandlerProperty) property) {
                 case EVENTHANDLER:
                     return setEventHandlerString((String) value);
                 case EVENTHANDLERENABLE:
@@ -1175,7 +1226,6 @@ public class Figure extends GraphicObject implements AxesContainer {
         return UpdateStatus.Success;
     }
 
-
     public Boolean getResize() {
         return resize;
     }
@@ -1323,7 +1373,7 @@ public class Figure extends GraphicObject implements AxesContainer {
             return UpdateStatus.Fail;
         }
 
-        for (int i = 0 ; i < value.length ; i++) {
+        for (int i = 0; i < value.length; i++) {
             if (borderOptPadding[i] != value[i]) {
                 borderOptPadding[i] = value[i];
                 status = UpdateStatus.Success;
@@ -1343,7 +1393,7 @@ public class Figure extends GraphicObject implements AxesContainer {
             return UpdateStatus.Fail;
         }
 
-        for (int i = 0 ; i < value.length ; i++) {
+        for (int i = 0; i < value.length; i++) {
             if (gridOptPadding[i] != value[i]) {
                 gridOptPadding[i] = value[i];
                 status = UpdateStatus.Success;
@@ -1363,7 +1413,7 @@ public class Figure extends GraphicObject implements AxesContainer {
             return UpdateStatus.Fail;
         }
 
-        for (int i = 0 ; i < value.length ; i++) {
+        for (int i = 0; i < value.length; i++) {
             if (gridOptGrid[i] != value[i]) {
                 gridOptGrid[i] = value[i];
                 status = UpdateStatus.Success;
@@ -1386,7 +1436,6 @@ public class Figure extends GraphicObject implements AxesContainer {
         return UpdateStatus.Success;
     }
 
-
     public String getIcon() {
         return icon;
     }
@@ -1400,7 +1449,6 @@ public class Figure extends GraphicObject implements AxesContainer {
         return UpdateStatus.Success;
     }
 
-
     /**
      * @return Type as String
      */
index 627e2bb..a7b3e2d 100644 (file)
@@ -95,17 +95,47 @@ public class Uicontrol extends GraphicObject {
         TOP, LEFT, BOTTOM, RIGHT;
         public static TitlePositionType intToEnum(Integer value) {
             switch (value) {
+                default:
                 case 0:
                     return TOP;
                 case 1:
                     return LEFT;
-                default:
                 case 2:
                     return BOTTOM;
                 case 3:
                     return RIGHT;
             }
         }
+
+        public static TitlePositionType stringToEnum(String value) {
+            if (value.equals("left")) {
+                return LEFT;
+            }
+
+            if (value.equals("bottom")) {
+                return BOTTOM;
+            }
+
+            if (value.equals("right")) {
+                return RIGHT;
+            }
+
+            return TOP;
+        }
+
+        public static String enumToString(TitlePositionType value) {
+            switch (value) {
+                case BOTTOM:
+                    return "bottom";
+                case LEFT:
+                    return "left";
+                case RIGHT:
+                    return "right";
+                default:
+                case TOP:
+                    return "top";
+            }
+        }
     }
 
     public enum BorderLayoutType {
@@ -126,7 +156,7 @@ public class Uicontrol extends GraphicObject {
             }
         }
 
-        public static BorderLayoutType stringToEnum(String value) {
+        public static BorderLayoutType stringToEnum2(String value) {
             if (value == null || value.equals("")) {
                 return CENTER;
             }
@@ -150,6 +180,42 @@ public class Uicontrol extends GraphicObject {
 
             return CENTER;
         }
+
+        public static String enumToString(BorderLayoutType value) {
+            switch (value) {
+                case BOTTOM:
+                    return "bottom";
+                default:
+                case CENTER:
+                    return "center";
+                case LEFT:
+                    return "left";
+                case RIGHT:
+                    return "right";
+                case TOP:
+                    return "top";
+            }
+        }
+
+        public static BorderLayoutType stringToEnum(String value) {
+            if (value.equals("bottom")) {
+                return BOTTOM;
+            }
+
+            if (value.equals("left")) {
+                return LEFT;
+            }
+
+            if (value.equals("right")) {
+                return RIGHT;
+            }
+
+            if (value.equals("top")) {
+                return TOP;
+            }
+
+            return CENTER;
+        }
     }
 
     public enum FillType {
@@ -188,6 +254,20 @@ public class Uicontrol extends GraphicObject {
 
             return NONE;
         }
+
+        public static String enumToString(FillType value) {
+            switch (value) {
+                case BOTH:
+                    return "both";
+                case HORIZONTAL:
+                    return "horizontal";
+                case NONE:
+                default:
+                    return "none";
+                case VERTICAL:
+                    return "vertical";
+            }
+        }
     }
 
     public enum AnchorType {
@@ -217,7 +297,7 @@ public class Uicontrol extends GraphicObject {
             }
         }
 
-        public static AnchorType stringToEnum(String value) {
+        public static AnchorType stringToEnum2(String value) {
             if (value == null || value.equals("")) {
                 return CENTER;
             }
@@ -263,6 +343,66 @@ public class Uicontrol extends GraphicObject {
 
             return CENTER;
         }
+
+        public static String enumToString(AnchorType value) {
+            switch (value) {
+                default:
+                case CENTER:
+                    return "center";
+                case LEFT:
+                    return "left";
+                case LOWER:
+                    return "lower";
+                case LOWER_LEFT:
+                    return "lower_left";
+                case LOWER_RIGHT:
+                    return "lower_right";
+                case RIGHT:
+                    return "right";
+                case UPPER:
+                    return "upper";
+                case UPPER_LEFT:
+                    return "upper_left";
+                case UPPER_RIGHT:
+                    return "upper_right";
+            }
+        }
+
+        public static AnchorType stringToEnum(String value) {
+            if (value.equals("left")) {
+                return LEFT;
+            }
+
+            if (value.equals("lower")) {
+                return LOWER;
+            }
+
+            if (value.equals("lower_left")) {
+                return LOWER_LEFT;
+            }
+
+            if (value.equals("lower_right")) {
+                return LOWER_RIGHT;
+            }
+
+            if (value.equals("right")) {
+                return RIGHT;
+            }
+
+            if (value.equals("upper")) {
+                return UPPER;
+            }
+
+            if (value.equals("upper_left")) {
+                return UPPER_LEFT;
+            }
+
+            if (value.equals("upper_right")) {
+                return UPPER_RIGHT;
+            }
+
+            return CENTER;
+        }
     }
 
     protected static final String RELIEF_DEFAULT   = "default";
index 0fd5586..c9e78af 100644 (file)
@@ -20,13 +20,13 @@ public enum LayoutType {
         switch (value) {
             default:
             case 0:
-                return LayoutType.NONE;
+                return NONE;
             case 1:
-                return LayoutType.GRIDBAG;
+                return GRIDBAG;
             case 2:
-                return LayoutType.GRID;
+                return GRID;
             case 3:
-                return LayoutType.BORDER;
+                return BORDER;
         }
     }
 
@@ -51,4 +51,18 @@ public enum LayoutType {
 
         return NONE;
     }
+
+    public static String enumToString(LayoutType value) {
+        switch (value) {
+            default:
+            case NONE:
+                return "none";
+            case GRIDBAG:
+                return "gridbag";
+            case GRID:
+                return "grid";
+            case BORDER:
+                return "border";
+        }
+    }
 }
index 8bf7a75..a7bb0e3 100644 (file)
@@ -331,7 +331,7 @@ public class GOBuilder {
                 switch (layout) {
                     case BORDER: {
                         item = XmlTools.getFromMap(map, "position", "center");
-                        controller.setProperty(uic, __GO_UI_BORDER_POSITION__, Uicontrol.BorderLayoutType.stringToEnum(item).ordinal());
+                        controller.setProperty(uic, __GO_UI_BORDER_POSITION__, Uicontrol.BorderLayoutType.stringToEnum2(item).ordinal());
                         Integer[] preferredsize = new Integer[] { -1, -1};
                         item = xmlAttributes.get("preferred-size");
                         if (item != null) {
@@ -356,7 +356,7 @@ public class GOBuilder {
                         weight[1] = Double.parseDouble(XmlTools.getFromMap(map, "weighty", "1.0"));
 
                         Integer fill = Uicontrol.FillType.stringToEnum(XmlTools.getFromMap(map, "fill", "none")).ordinal();
-                        Integer anchor = Uicontrol.AnchorType.stringToEnum(XmlTools.getFromMap(map, "anchor", "center")).ordinal();
+                        Integer anchor = Uicontrol.AnchorType.stringToEnum2(XmlTools.getFromMap(map, "anchor", "center")).ordinal();
 
                         Integer[] padding = new Integer[] { 0, 0 };
                         padding[0] = Integer.parseInt(XmlTools.getFromMap(map, "ipadx", "0"));
index 371bc52..dc6e361 100644 (file)
@@ -14,9 +14,13 @@ import org.scilab.modules.commons.gui.FindIconHelper;
 import org.scilab.modules.graphic_objects.ScilabNativeView;
 import org.scilab.modules.graphic_objects.builder.Builder;
 import org.scilab.modules.graphic_objects.console.Console;
+import org.scilab.modules.graphic_objects.figure.Figure;
+import org.scilab.modules.graphic_objects.figure.Figure.BarType;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
+import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
+import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -25,7 +29,8 @@ import org.w3c.dom.NodeList;
 public class XMLDomLoader {
 
     private enum ModelType {
-        BOOLEAN, BOOLEAN_ARRAY, DOUBLE, DOUBLE_ARRAY, STRING, STRING_ARRAY, INTEGER, INTEGER_ARRAY;
+        BOOLEAN, BOOLEAN_ARRAY, DOUBLE, DOUBLE_ARRAY, STRING, STRING_ARRAY, INTEGER, INTEGER_ARRAY,
+        ROTATIONTYPE, BARTYPE, LAYOUTTYPE, FILLTYPE, ANCHORTYPE, POSITIONTYPE;
     };
 
     private static final int __NODE_SCILABGUI__     = -10;
@@ -96,19 +101,19 @@ public class XMLDomLoader {
         figPropToGO.put("immediate_drawing", new Pair<Integer, ModelType>(__GO_IMMEDIATE_DRAWING__, ModelType.BOOLEAN));
         figPropToGO.put("background", new Pair<Integer, ModelType>(__GO_BACKGROUND__, ModelType.INTEGER));
         figPropToGO.put("visible", new Pair<Integer, ModelType>(__GO_VISIBLE__, ModelType.BOOLEAN));
-        figPropToGO.put("rotation_style", new Pair<Integer, ModelType>(__GO_ROTATION_TYPE__, ModelType.STRING));
+        figPropToGO.put("rotation_style", new Pair<Integer, ModelType>(__GO_ROTATION_TYPE__, ModelType.ROTATIONTYPE));
         figPropToGO.put("event_handler", new Pair<Integer, ModelType>(__GO_EVENTHANDLER_NAME__, ModelType.STRING));
         figPropToGO.put("event_handler_enable", new Pair<Integer, ModelType>(__GO_EVENTHANDLER_ENABLE__, ModelType.BOOLEAN));
         figPropToGO.put("resizefcn", new Pair<Integer, ModelType>(__GO_RESIZEFCN__, ModelType.STRING));
         figPropToGO.put("closerequestfcn", new Pair<Integer, ModelType>(__GO_CLOSEREQUESTFCN__, ModelType.STRING));
         figPropToGO.put("resize", new Pair<Integer, ModelType>(__GO_RESIZE__, ModelType.BOOLEAN));
-        figPropToGO.put("toolbar", new Pair<Integer, ModelType>(__GO_TOOLBAR__, ModelType.INTEGER));
+        figPropToGO.put("toolbar", new Pair<Integer, ModelType>(__GO_TOOLBAR__, ModelType.BARTYPE));
         figPropToGO.put("toolbar_visible", new Pair<Integer, ModelType>(__GO_TOOLBAR_VISIBLE__, ModelType.BOOLEAN));
-        figPropToGO.put("menubar", new Pair<Integer, ModelType>(__GO_MENUBAR__, ModelType.INTEGER));
+        figPropToGO.put("menubar", new Pair<Integer, ModelType>(__GO_MENUBAR__, ModelType.BARTYPE));
         figPropToGO.put("menubar_visible", new Pair<Integer, ModelType>(__GO_MENUBAR_VISIBLE__, ModelType.BOOLEAN));
         figPropToGO.put("infobar_visible", new Pair<Integer, ModelType>(__GO_INFOBAR_VISIBLE__, ModelType.BOOLEAN));
         figPropToGO.put("dockable", new Pair<Integer, ModelType>(__GO_DOCKABLE__, ModelType.BOOLEAN));
-        figPropToGO.put("layout", new Pair<Integer, ModelType>(__GO_LAYOUT__, ModelType.INTEGER));
+        figPropToGO.put("layout", new Pair<Integer, ModelType>(__GO_LAYOUT__, ModelType.LAYOUTTYPE));
         figPropToGO.put("default_axes", new Pair<Integer, ModelType>(__GO_DEFAULT_AXES__, ModelType.BOOLEAN));
         figPropToGO.put("icon", new Pair<Integer, ModelType>(__GO_UI_ICON__, ModelType.STRING));
         figPropToGO.put("tag", new Pair<Integer, ModelType>(__GO_TAG__, ModelType.STRING));
@@ -139,16 +144,16 @@ public class XMLDomLoader {
         UiPropToGO.put("string", new Pair<Integer, ModelType>(__GO_UI_STRING__, ModelType.STRING_ARRAY));
         UiPropToGO.put("tooltipstring", new Pair<Integer, ModelType>(__GO_UI_TOOLTIPSTRING__, ModelType.STRING_ARRAY));
         UiPropToGO.put("visible", new Pair<Integer, ModelType>(__GO_VISIBLE__, ModelType.BOOLEAN));
-        UiPropToGO.put("layout", new Pair<Integer, ModelType>(__GO_LAYOUT__, ModelType.INTEGER));
+        UiPropToGO.put("layout", new Pair<Integer, ModelType>(__GO_LAYOUT__, ModelType.LAYOUTTYPE));
         UiPropToGO.put("callback", new Pair<Integer, ModelType>(__GO_CALLBACK__, ModelType.STRING));
         UiPropToGO.put("callback_type", new Pair<Integer, ModelType>(__GO_CALLBACKTYPE__, ModelType.INTEGER));
         UiPropToGO.put("gridbaggrid", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_GRID__, ModelType.INTEGER_ARRAY));
         UiPropToGO.put("gridbagweight", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_WEIGHT__, ModelType.DOUBLE_ARRAY));
-        UiPropToGO.put("gridbagfill", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_FILL__, ModelType.INTEGER));
-        UiPropToGO.put("gridbaganchor", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_ANCHOR__, ModelType.INTEGER));
+        UiPropToGO.put("gridbagfill", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_FILL__, ModelType.FILLTYPE));
+        UiPropToGO.put("gridbaganchor", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_ANCHOR__, ModelType.ANCHORTYPE));
         UiPropToGO.put("gridbagpadding", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_PADDING__, ModelType.INTEGER_ARRAY));
         UiPropToGO.put("gridbagpreferredsize", new Pair<Integer, ModelType>(__GO_UI_GRIDBAG_PREFERREDSIZE__, ModelType.INTEGER_ARRAY));
-        UiPropToGO.put("borderposition", new Pair<Integer, ModelType>(__GO_UI_BORDER_POSITION__, ModelType.INTEGER));
+        UiPropToGO.put("borderposition", new Pair<Integer, ModelType>(__GO_UI_BORDER_POSITION__, ModelType.POSITIONTYPE));
         UiPropToGO.put("borderpreferredsize", new Pair<Integer, ModelType>(__GO_UI_BORDER_PREFERREDSIZE__, ModelType.INTEGER_ARRAY));
         UiPropToGO.put("margins", new Pair<Integer, ModelType>(__GO_MARGINS__, ModelType.DOUBLE_ARRAY));
         UiPropToGO.put("groupname", new Pair<Integer, ModelType>(__GO_UI_GROUP_NAME__, ModelType.STRING));
@@ -524,13 +529,13 @@ public class XMLDomLoader {
         //menubar
         tempnode = attr.getNamedItem("menubar");
         if (tempnode != null) {
-            menubar = getAttributeAsInteger(tempnode.getNodeValue());
+            menubar = Figure.BarType.stringToEnum(getAttributeAsString(tempnode.getNodeValue())).ordinal();
             attr.removeNamedItem("menubar");
         }
         //toolbar
         tempnode = attr.getNamedItem("toolbar");
         if (tempnode != null) {
-            toolbar = getAttributeAsInteger(tempnode.getNodeValue());
+            toolbar = Figure.BarType.stringToEnum(getAttributeAsString(tempnode.getNodeValue())).ordinal();
             attr.removeNamedItem("toolbar");
         }
         //default_axes
@@ -616,6 +621,15 @@ public class XMLDomLoader {
                 case STRING_ARRAY:
                     controller.setProperty(fig, pair.getFirst(), getAttributeAsStringArray(prop.getNodeValue()));
                     break;
+                case ROTATIONTYPE :
+                    controller.setProperty(fig, pair.getFirst(), Figure.RotationType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
+                case BARTYPE :
+                    controller.setProperty(fig, pair.getFirst(), Figure.BarType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
+                case LAYOUTTYPE :
+                    controller.setProperty(fig, pair.getFirst(), LayoutType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
                 default:
                     System.out.println("missing type");
                     break;
@@ -670,6 +684,18 @@ public class XMLDomLoader {
                 case STRING_ARRAY:
                     //nothing to do, manage as node instead of attributes
                     break;
+                case LAYOUTTYPE :
+                    controller.setProperty(uic, pair.getFirst(), LayoutType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
+                case FILLTYPE :
+                    controller.setProperty(uic, pair.getFirst(), Uicontrol.FillType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
+                case ANCHORTYPE :
+                    controller.setProperty(uic, pair.getFirst(), Uicontrol.AnchorType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
+                case POSITIONTYPE :
+                    controller.setProperty(uic, pair.getFirst(), Uicontrol.BorderLayoutType.stringToEnum(getAttributeAsString(prop.getNodeValue())).ordinal());
+                    break;
                 default:
                     System.out.println("missing type");
                     break;
index 1762ec6..0339ca3 100644 (file)
@@ -131,7 +131,7 @@ public class XmlSaver {
         //visible
         setAttribute(elemFig, "visible", createAttribute(fig.getVisible()), createAttribute(defaultFig.getVisible()));
         //rotation_style
-        setAttribute(elemFig, "rotation_style", createAttribute(fig.getRotation()), createAttribute(defaultFig.getRotation()));
+        setAttribute(elemFig, "rotation_style", createAttribute(Figure.RotationType.enumToString(fig.getRotationAsEnum())), createAttribute(Figure.RotationType.enumToString(defaultFig.getRotationAsEnum())));
         //event_handler
         setAttribute(elemFig, "event_handler", createAttribute(fig.getEventHandlerString()), createAttribute(defaultFig.getEventHandlerString()));
         //event_handler_enable
@@ -143,11 +143,11 @@ public class XmlSaver {
         //resize
         setAttribute(elemFig, "resize", createAttribute(fig.getResize()), createAttribute(defaultFig.getResize()));
         //toolbar
-        setAttribute(elemFig, "toolbar", createAttribute(fig.getToolbar()), createAttribute(defaultFig.getToolbar()));
+        setAttribute(elemFig, "toolbar", createAttribute(Figure.BarType.enumToString(fig.getToolbarAsEnum())), createAttribute(Figure.BarType.enumToString(defaultFig.getToolbarAsEnum())));
         //toolbar_visible
         setAttribute(elemFig, "toolbar_visible", createAttribute(fig.getToolbarVisible()), createAttribute(defaultFig.getToolbarVisible()));
         //menubar
-        setAttribute(elemFig, "menubar", createAttribute(fig.getMenubar()), createAttribute(defaultFig.getMenubar()));
+        setAttribute(elemFig, "menubar", createAttribute(Figure.BarType.enumToString(fig.getMenubarAsEnum())), createAttribute(Figure.BarType.enumToString(defaultFig.getMenubarAsEnum())));
         //menubar_visible
         setAttribute(elemFig, "menubar_visible", createAttribute(fig.getMenubarVisible()), createAttribute(defaultFig.getMenubarVisible()));
         //infobar_visible
@@ -155,7 +155,7 @@ public class XmlSaver {
         //dockable
         setAttribute(elemFig, "dockable", createAttribute(fig.getDockable()), createAttribute(defaultFig.getDockable()));
         //layout
-        setAttribute(elemFig, "layout", createAttribute(fig.getLayout()), createAttribute(defaultFig.getLayout()));
+        setAttribute(elemFig, "layout", createAttribute(LayoutType.enumToString(fig.getLayoutAsEnum())), createAttribute(LayoutType.enumToString(defaultFig.getLayoutAsEnum())));
 
         //default_axes
         setAttribute(elemFig, "default_axes", createAttribute(fig.hasDefaultAxes()), createAttribute(defaultFig.hasDefaultAxes()));
@@ -383,12 +383,12 @@ public class XmlSaver {
         if (layout == LayoutType.GRIDBAG) {
             setAttribute(elemUi, "gridbaggrid", createAttribute(uic.getGridBagGrid()), createAttribute(defaultUi.getGridBagGrid()));
             setAttribute(elemUi, "gridbagweight", createAttribute(uic.getGridBagWeight()), createAttribute(defaultUi.getGridBagWeight()));
-            setAttribute(elemUi, "gridbagfill", createAttribute(uic.getGridBagFill()), createAttribute(defaultUi.getGridBagFill()));
-            setAttribute(elemUi, "gridbaganchor", createAttribute(uic.getGridBagAnchor()), createAttribute(defaultUi.getGridBagAnchor()));
+            setAttribute(elemUi, "gridbagfill", createAttribute(Uicontrol.FillType.enumToString(uic.getGridBagFillAsEnum())), createAttribute(Uicontrol.FillType.enumToString(defaultUi.getGridBagFillAsEnum())));
+            setAttribute(elemUi, "gridbaganchor", createAttribute(Uicontrol.AnchorType.enumToString(uic.getGridBagAnchorAsEnum())), createAttribute(Uicontrol.AnchorType.enumToString(defaultUi.getGridBagAnchorAsEnum())));
             setAttribute(elemUi, "gridbagpadding", createAttribute(uic.getGridBagPadding()), createAttribute(defaultUi.getGridBagPadding()));
             setAttribute(elemUi, "gridbagpreferredsize", createAttribute(uic.getGridBagPreferredSize()), createAttribute(defaultUi.getGridBagPreferredSize()));
         } else if (layout == LayoutType.BORDER) {
-            setAttribute(elemUi, "borderposition", createAttribute(uic.getBorderPosition()), createAttribute(defaultUi.getBorderPosition()));
+            setAttribute(elemUi, "borderposition", createAttribute(Uicontrol.BorderLayoutType.enumToString(uic.getBorderPositionAsEnum())), createAttribute(Uicontrol.BorderLayoutType.enumToString(defaultUi.getBorderPositionAsEnum())));
             setAttribute(elemUi, "borderpreferredsize", createAttribute(uic.getBorderPreferredSize()), createAttribute(defaultUi.getBorderPreferredSize()));
         } else if (layout == LayoutType.NONE) {
             //Position
@@ -415,7 +415,7 @@ public class XmlSaver {
             }
 
             //Layout
-            setAttribute(elemUi, "layout", createAttribute(uic.getLayout()), createAttribute(defaultUi.getLayout()));
+            setAttribute(elemUi, "layout", createAttribute(LayoutType.enumToString(uic.getLayoutAsEnum())), createAttribute(LayoutType.enumToString(defaultUi.getLayoutAsEnum())));
             //Layout_options
             if (uic.getLayoutAsEnum() == LayoutType.GRID) {
                 setAttribute(elemUi, "gridoptgrid", createAttribute(uic.getGridOptGrid()), createAttribute(defaultUi.getGridOptGrid()));