allow to use #000000 as color of frame border 20/20520/3
Antoine ELIAS [Wed, 26 Sep 2018 14:32:58 +0000 (16:32 +0200)]
Change-Id: Icb50edcdaf2a0ff056f08d32ed8ae76ae13604b5

scilab/modules/gui/help/en_US/borders/bevel_border_properties.xml
scilab/modules/gui/help/en_US/borders/etched_border_properties.xml
scilab/modules/gui/help/en_US/borders/line_border_properties.xml
scilab/modules/gui/help/en_US/borders/matte_border_properties.xml
scilab/modules/gui/help/en_US/borders/titled_border_properties.xml
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/BorderConvertor.java
scilab/modules/gui/tests/unit_tests/border.tst

index 6376821..f1dcad5 100644 (file)
                 <term>hlouter</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for the outer edge highlight.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for the outer edge highlight.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>hlinner</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for the inner edge highlight.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for the inner edge highlight.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>shadowouter</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for the outer shadow area.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for the outer shadow area.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>shadowinner</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for the inner shadow area.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for the inner shadow area.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
index bc3f488..41a20e6 100644 (file)
                 <term>hl</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for border highlights.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for border highlights.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>shadow</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color used for the border shadows.</para>
+                    <para>The name of the color or a string like <literal>#FFFFFF</literal> used for the border shadows.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
index d4a3e99..df4fc23 100644 (file)
@@ -19,7 +19,7 @@
                 <term>color</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color of the border.</para>
+                    <para>The name of the color of the border or a string like <literal>#FFFFFF</literal>.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
index b5010e1..5606011 100644 (file)
@@ -45,7 +45,7 @@
                 <term>color</term>
                 <listitem>
                     <para>String</para>
-                    <para>The name of the color of the border.</para>
+                    <para>The name of the color of the border or a string like <literal>#FFFFFF</literal>.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
index 914b5e3..ff25201 100644 (file)
@@ -58,7 +58,7 @@
                 <term>color</term>
                 <listitem>
                     <para>String</para>
-                    <para>The color of the title.</para>
+                    <para>The color name of the title or a string like <literal>#FFFFFF</literal>.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
index ff92500..2231870 100644 (file)
@@ -54,8 +54,12 @@ 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);
+            if(str.charAt(0) == '#') {
+                return new Color.decode(str);
+            } else {     
+                Field field = Class.forName("java.awt.Color").getField(str);
+                return (Color) field.get(null);
+            }
         } catch (Exception e) {
             return Color.black;
         }
index 2bf10be..a0d54fa 100644 (file)
@@ -7,7 +7,6 @@
 
 // <-- TEST WITH GRAPHIC -->
 
-
 l = list();
 //border
 //none
@@ -59,3 +58,23 @@ for i = 1:size(l)
     u = uicontrol(f, "style", "frame", "border", l(i));
     assert_checkequal(u.border, l(i));
 end
+
+//generate colors from parula color map
+colors = sprintf("#%02X%02X%02X\n", (parulacolormap(64) .* 255));
+
+f = figure( ...
+    "dockable", "off", ...
+    "menubar_visible", "off", ...
+    "infobar_visible", "off", ...
+    "toolbar_visible", "off", ...
+    "visible", "off", ...
+    "layout", "grid", ...
+    "layout_options", createLayoutOptions("grid", [8,0], [1 1]));
+
+for i = 1:size(colors, "*")
+    b = createBorder("line", colors(i));
+    u = uicontrol(f, "style", "frame", "border", b);
+    assert_checkequal(u.border, b);
+end
+
+f.visible = "on";