better management of frame borders 11/13611/6
Antoine ELIAS [Thu, 30 Jan 2014 15:49:19 +0000 (16:49 +0100)]
Change-Id: I8f1039f79180de656778c70fa848145dd475124e

35 files changed:
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/cpp/createGraphicObject.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.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/uicontrol/frame/border/FrameBorder.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/frame/border/FrameBorderType.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/XmlLoader.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/xmlloader/XmlTools.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/macros/%BevelBor_p.sci
scilab/modules/graphics/macros/%Compound_p.sci
scilab/modules/graphics/macros/%EmptyBor_p.sci
scilab/modules/graphics/macros/%EtchedBo_p.sci
scilab/modules/graphics/macros/%FontBord_p.sci [new file with mode: 0644]
scilab/modules/graphics/macros/%LineBord_p.sci
scilab/modules/graphics/macros/%MatteBor_p.sci
scilab/modules/graphics/macros/%SoftBeve_p.sci
scilab/modules/graphics/macros/%TitledBo_p.sci
scilab/modules/graphics/macros/createBorders.sci
scilab/modules/graphics/macros/createFontBorder.sci [new file with mode: 0644]
scilab/modules/graphics/src/c/getHandleProperty/BorderLayoutType.h
scilab/modules/graphics/src/c/getHandleProperty/get_borders_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_constraints_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_borders_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_constraints_property.c
scilab/modules/graphics/tests/unit_tests/borders.dia.ref
scilab/modules/graphics/tests/unit_tests/borders.tst
scilab/modules/gui/sci_gateway/c/sci_uicontrol.c
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/pushbutton/SwingScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/BorderConvertor.java [new file with mode: 0644]

index 42d995e..84319e8 100755 (executable)
 #define __GO_UI_GROUP_NAME__ 368
 #define __GO_UI_TITLE_POSITION__ 369
 #define __GO_UI_TITLE_SCROLL__ 370
+#define __GO_UI_FRAME_BORDER_TYPE__ 371
 
 #endif /* !__GRAPHIC_OBJECT_PROPERTIES_H__ */
index 7f8eb6b..31e677a 100644 (file)
@@ -81,7 +81,7 @@ int createNewFigureWithAxes()
 
 int createFigure(int iDockable, int iMenubarType, int iToolbarType, int iDefaultAxes, int iVisible)
 {
-    return Builder::createFigure(getScilabJavaVM(), iDockable, iMenubarType, iToolbarType, iDefaultAxes, iVisible);
+    return Builder::createFigure(getScilabJavaVM(), iDockable != 0, iMenubarType, iToolbarType, iDefaultAxes != 0, iVisible != 0);
 }
 
 void cloneMenus(int model, int newParent)
index 8bd2355..6367f0a 100755 (executable)
@@ -391,5 +391,6 @@ public class GraphicObjectProperties {
     public static final int __GO_UI_GROUP_NAME__ = 368;
     public static final int __GO_UI_TITLE_POSITION__ = 369;
     public static final int __GO_UI_TITLE_SCROLL__ = 370;
+    public static final int __GO_UI_FRAME_BORDER_TYPE__ = 371;
 
 }
index 21e0a52..a76bc92 100644 (file)
@@ -101,20 +101,20 @@ public class Uicontrol extends GraphicObject {
     }
 
     public enum BorderLayoutType {
-        SOUTH, NORTH, CENTER, WEST, EAST;
+        BOTTOM, TOP, CENTER, LEFT, RIGHT;
         public static BorderLayoutType intToEnum(Integer value) {
             switch (value) {
                 case 0:
-                    return BorderLayoutType.SOUTH;
+                    return BorderLayoutType.BOTTOM;
                 case 1:
-                    return BorderLayoutType.NORTH;
+                    return BorderLayoutType.TOP;
                 default:
                 case 2:
                     return BorderLayoutType.CENTER;
                 case 3:
-                    return BorderLayoutType.WEST;
+                    return BorderLayoutType.LEFT;
                 case 4:
-                    return BorderLayoutType.EAST;
+                    return BorderLayoutType.RIGHT;
             }
         }
 
@@ -124,20 +124,20 @@ public class Uicontrol extends GraphicObject {
             }
 
             char[] chars = value.toCharArray();
-            if (chars[0] == 't' || chars[0] == 'T') {
-                return NORTH;
+            if (chars[0] == 'n' || chars[0] == 'N') {
+                return TOP;
             }
 
-            if (chars[0] == 'l' || chars[0] == 'L') {
-                return EAST;
+            if (chars[0] == 'e' || chars[0] == 'E') {
+                return RIGHT;
             }
 
-            if (chars[0] == 'b' || chars[0] == 'B') {
-                return SOUTH;
+            if (chars[0] == 's' || chars[0] == 'S') {
+                return BOTTOM;
             }
 
-            if (chars[0] == 'r' || chars[0] == 'R') {
-                return WEST;
+            if (chars[0] == 'w' || chars[0] == 'W') {
+                return LEFT;
             }
 
             return CENTER;
@@ -1342,7 +1342,7 @@ public class Uicontrol extends GraphicObject {
     }
 
     public UpdateStatus setFrameBorder(Integer value) {
-        if (value.equals(frameBorder)) {
+        if (frameBorder.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
index 2e5a6ec..a57abd4 100644 (file)
@@ -2,9 +2,7 @@ package org.scilab.modules.graphic_objects.uicontrol.frame.border;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LINE_THICKNESS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_STYLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TITLE__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTNAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTSIZE__;
@@ -19,7 +17,9 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_ROUNDED__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_IN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_OUT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_STYLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_TITLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_TYPE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
 
 import java.util.Arrays;
@@ -66,7 +66,7 @@ public class FrameBorder extends GraphicObject {
 
         public static BorderType stringToEnum(String value) {
             if (value == null || value.equals("")) {
-                return RAISED;
+                return null;
             }
 
             char[] chars = value.toCharArray();
@@ -99,7 +99,7 @@ public class FrameBorder extends GraphicObject {
 
         public static JustificationType stringToEnum(String value) {
             if (value == null || value.equals("")) {
-                return LEADING;
+                return null;
             }
 
             char[] chars = value.toCharArray();
@@ -151,7 +151,7 @@ public class FrameBorder extends GraphicObject {
 
         public static TitlePositionType stringToEnum(String value) {
             if (value == null || value.equals("")) {
-                return TOP;
+                return null;
             }
 
             if (value.equalsIgnoreCase("above_top")) {
@@ -178,33 +178,27 @@ public class FrameBorder extends GraphicObject {
         }
     };
 
-    private static final Integer DEFAULTFONTSIZE = 10;
-    private static final String DEFAULTFONTNAME = "helvetica";
-    private static final String DEFAULTFONTWEIGHT = "normal";
-    private static final String DEFAULTFONTANGLE = DEFAULTFONTWEIGHT;
-    private static final String DEFAULTCOLOR = "black";
-
-    private BorderType type = BorderType.RAISED;
-    private String color = DEFAULTCOLOR;
-    private String hlOutColor = DEFAULTCOLOR;
-    private String hlInColor = DEFAULTCOLOR;
-    private String shadowOutColor = DEFAULTCOLOR;
-    private String shadowInColor = DEFAULTCOLOR;
-    private Integer thickness = 1;
-    private Boolean rounded = false;
-    private FrameBorderType style = FrameBorderType.ETCHED;
-    private String title = "";
-    private JustificationType justification = JustificationType.LEADING;
-    private String fontAngle = DEFAULTFONTANGLE;
-    private String fontName = DEFAULTFONTNAME;
-    private Integer fontSize = DEFAULTFONTSIZE;
-    private String fontWeight = DEFAULTFONTWEIGHT;
+    private BorderType type = null;//BorderType.NONE;
+    private String color = null;
+    private String hlOutColor = null;
+    private String hlInColor = null;
+    private String shadowOutColor = null;
+    private String shadowInColor = null;
+    private Integer thickness = null;
+    private Boolean rounded = null;
+    private FrameBorderType style = null;//FrameBorderType.ETCHED;
+    private String title = null;
+    private JustificationType justification = null;//JustificationType.LEADING;
+    private String fontAngle = null;
+    private String fontName = null;
+    private Integer fontSize = null;
+    private String fontWeight = null;
     private TitlePositionType titlePosition = TitlePositionType.TOP;
-    private Double[] position = new Double[] {0.0, 0.0, 0.0, 0.0};//TLBR
+    private Double[] position = null;//new Double[] {0.0, 0.0, 0.0, 0.0};//TLBR
 
-    private Integer titleBorder = 0;
-    private Integer inBorder = 0;
-    private Integer outBorder = 0;
+    private Integer titleBorder = null;
+    private Integer inBorder = null;
+    private Integer outBorder = null;
 
     public FrameBorder() {
 
@@ -255,7 +249,7 @@ public class FrameBorder extends GraphicObject {
                 return FrameBorderProperty.TITLE_BORDER;
             case __GO_UI_FRAME_BORDER_POSITION__:
                 return FrameBorderProperty.TITLE_POSITION;
-            case __GO_TYPE__:
+            case __GO_UI_FRAME_BORDER_TYPE__:
                 return FrameBorderProperty.TYPE;
             default:
                 return super.getPropertyFromName(propertyName);
@@ -361,7 +355,7 @@ public class FrameBorder extends GraphicObject {
 
     /** type */
     public Integer getBorderType() {
-        return type.ordinal();
+        return type == null ? null : type.ordinal();
     }
 
     public BorderType getBorderTypeAsEnum() {
@@ -383,7 +377,7 @@ public class FrameBorder extends GraphicObject {
 
     /** titleposition */
     public Integer getTitlePosition() {
-        return titlePosition.ordinal();
+        return titlePosition == null ? null : titlePosition.ordinal();
     }
 
     public TitlePositionType getTitlePositionAsEnum() {
@@ -409,7 +403,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setTitleBorder(Integer value) {
-        if (titleBorder.equals(value)) {
+        if (titleBorder != null && titleBorder.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -423,7 +417,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setTitle(String value) {
-        if (title.equals(value)) {
+        if (title != null && title.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -437,7 +431,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setThickness(Integer value) {
-        if (thickness.equals(value)) {
+        if (thickness != null && thickness.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -447,7 +441,7 @@ public class FrameBorder extends GraphicObject {
 
     /** style */
     public Integer getStyle() {
-        return style.ordinal();
+        return style == null ? null : style.ordinal();
     }
 
     public FrameBorderType getStyleAsEnum() {
@@ -459,7 +453,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setStyle(FrameBorderType value) {
-        if (style.equals(value)) {
+        if (style != null && style.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -473,7 +467,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setShadowOut(String value) {
-        if (shadowOutColor.equals(value)) {
+        if (shadowOutColor != null && shadowOutColor.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -487,7 +481,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setShadowIn(String value) {
-        if (shadowInColor.equals(value)) {
+        if (shadowInColor != null && shadowInColor.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -501,7 +495,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setRounded(Boolean value) {
-        if (rounded.equals(value)) {
+        if (rounded != null && rounded.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -515,7 +509,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setPosition(Double[] value) {
-        if (Arrays.equals(position, value)) {
+        if (position != null && Arrays.equals(position, value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -529,7 +523,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setOutBorder(Integer value) {
-        if (outBorder.equals(value)) {
+        if (outBorder != null && outBorder.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -539,7 +533,7 @@ public class FrameBorder extends GraphicObject {
 
     /** justification */
     public Integer getJustification() {
-        return justification.ordinal();
+        return justification == null ? null : justification.ordinal();
     }
 
     public JustificationType getJustificationAsEnum() {
@@ -565,7 +559,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setInBorder(Integer value) {
-        if (inBorder.equals(value)) {
+        if (inBorder != null && inBorder.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -579,7 +573,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setHlOut(String value) {
-        if (hlOutColor.equals(value)) {
+        if (hlOutColor != null && hlOutColor.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -593,7 +587,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setHlIn(String value) {
-        if (hlInColor.equals(value)) {
+        if (hlInColor != null && hlInColor.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -607,7 +601,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setFontWeight(String value) {
-        if (fontWeight.equals(value)) {
+        if (fontWeight != null && fontWeight.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -621,7 +615,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setFontSize(Integer value) {
-        if (fontSize.equals(value)) {
+        if (fontSize != null && fontSize.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -635,7 +629,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setFontName(String value) {
-        if (fontName.equals(value)) {
+        if (fontName != null && fontName.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -649,7 +643,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setFontAngle(String value) {
-        if (fontAngle.equals(value)) {
+        if (fontAngle != null && fontAngle.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
@@ -663,7 +657,7 @@ public class FrameBorder extends GraphicObject {
     }
 
     public UpdateStatus setColor(String value) {
-        if (color.equals(value)) {
+        if (color != null && color.equals(value)) {
             return UpdateStatus.NoChange;
         }
 
index c2d336e..34e6af2 100644 (file)
@@ -4,6 +4,10 @@ public enum FrameBorderType {
     NONE, LINE, BEVEL, SOFTBEVEL, ETCHED, TITLED, EMPTY, COMPOUND, MATTE;
 
     public static FrameBorderType intToEnum(Integer value) {
+        if (value == null) {
+            return null;
+        }
+
         switch (value) {
             default :
             case 0 :
@@ -29,7 +33,7 @@ public enum FrameBorderType {
 
     public static FrameBorderType stringToEnum(String value) {
         if (value == null || value.equals("")) {
-            return NONE;
+            return null;
         }
 
         char[] chars = value.toCharArray();
index 4353aa8..e907cd6 100644 (file)
@@ -19,6 +19,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TOOLBAR_VISIBLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_BORDER_POSITION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_CHECKBOX__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTNAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTSIZE__;
@@ -42,6 +43,8 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_GRID__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_PADDING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_WEIGHT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_PUSHBUTTON__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TEXT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
@@ -59,9 +62,9 @@ import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.xml.sax.Attributes;
 
 public class GOBuilder {
-    public static Integer figureBuilder(GraphicController controller,
-                                        Attributes attributes) {
-        Integer fig = Builder.createNewFigureWithAxes();
+    public static Integer figureBuilder(GraphicController controller, Attributes attributes) {
+        Integer fig = Builder.createFigure(false, 0, 0, false, false);
+
         String item = null;
 
         // hide toolbar
@@ -80,12 +83,10 @@ public class GOBuilder {
         XmlTools.setPropAsString(fig, __GO_TAG__, attributes.getValue("id"));
 
         // visible
-        XmlTools.setPropAsBoolean(fig, __GO_VISIBLE__,
-                                  attributes.getValue("visible"));
+        XmlTools.setPropAsBoolean(fig, __GO_VISIBLE__, attributes.getValue("visible"));
 
         // position
-        Integer[] position = (Integer[]) controller.getProperty(fig,
-                             __GO_POSITION__);
+        Integer[] position = (Integer[]) controller.getProperty(fig, __GO_POSITION__);
         // posX
         item = attributes.getValue("posX");
         if (item != null) {
@@ -125,29 +126,23 @@ public class GOBuilder {
         // attributes.getValue("icon"));
 
         // resizable
-        XmlTools.setPropAsBoolean(fig, __GO_RESIZE__,
-                                  attributes.getValue("resizable"));
+        XmlTools.setPropAsBoolean(fig, __GO_RESIZE__, attributes.getValue("resizable"));
 
         // layout and layout_options
         setLayoutProperty(controller, fig, attributes.getValue("layout"));
-
         return fig;
     }
 
-    public static Integer uicontrolBuilder(GraphicController controller,
-                                           int type, Attributes attributes, int parent) {
+    public static Integer uicontrolBuilder(GraphicController controller, int type, Attributes attributes, int parent) {
         Integer uic = controller.askObject(GraphicObject.getTypeFromName(type));
         return uicontrolUpdater(controller, uic, attributes, parent);
     }
 
-    public static Integer uicontrolUpdater(GraphicController controller,
-                                           int uic, Attributes attributes, int parent) {
+    public static Integer uicontrolUpdater(GraphicController controller, int uic, Attributes attributes, int parent) {
         return uicontrolUpdater(controller, uic, attributes, parent, null);
     }
 
-    public static Integer uicontrolUpdater(GraphicController controller,
-                                           int uic, Attributes attributes, int parent,
-                                           Map<String, String> fromModel) {
+    public static Integer uicontrolUpdater(GraphicController controller, int uic, Attributes attributes, int parent, Map<String, String> fromModel) {
         String item = null;
 
         try {
@@ -169,8 +164,7 @@ public class GOBuilder {
             // get parent layout
             LayoutType layout = LayoutType.NONE;
             if (parent != 0) {
-                layout = LayoutType.intToEnum((Integer) controller.getProperty(
-                                                  parent, __GO_LAYOUT__));
+                layout = LayoutType.intToEnum((Integer) controller.getProperty(parent, __GO_LAYOUT__));
             }
 
             if (layout != LayoutType.NONE) {
@@ -187,48 +181,32 @@ 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.stringToEnum(item).ordinal());
                         break;
                     }
                     case GRIDBAG: {
                         Integer[] grid = new Integer[] { 0, 0, 0, 0 };
-                        grid[0] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                   "gridx", "0"));
-                        grid[1] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                   "gridy", "0"));
-                        grid[2] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                   "gridwidth", "1"));
-                        grid[3] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                   "gridheight", "1"));
+                        grid[0] = Integer.parseInt(XmlTools.getFromMap(map, "gridx", "0"));
+                        grid[1] = Integer.parseInt(XmlTools.getFromMap(map, "gridy", "0"));
+                        grid[2] = Integer.parseInt(XmlTools.getFromMap(map, "gridwidth", "1"));
+                        grid[3] = Integer.parseInt(XmlTools.getFromMap(map, "gridheight", "1"));
 
                         Double[] weight = new Double[] { 0.0, 0.0 };
-                        weight[0] = Double.parseDouble(XmlTools.getFromMap(map,
-                                                       "weightx", "1.0"));
-                        weight[1] = Double.parseDouble(XmlTools.getFromMap(map,
-                                                       "weighty", "1.0"));
+                        weight[0] = Double.parseDouble(XmlTools.getFromMap(map, "weightx", "1.0"));
+                        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 fill = Uicontrol.FillType.stringToEnum(XmlTools.getFromMap(map, "fill", "none")).ordinal();
+                        Integer anchor = Uicontrol.AnchorType.stringToEnum(XmlTools.getFromMap(map, "anchor", "center")).ordinal();
 
                         Integer[] padding = new Integer[] { 0, 0 };
-                        padding[0] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                      "ipadx", "0"));
-                        padding[1] = Integer.parseInt(XmlTools.getFromMap(map,
-                                                      "ipady", "0"));
+                        padding[0] = Integer.parseInt(XmlTools.getFromMap(map, "ipadx", "0"));
+                        padding[1] = Integer.parseInt(XmlTools.getFromMap(map, "ipady", "0"));
 
                         controller.setProperty(uic, __GO_UI_GRIDBAG_GRID__, grid);
-                        controller.setProperty(uic, __GO_UI_GRIDBAG_WEIGHT__,
-                                               weight);
+                        controller.setProperty(uic, __GO_UI_GRIDBAG_WEIGHT__, weight);
                         controller.setProperty(uic, __GO_UI_GRIDBAG_FILL__, fill);
-                        controller.setProperty(uic, __GO_UI_GRIDBAG_ANCHOR__,
-                                               anchor);
-                        controller.setProperty(uic, __GO_UI_GRIDBAG_PADDING__,
-                                               padding);
+                        controller.setProperty(uic, __GO_UI_GRIDBAG_ANCHOR__, anchor);
+                        controller.setProperty(uic, __GO_UI_GRIDBAG_PADDING__, padding);
                         break;
                     }
                     default:
@@ -253,7 +231,8 @@ public class GOBuilder {
                     // border
                     item = attributes.getValue("border");
                     if (item == null && fromModel != null) {
-                        // use value from model if property is not in "declaration"
+                        // use value from model if property is not in
+                        // "declaration"
                         item = XmlTools.getFromMap(fromModel, "border");
                     }
 
@@ -261,14 +240,17 @@ public class GOBuilder {
                         map = CSSParser.parseLine(item);
                     }
 
-                    FrameBorderType borderType = FrameBorderType
-                                                 .stringToEnum(XmlTools.getFromMap(map, "name", "none"));
+                    FrameBorderType borderType = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "name", "none"));
                     Integer border = createBorder(controller, uic, borderType, map);
                     controller.setProperty(uic, __GO_UI_FRAME_BORDER__, border);
 
                     break;
                 }
-                case __GO_UI_TEXT__ :
+
+                case __GO_UI_CHECKBOX__:
+                    controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
+                case __GO_UI_PUSHBUTTON__:
+                case __GO_UI_TEXT__:
                     String[] text = new String[1];
                     text[0] = attributes.getValue("text");
                     controller.setProperty(uic, __GO_UI_STRING__, text);
@@ -282,8 +264,7 @@ public class GOBuilder {
         return uic;
     }
 
-    private static void setLayoutProperty(GraphicController controller,
-                                          Integer uid, String item) {
+    private static void setLayoutProperty(GraphicController controller, Integer uid, String item) {
         try {
             if (item != null) {
                 Map<String, String> map = null;
@@ -296,26 +277,20 @@ public class GOBuilder {
                 switch (layout) {
                     case BORDER: {
                         Integer[] pad = new Integer[] { 0, 0 };
-                        pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap",
-                                                  "0"));
-                        pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap",
-                                                  "0"));
+                        pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap", "0"));
+                        pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap", "0"));
 
                         controller.setProperty(uid, __GO_BORDER_OPT_PADDING__, pad);
                         break;
                     }
                     case GRID: {
                         Integer[] grid = new Integer[] { 0, 0 };
-                        grid[0] = Integer.parseInt(XmlTools.getFromMap(map, "rows",
-                                                   "0"));
-                        grid[1] = Integer.parseInt(XmlTools.getFromMap(map, "cols",
-                                                   "0"));
+                        grid[0] = Integer.parseInt(XmlTools.getFromMap(map, "rows", "0"));
+                        grid[1] = Integer.parseInt(XmlTools.getFromMap(map, "cols", "0"));
 
                         Integer[] pad = new Integer[] { 0, 0 };
-                        pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap",
-                                                  "0"));
-                        pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap",
-                                                  "0"));
+                        pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap", "0"));
+                        pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap", "0"));
 
                         controller.setProperty(uid, __GO_GRID_OPT_GRID__, grid);
                         controller.setProperty(uid, __GO_GRID_OPT_PADDING__, pad);
@@ -334,96 +309,70 @@ public class GOBuilder {
 
     }
 
-    private static Integer createBorder(GraphicController controller,
-                                        Integer uic, FrameBorderType borderType, Map<String, String> map) {
-        Integer border = controller.askObject(GraphicObject
-                                              .getTypeFromName(__GO_UI_FRAME_BORDER__));
-        controller.setProperty(border, __GO_UI_FRAME_BORDER_STYLE__,
-                               borderType.ordinal());
+    private static Integer createBorder(GraphicController controller, Integer uic, FrameBorderType borderType, Map<String, String> map) {
+        Integer border = controller.askObject(GraphicObject.getTypeFromName(__GO_UI_FRAME_BORDER__));
+        controller.setProperty(border, __GO_UI_FRAME_BORDER_STYLE__, borderType.ordinal());
 
         switch (borderType) {
             case SOFTBEVEL:
             case BEVEL: {
-                BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(
-                                         map, "type", "raised"));
+                BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(map, "type", "none"));
                 String color = XmlTools.getFromMap(map, "color", "black");
 
                 controller.setProperty(border, __GO_TYPE__, etching.ordinal());
-                controller.setProperty(border,
-                                       __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__,
-                                       color);
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_OUT__,
-                                       color);
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_IN__,
-                                       color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_OUT__, color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_IN__, color);
                 break;
             }
             case COMPOUND: {
-                FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools
-                                            .getFromMap(map, "border-out", "none"));
-                FrameBorderType borderIn = FrameBorderType.stringToEnum(XmlTools
-                                           .getFromMap(map, "border-in", "none"));
+                FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border-out", "none"));
+                FrameBorderType borderIn = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border-in", "none"));
 
                 Integer out = createBorder(controller, border, borderOut, map);
                 Integer in = createBorder(controller, border, borderIn, map);
 
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__,
-                                       out);
-                controller
-                .setProperty(border, __GO_UI_FRAME_BORDER_IN_BORDER__, in);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__, out);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_IN_BORDER__, in);
 
                 break;
             }
             case EMPTY: {
                 Double[] position = new Double[4];
-                position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top",
-                                                 "0"));
-                position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left",
-                                                 "0"));
-                position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right",
-                                                 "0"));
-                position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom",
-                                                 "0"));
+                position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top", "0"));
+                position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left", "0"));
+                position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right", "0"));
+                position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom", "0"));
 
                 controller.setProperty(border, __GO_POSITION__, position);
                 break;
             }
             case ETCHED: {
-                BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(
-                                         map, "type", "raised"));
+                BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(map, "type", "none"));
                 String color = XmlTools.getFromMap(map, "color", "black");
 
                 controller.setProperty(border, __GO_TYPE__, etching.ordinal());
-                controller.setProperty(border,
-                                       __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__,
-                                       color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, color);
                 break;
             }
             case LINE: {
                 String color = XmlTools.getFromMap(map, "color", "black");
-                Integer thickness = Integer.parseInt(XmlTools.getFromMap(map,
-                                                     "thickness", "1"));
-                Boolean rounded = Boolean.parseBoolean(XmlTools.getFromMap(map,
-                                                       "rounded", "false"));
+                Integer thickness = Integer.parseInt(XmlTools.getFromMap(map, "thickness", "1"));
+                Boolean rounded = Boolean.parseBoolean(XmlTools.getFromMap(map, "rounded", "false"));
 
                 controller.setProperty(border, __GO_UI_FRAME_BORDER_COLOR__, color);
                 controller.setProperty(border, __GO_LINE_THICKNESS__, thickness);
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_ROUNDED__,
-                                       rounded);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_ROUNDED__, rounded);
                 break;
             }
             case MATTE: {
                 Double[] position = new Double[4];
-                position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top",
-                                                 "0"));
-                position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left",
-                                                 "0"));
-                position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right",
-                                                 "0"));
-                position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom",
-                                                 "0"));
+                position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top", "0"));
+                position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left", "0"));
+                position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right", "0"));
+                position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom", "0"));
                 String color = XmlTools.getFromMap(map, "color", "black");
 
                 controller.setProperty(border, __GO_POSITION__, position);
@@ -432,26 +381,20 @@ public class GOBuilder {
             }
             case TITLED: {
 
-                FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools
-                                            .getFromMap(map, "border", "none"));
+                FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border", "none"));
                 Integer out = createBorder(controller, border, borderOut, map);
                 String title = XmlTools.getFromMap(map, "title", "");
-                FrameBorder.JustificationType justify = FrameBorder.JustificationType
-                                                        .stringToEnum(XmlTools
-                                                                .getFromMap(map, "justify", "leading"));
+                FrameBorder.JustificationType justify = FrameBorder.JustificationType.stringToEnum(XmlTools.getFromMap(map, "justify", "leading"));
                 String fontName = XmlTools.getFromMap(map, "font-name", "helvetica");
                 String fontAngle = XmlTools.getFromMap(map, "italic", "false") == "false" ? "normal" : "italic";
                 Integer fontSize = Integer.parseInt(XmlTools.getFromMap(map, "font-size", "10"));
 
                 String fontWeight = XmlTools.getFromMap(map, "bold", "false") == "false" ? "normal" : "bold";
-                FrameBorder.TitlePositionType position = FrameBorder.TitlePositionType
-                        .stringToEnum(XmlTools
-                                      .getFromMap(map, "position", "leading"));
+                FrameBorder.TitlePositionType position = FrameBorder.TitlePositionType.stringToEnum(XmlTools.getFromMap(map, "position", "leading"));
 
                 String color = XmlTools.getFromMap(map, "color", "black");
 
-                controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__,
-                                       out);
+                controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__, out);
 
                 controller.setProperty(border, __GO_UI_FRAME_BORDER_TITLE__, out);
                 controller.setProperty(border, __GO_TITLE__, title);
@@ -466,9 +409,8 @@ public class GOBuilder {
                 break;
             }
             case NONE:
-            default: {
+            default:
                 break;
-            }
         }
 
         return border;
index 08abb8c..f9706bd 100644 (file)
@@ -66,7 +66,7 @@ public class XmlLoader extends DefaultHandler {
     private GraphicController controller;
 
     static {
-        //init map to convert control name to id
+        // init map to convert control name to id
         nameToGO.put("UIScilabWindow", __GO_FIGURE__);
         nameToGO.put("Figure", __GO_FIGURE__);
 
@@ -133,7 +133,7 @@ public class XmlLoader extends DefaultHandler {
             ret = parse(filename);
         }
 
-        //clean model before leave.
+        // clean model before leave.
         Set<String> entries = models.keySet();
         for (String key : entries) {
             HashMap<String, Entry<Integer, Map<String, String>>> map = models.get(key);
@@ -181,7 +181,8 @@ public class XmlLoader extends DefaultHandler {
         } finally {
             try {
                 in.close();
-            } catch (IOException e) { }
+            } catch (IOException e) {
+            }
         }
 
         return uid;
@@ -206,7 +207,7 @@ public class XmlLoader extends DefaultHandler {
             } else if (stackGO.size() > 0) {
                 Integer parent = stackGO.peek();
                 controller.setGraphicObjectRelationship(parent, go);
-                controller.setProperty(go,  __GO_VISIBLE__, true);
+                controller.setProperty(go, __GO_VISIBLE__, true);
             } else {
                 uid = go;
             }
@@ -221,12 +222,11 @@ public class XmlLoader extends DefaultHandler {
         isFirst = true;
     }
 
-    public void startElement(String uri, String localName, String qName,
-                             Attributes attributes) throws SAXException {
+    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
 
         if (localName.equals("interface")) {
             if (isFirst) {
-                myURI =  attributes.getValue("xmlns");
+                myURI = attributes.getValue("xmlns");
                 isFirst = false;
             }
         } else if (localName.equals("include")) {
@@ -240,7 +240,7 @@ public class XmlLoader extends DefaultHandler {
             Integer go = 0;
             if (uitype != null && uitype.intValue() > 0) {
                 if (uitype == __GO_FIGURE__) {
-                    //never create a new figure, clone figure model !
+                    // never create a new figure, clone figure model !
                     go = GOBuilder.figureBuilder(controller, attributes);
                 } else {
                     int parent = 0;
@@ -249,17 +249,17 @@ public class XmlLoader extends DefaultHandler {
                     }
                     go = GOBuilder.uicontrolBuilder(controller, uitype, attributes, parent);
                 }
-            } else { //namespace or bad name ...
+            } else { // namespace or bad name ...
                 if (myURI.equals(uri)) {
-                    //bad name
+                    // bad name
                 } else {
                     HashMap<String, Entry<Integer, Map<String, String>>> m = models.get(uri);
                     if (m == null) {
-                        //bad namespace
+                        // bad namespace
                     } else {
                         Entry<Integer, Map<String, String>> entry = m.get(localName);
                         go = entry.getKey();
-                        //need to clone object and children
+                        // need to clone object and children
                         Integer newgo = cloneObject(go);
                         GOBuilder.uicontrolUpdater(controller, newgo, attributes, stackGO.peek(), entry.getValue());
                         go = newgo;
@@ -274,15 +274,16 @@ public class XmlLoader extends DefaultHandler {
                 if (isWaitingModelName) {
                     String name = attributes.getValue("modele-name");
                     if (name == null) {
-                        //unmaned model ? :s
+                        // unmaned model ? :s
                     } else {
                         if (models.get(namespace) == null) {
                             models.put(namespace, new HashMap<String, Entry<Integer, Map<String, String>>>());
                         }
 
-                        //copy attributes to a Map, i do not know why a can use attributes ? Oo
+                        // copy attributes to a Map, i do not know why a can use
+                        // attributes ? Oo
                         Map<String, String> attrib = new HashMap<String, String>();
-                        for (int i = 0 ; i < attributes.getLength() ; i++) {
+                        for (int i = 0; i < attributes.getLength(); i++) {
                             attrib.put(attributes.getLocalName(i), attributes.getValue(i));
                         }
 
@@ -299,8 +300,8 @@ public class XmlLoader extends DefaultHandler {
 
     Integer cloneObject(Integer root) {
         Integer newGo = controller.cloneObject(root);
-        Integer[] children = (Integer[])controller.getProperty(root, __GO_CHILDREN__);
-        for (int i = 0 ; i < children.length ; i++) {
+        Integer[] children = (Integer[]) controller.getProperty(root, __GO_CHILDREN__);
+        for (int i = 0; i < children.length; i++) {
             Integer newChild = cloneObject(children[i]);
             controller.setGraphicObjectRelationship(newGo, newChild);
         }
@@ -309,8 +310,8 @@ public class XmlLoader extends DefaultHandler {
     }
 
     private void deleteObject(Integer root) {
-        Integer[] children = (Integer[])controller.getProperty(root, __GO_CHILDREN__);
-        for (int i = 0 ; i < children.length ; i++) {
+        Integer[] children = (Integer[]) controller.getProperty(root, __GO_CHILDREN__);
+        for (int i = 0; i < children.length; i++) {
             deleteObject(children[i]);
         }
 
index 76fe03c..ac8b717 100644 (file)
@@ -1,7 +1,5 @@
 package org.scilab.modules.graphic_objects.xmlloader;
 
-import java.awt.GridBagConstraints;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -23,7 +21,7 @@ public class XmlTools {
         }
 
         Double[] values = new Double[propString.length];
-        for (int i = 0 ; i < propString.length ; i++) {
+        for (int i = 0; i < propString.length; i++) {
             String value = map.get(propString[i]);
             if (value == null || value.equals("")) {
                 values[i] = 0.0;
@@ -161,4 +159,3 @@ public class XmlTools {
         return getFromMap(map, field, "");
     }
 }
-
index cac8371..924fac6 100755 (executable)
@@ -421,3 +421,4 @@ __GO_UI_FRAME_BORDER_STYLE__
 __GO_UI_GROUP_NAME__
 __GO_UI_TITLE_POSITION__
 __GO_UI_TITLE_SCROLL__
+__GO_UI_FRAME_BORDER_TYPE__
index 0f7b549..ce82a70 100644 (file)
@@ -6,9 +6,22 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %BevelBor_p(t)
+    count = size(t(1), "*");
+
     printf("Bevel Border\n");
     printf("  Type            : %s\n", sci2exp(t.type));
+
+    if count == 2 then
+        return
+    end
+
     printf("  Highlight outer : %s\n", sci2exp(t.hlouter));
+
+    if count == 4 then
+        printf("  Shadow outer    : %s\n", sci2exp(t.shadowouter));
+        return;
+    end
+
     printf("  Highlight inner : %s\n", sci2exp(t.hlinner));
     printf("  Shadow outer    : %s\n", sci2exp(t.shadowouter));
     printf("  Shadow inner    : %s\n", sci2exp(t.shadowinner));
index 1202eea..611193e 100644 (file)
@@ -6,7 +6,15 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %Compound_p(t)
+    count = size(t(1), "*");
+
     printf("Compound Border\n");
+
+    if count == 1 then
+        printf("  No option\n");
+        return;
+    end
+
     printf("  Outer : %s\n", typeof(t.outer));
     printf("  Inner : %s\n", typeof(t.inner));
 endfunction
index 72aecea..9459280 100644 (file)
@@ -6,7 +6,15 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %EmptyBor_p(t)
+    count = size(t(1), "*");
+
     printf("Empty Border\n");
+
+    if count == 1 then
+        printf("  No option\n");
+        return;
+    end
+
     printf("  Top    : %s\n", sci2exp(t.top));
     printf("  Left   : %s\n", sci2exp(t.left));
     printf("  Bottom : %s\n", sci2exp(t.bottom));
index fed7743..10b7273 100644 (file)
@@ -6,7 +6,26 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %EtchedBo_p(t)
+    count = size(t(1), "*");
+
     printf("Etched Border\n");
+
+    if count == 1 then
+        printf("  No option\n");
+        return;
+    end
+
+    if count == 2 then
+        printf("  Type      : %s\n", sci2exp(t.type));
+        return;
+    end
+
+    if count == 3 then
+        printf("  Highlight : %s\n", sci2exp(t.hl));
+        printf("  Shadow    : %s\n", sci2exp(t.shadow));
+        return;
+    end
+
     printf("  Type      : %s\n", sci2exp(t.type));
     printf("  Highlight : %s\n", sci2exp(t.hl));
     printf("  Shadow    : %s\n", sci2exp(t.shadow));
diff --git a/scilab/modules/graphics/macros/%FontBord_p.sci b/scilab/modules/graphics/macros/%FontBord_p.sci
new file mode 100644 (file)
index 0000000..2746e0d
--- /dev/null
@@ -0,0 +1,16 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2104 - Scilab Enterprises - Antoine ELIAS
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+function %FontBord_p(t)
+    count = size(t(1), "*");
+
+    printf("Font Border\n");
+    printf("  Name   : %s\n", sci2exp(t.name));
+    printf("  Size   : %s\n", sci2exp(t.size));
+    printf("  Weight : %s\n", sci2exp(t.weight));
+    printf("  Angle  : %s\n", sci2exp(t.angle));
+endfunction
index f7b4c0e..9300073 100644 (file)
@@ -6,8 +6,20 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %LineBord_p(t)
+    count = size(t(1), "*");
+
     printf("Line Border\n");
     printf("  Color     : %s\n", sci2exp(t.color));
+
+    if count < 3 then
+        return;
+    end
+
     printf("  Thickness : %s\n", sci2exp(t.thickness));
+
+    if count < 4 then
+        return;
+    end
+
     printf("  Rounded   : %s\n", sci2exp(t.rounded));
 endfunction
index be3036f..97da2f6 100644 (file)
@@ -6,6 +6,8 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %MatteBor_p(t)
+    count = size(t(1), "*");
+
     printf("Matte Border\n");
     printf("  Top    : %s\n", sci2exp(t.top));
     printf("  Left   : %s\n", sci2exp(t.left));
index b0100ff..da131fc 100644 (file)
@@ -6,9 +6,22 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %SoftBeve_p(t)
+    count = size(t(1), "*");
+
     printf("SoftBevel Border\n");
     printf("  Type            : %s\n", sci2exp(t.type));
+
+    if count == 2 then
+        return
+    end
+
     printf("  Highlight outer : %s\n", sci2exp(t.hlouter));
+
+    if count == 4 then
+        printf("  Shadow outer    : %s\n", sci2exp(t.shadowouter));
+        return;
+    end
+
     printf("  Highlight inner : %s\n", sci2exp(t.hlinner));
     printf("  Shadow outer    : %s\n", sci2exp(t.shadowouter));
     printf("  Shadow inner    : %s\n", sci2exp(t.shadowinner));
index 2eb40fc..d5f6686 100644 (file)
@@ -6,14 +6,37 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 function %TitledBo_p(t)
+    count = size(t(1), "*");
+
     printf("Titled Border\n");
+    if count == 2 then
+        if typeof(t(2)) == "string" then
+            printf("  Title         : %s\n", sci2exp(t.title));
+        else
+            printf("  Border        : %s\n", typeof(t.border));
+        end
+        return;
+    end
+
     printf("  Border        : %s\n", typeof(t.border));
     printf("  Title         : %s\n", sci2exp(t.title));
+
+    if count < 5 then
+        return;
+    end
+
     printf("  Justification : %s\n", sci2exp(t.justification));
-    printf("  FontName      : %s\n", sci2exp(t.fontname));
-    printf("  FontAngle     : %s\n", sci2exp(t.fontangle));
-    printf("  FontSize      : %s\n", sci2exp(t.fontsize));
-    printf("  FontWeight    : %s\n", sci2exp(t.fontweight));
     printf("  Position      : %s\n", sci2exp(t.position));
+
+    if count < 6 then
+        return;
+    end
+
+    printf("  Font          : %s\n", typeof(t.font));
+
+    if count < 7 then
+        return;
+    end
+
     printf("  Color         : %s\n", sci2exp(t.color));
 endfunction
index 0304663..f9d507c 100644 (file)
@@ -21,327 +21,345 @@ function ret = createBorders(constType, varargin)
     if constType == "none" then
         ret = tlist(["NoBorder"]);
     elseif constType == "line" then
-        arg1 = "black"; //color
-        arg2 = 1; //thickness
-        arg3 = %f; //rounded
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [2:4] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected."), "createBorders", 2, 4));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
-            end
+        //color
+        arg1 = varargin(1);
+        if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            t = typeof(arg3);
-            if (t <> "boolean" & t <> "string") | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A boolean expected.\n"), "createBorders", 4));
-            end
+        if rhs == 2 then
+            ret = tlist(["LineBorder", "color"], arg1);
+            return;
+        end
+
+        //thickness
+        arg2 = varargin(2);
+        if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
+        end
+
+        if rhs == 3 then
+            ret = tlist(["LineBorder", "color", "thickness"], arg1, arg2);
+            return;
+        end
+
+        //rounded
+        arg3 = varargin(3);
+        t = typeof(arg3);
+        if (t <> "boolean" & t <> "string") | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A boolean expected.\n"), "createBorders", 4));
+        end
 
-            if t == "string" then
-                if arg3 == "on" then
-                    arg3 = %t;
-                else
-                    arg3 = %f;
-                end
+        if t == "string" then
+            if arg3 == "on" then
+                arg3 = %t;
+            else
+                arg3 = %f;
             end
         end
 
         ret = tlist(["LineBorder", "color", "thickness", "rounded"], arg1, arg2, arg3);
     elseif constType == "bevel" then
-        arg1 = "raised"; //type
-        arg2 = "black"; //hl out color
-        arg3 = "black"; //hl in color
-        arg4 = "black"; //shadow out color
-        arg5 = "black"; //shadow in color
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [2 4 6] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d, %d or %d expected."), "createBorders", 2, 4, 6));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
-            end
+        //type
+        arg1 = varargin(1);
+        if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
-            end
+        if rhs == 2 then
+            ret = tlist(["BevelBorder", "type"], arg1);
+            return;
         end
 
-        if size(varargin) > 3 then
-            arg4 = varargin(4);
-            if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
-            end
+        //hl or hl out
+        arg2 = varargin(2);
+        if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
         end
 
-        if size(varargin) > 4 then
-            arg5 = varargin(5);
-            if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
-            end
+        //shadow or hl in
+        arg3 = varargin(3);
+        if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
+        end
+
+        if rhs == 4 then
+            ret = tlist(["BevelBorder", "type", "hlouter", "shadowouter"], arg1, arg2, arg3);
+            return;
+        end
+
+        //shadow out
+        arg4 = varargin(4);
+        if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
+        end
+
+        //shadow in
+        arg5 = varargin(5);
+        if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
         end
 
         ret = tlist(["BevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"], arg1, arg2, arg3, arg4, arg5);
     elseif constType == "softbevel" then
-        arg1 = "raised"; //type
-        arg2 = "black"; //hl out color
-        arg3 = "black"; //hl in color
-        arg4 = "black"; //shadow out color
-        arg5 = "black"; //shadow in color
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [2 4 6] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d, %d or %d expected."), "createBorders", 2, 4, 6));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
-            end
+        //type
+        arg1 = varargin(1);
+        if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
-            end
+        if rhs == 2 then
+            ret = tlist(["SoftBevelBorder", "type"], arg1);
+            return;
         end
 
-        if size(varargin) > 3 then
-            arg4 = varargin(4);
-            if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
-            end
+        //hl or hl out
+        arg2 = varargin(2);
+        if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
         end
 
-        if size(varargin) > 4 then
-            arg5 = varargin(5);
-            if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
-            end
+        //shadow or hl in
+        arg3 = varargin(3);
+        if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
+        end
+
+        if rhs == 4 then
+            ret = tlist(["SoftBevelBorder", "type", "hlouter", "shadowouter"], arg1, arg2, arg3);
+            return;
+        end
+
+        //shadow out
+        arg4 = varargin(4);
+        if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
+        end
+
+        //shadow in
+        arg5 = varargin(5);
+        if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
         end
 
         ret = tlist(["SoftBevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"], arg1, arg2, arg3, arg4, arg5);
-    elseif constType == "etched" then
-        arg1 = "raised"; //type
-        arg2 = "black"; //hl color
-        arg3 = "black"; //shadow color
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 2));
-            end
+   elseif constType == "etched" then
+
+        if rhs > 4 then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected."), "createBorders", 1, 4));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
-            end
+        if rhs == 1 then
+            ret = tlist(["EtchedBorder"]);
+            return;
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
-            end
+        //type or color
+        arg1 = varargin(1);
+        if typeof(arg1) <> "string" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer or a string expected.\n"), "createBorders", 2));
+        end
+
+        if rhs == 2 then
+            ret = tlist(["EtchedBorder", "type"], arg1);
+            return;
+        end
+
+        //color
+        arg2 = varargin(2);
+        if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
+        end
+
+        if rhs == 3 then
+            ret = tlist(["EtchedBorder", "hl", "shadow"], arg1, arg2);
+            return;
+        end
+
+        //color
+        arg3 = varargin(3);
+        if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
         end
 
         ret = tlist(["EtchedBorder", "type", "hl", "shadow"], arg1, arg2, arg3);
     elseif constType == "titled" then
-        arg1 = createBorders("etched"); //border
-        arg2 = "Title"; //title
-        arg3 = "leading"; //justification
-        arg4 = "helvetica"; //fontname
-        arg5 = "normal"; //font angle
-        arg6 = 10; //font size
-        arg7 = "normal"; //font weight
-        arg8 = "top"; //position
-        arg9 = "black"; //color
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> ["LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder"] then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A border expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [2:7] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected."), "createBorders", 2, 7));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
-            end
+        //string or border
+        arg1 = varargin(1);
+        if typeof(arg1) <> ["string", "LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder"] then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A border or a string expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
+        if rhs == 2 then
+            if typeof(arg1) == "string" then
+                ret = tlist(["TitledBorder", "title"], arg1);
+            else
+                ret = tlist(["TitledBorder", "border"], arg1);
             end
+            return;
         end
 
-        if size(varargin) > 3 then
-            arg4 = varargin(4);
-            if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
-            end
+        //title
+        arg2 = varargin(2);
+        if typeof(arg2) <> "string" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 3));
         end
 
-        if size(varargin) > 4 then
-            arg5 = varargin(5);
-            if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
-            end
+        if rhs == 3 then
+            ret = tlist(["TitledBorder", "border", "title"], arg1, arg2);
+            return;
         end
 
-        if size(varargin) > 5 then
-            arg6 = varargin(6);
-            if typeof(arg6) <> "constant" | size(arg6, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 7));
-            end
+        //justification
+        arg3 = varargin(3);
+        if typeof(arg3) <> "string" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 4));
         end
 
-        if size(varargin) > 6 then
-            arg7 = varargin(7);
-            if typeof(arg7) <> "string" | size(arg7, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 8));
-            end
+        //position
+        arg4 = varargin(4);
+        if typeof(arg4) <> "string" | size(arg4, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 5));
         end
 
-        if size(varargin) > 7 then
-            arg8 = varargin(8);
-            if typeof(arg8) <> "string" | size(arg8, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 9));
-            end
+        if rhs == 5 then
+            ret = tlist(["TitledBorder", "border", "title", "justification", "position"], arg1, arg2, arg3, arg4);
+            return;
         end
 
-        if size(varargin) > 8 then
-            arg9 = varargin(9);
-            if typeof(arg9) <> "string" | size(arg9, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 10));
-            end
+        //font
+        arg5 = varargin(5);
+        if typeof(arg5) <> "FontBorder" then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A Font Border expected.\n"), "createBorders", 6));
+        end
+
+        if rhs == 6 then
+            ret = tlist(["TitledBorder", "border", "title", "justification", "position", "font"], ...
+                arg1, arg2, arg3, arg4, arg5);
+            return;
+        end
+
+        arg6 = varargin(6);
+        if typeof(arg6) <> "string" | size(arg6, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
         end
 
-        ret = tlist(["TitledBorder", "border", "title", "justification", "fontname", "fontangle", "fontsize", "fontweight", "position", "color"], ...
-            arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+        ret = tlist(["TitledBorder", "border", "title", "justification", "position", "font", "color"], ...
+            arg1, arg2, arg3, arg4, arg5, arg6);
     elseif constType == "empty" then
-        arg1 = 0; //top
-        arg2 = 0; //left
-        arg3 = 0; //bottom
-        arg4 = 0; //right
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "constant" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [1 5] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d or %d expected."), "createBorders", 1, 5));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
-            end
+        if rhs == 1 then
+            ret = tlist(["EmptyBorder"]);
+            return;
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "constant" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 4));
-            end
+        arg1 = varargin(1);
+        if typeof(arg1) <> "constant" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 3 then
-            arg4 = varargin(4);
-            if typeof(arg4) <> "constant" | size(arg4, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 5));
-            end
+        arg2 = varargin(2);
+        if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
+        end
+
+        arg3 = varargin(3);
+        if typeof(arg3) <> "constant" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 4));
+        end
+
+        arg4 = varargin(4);
+        if typeof(arg4) <> "constant" | size(arg4, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 5));
         end
 
         ret = tlist(["EmptyBorder", "top", "left", "bottom", "right"], arg1, arg2, arg3, arg4);
     elseif constType == "compound" then
-        arg1 = createBorders("etched"); //out border
-        arg2 = createBorders("etched"); //in border
 
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> ["LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder","TitledBorder"] then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A border expected.\n"), "createBorders", 2));
-            end
+        if rhs <> [1 3] then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d or %d expected."), "createBorders", 1, 3));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> ["LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder","TitledBorder"] then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A border expected.\n"), "createBorders", 3));
-            end
+        if rhs == 1 then
+            ret = tlist(["CompoundBorder"]);
+            return;
+        end
+
+        arg1 = varargin(1);
+        if typeof(arg1) <> ["LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder","TitledBorder"] then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A border expected.\n"), "createBorders", 2));
+        end
+
+        arg2 = varargin(2);
+        if typeof(arg2) <> ["LineBorder","BevelBorder","SoftBevelBorder","EtchedBorder","EmptyBorder","MatteBorder","TitledBorder"] then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A border expected.\n"), "createBorders", 3));
         end
 
         ret = tlist(["CompoundBorder", "outer", "inner"], arg1, arg2);
     elseif constType == "matte" then
-        arg1 = 0; //top
-        arg2 = 0; //left
-        arg3 = 0; //bottom
-        arg4 = 0; //right
-        arg5 = "black"; //color
-
-        if size(varargin) > 0 then
-            arg1 = varargin(1);
-            if typeof(arg1) <> "constant" | size(arg1, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 2));
-            end
+
+        if rhs <> 6 then
+            error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected."), "createBorders", 6));
         end
 
-        if size(varargin) > 1 then
-            arg2 = varargin(2);
-            if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
-            end
+        //top
+        arg1 = varargin(1);
+        if typeof(arg1) <> "constant" | size(arg1, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 2));
         end
 
-        if size(varargin) > 2 then
-            arg3 = varargin(3);
-            if typeof(arg3) <> "constant" | size(arg3, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 4));
-            end
+        //left
+        arg2 = varargin(2);
+        if typeof(arg2) <> "constant" | size(arg2, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 3));
         end
 
-        if size(varargin) > 3 then
-            arg4 = varargin(4);
-            if typeof(arg4) <> "constant" | size(arg4, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 5));
-            end
+        //bottom
+        arg3 = varargin(3);
+        if typeof(arg3) <> "constant" | size(arg3, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 4));
         end
 
-        if size(varargin) > 4 then
-            arg5 = varargin(5);
-            if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
-                error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
-            end
+        //right
+        arg4 = varargin(4);
+        if typeof(arg4) <> "constant" | size(arg4, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer expected.\n"), "createBorders", 5));
+        end
+
+        //color
+        arg5 = varargin(5);
+        if typeof(arg5) <> "string" | size(arg5, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 6));
         end
 
         ret = tlist(["MatteBorder", "top", "left", "bottom", "right", "color"], arg1, arg2, arg3, arg4, arg5);
+
+    elseif constType == "help" | constType == "doc" then
+
+        //help based on printf
+        // /!\ do not translate, for localizated hepl, refer to online help /!\
+        printf("createBorders function is used to creates Uicontrol frame border :\n");
+        printf("Border type can be\n  - line\n  - bevel\n  - softbevel\n  - etched\n  - titled\n  - empty\n  - compound\n  - matte\n");
+        printf("For more information see Scilab help page help.scilab.org\n");
     else
         error(999, msprintf(_("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"), "createBorders", 1, "line, bevel, softbevel, etched, titled, empty, compound, matte"));
     end
diff --git a/scilab/modules/graphics/macros/createFontBorder.sci b/scilab/modules/graphics/macros/createFontBorder.sci
new file mode 100644 (file)
index 0000000..bc9c2ea
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution.  The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+//
+//
+
+function ret = createFontBorder(varargin)
+    [lhs,rhs]=argn(0)
+
+    fontangle = "normal";
+    fontweight = "normal";
+
+    if rhs < 2 then
+        error(msprintf(gettext("%s: Wrong number of input argument(s): At least %d expected."), "createFontBorder", 1));
+    end
+
+    fontname = varargin(1);
+    if typeof(fontname) <> "string" | size(fontname, "*") <> 1 then
+        error(999, msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"), "createBorders", 1));
+    end
+
+    fontsize = varargin(2);
+    if typeof(fontsize) <> "constant" | size(fontsize, "*") <> 1 then
+        error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer value expected.\n"), "createBorders", 2));
+    end
+
+    if rhs > 2 then
+        fontweight = varargin(3);
+        if typeof(fontweight) <> "string" | size(fontweight, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer value expected.\n"), "createBorders", 3));
+        end
+
+        if fontweight <> ["normal", "bold"] then
+            error(999, msprintf(_("%s: Wrong value for input argument #%d: %s or %sexpected.\n"), "createBorders", 3, "normal", "bold"));
+        end
+    end
+
+    if rhs > 3 then
+        fontangle = varargin(4);
+        if typeof(fontangle) <> "string" | size(fontangle, "*") <> 1 then
+            error(999, msprintf(_("%s: Wrong type for input argument #%d: A integer value expected.\n"), "createBorders", 4));
+        end
+
+        if fontangle <> ["normal", "italic"] then
+            error(999, msprintf(_("%s: Wrong value for input argument #%d: %s or %sexpected.\n"), "createBorders", 4, "normal", "italic"));
+        end
+    end
+
+    ret = tlist(["FontBorder", "name", "size", "angle", "weight"], fontname, fontsize, fontangle, fontweight);
+
+endfunction
\ No newline at end of file
index 61d4e45..2b9f2cd 100644 (file)
 
 typedef enum BorderLayoutType
 {
-    BORDER_SOUTH = 0,
-    BORDER_NORTH,
+    BORDER_BOTTOM = 0,
+    BORDER_TOP,
     BORDER_CENTER,
-    BORDER_WEST,
-    BORDER_EAST
+    BORDER_LEFT,
+    BORDER_RIGHT
 };
 
index dfba65b..dda2081 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
  *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
  *
  */
 
@@ -126,7 +126,7 @@ int getNoBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObjUI
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"NoBorder"};
+    char* pstFieldList[] = {"NoBorder"};
     if (_piParent)
     {
         sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 1, &piAddrList);
@@ -141,7 +141,7 @@ int getNoBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObjUI
         return -1;
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 1, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 1, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
@@ -154,13 +154,14 @@ int getLineBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObj
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"LineBorder", "color", "thickness", "rounded"};
+    char* pstFieldList[] = {"LineBorder", "color", "thickness", "rounded"};
     char* pstColor = NULL;
     int iThickness = 0;
     double dblThickness = 0;
     int* piThickness = &iThickness;
     int iRounded = 0;
     int* piRounded = &iRounded;
+    int iListSize = 4;
 
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_COLOR__, jni_string, (void **)&pstColor);
     if (pstColor == NULL)
@@ -170,28 +171,25 @@ int getLineBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObj
     }
 
     getGraphicObjectProperty(_iObjUID, __GO_LINE_THICKNESS__, jni_int, (void **)&piThickness);
-    if (piThickness == NULL)
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_ROUNDED__, jni_bool, (void **)&piRounded);
+
+    if (piRounded == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 3;
     }
 
-    dblThickness = (double)iThickness;
-
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_ROUNDED__, jni_bool, (void **)&piRounded);
-    if (piRounded == NULL)
+    if (piThickness == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 2;
     }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 4, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 4, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
     if (sciErr.iErr)
@@ -199,7 +197,7 @@ int getLineBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObj
         return -1;
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 4, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
@@ -211,16 +209,23 @@ int getLineBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iObj
         return -1;
     }
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &dblThickness);
-    if (sciErr.iErr)
+    if (iListSize > 2)
     {
-        return -1;
+        dblThickness = (double)iThickness;
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &dblThickness);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfBooleanInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &iRounded);
-    if (sciErr.iErr)
+    if (iListSize > 3)
     {
-        return -1;
+        sciErr = createMatrixOfBooleanInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &iRounded);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
     return 0;
@@ -240,8 +245,12 @@ int getCommonBevelBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, in
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"BevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"};
-    char * pstSoftFieldList[] = {"SoftBevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"};
+    char* pstFieldList1[] = {"BevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"};
+    char* pstFieldList2[] = {"BevelBorder", "type", "hlouter", "shadowouter"};
+    char** pstFieldList = pstFieldList1;
+    char* pstSoftFieldList1[] = {"SoftBevelBorder", "type", "hlouter", "hlinner", "shadowouter", "shadowinner"};
+    char* pstSoftFieldList2[] = {"SoftBevelBorder", "type", "hlouter", "shadowouter"};
+    char** pstSoftFieldList = pstSoftFieldList1;
     int iType = 0;
     int* piType = &iType;
     char* pstType[] = {"raised", "lowered"};
@@ -249,8 +258,9 @@ int getCommonBevelBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, in
     char* pstHlInColor = NULL;
     char* pstShadowOutColor = NULL;
     char* pstShadowInColor = NULL;
+    int iListSize = 6;
 
-    getGraphicObjectProperty(_iObjUID, __GO_TYPE__, jni_int, (void **)&piType);
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_TYPE__, jni_int, (void **)&piType);
     if (piType == NULL)
     {
         Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
@@ -258,40 +268,31 @@ int getCommonBevelBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, in
     }
 
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, jni_string, (void **)&pstHlOutColor);
-    if (pstHlOutColor == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, jni_string, (void **)&pstHlInColor);
-    if (pstHlInColor == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_SHADOW_OUT__, jni_string, (void **)&pstShadowOutColor);
-    if (pstShadowOutColor == NULL)
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_SHADOW_IN__, jni_string, (void **)&pstShadowInColor);
+
+    if (pstHlInColor == NULL || pstShadowInColor == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 4;
+        pstFieldList = pstFieldList2;
+        pstSoftFieldList = pstSoftFieldList2;
     }
 
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_SHADOW_IN__, jni_string, (void **)&pstShadowInColor);
-    if (pstShadowInColor == NULL)
+    if (pstHlOutColor == NULL || pstShadowOutColor == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 2;
+        pstFieldList = pstFieldList2;
+        pstSoftFieldList = pstSoftFieldList2;
     }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 6, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 6, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
     if (sciErr.iErr)
     {
@@ -300,11 +301,11 @@ int getCommonBevelBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, in
 
     if (_iBevel == 1)
     {
-        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 6, (const char * const*)&pstFieldList);
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     }
     else
     {
-        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 6, (const char * const*)&pstSoftFieldList);
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstSoftFieldList);
     }
 
     if (sciErr.iErr)
@@ -318,28 +319,45 @@ int getCommonBevelBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, in
         return -1;
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pstHlOutColor);
-    if (sciErr.iErr)
+    if (iListSize == 4)
     {
-        return -1;
-    }
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pstHlOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstHlInColor);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstShadowOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
-
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pstShadowOutColor);
-    if (sciErr.iErr)
+    else if (iListSize == 6)
     {
-        return -1;
-    }
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pstHlOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 6, 1, 1, &pstShadowInColor);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstHlInColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
+
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pstShadowOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
+
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 6, 1, 1, &pstShadowInColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
     return 0;
@@ -349,41 +367,51 @@ int getEtchedBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iO
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"EtchedBorder", "type", "hl", "shadow"};
+    char* pstFieldList1[] = {"EtchedBorder", "type", "hl", "shadow"};
+    char* pstFieldList2[] = {"EtchedBorder", "hl", "shadow"};
+    char** pstFieldList = pstFieldList1;
     int iType = 0;
     int* piType = &iType;
     char* pstType[] = {"raised", "lowered"};
     char* pstHlOutColor = NULL;
     char* pstShadowOutColor = NULL;
+    int iListSize = 4;
 
-    getGraphicObjectProperty(_iObjUID, __GO_TYPE__, jni_int, (void **)&piType);
-    if (piType == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_TYPE__, jni_int, (void **)&piType);
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, jni_string, (void **)&pstHlOutColor);
-    if (pstHlOutColor == NULL)
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_SHADOW_OUT__, jni_string, (void **)&pstShadowOutColor);
+
+    if (piType == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        if (pstHlOutColor == NULL || pstShadowOutColor == NULL)
+        {
+            iListSize = 1;
+        }
+        else
+        {
+            iListSize = 3;
+            pstFieldList = pstFieldList2;
+        }
     }
-
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_SHADOW_OUT__, jni_string, (void **)&pstShadowOutColor);
-    if (pstShadowOutColor == NULL)
+    else
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        if (pstHlOutColor == NULL || pstShadowOutColor == NULL)
+        {
+            iListSize = 2;
+        }
+        else
+        {
+            iListSize = 4;
+        }
     }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 4, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 4, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
     if (sciErr.iErr)
@@ -391,30 +419,35 @@ int getEtchedBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iO
         return -1;
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 4, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 2, 1, 1, &pstType[iType]);
-    if (sciErr.iErr)
+    if (iListSize == 2 || iListSize == 4)
     {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 2, 1, 1, &pstType[iType]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pstHlOutColor);
-    if (sciErr.iErr)
+    if (iListSize == 3 || iListSize == 4)
     {
-        return -1;
-    }
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, iListSize - 1, 1, 1, &pstHlOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstShadowOutColor);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, iListSize, 1, 1, &pstShadowOutColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
-
     return 0;
 }
 /*------------------------------------------------------------------------*/
@@ -422,7 +455,9 @@ int getTitledBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iO
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"TitledBorder", "border", "title", "justification", "fontname", "fontangle", "fontsize", "fontweight", "position", "color"};
+    char* pstFieldList1[] = {"TitledBorder", "border", "title", "justification", "position", "font", "color"};
+    char* pstFieldList2[] = {"TitledBorder", "title"};
+    char** pstFieldList = pstFieldList1;
     char* pstJustification[] = {"leading" , "left" , "center" , "right" , "trailing"};
     char* pstPosition[] = {"top" , "above_top" , "below_top" , "bottom" , "above_bottom", "below_bottom"};
     int iChildBorder = 0;
@@ -439,138 +474,147 @@ int getTitledBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iO
     int iPosition = 0;
     int* piPosition = &iPosition;
     char* pstColor = NULL;
+    int iListSize = 7;
 
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_TITLE__, jni_int, (void **)&piChildBorder);
-    if (piChildBorder == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_TITLE__, jni_string, (void **)&pstTitle);
-    if (pstTitle == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_JUSTIFICATION__, jni_int, (void **)&piJustification);
-    if (piJustification == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FONTNAME__, jni_string, (void **)&pstFontName);
-    if (pstFontName == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FONTANGLE__, jni_string, (void **)&pstFontAngle);
-    if (pstFontAngle == NULL)
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FONTSIZE__, jni_int, (void **)&piFontSize);
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FONTWEIGHT__, jni_string, (void **)&pstFontWeight);
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_POSITION__, jni_int, (void **)&piPosition);
+    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_COLOR__, jni_string, (void **)&pstColor);
+
+    //2 3 5 6 7
+    if (pstColor == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 6;
     }
 
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FONTSIZE__, jni_int, (void **)&piFontSize);
-    if (piFontSize == NULL)
+    if (pstFontName == NULL || pstFontAngle == NULL || piFontSize == NULL || pstFontWeight == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 5;
     }
 
-    dblFontSize = (double)iFontSize;
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FONTWEIGHT__, jni_string, (void **)&pstFontWeight);
-    if (pstFontWeight == NULL)
+    if (piJustification == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 3;
     }
 
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_POSITION__, jni_int, (void **)&piPosition);
-    if (piPosition == NULL)
+    if (pstTitle == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 2;
     }
 
-    getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_COLOR__, jni_string, (void **)&pstColor);
-    if (pstColor == NULL)
+    if (piChildBorder == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 2;
+        pstFieldList = pstFieldList2;
     }
 
+
+    dblFontSize = (double)iFontSize;
+
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 10, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 10, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 10, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
     }
 
-    //get child information and fill current list
-    if (getBorders(_pvCtx, _iVar, piAddrList, 2, iChildBorder))
+    if (piChildBorder)
     {
-        return -1;
+        //get child information and fill current list
+        if (getBorders(_pvCtx, _iVar, piAddrList, 2, iChildBorder))
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pstTitle);
-    if (sciErr.iErr)
+    if (pstTitle)
     {
-        return -1;
+        //pos 2 or 3
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, piChildBorder == NULL ? 2 : 3, 1, 1, &pstTitle);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstJustification[iJustification]);
-    if (sciErr.iErr)
+    if (iListSize > 3)
     {
-        return -1;
-    }
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pstJustification[iJustification]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pstFontName);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pstPosition[iPosition]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 6, 1, 1, &pstFontAngle);
-    if (sciErr.iErr)
+    if (iListSize > 5)
     {
-        return -1;
-    }
+        //create a Font Border
+        int* piFont = NULL;
+        char* pstFontBorder[] = {"FontBorder", "name", "size", "angle", "weight"};
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 7, 1, 1, &dblFontSize);
-    if (sciErr.iErr)
-    {
-        return -1;
-    }
+        sciErr = createTListInList(_pvCtx, _iVar, piAddrList, 6, 5, &piFont);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 8, 1, 1, &pstFontWeight);
-    if (sciErr.iErr)
-    {
-        return -1;
-    }
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piFont, 1, 1, 5, pstFontBorder);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 9, 1, 1, &pstPosition[iPosition]);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piFont, 2, 1, 1, &pstFontName);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
+
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piFont, 3, 1, 1, &dblFontSize);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
+
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piFont, 4, 1, 1, &pstFontAngle);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
+
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piFont, 5, 1, 1, &pstFontWeight);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 10, 1, 1, &pstColor);
-    if (sciErr.iErr)
+    if (iListSize > 6)
     {
-        return -1;
+        sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 7, 1, 1, &pstColor);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
     return 0;
@@ -580,53 +624,57 @@ int getEmptyBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iOb
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"EmptyBorder", "top", "left", "bottom", "right"};
+    char* pstFieldList[] = {"EmptyBorder", "top", "left", "bottom", "right"};
     double* pdblPosition = NULL;
+    int iListSize = 5;
 
     getGraphicObjectProperty(_iObjUID, __GO_POSITION__, jni_double_vector, (void **)&pdblPosition);
+
     if (pdblPosition == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 1;
     }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 5, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 5, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 5, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
     }
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 2, 1, 1, &pdblPosition[0]);
-    if (sciErr.iErr)
+    if (iListSize > 1)
     {
-        return -1;
-    }
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 2, 1, 1, &pdblPosition[0]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pdblPosition[1]);
-    if (sciErr.iErr)
-    {
-        return -1;
-    }
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 3, 1, 1, &pdblPosition[1]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pdblPosition[2]);
-    if (sciErr.iErr)
-    {
-        return -1;
-    }
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 4, 1, 1, &pdblPosition[2]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
 
-    sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pdblPosition[3]);
-    if (sciErr.iErr)
-    {
-        return -1;
+        sciErr = createMatrixOfDoubleInList(_pvCtx, _iVar, piAddrList, 5, 1, 1, &pdblPosition[3]);
+        if (sciErr.iErr)
+        {
+            return -1;
+        }
     }
 
     return 0;
@@ -636,50 +684,48 @@ int getCompoundBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"CompoundBorder", "outer", "inner"};
+    char* pstFieldList[] = {"CompoundBorder", "outer", "inner"};
     int iChildBorderOut = 0;
     int* piChildBorderOut = &iChildBorderOut;
     int iChildBorderIn = 0;
     int* piChildBorderIn = &iChildBorderIn;
+    int iListSize = 3;
 
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_OUT_BORDER__, jni_int, (void **)&piChildBorderOut);
-    if (piChildBorderOut == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_IN_BORDER__, jni_int, (void **)&piChildBorderIn);
-    if (piChildBorderIn == NULL)
+
+    if (piChildBorderOut == NULL || piChildBorderIn == NULL)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
+        iListSize = 1;
     }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 3, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 3, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 3, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
     }
 
-    //get child information and fill current list
-    if (getBorders(_pvCtx, _iVar, piAddrList, 2, iChildBorderOut))
+    if (iListSize > 1)
     {
-        return -1;
-    }
+        //get child information and fill current list
+        if (getBorders(_pvCtx, _iVar, piAddrList, 2, iChildBorderOut))
+        {
+            return -1;
+        }
 
-    if (getBorders(_pvCtx, _iVar, piAddrList, 3, iChildBorderIn))
-    {
-        return -1;
+        if (getBorders(_pvCtx, _iVar, piAddrList, 3, iChildBorderIn))
+        {
+            return -1;
+        }
     }
 
     return 0;
@@ -689,34 +735,24 @@ int getMatteBorders(void* _pvCtx, int _iVar, int* _piParent, int _iPos, int _iOb
 {
     SciErr sciErr;
     int* piAddrList = NULL;
-    char * pstFieldList[] = {"MatteBorder", "top", "left", "bottom", "right", "color"};
+    char* pstFieldList[] = {"MatteBorder", "top", "left", "bottom", "right", "color"};
     double* pdblPosition = NULL;
     char* pstColor = NULL;
+    int iListSize = 6;
 
     getGraphicObjectProperty(_iObjUID, __GO_POSITION__, jni_double_vector, (void **)&pdblPosition);
-    if (pdblPosition == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
-
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER_COLOR__, jni_string, (void **)&pstColor);
-    if (pstColor == NULL)
-    {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "borders");
-        return -1;
-    }
 
     if (_piParent)
     {
-        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, 6, &piAddrList);
+        sciErr = createTListInList(_pvCtx, _iVar, _piParent, _iPos, iListSize, &piAddrList);
     }
     else
     {
-        sciErr = createTList(_pvCtx, _iVar, 6, &piAddrList);
+        sciErr = createTList(_pvCtx, _iVar, iListSize, &piAddrList);
     }
 
-    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, 6, (const char * const*)&pstFieldList);
+    sciErr = createMatrixOfStringInList(_pvCtx, _iVar, piAddrList, 1, 1, iListSize, pstFieldList);
     if (sciErr.iErr)
     {
         return -1;
index db5fbab..4b01ada 100644 (file)
@@ -88,16 +88,16 @@ int get_constraints_property(void* _pvCtx, int iObjUID)
                 case BORDER_CENTER :
                     addStringToReturnedList(tList, "center");
                     break;
-                case BORDER_SOUTH :
+                case BORDER_BOTTOM :
                     addStringToReturnedList(tList, "bottom");
                     break;
-                case BORDER_NORTH :
+                case BORDER_TOP :
                     addStringToReturnedList(tList, "top");
                     break;
-                case BORDER_WEST :
+                case BORDER_LEFT :
                     addStringToReturnedList(tList, "left");
                     break;
-                case BORDER_EAST :
+                case BORDER_RIGHT :
                     addStringToReturnedList(tList, "right");
                     break;
             }
index cdc053e..c5649a3 100644 (file)
 #include "setGraphicObjectProperty.h"
 #include "getGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
-#include "LayoutType.h"
 #include "BorderLayoutType.h"
-#include "FillType.h"
-#include "AnchorType.h"
 /*------------------------------------------------------------------------*/
 int clearBorders(int iObjUID);
 int createBorder(void* _pvCtx, int* _piAddrList, int _iParent);
@@ -154,7 +151,6 @@ int clearBorders(int iObjUID)
         return SET_PROPERTY_ERROR;
     }
 
-
     return SET_PROPERTY_SUCCEED;
 }
 /*------------------------------------------------------------------------*/
@@ -174,40 +170,57 @@ int createLineBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     int iThickness = 0;
     int* piAddr4 = NULL;
     int bRounded = 0;
+    int iCount = 0;
 
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr2, &pstColor))
-    {
-        return SET_PROPERTY_ERROR;
-    }
-
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+    //color
+    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    if (getScalarDouble(_pvCtx, piAddr3, &dblThickness))
+    if (getAllocatedSingleString(_pvCtx, piAddr2, &pstColor))
     {
         return SET_PROPERTY_ERROR;
     }
 
-    iThickness = (int)dblThickness;
 
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
-    if (sciErr.iErr)
+    //thickness
+    if (iCount > 2)
     {
-        return SET_PROPERTY_ERROR;
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getScalarDouble(_pvCtx, piAddr3, &dblThickness))
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        iThickness = (int)dblThickness;
     }
 
-    if (getScalarBoolean(_pvCtx, piAddr4, &bRounded))
+    //rounded
+    if (iCount > 3)
     {
-        return SET_PROPERTY_ERROR;
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getScalarBoolean(_pvCtx, piAddr4, &bRounded))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
     //get current border
@@ -227,11 +240,19 @@ int createLineBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_COLOR__, pstColor, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_LINE_THICKNESS__, &iThickness, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_ROUNDED__, &bRounded, jni_bool, 1);
-
     freeAllocatedSingleString(pstColor);
 
+    if (iCount > 2)
+    {
+        setGraphicObjectProperty(iBorder, __GO_LINE_THICKNESS__, &iThickness, jni_int, 1);
+    }
+
+    if (iCount > 3)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_ROUNDED__, &bRounded, jni_bool, 1);
+    }
+
+
     return iBorder;
 }
 /*------------------------------------------------------------------------*/
@@ -267,6 +288,13 @@ int createCommonBevelBorder(void* _pvCtx, int* _piAddrList, int _iObjUID, int _i
     char* pstShadowOutColor = NULL;
     int* piAddr6 = NULL;
     char* pstShadowInColor = NULL;
+    int iCount = 0;
+
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
+    if (sciErr.iErr)
+    {
+        return SET_PROPERTY_ERROR;
+    }
 
     //type
     sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
@@ -291,52 +319,59 @@ int createCommonBevelBorder(void* _pvCtx, int* _piAddrList, int _iObjUID, int _i
 
     freeAllocatedSingleString(pstType);
 
-    //highlight out
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
-    if (sciErr.iErr)
+    //highlight out and highlight in or hl and shadow
+    if (iCount > 2)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //highlight out
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr3, &pstHlOutColor))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddr3, &pstHlOutColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //highlight in
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //highlight in
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr4, &pstHlInColor))
-    {
-        return SET_PROPERTY_ERROR;
+        if (getAllocatedSingleString(_pvCtx, piAddr4, &pstHlInColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
-    //shadow out
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
-    if (sciErr.iErr)
+    if (iCount > 4)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //shadow out
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr5, &pstShadowOutColor))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddr5, &pstShadowOutColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //shadow in
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 6, &piAddr6);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //shadow in
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 6, &piAddr6);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr6, &pstShadowInColor))
-    {
-        return SET_PROPERTY_ERROR;
+        if (getAllocatedSingleString(_pvCtx, piAddr6, &pstShadowInColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
     //get current border
@@ -355,11 +390,31 @@ int createCommonBevelBorder(void* _pvCtx, int* _piAddrList, int _iObjUID, int _i
     }
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &_iStyle, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_TYPE__, &iType, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, pstHlOutColor, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, pstHlInColor, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_OUT__, pstShadowOutColor, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_IN__, pstShadowInColor, jni_string, 1);
+    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_TYPE__, &iType, jni_int, 1);
+
+    if (iCount > 2)
+    {
+        if (iCount == 4)
+        {
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, pstHlOutColor, jni_string, 1);
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_OUT__, pstHlInColor, jni_string, 1);
+
+            freeAllocatedSingleString(pstHlOutColor);
+            freeAllocatedSingleString(pstHlInColor);
+        }
+        else
+        {
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, pstHlOutColor, jni_string, 1);
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, pstHlInColor, jni_string, 1);
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_OUT__, pstShadowOutColor, jni_string, 1);
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_IN__, pstShadowInColor, jni_string, 1);
+
+            freeAllocatedSingleString(pstHlOutColor);
+            freeAllocatedSingleString(pstHlInColor);
+            freeAllocatedSingleString(pstShadowOutColor);
+            freeAllocatedSingleString(pstShadowInColor);
+        }
+    }
 
     return iBorder;
 }
@@ -381,55 +436,70 @@ int createEtchedBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     char* pstHlOutColor = NULL;
     int* piAddr4 = NULL;
     char* pstShadowOutColor = NULL;
+    int iCount = 0;
 
-    //type
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr2, &pstType))
+    if (iCount == 2 || iCount == 4)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //type
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (stricmp(pstType, "raised") == 0)
-    {
-        iType = 0;
-    }
-    else if (stricmp(pstType, "lowered") == 0)
-    {
-        iType = 1;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddr2, &pstType))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    freeAllocatedSingleString(pstType);
+        if (stricmp(pstType, "raised") == 0)
+        {
+            iType = 0;
+        }
+        else if (stricmp(pstType, "lowered") == 0)
+        {
+            iType = 1;
+        }
 
-    //highlight out
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
+        freeAllocatedSingleString(pstType);
     }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr3, &pstHlOutColor))
+    if (iCount == 3 || iCount == 4)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        int iPos = iCount - 1;
+        //highlight out
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, iPos, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //shadow out
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddr3, &pstHlOutColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr4, &pstShadowOutColor))
-    {
-        return SET_PROPERTY_ERROR;
+        //shadow out
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, iPos + 1, &piAddr4);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getAllocatedSingleString(_pvCtx, piAddr4, &pstShadowOutColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
 
+
     //get current border
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER__, jni_int, (void**)&piBorder);
     if (piBorder != NULL && iBorder != 0)
@@ -446,9 +516,19 @@ int createEtchedBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     }
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_TYPE__, &iType, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, pstHlOutColor, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_OUT__, pstShadowOutColor, jni_string, 1);
+    if (iCount == 2 || iCount == 4)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_TYPE__, &iType, jni_int, 1);
+    }
+
+    if (iCount == 3 || iCount == 4)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, pstHlOutColor, jni_string, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_SHADOW_OUT__, pstShadowOutColor, jni_string, 1);
+
+        freeAllocatedSingleString(pstHlOutColor);
+        freeAllocatedSingleString(pstShadowOutColor);
+    }
 
     return iBorder;
 }
@@ -476,173 +556,208 @@ int createTitledBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     char* pstJustification = NULL;
     int iJustification = 0;
     int* piAddr5 = NULL;
-    char* pstFontName = NULL;
+    int iPosition = 0;
+    char* pstPosition = NULL;
     int* piAddr6 = NULL;
-    char* pstFontAngle = NULL;
+    int* piFont = NULL;
     int* piAddr7 = NULL;
-    double dblFontSize = 0;
+    char* pstColor = NULL;
+
+    //font data
+    char* pstFontName = NULL;
     int iFontSize = 0;
-    int* piAddr8 = NULL;
+    char* pstFontAngle = NULL;
     char* pstFontWeight = NULL;
-    int* piAddr9 = NULL;
-    char* pstPosition = NULL;
-    int iPosition = 0;
-    int* piAddr10 = NULL;
-    char* pstColor = NULL;
 
-    //child border
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+    int iCount = 0;
 
-    //title
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr3, &pstTitle))
+    if (iCount == 2)
     {
-        return SET_PROPERTY_ERROR;
+        //child border or title
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
-    //justification
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
-    if (sciErr.iErr)
+    if (iCount > 2)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //child border
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr4, &pstJustification))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //title
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (stricmp(pstJustification, "leading") == 0)
-    {
-        iJustification = 0;
-    }
-    else if (stricmp(pstJustification, "left") == 0)
-    {
-        iJustification = 1;
-    }
-    else if (stricmp(pstJustification, "center") == 0)
-    {
-        iJustification = 2;
-    }
-    else if (stricmp(pstJustification, "right") == 0)
-    {
-        iJustification = 3;
+        if (getAllocatedSingleString(_pvCtx, piAddr3, &pstTitle))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
-    else if (stricmp(pstJustification, "trailing") == 0)
+
+    if (iCount > 3)
     {
-        iJustification = 4;
-    }
+        //justification
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    freeAllocatedSingleString(pstJustification);
+        if (getAllocatedSingleString(_pvCtx, piAddr4, &pstJustification))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //fontname
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (stricmp(pstJustification, "leading") == 0)
+        {
+            iJustification = 0;
+        }
+        else if (stricmp(pstJustification, "left") == 0)
+        {
+            iJustification = 1;
+        }
+        else if (stricmp(pstJustification, "center") == 0)
+        {
+            iJustification = 2;
+        }
+        else if (stricmp(pstJustification, "right") == 0)
+        {
+            iJustification = 3;
+        }
+        else if (stricmp(pstJustification, "trailing") == 0)
+        {
+            iJustification = 4;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr5, &pstFontName))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        freeAllocatedSingleString(pstJustification);
 
-    //fontangle
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 6, &piAddr6);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //position
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr6, &pstFontAngle))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddr5, &pstPosition))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //fontsize
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 7, &piAddr7);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
+        if (stricmp(pstPosition, "top") == 0)
+        {
+            iPosition = 0;
+        }
+        else if (stricmp(pstPosition, "above_top") == 0)
+        {
+            iPosition = 1;
+        }
+        else if (stricmp(pstPosition, "below_top") == 0)
+        {
+            iPosition = 2;
+        }
+        else if (stricmp(pstPosition, "bottom") == 0)
+        {
+            iPosition = 3;
+        }
+        else if (stricmp(pstPosition, "above_bottom") == 0)
+        {
+            iPosition = 4;
+        }
+        else if (stricmp(pstPosition, "below_bottom") == 0)
+        {
+            iPosition = 5;
+        }
+
+        freeAllocatedSingleString(pstPosition);
     }
 
-    if (getScalarDouble(_pvCtx, piAddr7, &dblFontSize))
+    if (iCount > 5)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        int* piAddrFont = NULL;
+        double dblFontSize = 0;
+        //font
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 6, &piAddr6);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    iFontSize = (int)dblFontSize;
+        //read data from font tlist
+        sciErr = getListItemAddress(_pvCtx, piAddr6, 2, &piAddrFont);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //fontweight
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 8, &piAddr8);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getAllocatedSingleString(_pvCtx, piAddrFont, &pstFontName))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr8, &pstFontWeight))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        sciErr = getListItemAddress(_pvCtx, piAddr6, 3, &piAddrFont);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //position
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 9, &piAddr9);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getScalarDouble(_pvCtx, piAddrFont, &dblFontSize))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr9, &pstPosition))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        iFontSize = (int)dblFontSize;
 
-    if (stricmp(pstPosition, "top") == 0)
-    {
-        iPosition = 0;
-    }
-    else if (stricmp(pstPosition, "above_top") == 0)
-    {
-        iPosition = 1;
-    }
-    else if (stricmp(pstPosition, "below_top") == 0)
-    {
-        iPosition = 2;
-    }
-    else if (stricmp(pstPosition, "bottom") == 0)
-    {
-        iPosition = 3;
-    }
-    else if (stricmp(pstPosition, "above_bottom") == 0)
-    {
-        iPosition = 4;
-    }
-    else if (stricmp(pstPosition, "below_bottom") == 0)
-    {
-        iPosition = 5;
-    }
+        sciErr = getListItemAddress(_pvCtx, piAddr6, 4, &piAddrFont);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    freeAllocatedSingleString(pstPosition);
+        if (getAllocatedSingleString(_pvCtx, piAddrFont, &pstFontAngle))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //color
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 10, &piAddr10);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
+        sciErr = getListItemAddress(_pvCtx, piAddr6, 5, &piAddrFont);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getAllocatedSingleString(_pvCtx, piAddrFont, &pstFontWeight))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
-    if (getAllocatedSingleString(_pvCtx, piAddr10, &pstColor))
+    if (iCount > 6)
     {
-        return SET_PROPERTY_ERROR;
+        //color
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 7, &piAddr7);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getAllocatedSingleString(_pvCtx, piAddr7, &pstColor))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
     //get current border
@@ -660,23 +775,75 @@ int createTitledBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
         return SET_PROPERTY_ERROR;
     }
 
-    iChildBorder = createBorder(_pvCtx, piAddr2, iBorder);
-    if (iChildBorder == 0)
+    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
+
+    if (iCount == 2)
     {
-        return SET_PROPERTY_ERROR;
+        if (isTListType(_pvCtx, piAddr2))
+        {
+            iChildBorder = createBorder(_pvCtx, piAddr2, iBorder);
+            if (iChildBorder == 0)
+            {
+                return SET_PROPERTY_ERROR;
+            }
+
+            setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_TITLE__, &iChildBorder, jni_int, 1);
+
+        }
+        else //title
+        {
+            if (getAllocatedSingleString(_pvCtx, piAddr2, &pstTitle))
+            {
+                return SET_PROPERTY_ERROR;
+            }
+
+            setGraphicObjectProperty(iBorder, __GO_TITLE__, pstTitle, jni_string, 1);
+
+            freeAllocatedSingleString(pstTitle);
+        }
+
+        return iBorder;
     }
 
 
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_TITLE__, &iChildBorder, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_TITLE__, pstTitle, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_JUSTIFICATION__, &iJustification, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FONTNAME__, pstFontName, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FONTANGLE__, pstFontAngle, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FONTSIZE__, &iFontSize, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FONTWEIGHT__, pstFontWeight, jni_string, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_POSITION__, &iPosition, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_COLOR__, pstColor, jni_string, 1);
+    if (iCount > 2)
+    {
+        iChildBorder = createBorder(_pvCtx, piAddr2, iBorder);
+        if (iChildBorder == 0)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_TITLE__, &iChildBorder, jni_int, 1);
+        setGraphicObjectProperty(iBorder, __GO_TITLE__, pstTitle, jni_string, 1);
+
+        freeAllocatedSingleString(pstTitle);
+    }
+
+    if (iCount > 3)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_JUSTIFICATION__, &iJustification, jni_int, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_POSITION__, &iPosition, jni_int, 1);
+    }
+
+    if (iCount > 5)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FONTNAME__, pstFontName, jni_string, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FONTANGLE__, pstFontAngle, jni_string, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FONTSIZE__, &iFontSize, jni_int, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FONTWEIGHT__, pstFontWeight, jni_string, 1);
+
+        freeAllocatedSingleString(pstFontName);
+        freeAllocatedSingleString(pstFontAngle);
+        freeAllocatedSingleString(pstFontWeight);
+    }
+
+    if (iCount > 6)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_COLOR__, pstColor, jni_string, 1);
+
+        freeAllocatedSingleString(pstColor);
+    }
 
     return iBorder;
 }
@@ -696,53 +863,63 @@ int createEmptyBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     int* piAddr4 = NULL;
     int* piAddr5 = NULL;
     double pdblPosition[4];
+    int iCount = 0;
 
-    //top
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    if (getScalarDouble(_pvCtx, piAddr2, &pdblPosition[0]))
+    if (iCount > 1)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //top
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //left
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getScalarDouble(_pvCtx, piAddr2, &pdblPosition[0]))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getScalarDouble(_pvCtx, piAddr3, &pdblPosition[1]))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //left
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //bottom
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getScalarDouble(_pvCtx, piAddr3, &pdblPosition[1]))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getScalarDouble(_pvCtx, piAddr4, &pdblPosition[2]))
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //bottom
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 4, &piAddr4);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //right
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        if (getScalarDouble(_pvCtx, piAddr4, &pdblPosition[2]))
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    if (getScalarDouble(_pvCtx, piAddr5, &pdblPosition[3]))
-    {
-        return SET_PROPERTY_ERROR;
+        //right
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 5, &piAddr5);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+
+        if (getScalarDouble(_pvCtx, piAddr5, &pdblPosition[3]))
+        {
+            return SET_PROPERTY_ERROR;
+        }
     }
 
     //get current border
@@ -761,7 +938,12 @@ int createEmptyBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     }
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_POSITION__, pdblPosition, jni_double_vector, 4);
+
+    if (iCount > 1)
+    {
+        setGraphicObjectProperty(iBorder, __GO_POSITION__, pdblPosition, jni_double_vector, 4);
+    }
+
     return iBorder;
 }
 /*------------------------------------------------------------------------*/
@@ -775,33 +957,42 @@ int createCompoundBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     int iChildBorderOut = 0;
     int* piAddr3 = NULL;
     int iChildBorderIn = 0;
+    int iCount = 0;
 
-    //child border out
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
     if (sciErr.iErr)
     {
         return SET_PROPERTY_ERROR;
     }
 
-    iChildBorderOut = createBorder(_pvCtx, piAddr2, _iObjUID);
-    if (iChildBorderOut == 0)
+    if (iCount > 1)
     {
-        return SET_PROPERTY_ERROR;
-    }
+        //child border out
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    //child border in
-    sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
-    if (sciErr.iErr)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        iChildBorderOut = createBorder(_pvCtx, piAddr2, _iObjUID);
+        if (iChildBorderOut == 0)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
-    iChildBorderIn = createBorder(_pvCtx, piAddr3, _iObjUID);
-    if (iChildBorderIn == 0)
-    {
-        return SET_PROPERTY_ERROR;
-    }
+        //child border in
+        sciErr = getListItemAddress(_pvCtx, _piAddrList, 3, &piAddr3);
+        if (sciErr.iErr)
+        {
+            return SET_PROPERTY_ERROR;
+        }
 
+        iChildBorderIn = createBorder(_pvCtx, piAddr3, _iObjUID);
+        if (iChildBorderIn == 0)
+        {
+            return SET_PROPERTY_ERROR;
+        }
+    }
     //get current border
     getGraphicObjectProperty(_iObjUID, __GO_UI_FRAME_BORDER__, jni_int, (void**)&piBorder);
     if (piBorder != NULL && iBorder != 0)
@@ -818,8 +1009,13 @@ int createCompoundBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     }
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_OUT_BORDER__, &iChildBorderOut, jni_int, 1);
-    setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_IN_BORDER__, &iChildBorderIn, jni_int, 1);
+
+    if (iCount > 1)
+    {
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_OUT_BORDER__, &iChildBorderOut, jni_int, 1);
+        setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_IN_BORDER__, &iChildBorderIn, jni_int, 1);
+    }
+
     return iBorder;
 }
 /*------------------------------------------------------------------------*/
@@ -841,6 +1037,13 @@ int createMatteBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
     double pdblPosition[4];
     int* piAddr6 = NULL;
     char* pstColor = NULL;
+    int iCount = 0;
+
+    sciErr = getListItemNumber(_pvCtx, _piAddrList, &iCount);
+    if (sciErr.iErr)
+    {
+        return SET_PROPERTY_ERROR;
+    }
 
     //top
     sciErr = getListItemAddress(_pvCtx, _piAddrList, 2, &piAddr2);
@@ -919,7 +1122,10 @@ int createMatteBorder(void* _pvCtx, int* _piAddrList, int _iObjUID)
 
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_STYLE__, &iStyle, jni_int, 1);
     setGraphicObjectProperty(iBorder, __GO_POSITION__, pdblPosition, jni_double_vector, 4);
+
     setGraphicObjectProperty(iBorder, __GO_UI_FRAME_BORDER_COLOR__, pstColor, jni_string, 1);
+    freeAllocatedSingleString(pstColor);
+
     return iBorder;
 }
 /*------------------------------------------------------------------------*/
index dba32a4..a710771 100644 (file)
@@ -97,19 +97,19 @@ int set_constraints_property(void* _pvCtx, int iObjUID, void* _pvData, int value
             }
             else if (stricmp(pstPos, "bottom") == 0)
             {
-                iPos = BORDER_SOUTH;
+                iPos = BORDER_BOTTOM;
             }
             else if (stricmp(pstPos, "top") == 0)
             {
-                iPos = BORDER_NORTH;
+                iPos = BORDER_TOP;
             }
             else if (stricmp(pstPos, "left") == 0)
             {
-                iPos = BORDER_WEST;
+                iPos = BORDER_LEFT;
             }
             else if (stricmp(pstPos, "right") == 0)
             {
-                iPos = BORDER_EAST;
+                iPos = BORDER_RIGHT;
             }
             else
             {
index c237b61..d1c619a 100644 (file)
@@ -5,29 +5,52 @@
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 // <-- TEST WITH GRAPHIC -->
+l = list();
 //borders
-b1 = createBorders("line", "red", 10, %t);
-b2 = createBorders("bevel", "lowered", "red", "green", "blue", "white");
-b3 = createBorders("softbevel", "lowered", "pink", "cyan", "magenta", "orange");
-b4 = createBorders("etched", "lowered", "yellow", "gray");
-b5 = createBorders("titled", b4, "title", "center", "helvetica", "italic", 12, "bold", "top", "gray");
-b6 = createBorders("empty", 10, 10, 10, 10);
-b7 = createBorders("compound", b2, b3);
-b8 = createBorders("matte", 10, 10, 10, 10, "red");
-u = uicontrol("style", "frame");
-u.borders = b1;
-assert_checkequal(u.borders, b1);
-u.borders = b2;
-assert_checkequal(u.borders, b2);
-u.borders = b3;
-assert_checkequal(u.borders, b3);
-u.borders = b4;
-assert_checkequal(u.borders, b4);
-u.borders = b5;
-assert_checkequal(u.borders, b5);
-u.borders = b6;
-assert_checkequal(u.borders, b6);
-u.borders = b7;
-assert_checkequal(u.borders, b7);
-u.borders = b8;
-assert_checkequal(u.borders, b8);
+//none
+//l($+1) = createBorders("none");
+//empty
+l($+1) = createBorders("empty");
+l($+1) = createBorders("empty", 10, 20, 30, 40);
+//line
+l($+1) = createBorders("line", "blue");
+l($+1) = createBorders("line", "red", 2);
+//bevel
+l($+1) = createBorders("bevel", "raised");
+l($+1) = createBorders("bevel", "lowered", "blue", "red");
+l($+1) = createBorders("bevel", "lowered", "blue", "red", "magenta", "orange");
+// softbevel
+l($+1) = createBorders("softbevel", "raised");
+l($+1) = createBorders("softbevel", "lowered", "blue", "red");
+l($+1) = createBorders("softbevel", "lowered", "blue", "red", "magenta", "orange");
+//etched
+l($+1) = createBorders("etched");
+l($+1) = createBorders("etched", "raised");
+l($+1) = createBorders("etched", "blue", "red");
+l($+1) = createBorders("etched", "lowered", "blue", "red");
+//titled
+font1 = createFontBorder("Serif", 12, "bold");
+font2 = createFontBorder("Serif", 12, "normal", "italic");
+l($+1) = createBorders("titled", "title");
+l($+1) = createBorders("titled", createBorders("empty"));
+l($+1) = createBorders("titled", createBorders("line", "blue"), "title");
+l($+1) = createBorders("titled", createBorders("bevel", "raised"), "title", "center", "top");
+l($+1) = createBorders("titled", createBorders("matte", 1, 2, 3, 4, "pink"), "title", "center", "top", font1);
+l($+1) = createBorders("titled", createBorders("etched"), "title", "left", "top", font2, "blue");
+//compound
+l($+1) = createBorders("compound");
+l($+1) = createBorders("compound", createBorders("empty"), createBorders("etched"));
+//matte
+l($+1) = createBorders("matte", 4, 3, 2, 1, "yellow");
+//create a window with all type of frame border.
+f = figure( ...
+    "dockable", "off", ...
+    "menubar_visible", "off", ...
+    "infobar_visible", "off", ...
+    "toolbar_visible", "off", ...
+    "layout", "grid", ...
+    "layout_options", createLayoutOptions("grid", [4,0], [1 1]));
+for i = 1:size(l)
+    u = uicontrol(f, "style", "frame", "borders", l(i));
+    assert_checkequal(u.borders, l(i));
+end
index 537e700..a7337c8 100644 (file)
@@ -8,31 +8,54 @@
 // <-- TEST WITH GRAPHIC -->
 
 
-
+l = list();
 //borders
-b1 = createBorders("line", "red", 10, %t);
-b2 = createBorders("bevel", "lowered", "red", "green", "blue", "white");
-b3 = createBorders("softbevel", "lowered", "pink", "cyan", "magenta", "orange");
-b4 = createBorders("etched", "lowered", "yellow", "gray");
-b5 = createBorders("titled", b4, "title", "center", "helvetica", "italic", 12, "bold", "top", "gray");
-b6 = createBorders("empty", 10, 10, 10, 10);
-b7 = createBorders("compound", b2, b3);
-b8 = createBorders("matte", 10, 10, 10, 10, "red");
+//none
+//l($+1) = createBorders("none");
+//empty
+l($+1) = createBorders("empty");
+l($+1) = createBorders("empty", 10, 20, 30, 40);
+//line
+l($+1) = createBorders("line", "blue");
+l($+1) = createBorders("line", "red", 2);
+//bevel
+l($+1) = createBorders("bevel", "raised");
+l($+1) = createBorders("bevel", "lowered", "blue", "red");
+l($+1) = createBorders("bevel", "lowered", "blue", "red", "magenta", "orange");
+// softbevel
+l($+1) = createBorders("softbevel", "raised");
+l($+1) = createBorders("softbevel", "lowered", "blue", "red");
+l($+1) = createBorders("softbevel", "lowered", "blue", "red", "magenta", "orange");
+//etched
+l($+1) = createBorders("etched");
+l($+1) = createBorders("etched", "raised");
+l($+1) = createBorders("etched", "blue", "red");
+l($+1) = createBorders("etched", "lowered", "blue", "red");
+//titled
+font1 = createFontBorder("Serif", 12, "bold");
+font2 = createFontBorder("Serif", 12, "normal", "italic");
+l($+1) = createBorders("titled", "title");
+l($+1) = createBorders("titled", createBorders("empty"));
+l($+1) = createBorders("titled", createBorders("line", "blue"), "title");
+l($+1) = createBorders("titled", createBorders("bevel", "raised"), "title", "center", "top");
+l($+1) = createBorders("titled", createBorders("matte", 1, 2, 3, 4, "pink"), "title", "center", "top", font1);
+l($+1) = createBorders("titled", createBorders("etched"), "title", "left", "top", font2, "blue");
+//compound
+l($+1) = createBorders("compound");
+l($+1) = createBorders("compound", createBorders("empty"), createBorders("etched"));
+//matte
+l($+1) = createBorders("matte", 4, 3, 2, 1, "yellow");
+
+//create a window with all type of frame border.
 
-u = uicontrol("style", "frame");
-u.borders = b1;
-assert_checkequal(u.borders, b1);
-u.borders = b2;
-assert_checkequal(u.borders, b2);
-u.borders = b3;
-assert_checkequal(u.borders, b3);
-u.borders = b4;
-assert_checkequal(u.borders, b4);
-u.borders = b5;
-assert_checkequal(u.borders, b5);
-u.borders = b6;
-assert_checkequal(u.borders, b6);
-u.borders = b7;
-assert_checkequal(u.borders, b7);
-u.borders = b8;
-assert_checkequal(u.borders, b8);
+f = figure( ...
+    "dockable", "off", ...
+    "menubar_visible", "off", ...
+    "infobar_visible", "off", ...
+    "toolbar_visible", "off", ...
+    "layout", "grid", ...
+    "layout_options", createLayoutOptions("grid", [4,0], [1 1]));
+for i = 1:size(l)
+    u = uicontrol(f, "style", "frame", "borders", l(i));
+    assert_checkequal(u.borders, l(i));
+end
index b8c9f4f..374926b 100644 (file)
@@ -69,7 +69,7 @@ static const char* propertiesNames[] =
     "tooltipstring",
     "constraints",
     "layout",
-    "margins"
+    "margins",
     "borders",
     "groupname",
     "title_position",
@@ -550,7 +550,7 @@ int sci_uicontrol(char *fname, unsigned long fname_len)
                     return 1;
                 }
 
-                if (inputIndex == 21 || inputIndex == 23)   /* User data settings */
+                if (inputIndex == 21 || inputIndex == 23 || inputIndex == 31)   /* User data and border settings */
                 {
                     nbRow = -1;
                     nbCol = -1;
index be6db53..b3015ab 100644 (file)
@@ -43,6 +43,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTUNITS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FOREGROUNDCOLOR__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ICON__;
@@ -123,6 +124,7 @@ import org.scilab.modules.gui.textbox.ScilabTextBox;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ScilabToolBar;
 import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.BorderConvertor;
 import org.scilab.modules.gui.utils.ClosingOperationsManager;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.ToolBarBuilder;
@@ -428,7 +430,6 @@ public final class SwingView implements GraphicView {
 
                 tab.setEventHandler(figure.getEventHandlerString());
                 tab.setEventHandlerEnabled(figure.getEventHandlerEnable());
-
                 tab.setVisible(true);
                 tab.setName(figureTitle);
 
@@ -451,6 +452,10 @@ public final class SwingView implements GraphicView {
                 SwingScilabFrame frame = new SwingScilabFrame();
                 frame.setId(id);
                 setDefaultProperties(frame, id);
+                Integer borderId = (Integer)GraphicController.getController().getProperty(id, __GO_UI_FRAME_BORDER__);
+                if (borderId != 0) {
+                    frame.setBorder(BorderConvertor.getBorder(borderId));
+                }
                 return frame;
             case Image:
                 SwingScilabUiImage image = new SwingScilabUiImage();
index 03f73a0..ea63407 100644 (file)
 package org.scilab.modules.gui;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACK__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACKTYPE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACK__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_PARENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TAG__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_USER_DATA__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_BACKGROUNDCOLOR__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
@@ -30,22 +32,23 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTUNITS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FOREGROUNDCOLOR__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LISTBOXTOP__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RELIEF__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING_COLNB__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TOOLTIPSTRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_UNITS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VERTICALALIGNMENT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_USER_DATA__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VALID__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -54,15 +57,14 @@ import java.awt.GridBagLayout;
 import java.awt.GridLayout;
 
 import javax.swing.AbstractButton;
-import javax.swing.ButtonGroup;
+import javax.swing.border.Border;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
-import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
-import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
 import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
+import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
@@ -70,12 +72,12 @@ import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
 import org.scilab.modules.gui.bridge.uiimage.SwingScilabUiImage;
 import org.scilab.modules.gui.bridge.uitable.SwingScilabUiTable;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
+import org.scilab.modules.gui.utils.BorderConvertor;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.UnitsConverter;
 import org.scilab.modules.gui.utils.UnitsConverter.UicontrolUnits;
 import org.scilab.modules.gui.widget.Widget;
-
 /**
  * @author Bruno JOFRET
  * @author Vincent COUVERT
@@ -110,6 +112,7 @@ public final class SwingViewWidget {
         Double[] allColors = null;
         double maxValue = 0;
 
+        GraphicController controller = GraphicController.getController();
         switch (property) {
             case __GO_UI_BACKGROUNDCOLOR__ :
                 allColors = ((Double[]) value);
@@ -118,11 +121,11 @@ public final class SwingViewWidget {
                                                   (int) (allColors[2] * COLORS_COEFF)));
                 break;
             case __GO_CALLBACK__ :
-                int cbType = (Integer) GraphicController.getController().getProperty(uid, __GO_CALLBACKTYPE__);
+                int cbType = (Integer) controller.getProperty(uid, __GO_CALLBACKTYPE__);
                 uiControl.setCallback(CommonCallBack.createCallback((String) value, cbType, uid));
                 break;
             case __GO_CALLBACKTYPE__ :
-                String cbString = (String) GraphicController.getController().getProperty(uid, __GO_CALLBACK__);
+                String cbString = (String) controller.getProperty(uid, __GO_CALLBACK__);
                 if ((Integer) value == CallBack.UNTYPED) { /* Deactivate callback */
                     uiControl.setCallback(null);
                 } else {
@@ -168,7 +171,7 @@ public final class SwingViewWidget {
                 }
                 break;
             case __GO_UI_FONTSIZE__ :
-                UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController.getController()
+                UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) controller
                                                    .getProperty(uid, __GO_UI_FONTUNITS__));
                 Double dblFontSize = UnitsConverter.convertToPoint((Double) value, fontUnitsProperty, uiControl, false);
                 font = uiControl.getFont();
@@ -222,16 +225,16 @@ public final class SwingViewWidget {
                 break;
             case __GO_UI_MAX__ :
                 maxValue = ((Double) value);
-                Double[] allValues = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_VALUE__);
+                Double[] allValues = (Double[]) controller.getProperty(uid, __GO_UI_VALUE__);
                 if ((allValues == null) || (allValues.length == 0)) {
                     return;
                 }
                 double uicontrolValue = allValues[0];
                 if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider properties
-                    double minValue = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
                     ((SwingScilabSlider) uiControl).setMaximumValue(maxValue);
-                    Double[] sliderStep = ((Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__));
+                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
                     double minorSliderStep = sliderStep[0].doubleValue();
                     double majorSliderStep = sliderStep[1].doubleValue();
                     if (minValue <= maxValue) {
@@ -240,7 +243,7 @@ public final class SwingViewWidget {
                     }
                 } else if (uiControl instanceof SwingScilabListBox) {
                     // Enable/Disable multiple selection
-                    double minValue = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
                     ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
                 } else if (uiControl instanceof SwingScilabCheckBox) {
                     // Check/Uncheck the CheckBox
@@ -254,9 +257,9 @@ public final class SwingViewWidget {
                 double minValue = ((Double) value);
                 if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider properties
-                    maxValue = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
                     ((SwingScilabSlider) uiControl).setMinimumValue(minValue);
-                    Double[] sliderStep = ((Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__));
+                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
                     double minorSliderStep = sliderStep[0].doubleValue();
                     double majorSliderStep = sliderStep[1].doubleValue();
                     if (minValue <= maxValue) {
@@ -265,7 +268,7 @@ public final class SwingViewWidget {
                     }
                 } else if (uiControl instanceof SwingScilabListBox) {
                     // Enable/Disable multiple selection
-                    maxValue = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
                     ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
                 }
                 break;
@@ -274,10 +277,10 @@ public final class SwingViewWidget {
                 UicontrolUnits unitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController
                                                .getController().getProperty(uid, __GO_UI_UNITS__));
                 Double[] dblValues = UnitsConverter.convertPositionToPixels((Double[]) value, unitsProperty, uiControl);
-                /* Set dimensions before position because position is adjusted according to size */
+                // Set dimensions before position because position is adjusted according to size
                 uiControl.setDims(new Size(dblValues[WIDTH_INDEX].intValue(), dblValues[HEIGHT_INDEX].intValue()));
                 uiControl.setPosition(new Position(dblValues[X_INDEX].intValue(), dblValues[Y_INDEX].intValue()));
-                /* Manage sliders orientation */
+                // Manage sliders orientation
                 if (uiControl instanceof SwingScilabSlider) {
                     if (dblValues[WIDTH_INDEX].intValue() > dblValues[HEIGHT_INDEX].intValue()) {
                         ((SwingScilabSlider) uiControl).setHorizontal();
@@ -306,7 +309,7 @@ public final class SwingViewWidget {
                 if (uiControl instanceof SwingScilabUiTable) {
                     // Update column names
                     String[] stringValue = (String[]) value;
-                    int colNb = ((Integer) GraphicController.getController().getProperty(uid, __GO_UI_STRING_COLNB__));
+                    int colNb = ((Integer) controller.getProperty(uid, __GO_UI_STRING_COLNB__));
                     String[] colNames = new String[colNb - 1];
                     for (int k = 1; k < colNb; k++) {
                         colNames[k - 1] = stringValue[k * (stringValue.length / colNb)];
@@ -385,11 +388,11 @@ public final class SwingViewWidget {
                     ((SwingScilabPopupMenu) uiControl).setUserSelectedIndex(intValue[0]);
                 } else if (uiControl instanceof SwingScilabCheckBox) {
                     // Check the checkbox if the value is equal to MAX property
-                    maxValue = ((Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__)).intValue();
+                    maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
                     ((SwingScilabCheckBox) uiControl).setChecked(maxValue == intValue[0]);
                 } else if (uiControl instanceof SwingScilabRadioButton) {
                     // Check the radiobutton if the value is equal to MAX property
-                    maxValue = ((Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__)).intValue();
+                    maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
                     ((SwingScilabRadioButton) uiControl).setChecked(maxValue == intValue[0]);
                 } else if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider value
@@ -442,7 +445,7 @@ public final class SwingViewWidget {
             case __GO_PARENT__ :
                 /* Update position */
                 SwingViewWidget.update(uiControl, __GO_POSITION__,
-                                       GraphicController.getController().getProperty(uid, __GO_POSITION__));
+                                       controller.getProperty(uid, __GO_POSITION__));
                 break;
             case __GO_UI_GROUP_NAME__ :
                 if (uiControl instanceof SwingScilabRadioButton
@@ -461,16 +464,23 @@ public final class SwingViewWidget {
                     SwingScilabFrame frame = (SwingScilabFrame)uiControl;
                     LayoutType newLayout = LayoutType.intToEnum((Integer) value);
                     switch (newLayout) {
-                        case BORDER :
-                            Integer[] padding = (Integer[]) GraphicController.getController().getProperty(frame.getId(), __GO_BORDER_OPT_PADDING__);
+                        case BORDER : {
+                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_BORDER_OPT_PADDING__);
                             frame.setLayout(new BorderLayout(padding[0], padding[1]));
                             break;
+                        }
                         case GRIDBAG :
                             frame.setLayout(new GridBagLayout());
                             break;
-                        case GRID :
-                            frame.setLayout(new GridLayout());
+                        case GRID : {
+                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_PADDING__);
+                            Integer[] grid = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_GRID__);
+                            if (grid[0] == 0 && grid[1] == 0) {
+                                grid[0] = 1;
+                            }
+                            frame.setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
                             break;
+                        }
                         case NONE :
                         default:
                             frame.setLayout(null);
@@ -479,6 +489,13 @@ public final class SwingViewWidget {
                 } else {
                 }
                 break;
+            case __GO_UI_FRAME_BORDER__ :
+                if (uiControl instanceof SwingScilabFrame) {
+                    SwingScilabFrame frame = (SwingScilabFrame)uiControl;
+                    Integer borderId = (Integer)value;
+                    Border border = BorderConvertor.getBorder(borderId);
+                    frame.setBorder(border);
+                }
             default :
                 //System.err.println("[SwingScilabWidget.update] Property not mapped: " + property);
         }
index 739655d..65da5f7 100644 (file)
 package org.scilab.modules.gui.bridge.frame;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
 
 import java.awt.BorderLayout;
 import java.awt.Component;
@@ -25,13 +23,13 @@ import java.awt.Container;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.GridLayout;
+import java.awt.Insets;
 
 import javax.swing.JPanel;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
-import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.scilab.modules.gui.SwingView;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -143,16 +141,16 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
         Uicontrol uicontrol = (Uicontrol) GraphicModel.getModel().getObjectFromId(member.getId());
         if (getLayout() instanceof BorderLayout) {
             switch (uicontrol.getBorderPositionAsEnum()) {
-                case SOUTH:
+                case BOTTOM:
                     add((Component) member, BorderLayout.SOUTH);
                     break;
-                case NORTH:
+                case TOP:
                     add((Component) member, BorderLayout.NORTH);
                     break;
-                case WEST:
+                case LEFT:
                     add((Component) member, BorderLayout.WEST);
                     break;
-                case EAST:
+                case RIGHT:
                     add((Component) member, BorderLayout.EAST);
                     break;
                 case CENTER:
@@ -179,7 +177,7 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
             // Anchor
             switch (uicontrol.getGridBagAnchorAsEnum()) {
                 case LEFT :
-                    constraints.anchor = GridBagConstraints.EAST;
+                    constraints.anchor = GridBagConstraints.WEST;
                     break;
                 case UPPER :
                     constraints.anchor = GridBagConstraints.NORTH;
@@ -188,19 +186,19 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
                     constraints.anchor = GridBagConstraints.SOUTH;
                     break;
                 case LOWER_LEFT:
-                    constraints.anchor = GridBagConstraints.SOUTHEAST;
+                    constraints.anchor = GridBagConstraints.SOUTHWEST;
                     break;
                 case LOWER_RIGHT:
-                    constraints.anchor = GridBagConstraints.SOUTHWEST;
+                    constraints.anchor = GridBagConstraints.SOUTHEAST;
                     break;
                 case RIGHT:
-                    constraints.anchor = GridBagConstraints.WEST;
+                    constraints.anchor = GridBagConstraints.EAST;
                     break;
                 case UPPER_LEFT:
-                    constraints.anchor = GridBagConstraints.NORTHEAST;
+                    constraints.anchor = GridBagConstraints.NORTHWEST;
                     break;
                 case UPPER_RIGHT:
-                    constraints.anchor = GridBagConstraints.NORTHWEST;
+                    constraints.anchor = GridBagConstraints.NORTHEAST;
                     break;
                 case CENTER :
                 default :
@@ -226,7 +224,10 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
             }
 
             // Insets
-            // TODO : add Insets
+            Double[] margins = uicontrol.getMargins();
+            constraints.insets = new Insets(
+                margins[0].intValue(), margins[1].intValue(),
+                margins[2].intValue(), margins[2].intValue());
 
             // Padding
             Integer[] padding = uicontrol.getGridBagPadding();
@@ -235,6 +236,8 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
 
             add((Component) member, constraints);
             revalidate();
+        } else if (getLayout() instanceof GridLayout) {
+            this.add((Component) member, 0);
         } else {
             this.add((Component) member);
         }
@@ -634,7 +637,7 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        //setBorder(ScilabRelief.getBorderFromRelief(reliefType));
     }
 
     /**
@@ -717,6 +720,8 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
                     }
                 }
                 break;
+            default :
+                break;
         }
     }
 
index 7df4b90..e58c006 100644 (file)
@@ -142,7 +142,11 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
      */
     public void setDims(Size newSize) {
         setSize(newSize.getWidth(), newSize.getHeight());
-        setPreferredSize(new Dimension(newSize.getWidth(), newSize.getHeight()));
+        if (newSize.getWidth() == 0 && newSize.getHeight() == 0) {
+            setPreferredSize(null);
+        } else {
+            setPreferredSize(new Dimension(newSize.getWidth(), newSize.getHeight()));
+        }
     }
 
     /**
index 481d09b..715c551 100644 (file)
@@ -18,6 +18,8 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_ENABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_NAME__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_ID__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_INFOBAR_VISIBLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_INFO_MESSAGE__;
@@ -171,23 +173,60 @@ public class SwingScilabCommonPanel {
             case __GO_LAYOUT__ :
                 LayoutType newLayout = LayoutType.intToEnum((Integer) value);
                 switch (newLayout) {
-                    case BORDER :
+                    case BORDER : {
                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
                         component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
                         component.getWidgetPane().setLayout(new BorderLayout());
                         break;
-                    case GRIDBAG :
+                    }
+                    case GRIDBAG : {
                         component.getWidgetPane().setLayout(new GridBagLayout());
                         break;
-                    case GRID :
-                        component.getWidgetPane().setLayout(new GridLayout());
+                    }
+                    case GRID : {
+                        Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
+                        Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
+                        if (grid[0] == 0 && grid[1] == 0) {
+                            grid[0] = 1;
+                        }
+                        component.getWidgetPane().setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
                         break;
+                    }
                     case NONE :
                     default:
                         component.getWidgetPane().setLayout(null);
                         break;
                 }
                 break;
+            case __GO_GRID_OPT_PADDING__ :
+            case __GO_GRID_OPT_GRID__ : {
+                Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
+                LayoutType layoutType = LayoutType.intToEnum(layout);
+
+                if (layoutType != LayoutType.GRID) {
+                    break;
+                }
+
+                Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
+                Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
+                if (grid[0] == 0 && grid[1] == 0) {
+                    grid[0] = 1;
+                }
+                component.getWidgetPane().setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
+                break;
+            }
+            case __GO_BORDER_OPT_PADDING__ : {
+                Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
+                LayoutType layoutType = LayoutType.intToEnum(layout);
+
+                if (layoutType != LayoutType.BORDER) {
+                    break;
+                }
+
+                Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
+                component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
+                component.getWidgetPane().setLayout(new BorderLayout());
+            }
         }
     }
 
@@ -243,16 +282,16 @@ public class SwingScilabCommonPanel {
         Uicontrol uicontrol = (Uicontrol) GraphicModel.getModel().getObjectFromId(member.getId());
         if (component.getWidgetPane().getLayout() instanceof BorderLayout) {
             switch (uicontrol.getBorderPositionAsEnum()) {
-                case SOUTH:
+                case BOTTOM:
                     component.getWidgetPane().add((Component) member, BorderLayout.SOUTH);
                     break;
-                case NORTH:
+                case TOP:
                     component.getWidgetPane().add((Component) member, BorderLayout.NORTH);
                     break;
-                case WEST:
+                case LEFT:
                     component.getWidgetPane().add((Component) member, BorderLayout.WEST);
                     break;
-                case EAST:
+                case RIGHT:
                     component.getWidgetPane().add((Component) member, BorderLayout.EAST);
                     break;
                 case CENTER:
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/utils/BorderConvertor.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/utils/BorderConvertor.java
new file mode 100644 (file)
index 0000000..e96812d
--- /dev/null
@@ -0,0 +1,270 @@
+package org.scilab.modules.gui.utils;
+
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LINE_THICKNESS__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TITLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTNAME__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTSIZE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_COLOR__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_HIGHLIGHT_IN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_IN_BORDER__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_JUSTIFICATION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_OUT_BORDER__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_POSITION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_ROUNDED__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_IN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_OUT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_STYLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_TITLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_TYPE__;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.lang.reflect.Field;
+
+import javax.swing.BorderFactory;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorder.BorderType;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorder.JustificationType;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorder.TitlePositionType;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
+
+public class BorderConvertor {
+    public static Color getColor(String str) {
+        try {
+            Field field = Class.forName("java.awt.Color").getField(str);
+            return (Color) field.get(null);
+        } catch (Exception e) {
+            return Color.black;
+        }
+    }
+
+    public static Border getBorder(Integer borderId) {
+        GraphicController controller = GraphicController.getController();
+        Integer styleInt = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_STYLE__);
+        Border border = null;
+
+        FrameBorderType style = FrameBorderType.intToEnum(styleInt);
+        switch (style) {
+            case BEVEL: {
+                BorderType type = BorderType.intToEnum((Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_TYPE__));
+                int bevelType = type == BorderType.LOWERED ? BevelBorder.LOWERED : BevelBorder.RAISED;
+                String hlOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__);
+                String hlIn = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__);
+                String shadowOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_SHADOW_OUT__);
+                String shadowIn = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_SHADOW_IN__);
+
+                if (hlOut != null && shadowOut != null) {
+                    if (hlIn != null && shadowIn != null) {
+                        border = BorderFactory.createBevelBorder(bevelType, getColor(hlOut), getColor(hlIn), getColor(shadowOut), getColor(shadowIn));
+                    } else {
+                        border = BorderFactory.createBevelBorder(bevelType, getColor(hlOut), getColor(shadowOut));
+                    }
+                } else {
+                    border = BorderFactory.createBevelBorder(bevelType);
+                }
+                break;
+            }
+            case COMPOUND: {
+                Integer borderId1 = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_OUT_BORDER__);
+                Integer borderId2 = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_IN_BORDER__);
+
+                if (borderId1 != null && borderId2 != null) {
+                    Border border1 = getBorder(borderId1);
+                    Border border2 = getBorder(borderId2);
+
+                    border = BorderFactory.createCompoundBorder(border1, border2);
+                } else {
+                    border = BorderFactory.createCompoundBorder();
+                }
+                break;
+            }
+            case EMPTY: {
+                // TLBR
+                Double[] pos = (Double[]) controller.getProperty(borderId, __GO_POSITION__);
+
+                if (pos != null) {
+                    border = BorderFactory.createEmptyBorder(pos[0].intValue(), pos[1].intValue(), pos[2].intValue(), pos[3].intValue());
+                } else {
+                    border = BorderFactory.createEmptyBorder();
+                }
+                break;
+            }
+            case ETCHED: {
+                Integer type = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_TYPE__);
+                String hlOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__);
+                String shadowOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_SHADOW_OUT__);
+
+                if (type == null) {
+                    if (hlOut != null && shadowOut != null) {
+                        border = BorderFactory.createEtchedBorder(getColor(hlOut), getColor(shadowOut));
+                    } else {
+                        border = BorderFactory.createEtchedBorder();
+                    }
+
+                } else {
+                    BorderType borderType = BorderType.intToEnum(type);
+                    int bevelType = borderType == BorderType.RAISED ? BevelBorder.RAISED : BevelBorder.LOWERED;
+
+                    if (hlOut != null && shadowOut != null) {
+                        border = BorderFactory.createEtchedBorder(bevelType, getColor(hlOut), getColor(shadowOut));
+                    } else {
+                        border = BorderFactory.createEtchedBorder(bevelType);
+                    }
+                }
+                break;
+            }
+            case LINE: {
+                String color = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_COLOR__);
+                Integer thickness = (Integer) controller.getProperty(borderId, __GO_LINE_THICKNESS__);
+                Boolean rounded = (Boolean) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_ROUNDED__);
+
+                if (thickness != null) {
+                    if (rounded != null) {
+                        // Java 1.7
+                        // border = BorderFactory.createLineBorder(
+                        // getColor(color),
+                        // thickness,
+                        // rounded);
+                        border = BorderFactory.createLineBorder(getColor(color), thickness);
+                    } else {
+                        border = BorderFactory.createLineBorder(getColor(color), thickness);
+                    }
+                } else {
+                    border = BorderFactory.createLineBorder(getColor(color));
+                }
+                break;
+            }
+            case MATTE: {
+                // TLBR
+                Double[] pos = (Double[]) controller.getProperty(borderId, __GO_POSITION__);
+                String color = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_COLOR__);
+
+                border = BorderFactory.createMatteBorder(pos[0].intValue(), pos[1].intValue(), pos[2].intValue(), pos[3].intValue(), getColor(color));
+                break;
+            }
+            case SOFTBEVEL: {
+
+                BorderType type = BorderType.intToEnum((Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_TYPE__));
+                int bevelType = type == BorderType.LOWERED ? BevelBorder.LOWERED : BevelBorder.RAISED;
+                String hlOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__);
+                String hlIn = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__);
+                String shadowOut = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_SHADOW_OUT__);
+                String shadowIn = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_SHADOW_IN__);
+
+                /* in Java 1.6 use normal bevel function */
+                if (hlOut != null && shadowOut != null) {
+                    if (hlIn != null && shadowIn != null) {
+                        border = BorderFactory.createBevelBorder(bevelType, getColor(hlOut), getColor(hlIn), getColor(shadowOut), getColor(shadowIn));
+                    } else {
+                        border = BorderFactory.createBevelBorder(bevelType, getColor(hlOut), getColor(shadowOut));
+                    }
+                } else {
+                    border = BorderFactory.createBevelBorder(bevelType);
+                }
+                break;
+            }
+            case TITLED: {
+                Integer borderId1 = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_TITLE__);
+                String title = (String) controller.getProperty(borderId, __GO_TITLE__);
+                Integer justification = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_JUSTIFICATION__);
+                String fontName = (String) controller.getProperty(borderId, __GO_UI_FONTNAME__);
+                String fontAngle = (String) controller.getProperty(borderId, __GO_UI_FONTANGLE__);
+                Integer fontSize = (Integer) controller.getProperty(borderId, __GO_UI_FONTSIZE__);
+                String fontWeight = (String) controller.getProperty(borderId, __GO_UI_FONTWEIGHT__);
+                Integer pos = (Integer) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_POSITION__);
+                String color = (String) controller.getProperty(borderId, __GO_UI_FRAME_BORDER_COLOR__);
+
+                if (borderId1 == null && title != null) {
+                    border = BorderFactory.createTitledBorder(title);
+                } else {
+                    // create sub border
+                    Border border1 = getBorder(borderId1);
+
+                    if (title != null) {
+                        if (justification != null && pos != null) {
+                            int justify = TitledBorder.LEADING;
+                            switch (JustificationType.intToEnum(justification)) {
+                                case CENTER:
+                                    justify = TitledBorder.CENTER;
+                                    break;
+                                case LEFT:
+                                    justify = TitledBorder.LEFT;
+                                    break;
+                                case RIGHT:
+                                    justify = TitledBorder.RIGHT;
+                                    break;
+                                case TRAILING:
+                                    justify = TitledBorder.TRAILING;
+                                    break;
+                                case LEADING:
+                                default:
+                                    justify = TitledBorder.LEADING;
+                                    break;
+                            }
+
+                            int position = TitledBorder.TOP;
+                            switch (TitlePositionType.intToEnum(pos)) {
+                                case ABOVE_BOTTOM:
+                                    position = TitledBorder.ABOVE_BOTTOM;
+                                    break;
+                                case ABOVE_TOP:
+                                    position = TitledBorder.ABOVE_TOP;
+                                    break;
+                                case BELOW_BOTTOM:
+                                    position = TitledBorder.BELOW_BOTTOM;
+                                    break;
+                                case BELOW_TOP:
+                                    position = TitledBorder.BELOW_TOP;
+                                    break;
+                                case BOTTOM:
+                                    position = TitledBorder.BOTTOM;
+                                    break;
+                                case TOP:
+                                default:
+                                    position = TitledBorder.TOP;
+                                    break;
+                            }
+
+                            if (fontName != null && fontAngle != null && fontSize != null && fontWeight != null) {
+                                // create font
+                                int fontStyle = Font.PLAIN;
+                                if (fontAngle.equals("italic")) {
+                                    fontStyle |= Font.ITALIC;
+                                }
+
+                                if (fontWeight.equals("bold")) {
+                                    fontStyle |= Font.BOLD;
+                                }
+
+                                Font font = new Font(fontName, fontStyle, fontSize);
+                                border = BorderFactory.createTitledBorder(border1, title, justify, position, font, getColor(color));
+                            } else {
+                                border = BorderFactory.createTitledBorder(border1, title, justify, position);
+                            }
+                        } else {
+                            border = BorderFactory.createTitledBorder(border1, title);
+                        }
+                    } else {
+                        border = BorderFactory.createTitledBorder(border1);
+                    }
+                }
+                break;
+            }
+            default:
+            case NONE: {
+                border = BorderFactory.createEmptyBorder();
+                break;
+            }
+        }
+
+        return border;
+    }
+}