add groupname in uicontrol properties and manage it in swingview 68/13568/5
Antoine ELIAS [Tue, 28 Jan 2014 10:01:36 +0000 (11:01 +0100)]
Change-Id: I66a3b879aa64a32e10d0a70443fa9e9c5c92e5ed

25 files changed:
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
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/scripts/propertiesMap.properties
scilab/modules/graphics/Makefile.am
scilab/modules/graphics/Makefile.in
scilab/modules/graphics/graphics.vcxproj
scilab/modules/graphics/graphics.vcxproj.filters
scilab/modules/graphics/macros/%h_p.sci
scilab/modules/graphics/src/c/getHandleProperty/GetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/SetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/getHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/get_groupname_property.c [new file with mode: 0644]
scilab/modules/graphics/src/c/getHandleProperty/setHandleProperty.h
scilab/modules/graphics/src/c/getHandleProperty/set_groupname_property.c [new file with mode: 0644]
scilab/modules/gui/sci_gateway/c/sci_uicontrol.c
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkbox/SwingScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/groupmanager/GroupManager.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiobutton/SwingScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiogroup/SwingScilabRadioGroup.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/RadioGroup.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/ScilabRadioGroupBridge.java [deleted file]
scilab/modules/gui/tests/unit_tests/radiobutton.groupname.dia.ref [new file with mode: 0644]
scilab/modules/gui/tests/unit_tests/radiobutton.groupname.tst [new file with mode: 0644]

index c5fde2a..14450e9 100755 (executable)
 #define __GO_UI_FRAME_BORDER_TITLE__ 364
 #define __GO_UI_FRAME_BORDER_POSITION__ 365
 #define __GO_UI_FRAME_BORDER_STYLE__ 366
+#define __GO_UI_GROUP_NAME__ 367
 
 #endif /* !__GRAPHIC_OBJECT_PROPERTIES_H__ */
index 15e6a03..df2a687 100755 (executable)
@@ -387,5 +387,6 @@ public class GraphicObjectProperties {
     public static final int __GO_UI_FRAME_BORDER_TITLE__ = 364;
     public static final int __GO_UI_FRAME_BORDER_POSITION__ = 365;
     public static final int __GO_UI_FRAME_BORDER_STYLE__ = 366;
+    public static final int __GO_UI_GROUP_NAME__ = 367;
 
 }
index 748139f..b834a03 100644 (file)
@@ -18,6 +18,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT_SET__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT_SET__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MARGINS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
@@ -69,6 +70,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 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_UI_FRAME_BORDER__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
 
 import java.util.Arrays;
 import java.util.StringTokenizer;
@@ -300,6 +302,9 @@ public class Uicontrol extends GraphicObject {
     /** border options */
     private Integer frameBorder = 0;
 
+    /** groupname for radiobutton */
+    private String groupName = "";
+
     /**
      * All uicontrol properties
      */
@@ -344,7 +349,8 @@ public class Uicontrol extends GraphicObject {
         GRIDOPT_GRID,
         GRIDOPT_PADDING,
         BORDEROPT_PADDING,
-        FRAMEBORDER
+        FRAMEBORDER,
+        GROUPNAME
     };
 
     /**
@@ -545,6 +551,8 @@ public class Uicontrol extends GraphicObject {
                 return UicontrolProperty.BORDEROPT_PADDING;
             case __GO_UI_FRAME_BORDER__:
                 return UicontrolProperty.FRAMEBORDER;
+            case __GO_UI_GROUP_NAME__:
+                return UicontrolProperty.GROUPNAME;
             default :
                 return super.getPropertyFromName(propertyName);
         }
@@ -634,6 +642,8 @@ public class Uicontrol extends GraphicObject {
             return getBorderOptPadding();
         } else if (property == UicontrolProperty.FRAMEBORDER) {
             return getFrameBorder();
+        } else if (property == UicontrolProperty.GROUPNAME) {
+            return getGroupName();
         } else {
             return super.getProperty(property);
         }
@@ -720,6 +730,8 @@ public class Uicontrol extends GraphicObject {
                 return setBorderOptPadding((Integer[]) value);
             case FRAMEBORDER:
                 return setFrameBorder((Integer) value);
+            case GROUPNAME:
+                return setGroupName((String) value);
             default:
                 return super.setProperty(property, value);
         }
@@ -1307,6 +1319,19 @@ public class Uicontrol extends GraphicObject {
         return UpdateStatus.Success;
     }
 
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public UpdateStatus setGroupName(String value) {
+        if (groupName.equals(value)) {
+            return UpdateStatus.NoChange;
+        }
+
+        groupName = value;
+        return UpdateStatus.Success;
+    }
+
     public void accept(Visitor visitor) {
     }
 }
index bc46aca..c11b761 100755 (executable)
@@ -417,3 +417,4 @@ __GO_UI_FRAME_BORDER_SHADOW_OUT__
 __GO_UI_FRAME_BORDER_TITLE__
 __GO_UI_FRAME_BORDER_POSITION__
 __GO_UI_FRAME_BORDER_STYLE__
+__GO_UI_GROUP_NAME__
\ No newline at end of file
index 9f23fe9..1ea90f5 100644 (file)
@@ -335,6 +335,8 @@ src/c/getHandleProperty/get_layout_options_property.c \
 src/c/getHandleProperty/set_layout_options_property.c \
 src/c/getHandleProperty/get_borders_property.c \
 src/c/getHandleProperty/set_borders_property.c \
+src/c/getHandleProperty/get_groupname_property.c \
+src/c/getHandleProperty/set_groupname_property.c \
 src/c/DefaultCommandArg.c \
 src/c/Axes.c \
 src/c/sciMatrix.c \
index 1a79668..f70196c 100644 (file)
@@ -482,6 +482,8 @@ am__objects_1 = src/c/libscigraphics_algo_la-GetCommandArg.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_layout_options_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-get_borders_property.lo \
        src/c/getHandleProperty/libscigraphics_algo_la-set_borders_property.lo \
+       src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo \
+       src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo \
        src/c/libscigraphics_algo_la-DefaultCommandArg.lo \
        src/c/libscigraphics_algo_la-Axes.lo \
        src/c/libscigraphics_algo_la-sciMatrix.lo \
@@ -1266,6 +1268,8 @@ src/c/getHandleProperty/get_layout_options_property.c \
 src/c/getHandleProperty/set_layout_options_property.c \
 src/c/getHandleProperty/get_borders_property.c \
 src/c/getHandleProperty/set_borders_property.c \
+src/c/getHandleProperty/get_groupname_property.c \
+src/c/getHandleProperty/set_groupname_property.c \
 src/c/DefaultCommandArg.c \
 src/c/Axes.c \
 src/c/sciMatrix.c \
@@ -2555,6 +2559,12 @@ src/c/getHandleProperty/libscigraphics_algo_la-get_borders_property.lo:  \
 src/c/getHandleProperty/libscigraphics_algo_la-set_borders_property.lo:  \
        src/c/getHandleProperty/$(am__dirstamp) \
        src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
+src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo:  \
+       src/c/getHandleProperty/$(am__dirstamp) \
+       src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
+src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo:  \
+       src/c/getHandleProperty/$(am__dirstamp) \
+       src/c/getHandleProperty/$(DEPDIR)/$(am__dirstamp)
 src/c/libscigraphics_algo_la-DefaultCommandArg.lo:  \
        src/c/$(am__dirstamp) src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libscigraphics_algo_la-Axes.lo: src/c/$(am__dirstamp) \
@@ -3053,6 +3063,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_grid_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_grid_style_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_grid_thickness_property.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_groupname_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_handle_visible_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_hidden_axis_color_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_hidden_color_property.Plo@am__quote@
@@ -3211,6 +3222,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_grid_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_grid_style_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_grid_thickness_property.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_groupname_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_handle_visible_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_hidden_axis_color_property.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_hidden_color_property.Plo@am__quote@
@@ -5491,6 +5503,20 @@ src/c/getHandleProperty/libscigraphics_algo_la-set_borders_property.lo: src/c/ge
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_borders_property.lo `test -f 'src/c/getHandleProperty/set_borders_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_borders_property.c
 
+src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo: src/c/getHandleProperty/get_groupname_property.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo -MD -MP -MF src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_groupname_property.Tpo -c -o src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo `test -f 'src/c/getHandleProperty/get_groupname_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_groupname_property.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_groupname_property.Tpo src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-get_groupname_property.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/getHandleProperty/get_groupname_property.c' object='src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/getHandleProperty/libscigraphics_algo_la-get_groupname_property.lo `test -f 'src/c/getHandleProperty/get_groupname_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/get_groupname_property.c
+
+src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo: src/c/getHandleProperty/set_groupname_property.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo -MD -MP -MF src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_groupname_property.Tpo -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo `test -f 'src/c/getHandleProperty/set_groupname_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_groupname_property.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_groupname_property.Tpo src/c/getHandleProperty/$(DEPDIR)/libscigraphics_algo_la-set_groupname_property.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/getHandleProperty/set_groupname_property.c' object='src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/getHandleProperty/libscigraphics_algo_la-set_groupname_property.lo `test -f 'src/c/getHandleProperty/set_groupname_property.c' || echo '$(srcdir)/'`src/c/getHandleProperty/set_groupname_property.c
+
 src/c/libscigraphics_algo_la-DefaultCommandArg.lo: src/c/DefaultCommandArg.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscigraphics_algo_la-DefaultCommandArg.lo -MD -MP -MF src/c/$(DEPDIR)/libscigraphics_algo_la-DefaultCommandArg.Tpo -c -o src/c/libscigraphics_algo_la-DefaultCommandArg.lo `test -f 'src/c/DefaultCommandArg.c' || echo '$(srcdir)/'`src/c/DefaultCommandArg.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscigraphics_algo_la-DefaultCommandArg.Tpo src/c/$(DEPDIR)/libscigraphics_algo_la-DefaultCommandArg.Plo
index 3f1b58c..27c333f 100644 (file)
@@ -287,6 +287,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="src\c\getHandleProperty\get_grid_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_grid_style_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_grid_thickness_property.c" />
+    <ClCompile Include="src\c\getHandleProperty\get_groupname_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_handle_visible_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_hidden_axis_color_property.c" />
     <ClCompile Include="src\c\getHandleProperty\get_hidden_color_property.c" />
@@ -354,6 +355,7 @@ lib /DEF:"$(ProjectDir)elementary_functions_f_Import.def" /SUBSYSTEM:WINDOWS /MA
     <ClCompile Include="src\c\getHandleProperty\set_figure_resizefcn_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_grid_style_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_grid_thickness_property.c" />
+    <ClCompile Include="src\c\getHandleProperty\set_groupname_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_infobar_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_layout_options_property.c" />
     <ClCompile Include="src\c\getHandleProperty\set_layout_property.c" />
index 9c4c310..f2056ed 100644 (file)
     <ClCompile Include="src\c\getHandleProperty\set_borders_property.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\c\getHandleProperty\get_groupname_property.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\c\getHandleProperty\set_groupname_property.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\Axes.h">
index 66ff2a3..a52785c 100755 (executable)
@@ -1034,6 +1034,7 @@ function %h_p(h)
                 "Constraints = "+sci2exp(c)
                 "Borders = "+sci2exp(b)
                 "Margins = "+sci2exp(h.margins)
+                "Groupname = "+sci2exp(h.groupname)
                 "Userdata = "+fmtuser_data(u)
                 "Tag = "+h.tag
                 ]
index d801d27..093a2e4 100755 (executable)
@@ -241,7 +241,8 @@ static getHashTableCouple propertyGetTable[] =
     {"constraints", get_constraints_property},
     {"rect", get_rect_property},
     {"layout_options", get_layout_options_property},
-    {"borders", get_borders_property}
+    {"borders", get_borders_property},
+    {"groupname", get_groupname_property}
 };
 
 /*--------------------------------------------------------------------------*/
index f1472ee..ce0f368 100755 (executable)
@@ -242,7 +242,8 @@ static setHashTableCouple propertySetTable[] =
     {"constraints", set_constraints_property},
     {"rect", set_rect_property},
     {"layout_options", set_layout_options_property},
-    {"borders", set_borders_property}
+    {"borders", set_borders_property},
+    {"groupname", set_groupname_property}
 };
 
 /*--------------------------------------------------------------------------*/
index 68ea8aa..a898bb9 100755 (executable)
@@ -214,5 +214,6 @@ int get_constraints_property(void* _pvCtx, int iObjUID);
 int get_rect_property(void* _pvCtx, int iObjUID);
 int get_layout_options_property(void* _pvCtx, int iObjUID);
 int get_borders_property(void* _pvCtx, int iObjUID);
+int get_groupname_property(void* _pvCtx, int iObjUID);
 
 #endif /* _GET_HANDLE_PROPERTY_H_ */
diff --git a/scilab/modules/graphics/src/c/getHandleProperty/get_groupname_property.c b/scilab/modules/graphics/src/c/getHandleProperty/get_groupname_property.c
new file mode 100644 (file)
index 0000000..d60db5c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ */
+
+/*------------------------------------------------------------------------*/
+/* file: get_info_message_property.c                                       */
+/* desc : function to retrieve in Scilab the info_message field of a       */
+/*        handle                                                          */
+/*------------------------------------------------------------------------*/
+
+#include "getHandleProperty.h"
+#include "returnProperty.h"
+#include "Scierror.h"
+#include "localization.h"
+
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+
+/*------------------------------------------------------------------------*/
+int get_groupname_property(void* _pvCtx, int iObjUID)
+{
+    char *pstGroupName = NULL;
+    getGraphicObjectProperty(iObjUID, __GO_UI_GROUP_NAME__, jni_string, (void **)&pstGroupName);
+
+    if (pstGroupName == NULL)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "groupname");
+        return -1;
+    }
+
+    return sciReturnString(_pvCtx, pstGroupName);
+}
+/*------------------------------------------------------------------------*/
index ea7449f..b16a0cc 100755 (executable)
@@ -215,5 +215,6 @@ int set_constraints_property(void* _pvCtx, int iObj, void* _pvData, int valueTyp
 int set_rect_property(void* _pvCtx, int iObj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_layout_options_property(void* _pvCtx, int iObj, void* _pvData, int valueType, int nbRow, int nbCol);
 int set_borders_property(void* _pvCtx, int iObj, void* _pvData, int valueType, int nbRow, int nbCol);
+int set_groupname_property(void* _pvCtx, int iObj, void* _pvData, int valueType, int nbRow, int nbCol);
 
 #endif /* _SET_HANDLE_PROPERTY_H_ */
diff --git a/scilab/modules/graphics/src/c/getHandleProperty/set_groupname_property.c b/scilab/modules/graphics/src/c/getHandleProperty/set_groupname_property.c
new file mode 100644 (file)
index 0000000..fa4cb7f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
+ */
+
+/*------------------------------------------------------------------------*/
+/* file: set_info_message_property.c                                      */
+/* desc : function to modify in Scilab the info_message field of          */
+/*        a handle                                                        */
+/*------------------------------------------------------------------------*/
+
+#include "setHandleProperty.h"
+#include "SetProperty.h"
+#include "GetProperty.h"
+#include "getPropertyAssignedValue.h"
+#include "Scierror.h"
+#include "localization.h"
+#include "SetPropertyStatus.h"
+
+#include "setGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+
+/*------------------------------------------------------------------------*/
+int set_groupname_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
+{
+    BOOL status = FALSE;
+    if (valueType != sci_strings)
+    {
+        Scierror(999, _("Wrong type for '%s' property: String expected.\n"), "groupname");
+        return SET_PROPERTY_ERROR;
+    }
+
+    status = setGraphicObjectProperty(iObjUID, __GO_UI_GROUP_NAME__, _pvData, jni_string, 1);
+
+    if (status == TRUE)
+    {
+        return SET_PROPERTY_SUCCEED;
+    }
+    else
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "groupname");
+        return SET_PROPERTY_ERROR;
+    }
+}
+/*------------------------------------------------------------------------*/
index eb406df..2638efc 100644 (file)
@@ -71,6 +71,7 @@ static const char* propertiesNames[] =
     "layout",
     "margins"
     "borders",
+    "groupname"
 };
 
 /*--------------------------------------------------------------------------*/
@@ -317,7 +318,7 @@ int sci_uicontrol(char *fname, unsigned long fname_len)
                     {
                         getGraphicObjectProperty(iParentUID, __GO_STYLE__, jni_int, (void **)&piParentStyle);
                         if (iParentType != __GO_UICONTROL__ ||
-                            (iParentStyle != __GO_UI_FRAME__ && iParentStyle != __GO_UI_TAB__ && iParentStyle != __GO_UI_LAYER__))
+                                (iParentStyle != __GO_UI_FRAME__ && iParentStyle != __GO_UI_TAB__ && iParentStyle != __GO_UI_LAYER__))
                         {
                             Scierror(999, _("%s: Wrong type for input argument #%d: A '%s' or a '%s' handle expected.\n"), fname, 1, "Figure",
                                      "Frame uicontrol");
@@ -370,7 +371,7 @@ int sci_uicontrol(char *fname, unsigned long fname_len)
                 {
                     getGraphicObjectProperty(iParentUID, __GO_STYLE__, jni_int, (void **)&piParentStyle);
                     if (iParentType != __GO_UICONTROL__ ||
-                        (iParentStyle != __GO_UI_FRAME__ && iParentStyle != __GO_UI_TAB__ && iParentStyle != __GO_UI_LAYER__))
+                            (iParentStyle != __GO_UI_FRAME__ && iParentStyle != __GO_UI_TAB__ && iParentStyle != __GO_UI_LAYER__))
                     {
                         Scierror(999, _("%s: Wrong type for input argument #%d: A '%s' or a '%s' handle expected.\n"), fname, 1, "Figure",
                                  "Frame uicontrol");
index d8671a8..a780f33 100644 (file)
@@ -13,8 +13,8 @@
 
 package org.scilab.modules.gui;
 
-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_PARENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
@@ -43,13 +43,18 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VERTICALALIGNMENT__;
 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 java.awt.Color;
 import java.awt.Font;
 
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
+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;
@@ -431,6 +436,19 @@ public final class SwingViewWidget {
                 SwingViewWidget.update(uiControl, __GO_POSITION__,
                                        GraphicController.getController().getProperty(uid, __GO_POSITION__));
                 break;
+            case __GO_UI_GROUP_NAME__ :
+                if (uiControl instanceof SwingScilabRadioButton
+                        || uiControl instanceof SwingScilabCheckBox) {
+                    String groupName = (String)value;
+                    if (groupName == null || groupName.equals("")) {
+                        //remove rb from buttonGroup Map
+                        GroupManager.getGroupManager().removeFromGroup((AbstractButton) uiControl);
+                    } else {
+                        GroupManager.getGroupManager().addToGroup(groupName, (AbstractButton) uiControl);
+                    }
+                }
+
+                break;
             default :
                 //System.err.println("[SwingScilabWidget.update] Property not mapped: " + property);
         }
index 56e78a8..2fe4a99 100644 (file)
 
 package org.scilab.modules.gui.bridge.checkbox;
 
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
 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_VALUE__;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.util.Enumeration;
 
+import javax.swing.AbstractButton;
 import javax.swing.JCheckBox;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
-import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.SwingViewWidget;
+import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
+import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
 import org.scilab.modules.gui.checkbox.SimpleCheckBox;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -63,10 +68,39 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
             @Override
             public void actionPerformed(ActionEvent e) {
                 Double[] value = new Double[1];
-                value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
                 if (isSelected()) {
                     value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+                } else {
+                    value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
                 }
+
+                if (isSelected()) {
+                    String groupname = (String) GraphicController.getController().getProperty(uid, __GO_UI_GROUP_NAME__);
+                    if (groupname != null && groupname.equals("") == false) {
+                        Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
+                        while (elements.hasMoreElements()) {
+                            AbstractButton aButton =  elements.nextElement();
+                            if (aButton == e.getSource()) {
+                                continue;
+                            }
+
+                            Integer id = 0;
+                            if (aButton instanceof SwingScilabRadioButton) {
+                                id = ((SwingScilabRadioButton)aButton).getId();
+                            } else if (aButton instanceof SwingScilabRadioButton) {
+                                id = ((SwingScilabCheckBox)aButton).getId();
+                            } else {
+                                continue;
+                            }
+                            //update model with min value
+                            Double newValue[] = new Double[1];
+                            newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MIN__);
+                            GraphicController.getController().setProperty(id, __GO_UI_VALUE__, newValue);
+                        }
+                    }
+                }
+
+
                 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
                 if (callback != null) {
                     callback.actionPerformed(e);
@@ -192,7 +226,41 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
             removeActionListener(actListener);
         }
 
-        setSelected(status);
+        String groupname = (String) GraphicController.getController().getProperty(uid, __GO_UI_GROUP_NAME__);
+        if (groupname != null && groupname.equals("") == false) {
+            // use setSelected of ButtonGroup instead of JRadioButton
+            GroupManager.getGroupManager().setSelected(getModel(), groupname, status);
+
+            //update model with changes
+            Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
+            while (elements.hasMoreElements()) {
+                AbstractButton aButton = elements.nextElement();
+                Integer id = 0;
+                boolean selected = false;
+
+                if (aButton instanceof SwingScilabRadioButton) {
+                    id = ((SwingScilabRadioButton)aButton).getId();
+                    selected = ((SwingScilabRadioButton)aButton).isSelected();
+                } else if (aButton instanceof SwingScilabCheckBox) {
+                    id = ((SwingScilabCheckBox)aButton).getId();
+                    selected = ((SwingScilabCheckBox)aButton).isSelected();
+                } else {
+                    continue;
+                }
+
+                // update model with min value
+                Double newValue[] = new Double[1];
+                if (selected) {
+                    newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MAX__);
+                } else {
+                    newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MIN__);
+                }
+                GraphicController.getController().setProperty(id, __GO_UI_VALUE__, newValue);
+            }
+
+        } else {
+            setSelected(status);
+        }
 
         /* Put back the listener */
         if (actListener != null) {
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/groupmanager/GroupManager.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/groupmanager/GroupManager.java
new file mode 100644 (file)
index 0000000..71da651
--- /dev/null
@@ -0,0 +1,57 @@
+package org.scilab.modules.gui.bridge.groupmanager;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.ButtonModel;
+
+public class GroupManager {
+    private Map<String, ButtonGroup> buttonGroup = new HashMap<String, ButtonGroup>();
+    private static GroupManager me;
+
+    private GroupManager() {
+    }
+
+    public static GroupManager getGroupManager() {
+        if (me == null) {
+            me = new GroupManager();
+        }
+
+        return me;
+    }
+
+    public void addToGroup(String groupName, AbstractButton obj) {
+
+        //first is to remove obj from others group
+        removeFromGroup(obj);
+
+        ButtonGroup group = buttonGroup.get(groupName);
+        if (group == null) {
+            group = new ButtonGroup();
+            buttonGroup.put(groupName, group);
+        }
+
+        group.add(obj);
+    }
+
+    public void removeFromGroup(AbstractButton obj) {
+        Collection<ButtonGroup> groupList = buttonGroup.values();
+        for (ButtonGroup group : groupList) {
+            group.remove(obj);
+        }
+    }
+
+    public Enumeration<AbstractButton> getGroupElements(String groupname) {
+        ButtonGroup group = buttonGroup.get(groupname);
+        return group.getElements();
+    }
+
+    public void setSelected(ButtonModel model, String groupname, boolean status) {
+        ButtonGroup group = buttonGroup.get(groupname);
+        group.setSelected(model, status);
+    }
+}
index dbbf19c..b24e6da 100644 (file)
 
 package org.scilab.modules.gui.bridge.radiobutton;
 
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
 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_VALUE__;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
 import javax.swing.JRadioButton;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
+import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
+import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.radiobutton.SimpleRadioButton;
@@ -64,10 +73,38 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
             @Override
             public void actionPerformed(ActionEvent e) {
                 Double[] value = new Double[1];
-                value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
                 if (isSelected()) {
                     value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+                } else {
+                    value[0] = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+                }
+
+                if (isSelected()) {
+                    String groupname = (String) GraphicController.getController().getProperty(uid, __GO_UI_GROUP_NAME__);
+                    if (groupname != null && groupname.equals("") == false) {
+                        Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
+                        while (elements.hasMoreElements()) {
+                            AbstractButton aButton =  elements.nextElement();
+                            if (aButton == e.getSource()) {
+                                continue;
+                            }
+
+                            Integer id = 0;
+                            if (aButton instanceof SwingScilabRadioButton) {
+                                id = ((SwingScilabRadioButton)aButton).getId();
+                            } else if (aButton instanceof SwingScilabRadioButton) {
+                                id = ((SwingScilabCheckBox)aButton).getId();
+                            } else {
+                                continue;
+                            }
+                            //update model with min value
+                            Double newValue[] = new Double[1];
+                            newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MIN__);
+                            GraphicController.getController().setProperty(id, __GO_UI_VALUE__, newValue);
+                        }
+                    }
                 }
+
                 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
                 if (callback != null) {
                     callback.actionPerformed(e);
@@ -193,7 +230,43 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
             removeActionListener(actListener);
         }
 
-        setSelected(status);
+
+        String groupname = (String) GraphicController.getController().getProperty(uid, __GO_UI_GROUP_NAME__);
+        if (groupname != null && groupname.equals("") == false) {
+            // use setSelected of ButtonGroup instead of JRadioButton
+            GroupManager.getGroupManager().setSelected(getModel(), groupname, status);
+
+            //update model with changes
+            Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
+            while (elements.hasMoreElements()) {
+
+                AbstractButton aButton = elements.nextElement();
+                Integer id = 0;
+                boolean selected = false;
+
+                if (aButton instanceof SwingScilabRadioButton) {
+                    id = ((SwingScilabRadioButton)aButton).getId();
+                    selected = ((SwingScilabRadioButton)aButton).isSelected();
+                } else if (aButton instanceof SwingScilabCheckBox) {
+                    id = ((SwingScilabCheckBox)aButton).getId();
+                    selected = ((SwingScilabCheckBox)aButton).isSelected();
+                } else {
+                    continue;
+                }
+
+                // update model with min value
+                Double newValue[] = new Double[1];
+                if (selected) {
+                    newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MAX__);
+                } else {
+                    newValue[0] = (Double) GraphicController.getController().getProperty(id, __GO_UI_MIN__);
+                }
+                GraphicController.getController().setProperty(id, __GO_UI_VALUE__, newValue);
+            }
+
+        } else {
+            setSelected(status);
+        }
 
         /* Put back the listener */
         if (actListener != null) {
@@ -259,10 +332,10 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
     }
 
     /**
-     * Generic update method
-     * @param property property name
-     * @param value property value
-     */
+    * Generic update method
+    * @param property property name
+    * @param value property value
+    */
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiogroup/SwingScilabRadioGroup.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiogroup/SwingScilabRadioGroup.java
deleted file mode 100644 (file)
index 53f2014..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * 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
- *
- */
-
-package org.scilab.modules.gui.bridge.radiogroup;
-
-import javax.swing.ButtonGroup;
-
-import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
-import org.scilab.modules.gui.radiobutton.RadioButton;
-import org.scilab.modules.gui.radiogroup.RadioGroup;
-
-/**
- * Swing implementation for Scilab RadioGroup in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class SwingScilabRadioGroup extends ButtonGroup implements RadioGroup {
-
-    private static final long serialVersionUID = 5155598847554099496L;
-
-    /**
-     * Constructor
-     */
-    public SwingScilabRadioGroup() {
-        super();
-    }
-
-    /**
-     * Add a RadioButton to a RadioGroup
-     * @param button the button to add
-     */
-    public void add(RadioButton button) {
-        super.add((SwingScilabRadioButton) button);
-    }
-
-    /**
-     * Remove a RadioButton from a RadioGroup.
-     * @param button the button to remove
-     */
-    public void remove(RadioButton button) {
-        super.remove((SwingScilabRadioButton) button);
-    }
-
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/RadioGroup.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/RadioGroup.java
deleted file mode 100644 (file)
index aa649d0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * 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
- *
- */
-
-package org.scilab.modules.gui.radiogroup;
-
-import org.scilab.modules.gui.radiobutton.RadioButton;
-
-/**
- * Interface for RadioGroup associated to objects in Scilab GUIs
- * @author Marouane BEN JELLOUL
- */
-public interface RadioGroup {
-
-    /**
-     * add a RadioButton in a RadioGroup.
-     * @param button the button to add
-     */
-    void add(RadioButton button);
-
-    /**
-     * remove a RadioButton from a RadioGroup.
-     * @param button the button to remove
-     */
-    void remove(RadioButton button);
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/ScilabRadioGroupBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/radiogroup/ScilabRadioGroupBridge.java
deleted file mode 100644 (file)
index aad8eac..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * 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
- *
- */
-
-package org.scilab.modules.gui.radiogroup;
-
-import org.scilab.modules.gui.bridge.radiogroup.SwingScilabRadioGroup;
-
-/**
- * Bridge for Scilab RadioGroup in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class ScilabRadioGroupBridge {
-
-    /**
-     * Constructor
-     */
-    protected ScilabRadioGroupBridge() {
-        throw new UnsupportedOperationException(); /* Prevents calls from subclass */
-    }
-
-    /**
-     * Creates a Scilab RadioGroup
-     * @return the created RadioGroup
-     */
-    public static RadioGroup createRadioGroup() {
-        return new SwingScilabRadioGroup();
-    }
-}
diff --git a/scilab/modules/gui/tests/unit_tests/radiobutton.groupname.dia.ref b/scilab/modules/gui/tests/unit_tests/radiobutton.groupname.dia.ref
new file mode 100644 (file)
index 0000000..e1a3d10
--- /dev/null
@@ -0,0 +1,105 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+function check(rb)
+    rb.value = rb.max;
+endfunction
+function uncheck(rb)
+    rb.value = rb.min;
+endfunction
+function a = checked(rb)
+    a = rb.value == rb.max;
+endfunction
+function a = getStatus()
+    a = [checked(rb1), checked(rb2), checked(rb3), checked(rb4)];
+endfunction
+f1 = figure("toolbar_visible", "off", "menubar_visible", "off", "infobar_visible", "off");
+f1.figure_position = [100, 100];
+f1.figure_size = [200, 200];
+f2 = figure("toolbar_visible", "off", "menubar_visible", "off", "infobar_visible", "off");
+f2.figure_position = [300, 100];
+f2.figure_size = [200, 200];
+//all in same group
+rb1 = uicontrol(f1, "style", "radiobutton", "string", "radiobutton 1", "position", [30 35 100 25], "groupname", "group1");
+rb2 = uicontrol(f1, "style", "checkbox", "string", "checkbox 2", "position", [30 85 100 25], "groupname", "group1");
+rb3 = uicontrol(f2, "style", "radiobutton", "string", "radiobutton 3", "position", [30 35 100 25], "groupname", "group1");
+rb4 = uicontrol(f2, "style", "checkbox", "string", "checkbox 4", "position", [30 85 100 25], "groupname", "group1");
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+check(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+//remove rb1 and rb3 from group 1
+rb1.groupname = "";
+rb3.groupname = "";
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+check(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+//add rb1 and rb2 in a second group
+rb1.groupname = "group2";
+rb3.groupname = "group2";
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+check(rb2);
+assert_checkequal(getStatus(), [%t %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%t %t %f %f]);
+check(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %t %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %t %t]);
+//move rb1 and rb3 from group2 to group1
+rb1.groupname = "group1";
+rb3.groupname = "group1";
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+check(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+delete(f1);
+delete(f2);
diff --git a/scilab/modules/gui/tests/unit_tests/radiobutton.groupname.tst b/scilab/modules/gui/tests/unit_tests/radiobutton.groupname.tst
new file mode 100644 (file)
index 0000000..66011a6
--- /dev/null
@@ -0,0 +1,135 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+function check(rb)
+    rb.value = rb.max;
+endfunction
+
+function uncheck(rb)
+    rb.value = rb.min;
+endfunction
+
+function a = checked(rb)
+    a = rb.value == rb.max;
+endfunction
+
+function a = getStatus()
+    a = [checked(rb1), checked(rb2), checked(rb3), checked(rb4)];
+endfunction
+
+
+f1 = figure("toolbar_visible", "off", "menubar_visible", "off", "infobar_visible", "off");
+f1.figure_position = [100, 100];
+f1.figure_size = [200, 200];
+f2 = figure("toolbar_visible", "off", "menubar_visible", "off", "infobar_visible", "off");
+f2.figure_position = [300, 100];
+f2.figure_size = [200, 200];
+
+
+//all in same group
+rb1 = uicontrol(f1, "style", "radiobutton", "string", "radiobutton 1", "position", [30 35 100 25], "groupname", "group1");
+rb2 = uicontrol(f1, "style", "checkbox", "string", "checkbox 2", "position", [30 85 100 25], "groupname", "group1");
+rb3 = uicontrol(f2, "style", "radiobutton", "string", "radiobutton 3", "position", [30 35 100 25], "groupname", "group1");
+rb4 = uicontrol(f2, "style", "checkbox", "string", "checkbox 4", "position", [30 85 100 25], "groupname", "group1");
+
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+
+check(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+
+
+//remove rb1 and rb3 from group 1
+rb1.groupname = "";
+rb3.groupname = "";
+
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+
+check(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+
+//add rb1 and rb2 in a second group
+rb1.groupname = "group2";
+rb3.groupname = "group2";
+
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %t]);
+
+check(rb2);
+assert_checkequal(getStatus(), [%t %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%t %t %f %f]);
+
+check(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %t %t %f]);
+
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %t %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %t %t]);
+
+//move rb1 and rb3 from group2 to group1
+rb1.groupname = "group1";
+rb3.groupname = "group1";
+
+check(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+uncheck(rb1);
+assert_checkequal(getStatus(), [%t %f %f %f]);
+
+check(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+uncheck(rb2);
+assert_checkequal(getStatus(), [%f %t %f %f]);
+
+check(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+uncheck(rb3);
+assert_checkequal(getStatus(), [%f %f %t %f]);
+
+check(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+uncheck(rb4);
+assert_checkequal(getStatus(), [%f %f %f %t]);
+
+delete(f1);
+delete(f2);
\ No newline at end of file