Enable Callbacks for all GraphicObjects 68/5168/4
Vincent COUVERT [Thu, 6 Oct 2011 13:19:46 +0000 (15:19 +0200)]
Change-Id: Ic7dfad9e381374a227096945c5caa527390315b1

96 files changed:
scilab/modules/graph/src/java/org/scilab/modules/graph/actions/base/DefaultAction.java
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/CallBack.java [new file with mode: 0644]
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObject.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/macros/%h_p.sci
scilab/modules/graphics/src/c/getHandleProperty/get_callback_property.c
scilab/modules/graphics/src/c/getHandleProperty/get_callback_type_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_callback_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_callback_type_property.c
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingScilabWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkbox/SwingScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkboxmenuitem/SwingScilabCheckBoxMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/console/SwingScilabConsole.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/contextmenu/SwingScilabContextMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/imagerenderer/SwingScilabImageRenderer.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/label/SwingScilabLabel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/menu/SwingScilabMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/menuitem/SwingScilabMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/popupmenu/SwingScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/pushbutton/SwingScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiobutton/SwingScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/textbox/SwingScilabTextBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tree/SwingScilabTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uidisplaytree/SwingScilabUiDisplayTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uitable/SwingScilabUiTable.java
scilab/modules/gui/src/java/org/scilab/modules/gui/checkbox/ScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/checkbox/ScilabCheckBoxBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/checkboxmenuitem/ScilabCheckBoxMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/checkboxmenuitem/ScilabCheckBoxMenuItemBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/contextmenu/ScilabContextMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/contextmenu/ScilabContextMenuBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/editbox/ScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/editbox/ScilabEditBoxBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CallBack.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CommonCallBack.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/JavaCallBack.java
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/ScilabCallBack.java
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/ScilabCloseCallBack.java
scilab/modules/gui/src/java/org/scilab/modules/gui/frame/Frame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/frame/ScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/frame/ScilabFrameBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/frame/SimpleFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/helpbrowser/ScilabHelpBrowser.java
scilab/modules/gui/src/java/org/scilab/modules/gui/imagerenderer/ScilabImageRenderer.java
scilab/modules/gui/src/java/org/scilab/modules/gui/imagerenderer/ScilabImageRendererBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/label/ScilabLabel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/label/ScilabLabelBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBoxBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menu/Menu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menu/ScilabMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menu/ScilabMenuBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menu/SimpleMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menuitem/ScilabMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menuitem/ScilabMenuItemBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/popupmenu/ScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/popupmenu/ScilabPopupMenuBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/pushbutton/ScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/pushbutton/ScilabPushButtonBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/radiobutton/ScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/radiobutton/ScilabRadioButtonBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/slider/ScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/slider/ScilabSliderBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/ScilabTabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/SimpleTab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tab/Tab.java
scilab/modules/gui/src/java/org/scilab/modules/gui/textbox/ScilabTextBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/textbox/ScilabTextBoxBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tree/ScilabTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tree/Tree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uidisplaytree/ScilabUiDisplayTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uidisplaytree/ScilabUiDisplayTreeBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uitable/ScilabUiTable.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uitable/ScilabUiTableBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/MenuBarBuilder.java
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/ToolBarBuilder.java
scilab/modules/gui/src/java/org/scilab/modules/gui/widget/Widget.java
scilab/modules/gui/tests/unit_tests/uicontrol_generic_test.sci
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotes.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/DefaultAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/DefaultCheckAction.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/NavigatorWindow.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/SearchFile.java
scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/BasicBlock.java
scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockMouseListener.java
scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteManagerMouseListener.java

index c3fe6eb..3be2914 100644 (file)
@@ -32,7 +32,7 @@ import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.ScilabCheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.gui.pushbutton.PushButton;
@@ -43,7 +43,7 @@ import com.mxgraph.swing.mxGraphComponent;
 /**
  * Default action for a Scilab Graph
  */
-public abstract class DefaultAction extends CallBack {
+public abstract class DefaultAction extends CommonCallBack {
        private static final Set<String> ICON_PATH = new HashSet<String>();
 
        static {
index 01bbc73..7622e2e 100644 (file)
@@ -53,6 +53,8 @@
 #define __GO_HAS_LEGEND_CHILD__            "HasLegendChild"
 #define __GO_LEGEND_CHILD__                "LegendChild"
 #define __GO_SELECTED_CHILD__              "SelectedChild"
+#define __GO_CALLBACK__                    "Callback"
+#define __GO_CALLBACKTYPE__                "CallbackType"
 
 #define __GO_DATA_MODEL_COORDINATES__      "DataModelCoordinates"
 #define __GO_DATA_MODEL_X__                "DataModelX"
diff --git a/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/CallBack.java b/scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/CallBack.java
new file mode 100644 (file)
index 0000000..52859d1
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *  Copyright (C) 2011 - DIGITEO - Vincent COUVERT
+ *
+ *  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-en.txt
+ *
+ */
+package org.scilab.modules.graphic_objects.graphicObject;
+
+/**
+ * Abstract class to manage all callbacks.
+ *
+ * @author Bruno JOFRET
+ */
+public class CallBack {
+
+    /**
+     * Unmanaged command type constant
+     */
+    public static final int UNTYPED = -1;
+    /**
+     * Scilab instruction command type constant
+     */
+    public static final int SCILAB_INSTRUCTION = 0;
+    /**
+     * C or Fortran function type constant
+     */
+    public static final int C_FORTRAN = 1;
+    /**
+     * Scilab function type constant
+     */
+    public static final int SCILAB_FUNCTION = 2;
+    /**
+     * Scilab function type constant (not trapped by scilab event listeners)
+     */
+    public static final int SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE = -2;
+    /**
+     * Java function type constant
+     */
+    public static final int JAVA = 3;
+    /**
+     * Java function type constant (not trapped by scilab event listeners)
+     */
+    public static final int JAVA_OUT_OF_XCLICK_AND_XGETMOUSE = -3;
+
+    /**
+     * Scilab instruction without GCBO setting (old addmenu compatibility)
+     */
+    public static final int SCILAB_INSTRUCTION_WITHOUT_GCBO = 4;
+
+    /**
+     * The Command to Store and remember.
+     */
+    private String command;
+
+    /**
+     * The command type
+     */
+    private int commandType;
+    
+    /**
+     * Constructor to be seen by specifics CallBack.
+     * @param command the command associated to the ccallback
+     */
+    public CallBack(String command) {
+        this(command, UNTYPED);
+    }
+
+    /**
+     * Constructor to be seen by specifics CallBack.
+     * @param command the command associated to the ccallback
+     * @param commandType the command type 
+     */
+    public CallBack(String command, int commandType) {
+        this.command = command;
+        this.commandType =  commandType;
+    }
+
+    /**
+     * @param command sets the command
+     */
+    public void setCommand(String command) {
+        this.command = command;
+    }
+    
+    /**
+     * @return the command if it's a Scilab instruction.
+     */
+    public String getCommand() {
+        return command;
+    }
+    
+    /**
+     * @param commandType sets the command
+     */
+    public void setCommandType(int commandType) {
+        this.commandType = commandType;
+    }
+    
+    /**
+     * @return the command type
+     */
+    public int getCommandType() {
+        return commandType;
+    }
+}
index 06beb32..633a090 100644 (file)
@@ -40,7 +40,7 @@ public abstract class GraphicObject implements Cloneable {
 
     /** GraphicObject properties */
     public enum GraphicObjectPropertyType { PARENT, CHILDREN, CHILDREN_COUNT, VISIBLE, USERDATA, USERDATASIZE, TYPE, REFERENCED, VALID, DATA,
-        PARENT_FIGURE, PARENT_AXES, HASLEGENDCHILD, LEGENDCHILD, SELECTEDCHILD, TAG, UNKNOWNPROPERTY 
+        PARENT_FIGURE, PARENT_AXES, HASLEGENDCHILD, LEGENDCHILD, SELECTEDCHILD, TAG, CALLBACK, CALLBACKTYPE, UNKNOWNPROPERTY 
     };
 
     /** Identifier */
@@ -67,6 +67,9 @@ public abstract class GraphicObject implements Cloneable {
     /** Tag */
     private String tag;
 
+    /** Callback */
+    private CallBack callback;
+
     /**
      * Identifier of the selected child
      * This was previously implemented as a list, but is used in practice
@@ -86,8 +89,14 @@ public abstract class GraphicObject implements Cloneable {
         referenced = false;
         selectedChild = "";
         tag = "";
+        callback = new CallBack("");
     }
 
+    /**
+     * Clone
+     * @return clone
+     * @see java.lang.Object#clone()
+     */
     public GraphicObject clone() {
         GraphicObject copy = null;
 
@@ -228,6 +237,10 @@ public abstract class GraphicObject implements Cloneable {
             return GraphicObjectPropertyType.DATA;
         }  else if (propertyName.equals(__GO_TAG__)) {
             return GraphicObjectPropertyType.TAG;
+        }  else if (propertyName.equals(__GO_CALLBACK__)) {
+            return GraphicObjectPropertyType.CALLBACK;
+        }  else if (propertyName.equals(__GO_CALLBACKTYPE__)) {
+            return GraphicObjectPropertyType.CALLBACKTYPE;
         }  else {
             return GraphicObjectPropertyType.UNKNOWNPROPERTY;
         }
@@ -267,6 +280,10 @@ public abstract class GraphicObject implements Cloneable {
             return getIdentifier();
         }  else if (property == GraphicObjectPropertyType.TAG) {
             return getTag();
+        }  else if (property == GraphicObjectPropertyType.CALLBACK) {
+            return getCallbackString();
+        }  else if (property == GraphicObjectPropertyType.CALLBACKTYPE) {
+            return getCallbackType();
         }  else if (property == GraphicObjectPropertyType.UNKNOWNPROPERTY) {
             return null;
         } else {
@@ -297,6 +314,10 @@ public abstract class GraphicObject implements Cloneable {
             return true;
         } else if (property == GraphicObjectPropertyType.TAG) {
             setTag((String) value);
+        } else if (property == GraphicObjectPropertyType.CALLBACK) {
+            setCallbackString((String) value);
+        } else if (property == GraphicObjectPropertyType.CALLBACKTYPE) {
+            setCallbackType((Integer) value);
         } else if (property == GraphicObjectPropertyType.UNKNOWNPROPERTY) {
             return false;
         }
@@ -426,6 +447,35 @@ public abstract class GraphicObject implements Cloneable {
     public void setTag(String tag) {
         this.tag = tag;
     }
+
+    /**
+     * @return the callback
+     */
+    public String getCallbackString() {
+        return callback.getCommand();
+    }
+
+    /**
+     * @param callback the callback to set
+     */
+    public void setCallbackString(String callback) {
+        this.callback.setCommand(callback);
+    }
+
+    /**
+     * @return the callbackType
+     */
+    public Integer getCallbackType() {
+        return callback.getCommandType();
+    }
+
+    /**
+     * @param callbackType the callbackType to set
+     */
+    public void setCallbackType(Integer callbackType) {
+        this.callback.setCommandType(callbackType);
+    }
+
     /**
      * Get parent Figure method
      * Returns the identifier of the object's parent Figure
index fdfef52..b1e5b77 100644 (file)
@@ -54,6 +54,8 @@ public static final String __GO_PARENT_AXES__ =            "ParentAxes";
 public static final String __GO_HAS_LEGEND_CHILD__ =       "HasLegendChild";
 public static final String __GO_LEGEND_CHILD__ =           "LegendChild";
 public static final String __GO_SELECTED_CHILD__ =         "SelectedChild";
+public static final String __GO_CALLBACK__ =               "Callback";
+public static final String __GO_CALLBACKTYPE__ =           "CallbackType";
 
 public static final String __GO_DATA_MODEL_COORDINATES__ = "DataModelCoordinates";
 public static final String __GO_DATA_MODEL_X__ =           "DataModelX";
index b7c9ade..ad3b2c4 100644 (file)
@@ -32,6 +32,8 @@
 @DECLARE@ __GO_HAS_LEGEND_CHILD__ @EQUAL@       "HasLegendChild" @END@
 @DECLARE@ __GO_LEGEND_CHILD__ @EQUAL@           "LegendChild" @END@
 @DECLARE@ __GO_SELECTED_CHILD__ @EQUAL@         "SelectedChild" @END@
+@DECLARE@ __GO_CALLBACK__ @EQUAL@               "Callback" @END@
+@DECLARE@ __GO_CALLBACKTYPE__ @EQUAL@           "CallbackType" @END@
 
 @DECLARE@ __GO_DATA_MODEL_COORDINATES__ @EQUAL@ "DataModelCoordinates" @END@
 @DECLARE@ __GO_DATA_MODEL_X__ @EQUAL@           "DataModelX" @END@
index a85415f..edce221 100644 (file)
@@ -889,8 +889,8 @@ function %h_p(h)
             "Value = "+sci2exp(h.value,0)
             "VerticalAlignment = "+h.verticalalignment
             "Visible = "+sci2exp(h.visible)
-            //"Callback = "+h.callback
-            //"CallbackType = "+sci2exp(h.callback_type,0)
+            "Callback = "+h.callback
+            "CallbackType = "+sci2exp(h.callback_type,0)
             //"Handle_visible = "+sci2exp(h.handle_visible)
             //"Userdata = "+fmtuser_data(u)
             "Tag = "+h.tag
index f629130..c2a0da1 100644 (file)
 /*------------------------------------------------------------------------*/
 
 #include "getHandleProperty.h"
-#include "Interaction.h"
 #include "returnProperty.h"
-#include "GetProperty.h"
-#include "MALLOC.h"
+#include "Scierror.h"
+#include "localization.h"
+
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
 
 /*------------------------------------------------------------------------*/
 int get_callback_property(char *pobjUID)
 {
-    //
-    // FIXME
-    //
-#if 0
-  if(sciGetEntityType(pobj) == SCI_UIMENU || sciGetEntityType(pobj) == SCI_UICONTROL)
+    char* callback = NULL;
+    int status = 0;
+
+    getGraphicObjectProperty(pobjUID,  __GO_CALLBACK__, jni_string, (void**) &callback);
+
+    if (callback == NULL)
     {
-      return GetUiobjectCallback(pobj);
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "Callback");
+        return FALSE;
     }
-  else
+    else
     {
-        char * callBack = sciGetCallback(pobj);
-        if (callBack == NULL)
-        {
-            return sciReturnString("");
-        }
-        else
-        {
-            return sciReturnString( sciGetCallback( pobj ) ) ;
-        }
+        status = sciReturnString(callback);
+        free(callback);
+        return status;
     }
-#endif
-  return sciReturnString("");
 }
 /*------------------------------------------------------------------------*/
index 664f48f..b666943 100644 (file)
 /*------------------------------------------------------------------------*/
 
 #include "getHandleProperty.h"
-#include "GetProperty.h"
 #include "returnProperty.h"
 #include "Scierror.h"
 #include "localization.h"
 
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+
 /*------------------------------------------------------------------------*/
 int get_callback_type_property(char *pobjUID)
 {
-    int type = 0;
+    int iCallbackType = 0;
+    int *piCallbackType = &iCallbackType;
 
-    //
-    // FIXME
-    //
-#if 0
-    if(sciGetEntityType (pobj) == SCI_UIMENU)
-    {
-        type = pUIMENU_FEATURE(pobj)->callbackType;
-    }
-    else if (sciGetEntityType (pobj) == SCI_UICONTROL)
-    {
-        type = pUICONTROL_FEATURE(pobj)->callbackType;
-    }
-    else
+    getGraphicObjectProperty(pobjUID, __GO_CALLBACKTYPE__, jni_int, &piCallbackType);
+
+    if (piCallbackType == NULL)
     {
         Scierror(999, _("'%s' property does not exist for this handle.\n"),"callback_type");
-        return -1;
+        return FALSE;
     }
-#endif
-    return sciReturnDouble(type);
+
+    return sciReturnDouble(iCallbackType);
 }
 /*------------------------------------------------------------------------*/
index cb14072..b771477 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2006 - INRIA - Allan Cornet
  * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
  * Copyright (C) 2009 - DIGITEO - Pierre Lando
+ * Copyright (C) 2011 - DIGITEO - Vincent COUVERT
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
 #include "sci_types.h"
 #include "setHandleProperty.h"
 #include "getPropertyAssignedValue.h"
-#include "Interaction.h"
 #include "Scierror.h"
 #include "localization.h"
 #include "SetPropertyStatus.h"
-#include "GetProperty.h"
+#include "graphicObjectProperties.h"
+#include "setGraphicObjectProperty.h"
+#include "stack-c.h"
 /*------------------------------------------------------------------------*/
 int set_callback_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol )
 {
-// FIXME
-    abort();
-#if 0
-  if (sciGetEntityType(pobj) == SCI_UIMENU || sciGetEntityType(pobj) == SCI_UICONTROL)
+    // Callback must be only one character string
+
+    BOOL status = FALSE;
+    char * cbString = NULL;
+    int cbType = 0;
+
+    int strNbRow = 0, strNbCol = 0;
+    int typeNbRow = 0, typeNbCol = 0;
+    int typeStackPointer = 0, stringStackPointer = 0;
+
+    if (valueType == sci_strings)
     {
-      if ( (!isParameterStringMatrix( valueType )) && (valueType != sci_list) )
-        {
-          Scierror(999, _("Wrong type for '%s' property: String matrix expected.\n"), "callback");
-          return SET_PROPERTY_ERROR ;
+        if (nbCol != 1) {
+            Scierror(999, _("Wrong size for '%s' property: A string expected.\n"), "Callback");
+            return SET_PROPERTY_ERROR;
         }
-      return SetUiobjectCallback(pobj, stackPointer, valueType, nbRow, nbCol);
+        cbString = getStringFromStack(stackPointer);
     }
-  else
+    else if (valueType == sci_list)
     {
-      if ( !isParameterStringMatrix( valueType ) )
+        if (nbRow * nbCol != 2)
         {
-          Scierror(999, _("Wrong type for '%s' property: String matrix expected.\n"), "callback");
-          return SET_PROPERTY_ERROR ;
+            Scierror(999, _("Wrong size for '%s' property: a 2-item list expected.\n"), "Callback");
+            return SET_PROPERTY_ERROR;
+        }
+
+        GetListRhsVar((int)stackPointer, 1, MATRIX_OF_DOUBLE_DATATYPE, &typeNbRow, &typeNbCol, &typeStackPointer);
+        if (typeNbRow * typeNbCol !=1)
+        {
+            Scierror(999, _("Wrong size for '%s' property: A real expected.\n"), "callback_type");
+            return SET_PROPERTY_ERROR;
+        }
+        else
+        {
+            cbType = (int) (*stk(typeStackPointer));
+        }
+
+        GetListRhsVar((int)stackPointer, 2, STRING_DATATYPE, &strNbRow, &strNbCol, &stringStackPointer);
+        if (strNbCol !=1)
+        {
+            Scierror(999, _("Wrong size for '%s' property: A string expected.\n"), "Callback");
+            return SET_PROPERTY_ERROR;
+        }
+        else
+        {
+            cbString = cstk(stringStackPointer);
         }
-     return sciAddCallback( pobj, getStringFromStack( stackPointer ), nbRow * nbCol, 1 ) ;
     }
-#endif
+    else
+    {
 
-return SET_PROPERTY_ERROR;
+        Scierror(999, _("Wrong type for '%s' property: A string or a 2-item list expected.\n"), "Callback");
+        return SET_PROPERTY_ERROR;
+    }
+
+    if (strcmp(cbString, "") == 0)
+    {
+        cbType = -1; /* Disabled */
+    }
+
+    status = setGraphicObjectProperty(pobjUID, __GO_CALLBACK__, cbString, jni_string, 1);
+
+    if (status != TRUE)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "Callback");
+        return SET_PROPERTY_ERROR;
+    }
+
+    status = setGraphicObjectProperty(pobjUID, __GO_CALLBACKTYPE__, &cbType, jni_int, 1);
+
+    if (status == TRUE)
+    {
+        return SET_PROPERTY_SUCCEED;
+    }
+    else
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "callback_type");
+        return SET_PROPERTY_ERROR;
+    }
 }
 /*------------------------------------------------------------------------*/
index 565fef4..03eaccc 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2006 - INRIA - Allan Cornet
  * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
  * Copyright (C) 2009 - DIGITEO - Pierre Lando
+ * Copyright (C) 2011 - DIGITEO - Vincent COUVERT
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
 /*------------------------------------------------------------------------*/
 
 #include "setHandleProperty.h"
-#include "SetProperty.h"
 #include "getPropertyAssignedValue.h"
 #include "Scierror.h"
 #include "localization.h"
-#include "GetProperty.h"
 #include "SetPropertyStatus.h"
 
+#include "setGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+
 /*------------------------------------------------------------------------*/
 int set_callback_type_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol )
 {
-// FIXME
-    abort();
-#if 0
-  int cbType = -1;
-
-  if ( !isParameterDoubleMatrix(valueType) || nbRow !=1 || nbCol != 1 )
-  {
-    Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "callback_type");
-    return SET_PROPERTY_ERROR ;
-  }
+    BOOL status;
+    double callbackType = 0.0;
 
-  cbType = (int)getDoubleFromStack(stackPointer);
-
-  if (cbType < -1 || cbType > 2)
+    if ( !isParameterDoubleMatrix( valueType ) )
     {
-      Scierror(999, _("Wrong value for '%s' property: Must be in the set {%s}.\n"), "callback_type", "-1, 0, 1, 2");
-      return SET_PROPERTY_ERROR ;
+        Scierror(999, _("Wrong type for '%s' property: A Real scalar expected.\n"), "callback_type");
+        return SET_PROPERTY_ERROR;
     }
-
-  if (sciGetEntityType (pobj) == SCI_UIMENU)
+    if (nbRow*nbCol != 1)
     {
-      pUIMENU_FEATURE(pobj)->callbackType = cbType;
+        Scierror(999, _("Wrong size for '%s' property: A Real scalar expected.\n"), "callback_type");
+        return SET_PROPERTY_ERROR;
     }
-  else if (sciGetEntityType (pobj) == SCI_UICONTROL)
+
+    callbackType = getDoubleFromStack(stackPointer);
+
+    status = setGraphicObjectProperty(pobjUID, __GO_CALLBACKTYPE__, &callbackType, jni_int, 1);
+
+    if (status == TRUE)
     {
-      pUICONTROL_FEATURE(pobj)->callbackType = cbType;
+        return SET_PROPERTY_SUCCEED;
     }
-  else
+    else
     {
-      Scierror(999, _("'%s' property does not exist for this handle.\n"),"callback_type");
-      return SET_PROPERTY_ERROR ;
+        Scierror(999, _("'%s' property does not exist for this handle.\n"),"callback_type");
+        return SET_PROPERTY_ERROR;
     }
-#endif
-  return SET_PROPERTY_ERROR;
 }
 /*------------------------------------------------------------------------*/
index 83c69b1..6fb3c4f 100644 (file)
@@ -13,6 +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_PARENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
@@ -53,6 +55,7 @@ import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
 import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
 import org.scilab.modules.gui.bridge.uitable.SwingScilabUiTable;
+import org.scilab.modules.gui.events.callback.ScilabCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.UnitsConverter;
@@ -88,11 +91,18 @@ public final class SwingScilabWidget {
      * @param value the property value
      */
     public static void update(Widget uiControl, String property, Object value) {
+        String uid = ((SwingViewObject) uiControl).getId();
         if (property.equals(__GO_UI_BACKGROUNDCOLOR__)) {
             Double[] allColors = ((Double[]) value);
             uiControl.setBackground(new Color((int) (allColors[0] * COLORS_COEFF),
                     (int) (allColors[1] * COLORS_COEFF),
                     (int) (allColors[2] * COLORS_COEFF)));
+        } else if (property.equals(__GO_CALLBACK__)) {
+            int cbType = (Integer) GraphicController.getController().getProperty(uid, __GO_CALLBACKTYPE__);
+            uiControl.setCallback(ScilabCallBack.createCallback((String) value, cbType));
+        } else if (property.equals(__GO_CALLBACKTYPE__)) {
+            String cbString = (String) GraphicController.getController().getProperty(uid, __GO_CALLBACK__);
+            uiControl.setCallback(ScilabCallBack.createCallback(cbString, (Integer) value));
         } else if (property.equals(__GO_UI_COLUMNNAMES__)) {
             ((SwingScilabUiTable) uiControl).setColumnNames((String[]) value);
         } else if (property.equals(__GO_UI_ENABLE__)) {
@@ -125,7 +135,7 @@ public final class SwingScilabWidget {
             uiControl.setFont(font);
         } else if (property.equals(__GO_UI_FONTSIZE__)) {
             UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController.getController()
-                .getProperty(((SwingViewObject) uiControl).getId(), __GO_UI_FONTUNITS__));
+                    .getProperty(uid, __GO_UI_FONTUNITS__));
             Double dblFontSize = UnitsConverter.convertToPoint((Double) value, fontUnitsProperty, uiControl, false);
             Font font = uiControl.getFont();
             int size = dblFontSize.intValue();
@@ -165,12 +175,12 @@ public final class SwingScilabWidget {
             }
         } else if (property.equals(__GO_UI_MAX__)) {
             int maxValue = ((Integer) value);
+            int uicontrolValue = ((Integer[]) GraphicController.getController().getProperty(uid, __GO_UI_VALUE__))[0];
             if (uiControl instanceof SwingScilabSlider) {
              // Update the slider properties
-                int minValue = (Integer) GraphicController.getController().getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_MIN__);
+                int minValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
                 ((SwingScilabSlider) uiControl).setMaximumValue(maxValue);
-                Double[] sliderStep = ((Double[]) GraphicController.getController()
-                        .getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_SLIDERSTEP__));
+                Double[] sliderStep = ((Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__));
                 double minorSliderStep = sliderStep[0].doubleValue();
                 double majorSliderStep = sliderStep[1].doubleValue();
                 if (minValue <= maxValue) {
@@ -179,27 +189,22 @@ public final class SwingScilabWidget {
                 }
             } else if (uiControl instanceof SwingScilabListBox) {
                 // Enable/Disable multiple selection
-                int minValue = (Integer) GraphicController.getController().getProperty(((SwingScilabListBox) uiControl).getId(), __GO_UI_MIN__);
+                int minValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
                 ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
             } else if (uiControl instanceof SwingScilabCheckBox) {
                 // Check/Uncheck the CheckBox
-                int uicontrolValue = ((Integer[]) GraphicController.getController()
-                        .getProperty(((SwingScilabCheckBox) uiControl).getId(), __GO_UI_VALUE__))[0];
                 ((SwingScilabCheckBox) uiControl).setChecked(maxValue == uicontrolValue);
             } else if (uiControl instanceof SwingScilabRadioButton) {
-             // Check/Uncheck the RadioButton
-                int uicontrolValue = ((Integer[]) GraphicController.getController()
-                        .getProperty(((SwingScilabRadioButton) uiControl).getId(), __GO_UI_VALUE__))[0];
+                // Check/Uncheck the RadioButton
                 ((SwingScilabRadioButton) uiControl).setChecked(maxValue == uicontrolValue);
             }
         } else if (property.equals(__GO_UI_MIN__)) {
             int minValue = ((Integer) value);
             if (uiControl instanceof SwingScilabSlider) {
                 // Update the slider properties
-                int maxValue = (Integer) GraphicController.getController().getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_MAX__);
+                int maxValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
                 ((SwingScilabSlider) uiControl).setMinimumValue(minValue);
-                Double[] sliderStep = ((Double[]) GraphicController.getController()
-                        .getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_SLIDERSTEP__));
+                Double[] sliderStep = ((Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__));
                 double minorSliderStep = sliderStep[0].doubleValue();
                 double majorSliderStep = sliderStep[1].doubleValue();
                 if (minValue <= maxValue) {
@@ -208,13 +213,13 @@ public final class SwingScilabWidget {
                 }
             } else if (uiControl instanceof SwingScilabListBox) {
                 // Enable/Disable multiple selection
-                int maxValue = (Integer) GraphicController.getController().getProperty(((SwingScilabListBox) uiControl).getId(), __GO_UI_MAX__);
+                int maxValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
                 ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
             }
         } else if (property.equals(__GO_POSITION__)) {
             /* Convert value according to units */
             UicontrolUnits unitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController
-                    .getController().getProperty(((SwingViewObject) uiControl).getId(), __GO_UI_UNITS__));
+                    .getController().getProperty(uid, __GO_UI_UNITS__));
             Double[] dblValues = UnitsConverter.convertPositionToPixels((Double[]) value, unitsProperty, uiControl, false);
             /* Set dimensions before position because position is adjusted according to size */
             uiControl.setDims(new Size(dblValues[WIDTH_INDEX].intValue(), dblValues[HEIGHT_INDEX].intValue()));
@@ -249,8 +254,8 @@ public final class SwingScilabWidget {
                 // Update the slider properties
                 double minorSliderStep = sliderStep[0].doubleValue();
                 double majorSliderStep = sliderStep[1].doubleValue();
-                int minValue = (Integer) GraphicController.getController().getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_MIN__);
-                int maxValue = (Integer) GraphicController.getController().getProperty(((SwingScilabSlider) uiControl).getId(), __GO_UI_MAX__);
+                int minValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+                int maxValue = (Integer) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
                 ((SwingScilabSlider) uiControl).setMinimumValue(minValue);
                 if (minValue <= maxValue) {
                     ((SwingScilabSlider) uiControl).setMinorTickSpacing((int) (minorSliderStep * (maxValue - minValue)));
@@ -290,13 +295,11 @@ public final class SwingScilabWidget {
                 ((SwingScilabPopupMenu) uiControl).setSelectedIndex(intValue[0]);
             } else if (uiControl instanceof SwingScilabCheckBox) {
                 // Check the checkbox if the value is equal to MAX property
-                int maxValue = ((Integer) GraphicController.getController()
-                        .getProperty(((SwingScilabCheckBox) uiControl).getId(), __GO_UI_MAX__)).intValue();
+                int maxValue = ((Integer) GraphicController.getController().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
-                int maxValue = ((Integer) GraphicController.getController()
-                        .getProperty(((SwingScilabRadioButton) uiControl).getId(), __GO_UI_MAX__)).intValue();
+                int maxValue = ((Integer) GraphicController.getController().getProperty(uid, __GO_UI_MAX__)).intValue();
                 ((SwingScilabRadioButton) uiControl).setChecked(maxValue == intValue[0]);
             } else if (uiControl instanceof SwingScilabSlider) {
                 // Update the slider value
@@ -310,7 +313,7 @@ public final class SwingScilabWidget {
             /* Update position */
             SwingScilabWidget.update(uiControl, __GO_POSITION__,
                     (Double[]) GraphicController.getController()
-                    .getProperty(((SwingViewObject) uiControl).getId(), __GO_POSITION__));
+                    .getProperty(uid, __GO_POSITION__));
         } else {
             System.err.println("[SwingScilabWidget.update] Property not mapped: " + property);
         }
index 51b1e1e..4d78529 100644 (file)
@@ -66,7 +66,7 @@ import org.scilab.modules.gui.contextmenu.ContextMenu;
 import org.scilab.modules.gui.contextmenu.ScilabContextMenu;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.editbox.ScilabEditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.events.callback.ScilabCloseCallBack;
 import org.scilab.modules.gui.filechooser.FileChooser;
 import org.scilab.modules.gui.filechooser.ScilabFileChooser;
@@ -1133,7 +1133,7 @@ public class CallScilabBridge {
      */
     public static void setWidgetCallback(int objID, String callbackString, int callbackType) {
         ((Widget) UIElementMapper.getCorrespondingUIElement(objID))
-            .setCallback(CallBack.createCallback(callbackString, callbackType, objID));
+            .setCallback(CommonCallBack.createCallback(callbackString, callbackType, objID));
     }
 
     /**
@@ -1143,7 +1143,7 @@ public class CallScilabBridge {
      * @param callbackType the type of the callback
      */
     public static void setFrameCallback(int objID, String callbackString, int callbackType) {
-        ((Frame) UIElementMapper.getCorrespondingUIElement(objID)).setCallback(CallBack.createCallback(callbackString, callbackType, objID));
+        ((Frame) UIElementMapper.getCorrespondingUIElement(objID)).setCallback(CommonCallBack.createCallback(callbackString, callbackType, objID));
     }
 
     /************************/
index 02ce352..116221c 100644 (file)
@@ -45,7 +45,7 @@ import org.scilab.modules.gui.contextmenu.SimpleContextMenu;
 import org.scilab.modules.gui.editbox.EditBox;
 import org.scilab.modules.gui.editbox.ScilabEditBoxBridge;
 import org.scilab.modules.gui.editbox.SimpleEditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.filechooser.FileChooser;
 import org.scilab.modules.gui.filechooser.ScilabFileChooserBridge;
 import org.scilab.modules.gui.filechooser.SimpleFileChooser;
@@ -559,7 +559,7 @@ public class ScilabBridge {
         * @param frame the Frame we want to set the callback of
         * @param callback the callback to set
         */
-       public static void setCallback(Frame frame, CallBack callback) {
+       public static void setCallback(Frame frame, CommonCallBack callback) {
                ScilabFrameBridge.setCallback(frame, callback);
        }
 
@@ -998,7 +998,7 @@ public class ScilabBridge {
         * @param tab the tab which we want to set the callback of
         * @param callback the CallBack to set
         */
-       public static void setCallback(Tab tab, CallBack callback) {
+       public static void setCallback(Tab tab, CommonCallBack callback) {
                ScilabTabBridge.setCallback(tab, callback);
        }
        
@@ -1642,7 +1642,7 @@ public class ScilabBridge {
         * @param menuItem the MenuItem which we want to add the mnemonic to
         * @param callback the CallBack to set.
         */
-       public static void setCallback(MenuItem menuItem, CallBack callback) {
+       public static void setCallback(MenuItem menuItem, CommonCallBack callback) {
                ScilabMenuItemBridge.setCallback(menuItem, callback);
        }
 
@@ -1822,7 +1822,7 @@ public class ScilabBridge {
         * @param menuItem the MenuItem
         * @return the CallBack
         */
-       public static CallBack getCallback(MenuItem menuItem) {
+       public static CommonCallBack getCallback(MenuItem menuItem) {
                return ScilabMenuItemBridge.getCallback(menuItem);
        }
        
@@ -1897,7 +1897,7 @@ public class ScilabBridge {
         * @param checkBoxMenuItem the CheckBoxMenuItem which we want to add the mnemonic to
         * @param callback the CallBack to set.
         */
-       public static void setCallback(CheckBoxMenuItem checkBoxMenuItem, CallBack callback) {
+       public static void setCallback(CheckBoxMenuItem checkBoxMenuItem, CommonCallBack callback) {
                ScilabCheckBoxMenuItemBridge.setCallback(checkBoxMenuItem, callback);
        }
 
@@ -2077,7 +2077,7 @@ public class ScilabBridge {
         * @param checkBoxMenuItem the CheckBoxMenuItem
         * @return the CallBack
         */
-       public static CallBack getCallback(CheckBoxMenuItem checkBoxMenuItem) {
+       public static CommonCallBack getCallback(CheckBoxMenuItem checkBoxMenuItem) {
                return ScilabCheckBoxMenuItemBridge.getCallback(checkBoxMenuItem);
        }
 
@@ -2116,7 +2116,7 @@ public class ScilabBridge {
         * @param menu the Menu
         * @return the CallBack
         */
-       public static CallBack getCallback(Menu menu) {
+       public static CommonCallBack getCallback(Menu menu) {
                return ScilabMenuBridge.getCallback(menu);
        }
        
@@ -2279,7 +2279,7 @@ public class ScilabBridge {
         * @param menu the menu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(Menu menu, CallBack callback) {
+       public static void setCallback(Menu menu, CommonCallBack callback) {
                ScilabMenuBridge.setCallback(menu, callback);
        }
 
@@ -2489,7 +2489,7 @@ public class ScilabBridge {
         * @param contextMenu the contextMenu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(ContextMenu contextMenu, CallBack callback) {
+       public static void setCallback(ContextMenu contextMenu, CommonCallBack callback) {
                ScilabContextMenuBridge.setCallback(contextMenu, callback);
        }
 
@@ -2655,7 +2655,7 @@ public class ScilabBridge {
         * @param pushButton the PushButton we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(PushButton pushButton, CallBack callback) {
+       public static void setCallback(PushButton pushButton, CommonCallBack callback) {
                ScilabPushButtonBridge.setCallback(pushButton, callback);
        }
 
@@ -2960,7 +2960,7 @@ public class ScilabBridge {
         * @param textBox the TextBox we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(TextBox textBox, CallBack callback) {
+       public static void setCallback(TextBox textBox, CommonCallBack callback) {
                ScilabTextBoxBridge.setCallback(textBox, callback);
        }
 
@@ -3183,7 +3183,7 @@ public class ScilabBridge {
         * @param editBox the EditBox we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(EditBox editBox, CallBack callback) {
+       public static void setCallback(EditBox editBox, CommonCallBack callback) {
                ScilabEditBoxBridge.setCallback(editBox, callback);
        }
 
@@ -3406,7 +3406,7 @@ public class ScilabBridge {
         * @param label the Label we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(Label label, CallBack callback) {
+       public static void setCallback(Label label, CommonCallBack callback) {
                ScilabLabelBridge.setCallback(label, callback);
        }
 
@@ -3629,7 +3629,7 @@ public class ScilabBridge {
         * @param checkBox the CheckBox we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(CheckBox checkBox, CallBack callback) {
+       public static void setCallback(CheckBox checkBox, CommonCallBack callback) {
                ScilabCheckBoxBridge.setCallback(checkBox, callback);
        }
 
@@ -3870,7 +3870,7 @@ public class ScilabBridge {
         * @param radioButton the RadioButton we want to set the callback of
         * @param callback the callback to set.
         */
-       public static void setCallback(RadioButton radioButton, CallBack callback) {
+       public static void setCallback(RadioButton radioButton, CommonCallBack callback) {
                ScilabRadioButtonBridge.setCallback(radioButton, callback);
        }
 
@@ -4111,7 +4111,7 @@ public class ScilabBridge {
         * @param slider the Slider we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(Slider slider, CallBack callback) {
+       public static void setCallback(Slider slider, CommonCallBack callback) {
                ScilabSliderBridge.setCallback(slider, callback);
        }
 
@@ -4404,7 +4404,7 @@ public class ScilabBridge {
         * @param listBox the ListBox we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(ListBox listBox, CallBack callback) {
+       public static void setCallback(ListBox listBox, CommonCallBack callback) {
                ScilabListBoxBridge.setCallback(listBox, callback);
        }
 
@@ -4712,7 +4712,7 @@ public class ScilabBridge {
         * @param popupMenu the PopupMenu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(PopupMenu popupMenu, CallBack callback) {
+       public static void setCallback(PopupMenu popupMenu, CommonCallBack callback) {
                ScilabPopupMenuBridge.setCallback(popupMenu, callback);
        }
 
@@ -5575,7 +5575,7 @@ public class ScilabBridge {
         * @param imageRenderer the ImageRenderer we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(ImageRenderer imageRenderer, CallBack callback) {
+       public static void setCallback(ImageRenderer imageRenderer, CommonCallBack callback) {
                ScilabImageRendererBridge.setCallback(imageRenderer, callback);
        }
        
@@ -5825,7 +5825,7 @@ public class ScilabBridge {
         * @param uiTable the UiTable we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(UiTable uiTable, CallBack callback) {
+       public static void setCallback(UiTable uiTable, CommonCallBack callback) {
                ScilabUiTableBridge.setCallback(uiTable, callback);
        }
        
@@ -6076,7 +6076,7 @@ public class ScilabBridge {
         * @param uiTree the UiDisplayTree we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(UiDisplayTree uiTree, CallBack callback) {
+       public static void setCallback(UiDisplayTree uiTree, CommonCallBack callback) {
                ScilabUiDisplayTreeBridge.setCallback(uiTree, callback);
        }
        
index 632245b..0e55f84 100644 (file)
@@ -18,7 +18,7 @@ import javax.swing.JCheckBox;
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.checkbox.SimpleCheckBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
@@ -39,7 +39,7 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
        
     private String uid;
 
-    private CallBack callback;
+    private CommonCallBack callback;
 
        /**
         * Constructor
@@ -101,7 +101,7 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
         * Add a callback to the CheckBox
         * @param callback the callback to set
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                if (this.callback != null) {
                        removeActionListener(this.callback);
                }
index 8cbf2e3..7a790db 100644 (file)
@@ -24,7 +24,7 @@ import org.scilab.modules.gui.bridge.menu.SwingScilabMenu;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.SimpleCheckBoxMenuItem;
 import org.scilab.modules.gui.events.BlockingResult;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -44,7 +44,7 @@ import org.scilab.modules.gui.utils.Size;
 public class SwingScilabCheckBoxMenuItem extends JCheckBoxMenuItem implements SimpleCheckBoxMenuItem {
 
         private static final long serialVersionUID = 1L;
-        private CallBack callback;
+        private CommonCallBack callback;
         private Menu meAsAMenu;
         private boolean autoCheckedMode = true;
         private String text = "";
@@ -102,7 +102,7 @@ public class SwingScilabCheckBoxMenuItem extends JCheckBoxMenuItem implements Si
          * Add a callback to the MenuItem, this callback is a Scilab command
          * @param callback the callback to set.
          */
-        public void setCallback(CallBack callback) {
+        public void setCallback(CommonCallBack callback) {
                 this.callback = callback;
                 addActionListener(this.callback);
         }
@@ -302,7 +302,7 @@ public class SwingScilabCheckBoxMenuItem extends JCheckBoxMenuItem implements Si
          * Retrieve the CallBack associated to this MenuItem
          * @return the CallBack
          */
-        public CallBack getCallback() {
+        public CommonCallBack getCallback() {
                 return callback;
         }
         /**
index a9a509f..8c4f1d4 100644 (file)
@@ -39,6 +39,7 @@ import org.scilab.modules.console.OneCharKeyEventListener;
 import org.scilab.modules.console.SciConsole;
 import org.scilab.modules.console.SciHistoryManager;
 import org.scilab.modules.console.SciOutputView;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
 import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.console.SimpleConsole;
@@ -72,42 +73,42 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
         cutMenu.setText(Messages.gettext("Cut"));
         cutMenu.setCallback(ScilabCallBack.createCallback(
                                                           "org.scilab.modules.gui.bridge.CallScilabBridge.cutConsoleSelection",
-                                                          ScilabCallBack.JAVA));
+                                                          CallBack.JAVA));
         cutMenu.setMnemonic('U');
 
         SwingScilabMenuItem copyMenu = new SwingScilabMenuItem();
         copyMenu.setText(Messages.gettext("Copy"));
         copyMenu.setCallback(ScilabCallBack.createCallback(
                                                            "org.scilab.modules.gui.bridge.CallScilabBridge.copyConsoleSelection",
-                                                           ScilabCallBack.JAVA));
+                                                           CallBack.JAVA));
         copyMenu.setMnemonic('C');
 
         SwingScilabMenuItem pasteMenu = new SwingScilabMenuItem();
         pasteMenu.setText(Messages.gettext("Paste"));
         pasteMenu.setCallback(ScilabCallBack.createCallback(
                                                             "org.scilab.modules.gui.bridge.CallScilabBridge.pasteClipboardIntoConsole",
-                                                            ScilabCallBack.JAVA));
+                                                            CallBack.JAVA));
         pasteMenu.setMnemonic('P');
 
         SwingScilabMenuItem clearHistoryMenu = new SwingScilabMenuItem();
         clearHistoryMenu.setText(Messages.gettext("Clear History"));
         clearHistoryMenu.setCallback(ScilabCallBack.createCallback(
                                                                    "org.scilab.modules.gui.bridge.CallScilabBridge.clearHistory",
-                                                                   ScilabCallBack.JAVA));
+                                                                   CallBack.JAVA));
         clearHistoryMenu.setMnemonic('H');
 
         SwingScilabMenuItem clearMenu = new SwingScilabMenuItem();
         clearMenu.setText(Messages.gettext("Clear Console"));
         clearMenu.setCallback(ScilabCallBack.createCallback(
                                                             "org.scilab.modules.gui.bridge.CallScilabBridge.clear",
-                                                            ScilabCallBack.JAVA));
+                                                            CallBack.JAVA));
         clearMenu.setMnemonic('O');
 
         SwingScilabMenuItem selectMenu = new SwingScilabMenuItem();
         selectMenu.setText(Messages.gettext("Select All"));
         selectMenu.setCallback(ScilabCallBack.createCallback(
                                                              "org.scilab.modules.gui.bridge.CallScilabBridge.selectAllConsoleContents",
-                                                             ScilabCallBack.JAVA));
+                                                             CallBack.JAVA));
         selectMenu.setMnemonic('S');
 
 
@@ -115,7 +116,7 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
         helpMenu.setText(Messages.gettext("Help on a selected keyword"));
         helpMenu.setCallback(ScilabCallBack.createCallback(
                                                            "org.scilab.modules.gui.bridge.CallScilabBridge.helpOnTheKeyword",
-                                                           ScilabCallBack.JAVA));
+                                                           CallBack.JAVA));
         helpMenu.setMnemonic('M');
         PropertyChangeListener listener = new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent arg0) {
@@ -123,11 +124,11 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
                     if (keyword == null || keyword.length() == 0) {
                         helpMenu.setText(Messages.gettext("Help about a selected text"));
                     } else {
-                        int nbOfDisplayedOnlyXChar=10;
+                        int nbOfDisplayedOnlyXChar = 10;
                         if (keyword.length() > nbOfDisplayedOnlyXChar) {
                             keyword = keyword.substring(0, nbOfDisplayedOnlyXChar) + "...";
                         }
-                        helpMenu.setText(Messages.gettext("Help about '") +keyword+"'");
+                        helpMenu.setText(Messages.gettext("Help about '") + keyword + "'");
                     }
                 }
             };
@@ -136,7 +137,7 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
         final SwingScilabMenuItem evalWithEchoMenu = new SwingScilabMenuItem();
         evalWithEchoMenu.setText(Messages.gettext("Evaluate selection with echo"));
         evalWithEchoMenu.setCallback(ScilabCallBack.createCallback("org.scilab.modules.gui.bridge.CallScilabBridge.evaluateSelectionWithEcho",
-                                                                   ScilabCallBack.JAVA));
+                                                                   CallBack.JAVA));
         evalWithEchoMenu.setMnemonic('E');
         listener = new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent arg0) {
@@ -149,7 +150,7 @@ public class SwingScilabConsole extends SciConsole implements SimpleConsole {
         final SwingScilabMenuItem evalWithNoEchoMenu = new SwingScilabMenuItem();
         evalWithNoEchoMenu.setText(Messages.gettext("Evaluate selection with no echo"));
         evalWithNoEchoMenu.setCallback(ScilabCallBack.createCallback("org.scilab.modules.gui.bridge.CallScilabBridge.evaluateSelectionWithNoEcho",
-                                                                     ScilabCallBack.JAVA));
+                                                                     CallBack.JAVA));
         evalWithNoEchoMenu.setMnemonic('N');
         listener = new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent arg0) {
index 407b775..82ea01c 100644 (file)
@@ -22,7 +22,7 @@ import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
 import org.scilab.modules.gui.contextmenu.SimpleContextMenu;
 import org.scilab.modules.gui.events.BlockingResult;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.menuitem.MenuItem;
@@ -170,7 +170,7 @@ public class SwingScilabContextMenu extends JPopupMenu implements SimpleContextM
         * Add a callback to the menu, this callback is a Scilab command
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                throw new UnsupportedOperationException();
        }
 
@@ -285,7 +285,7 @@ public class SwingScilabContextMenu extends JPopupMenu implements SimpleContextM
         * Retrieve the CallBack associated to this ContextMenu
         * @return the CallBack
         */
-       public CallBack getCallback() {
+       public CommonCallBack getCallback() {
                throw new UnsupportedOperationException();
        }
        
index 17136f3..243e711 100644 (file)
@@ -24,7 +24,7 @@ import javax.swing.JTextField;
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.editbox.SimpleEditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
@@ -46,7 +46,7 @@ public class SwingScilabEditBox extends JTextField implements SwingViewObject, S
        
     private String uid;
 
-       private CallBack callback;
+       private CommonCallBack callback;
 
        private FocusListener focusListener;
        private ActionListener actionListener;
@@ -108,7 +108,7 @@ public class SwingScilabEditBox extends JTextField implements SwingViewObject, S
         * Add a callback to the EditBox
         * @param cb the callback to set.
         */
-       public void setCallback(CallBack cb) {
+       public void setCallback(CommonCallBack cb) {
                
                // Remove previous callback
                if (focusListener != null) {
index d737cc6..2a2e659 100644 (file)
@@ -33,7 +33,7 @@ import org.scilab.modules.gui.checkbox.CheckBox;
 import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.dockable.Dockable;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.frame.SimpleFrame;
 import org.scilab.modules.gui.label.Label;
@@ -445,7 +445,7 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
         * Add a callback to the Frame
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                // Nothing to do...
        }
 
index 5b56ca0..7c5cdc0 100644 (file)
@@ -26,7 +26,7 @@ import javax.swing.JScrollPane;
 
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.imagerenderer.SimpleImageRenderer;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -174,7 +174,7 @@ public class SwingScilabImageRenderer extends JScrollPane implements SwingViewOb
         * Add a callback to the ImageRenderer
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                // Nothing to do...
        }
 
index 7aaac4d..8786df9 100644 (file)
@@ -35,7 +35,7 @@ import javax.swing.text.html.StyleSheet;
 
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.label.SimpleLabel;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -225,7 +225,7 @@ public class SwingScilabLabel extends JScrollPane implements SwingViewObject, Si
      * Add a callback to the Label
      * @param callback the callback to set.
      */
-    public void setCallback(CallBack callback) {
+    public void setCallback(CommonCallBack callback) {
         // Nothing to do...
     }
 
index 3dfb8de..4a80773 100644 (file)
@@ -30,7 +30,7 @@ import javax.swing.ListSelectionModel;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.listbox.SimpleListBox;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -54,7 +54,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
 
     private String uid;
 
-    private CallBack callback;
+    private CommonCallBack callback;
 
     private MouseListener mouseListener;
 
@@ -198,7 +198,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
      * Add a callback to the CheckBox
      * @param cb the callback to set.
      */
-    public void setCallback(CallBack cb) {
+    public void setCallback(CommonCallBack cb) {
         if (mouseListener != null) {
             getList().removeMouseListener(mouseListener);
         }
index f057160..12ace0f 100644 (file)
@@ -20,7 +20,7 @@ import javax.swing.JMenu;
 import org.scilab.modules.gui.bridge.checkboxmenuitem.SwingScilabCheckBoxMenuItem;
 import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.SimpleMenu;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -42,7 +42,7 @@ import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
 public class SwingScilabMenu extends JMenu implements SimpleMenu {
 
     private static final long serialVersionUID = 1L;
-    private CallBack callback;
+    private CommonCallBack callback;
     private MouseListener[] nativeMouseListeners;
     private MouseListener customedMouseListener;
     private boolean checkedState = false;
@@ -224,7 +224,7 @@ public class SwingScilabMenu extends JMenu implements SimpleMenu {
      * Add a callback to the menu, this callback is a Scilab command
      * @param cb the callback to set.
      */
-    public void setCallback(CallBack cb) {
+    public void setCallback(CommonCallBack cb) {
        this.callback = cb;
                
        /* Remove Java MouseListeners if not already done */
@@ -365,7 +365,7 @@ public class SwingScilabMenu extends JMenu implements SimpleMenu {
      * Retrieve the CallBack associated to this MenuItem
      * @return the CallBack
      */
-    public CallBack getCallback() {
+    public CommonCallBack getCallback() {
        return callback;
     }
 }
index a0df179..7b95b68 100644 (file)
@@ -25,7 +25,7 @@ import org.scilab.modules.gui.bridge.menu.SwingScilabMenu;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.ScilabCheckBoxMenuItem;
 import org.scilab.modules.gui.events.BlockingResult;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -48,7 +48,7 @@ import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
 public class SwingScilabMenuItem extends JMenuItem implements SimpleMenuItem {
 
     private static final long serialVersionUID = 1L;
-    private CallBack callback;
+    private CommonCallBack callback;
     private Menu meAsAMenu;
     private CheckBoxMenuItem meAsACheckBoxMenuItem;
     private boolean checkedState;
@@ -106,7 +106,7 @@ public class SwingScilabMenuItem extends JMenuItem implements SimpleMenuItem {
      * Add a callback to the MenuItem, this callback is a Scilab command
      * @param callback the callback to set.
      */
-    public void setCallback(CallBack callback) {
+    public void setCallback(CommonCallBack callback) {
         this.callback = callback;
         addActionListener(this.callback);
         if (meAsACheckBoxMenuItem != null) {
@@ -322,7 +322,7 @@ public class SwingScilabMenuItem extends JMenuItem implements SimpleMenuItem {
      * Retrieve the CallBack associated to this MenuItem
      * @return the CallBack
      */
-    public CallBack getCallback() {
+    public CommonCallBack getCallback() {
         return callback;
     }
 
index 69dfd91..b245e17 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.JComboBox;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.popupmenu.SimplePopupMenu;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -47,7 +47,7 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
 
     private String uid;
 
-    private CallBack callback;
+    private CommonCallBack callback;
 
     /**
      * Constructor
@@ -108,7 +108,7 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
      * Add a callback to the PopupMenu
      * @param callback the callback to set.
      */
-    public void setCallback(CallBack callback) {
+    public void setCallback(CommonCallBack callback) {
         if (this.callback != null) {
             removeActionListener(this.callback);
         }
index b4e07b0..8639491 100644 (file)
@@ -26,7 +26,7 @@ import javax.swing.JButton;
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.pushbutton.SimplePushButton;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -49,7 +49,7 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
        
        private String uid;
 
-       private CallBack callback;
+       private CommonCallBack callback;
        private String text = "";
        private boolean isLaTeX;
        private int fontSize;
@@ -167,7 +167,7 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
         * Add a callback to the pushbutton
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                if (this.callback != null) {
                        removeActionListener(this.callback);
                }
index 974f3bb..911e726 100644 (file)
@@ -17,7 +17,7 @@ import javax.swing.JRadioButton;
 
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.radiobutton.SimpleRadioButton;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -40,7 +40,7 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
 
     private String uid;
 
-    private CallBack callback;
+    private CommonCallBack callback;
 
     /**
      * Constructor
@@ -102,7 +102,7 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
      * Add a callback to the RadioButton
      * @param callback the callback to set.
      */
-    public void setCallback(CallBack callback) {
+    public void setCallback(CommonCallBack callback) {
         if (this.callback != null) {
             removeActionListener(this.callback);
         }
index 93eea81..c23067b 100644 (file)
@@ -20,7 +20,7 @@ import javax.swing.JScrollBar;
 
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.slider.SimpleSlider;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -44,7 +44,7 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
 
     private String uid;
 
-    private CallBack callback;
+    private CommonCallBack callback;
        
        private AdjustmentListener adjustmentListener;
        
@@ -108,7 +108,7 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
         * Add a callback to the Slider
         * @param cb the callback to set.
         */
-       public void setCallback(CallBack cb) {
+       public void setCallback(CommonCallBack cb) {
                /* Create a callback */
                this.callback = cb;
                
index 20d1b9d..77be94e 100644 (file)
@@ -73,7 +73,7 @@ import org.scilab.modules.gui.checkbox.CheckBox;
 import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.dockable.Dockable;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.events.callback.ScilabCloseCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.helpbrowser.HelpBrowser;
@@ -1055,7 +1055,7 @@ public class SwingScilabTab extends View implements SwingViewObject, SimpleTab,
      * Set the callback of the tab
      * @param callback the callback to set.
      */
-    public void setCallback(CallBack callback) {
+    public void setCallback(CommonCallBack callback) {
 
         if (closeAction != null) {
             this.getTitlebar().removeAction(closeAction);
index 92e7389..3333523 100644 (file)
@@ -14,7 +14,7 @@ package org.scilab.modules.gui.bridge.textbox;
 
 import javax.swing.JTextArea;
 
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.SimpleTextBox;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -151,7 +151,7 @@ public class SwingScilabTextBox extends JTextArea implements SimpleTextBox {
         * Add a callback to the TextBox
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                throw new UnsupportedOperationException();
        }
 
index 2680504..1a94f07 100644 (file)
@@ -27,9 +27,10 @@ import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
 
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
 import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
@@ -47,310 +48,310 @@ import org.scilab.modules.localization.Messages;
  */
 public class SwingScilabTree extends DefaultMutableTreeNode implements SimpleTree {
 
-       private static final long serialVersionUID = 1L;
-       
-       private Icon icon;
-       private CallBack callback;
-       private JScrollPane scrollPane = new JScrollPane();
-
-       /**
-        * Default constructor
-        * @param tree structure to display
-        */
-       public SwingScilabTree(Tree tree) {
-               super(tree.getLabel());
-               this.setIcon(tree.getIcon());
-               this.setCallback(tree.getCallback());
-               
-               Vector<Tree> children = tree.getChildren();
-               
-               for (int i = 0; i < children.size(); ++i)       {
-                       SwingScilabTree swingScilabTree = new SwingScilabTree(children.get(i));
-                       this.add(swingScilabTree);
-               }
-       }
-       
-       /**
-        * Getter for icon
-        * @return an icon
-        */
-       public Icon getIcon() {
-               return icon;
-       }
-
-       /**
-        * Setter for icon
-        * @param icon an Icon
-        */
-       public void setIcon(Icon icon) {
-               this.icon = icon;
-       }
-       
-       /**
-        * Getter for callback
-        * @return a callback
-        */
-       public CallBack getCallback() {
-               return callback;
-       }
-
-       /**
-        * Setter for callback
-        * @param callback a callback
-        */
-       public void setCallback(CallBack callback) {
-               this.callback = callback;
-       }
-
-       /**
-        *  This is a private class to embed the JTree inside its Mouse Listener
-        *  in order we can figure out on which leaff the user clicked on.
-        */
-       private class ClickListener extends MouseAdapter {
-           private JTree myJtree;
-           
-           /**
-            * Constructor
-            * @param jtree a Jtree
-            */
-           public ClickListener(JTree jtree) {
-               myJtree = jtree;
-           }
-           
-           /**
-            * Mouse clicked actions
-            * @param arg0 event
-            */
-           public void mouseClicked(MouseEvent arg0) {
-               TreePath path = myJtree.getPathForLocation(arg0.getX(), arg0.getY());
-               /* We only want double click to do something */
-               if (path != null && arg0.getClickCount() >= 2) {
-                   ((SwingScilabTree) path.getLastPathComponent()).getCallback().actionPerformed(null);
-               }
-
-           }
-       }
-       
-       /**
-        * Get as Component
-        * @return a component
-        */
-       public JComponent getAsComponent() {
-               // Tree Model
-               DefaultTreeModel model = new DefaultTreeModel(this);            
-               // Renderer
-               ScilabTreeCellRenderer renderer = new ScilabTreeCellRenderer();
-               // Swing tree component
-               JTree jtree = new JTree();      
-               // Show Root Handles
-               jtree.setShowsRootHandles(true);
-               // Set model to the JTree
-               jtree.setModel(model);          
-               // Set renderer
-               jtree.setCellRenderer(renderer);
-
-               jtree.addMouseListener(new ClickListener(jtree));
-               jtree.setVisible(true);
-               
-               
-               scrollPane.getViewport().add(jtree);
-               return scrollPane;
-       }
-
-       public JTree getJTree() {
-               // Tree Model
-               DefaultTreeModel model = new DefaultTreeModel(this);            
-               // Renderer
-               ScilabTreeCellRenderer renderer = new ScilabTreeCellRenderer();
-               // Swing tree component
-               JTree jtree = new JTree();      
-               // Show Root Handles
-               jtree.setShowsRootHandles(true);
-               // Set model to the JTree
-               jtree.setModel(model);          
-               // Set renderer
-               jtree.setCellRenderer(renderer);
-
-               jtree.addMouseListener(new ClickListener(jtree));
-               jtree.setVisible(true);
-
-               return jtree;
-       }
-       
-       /**
-        * Display the tree
-        * @param tree a tree
-        */
-       public static void  showTree(Tree tree) {
-               
-               // Scilab tree
-               SwingScilabTree swingScilabTree = new SwingScilabTree(tree);
-               
-               SwingScilabWindow window = new SwingScilabWindow();
-               final SwingScilabTab tab = new SwingScilabTab(Messages.gettext("Tree Overview"));
-               tab.setCallback(new CallBack(null) {
-                       private static final long serialVersionUID = 8418506008885202932L;
-
-                       public void callBack() {
-                               tab.close();
-                       }
-               });
-               tab.addTree(swingScilabTree);
-               window.addTab(tab);
-               tab.setVisible(true);
-               window.setVisible(true);
-       }
-
-       public void destroy() {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public Color getBackground() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public Font getFont() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public Color getForeground() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public String getText() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public boolean isEnabled() {
-               // TODO Auto-generated method stub
-               return false;
-       }
-
-       public void requestFocus() {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setBackground(Color color) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setEnabled(boolean status) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setFont(Font font) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setForeground(Color color) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setHorizontalAlignment(String alignment) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setRelief(String reliefType) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setText(String text) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void setVerticalAlignment(String alignment) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void addInfoBar(TextBox infoBarToAdd) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void addMenuBar(MenuBar menuBarToAdd) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void addToolBar(ToolBar toolBarToAdd) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       public void draw() {
-               // TODO Auto-generated method stub
-               
-       }
-
-       /**
-        * Get size
-        * @return the size
-        */
-       public Size getDims() {
-           return new Size(scrollPane.getSize().width, scrollPane.getSize().height);
-       }
-
-       public TextBox getInfoBar() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public MenuBar getMenuBar() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       /**
-        * Get position
-        * @return the position
-        */
-       public Position getPosition() {
-           return PositionConverter.javaToScilab(scrollPane.getLocation(), scrollPane.getSize(), scrollPane.getParent());
-       }
-
-       public ToolBar getToolBar() {
-               // TODO Auto-generated method stub
-               return null;
-       }
-
-       public boolean isVisible() {
-               // TODO Auto-generated method stub
-               return false;
-       }
-
-       /**
-        * Set size
-        * @param newSize a new size
-        */
-       public void setDims(Size newSize) {
-           scrollPane.setSize(new Dimension(newSize.getWidth(), newSize.getHeight()));
-       }
-
-       /**
-        * Set position
-        * @param newPosition a new position
-        */
-       public void setPosition(Position newPosition) {
-           Position javaPosition = PositionConverter.scilabToJava(newPosition, this.getDims(), scrollPane.getParent());
-           scrollPane.setLocation(javaPosition.getX(), javaPosition.getY());
-       }
-
-       public void setVisible(boolean newVisibleState) {
-               // TODO Auto-generated method stub
-               
-       }
+    private static final long serialVersionUID = 1L;
+
+    private Icon icon;
+    private CommonCallBack callback;
+    private JScrollPane scrollPane = new JScrollPane();
+
+    /**
+     * Default constructor
+     * @param tree structure to display
+     */
+    public SwingScilabTree(Tree tree) {
+        super(tree.getLabel());
+        this.setIcon(tree.getIcon());
+        this.setCallback(tree.getCallback());
+
+        Vector<Tree> children = tree.getChildren();
+
+        for (int i = 0; i < children.size(); ++i)      {
+            SwingScilabTree swingScilabTree = new SwingScilabTree(children.get(i));
+            this.add(swingScilabTree);
+        }
+    }
+
+    /**
+     * Getter for icon
+     * @return an icon
+     */
+    public Icon getIcon() {
+        return icon;
+    }
+
+    /**
+     * Setter for icon
+     * @param icon an Icon
+     */
+    public void setIcon(Icon icon) {
+        this.icon = icon;
+    }
+
+    /**
+     * Getter for callback
+     * @return a callback
+     */
+    public CommonCallBack getCallback() {
+        return callback;
+    }
+
+    /**
+     * Setter for callback
+     * @param callback a callback
+     */
+    public void setCallback(CommonCallBack callback) {
+        this.callback = callback;
+    }
+
+    /**
+     *  This is a private class to embed the JTree inside its Mouse Listener
+     *  in order we can figure out on which leaff the user clicked on.
+     */
+    private class ClickListener extends MouseAdapter {
+        private JTree myJtree;
+
+        /**
+         * Constructor
+         * @param jtree a Jtree
+         */
+        public ClickListener(JTree jtree) {
+            myJtree = jtree;
+        }
+
+        /**
+         * Mouse clicked actions
+         * @param arg0 event
+         */
+        public void mouseClicked(MouseEvent arg0) {
+            TreePath path = myJtree.getPathForLocation(arg0.getX(), arg0.getY());
+            /* We only want double click to do something */
+            if (path != null && arg0.getClickCount() >= 2) {
+                ((SwingScilabTree) path.getLastPathComponent()).getCallback().actionPerformed(null);
+            }
+
+        }
+    }
+
+    /**
+     * Get as Component
+     * @return a component
+     */
+    public JComponent getAsComponent() {
+        // Tree Model
+        DefaultTreeModel model = new DefaultTreeModel(this);           
+        // Renderer
+        ScilabTreeCellRenderer renderer = new ScilabTreeCellRenderer();
+        // Swing tree component
+        JTree jtree = new JTree();     
+        // Show Root Handles
+        jtree.setShowsRootHandles(true);
+        // Set model to the JTree
+        jtree.setModel(model);         
+        // Set renderer
+        jtree.setCellRenderer(renderer);
+
+        jtree.addMouseListener(new ClickListener(jtree));
+        jtree.setVisible(true);
+
+
+        scrollPane.getViewport().add(jtree);
+        return scrollPane;
+    }
+
+    public JTree getJTree() {
+        // Tree Model
+        DefaultTreeModel model = new DefaultTreeModel(this);           
+        // Renderer
+        ScilabTreeCellRenderer renderer = new ScilabTreeCellRenderer();
+        // Swing tree component
+        JTree jtree = new JTree();     
+        // Show Root Handles
+        jtree.setShowsRootHandles(true);
+        // Set model to the JTree
+        jtree.setModel(model);         
+        // Set renderer
+        jtree.setCellRenderer(renderer);
+
+        jtree.addMouseListener(new ClickListener(jtree));
+        jtree.setVisible(true);
+
+        return jtree;
+    }
+
+    /**
+     * Display the tree
+     * @param tree a tree
+     */
+    public static void  showTree(Tree tree) {
+
+        // Scilab tree
+        SwingScilabTree swingScilabTree = new SwingScilabTree(tree);
+
+        SwingScilabWindow window = new SwingScilabWindow();
+        final SwingScilabTab tab = new SwingScilabTab(Messages.gettext("Tree Overview"));
+        tab.setCallback(new CommonCallBack("", CallBack.UNTYPED) {
+            private static final long serialVersionUID = 8418506008885202932L;
+
+            public void callBack() {
+                tab.close();
+            }
+        });
+        tab.addTree(swingScilabTree);
+        window.addTab(tab);
+        tab.setVisible(true);
+        window.setVisible(true);
+    }
+
+    public void destroy() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Color getBackground() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Font getFont() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Color getForeground() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getText() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public void requestFocus() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setBackground(Color color) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setEnabled(boolean status) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setFont(Font font) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setForeground(Color color) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setHorizontalAlignment(String alignment) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setRelief(String reliefType) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setText(String text) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setVerticalAlignment(String alignment) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addInfoBar(TextBox infoBarToAdd) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addMenuBar(MenuBar menuBarToAdd) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addToolBar(ToolBar toolBarToAdd) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void draw() {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * Get size
+     * @return the size
+     */
+    public Size getDims() {
+        return new Size(scrollPane.getSize().width, scrollPane.getSize().height);
+    }
+
+    public TextBox getInfoBar() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public MenuBar getMenuBar() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * Get position
+     * @return the position
+     */
+    public Position getPosition() {
+        return PositionConverter.javaToScilab(scrollPane.getLocation(), scrollPane.getSize(), scrollPane.getParent());
+    }
+
+    public ToolBar getToolBar() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isVisible() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /**
+     * Set size
+     * @param newSize a new size
+     */
+    public void setDims(Size newSize) {
+        scrollPane.setSize(new Dimension(newSize.getWidth(), newSize.getHeight()));
+    }
+
+    /**
+     * Set position
+     * @param newPosition a new position
+     */
+    public void setPosition(Position newPosition) {
+        Position javaPosition = PositionConverter.scilabToJava(newPosition, this.getDims(), scrollPane.getParent());
+        scrollPane.setLocation(javaPosition.getX(), javaPosition.getY());
+    }
+
+    public void setVisible(boolean newVisibleState) {
+        // TODO Auto-generated method stub
+
+    }
 }
index 0428f18..56b40d0 100644 (file)
@@ -21,7 +21,7 @@ import javax.swing.SwingUtilities;
 
 import java.util.StringTokenizer;
 
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.uidisplaytree.SimpleUiDisplayTree;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -162,7 +162,7 @@ public class SwingScilabUiDisplayTree extends JScrollPane implements SimpleUiDis
         * Add a callback to the UiTable
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                // Nothing to do...
        }
 
index f4e6c28..54b3bd2 100644 (file)
@@ -22,7 +22,7 @@ import javax.swing.JScrollPane;
 
 import org.scilab.modules.gui.SwingScilabWidget;
 import org.scilab.modules.gui.SwingViewObject;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.uitable.SimpleUiTable;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
@@ -173,7 +173,7 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
         * Add a callback to the UiTable
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                // Nothing to do...
        }
 
index a7b5078..b4d71bf 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabCheckBox extends ScilabWidget implements CheckBox {
         * Add a callback to the CheckBox
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 12de141..70077a7 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -134,7 +134,7 @@ public class ScilabCheckBoxBridge {
         * @param checkBox the CheckBox we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(CheckBox checkBox, CallBack callback) {
+       public static void setCallback(CheckBox checkBox, CommonCallBack callback) {
                checkBox.getAsSimpleCheckBox().setCallback(callback);
        }
        
index f897114..60e3209 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.menuitem.ScilabMenuItem;
@@ -214,7 +214,7 @@ public class ScilabCheckBoxMenuItem extends ScilabMenuItem implements CheckBoxMe
         * Add a callback to the menu, this callback is a Scilab command
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
@@ -292,7 +292,7 @@ public class ScilabCheckBoxMenuItem extends ScilabMenuItem implements CheckBoxMe
         * Retrieve the CallBack associated to this MenuItem
         * @return the CallBack
         */
-       public CallBack getCallback() {
+       public CommonCallBack getCallback() {
                return ScilabBridge.getCallback(this);
        }
        
index 67f8330..0b6898e 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.checkboxmenuitem.SwingScilabCheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 
 /**
@@ -210,7 +210,7 @@ public class ScilabCheckBoxMenuItemBridge {
         * @param checkBoxMenuItem the menu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(CheckBoxMenuItem checkBoxMenuItem, CallBack callback) {
+       public static void setCallback(CheckBoxMenuItem checkBoxMenuItem, CommonCallBack callback) {
                checkBoxMenuItem.getAsSimpleCheckBoxMenuItem().setCallback(callback);
        }
 
@@ -280,7 +280,7 @@ public class ScilabCheckBoxMenuItemBridge {
         * @param checkBoxMenuItem the CheckBoxMenuItem
         * @return the CallBack
         */
-       public static CallBack getCallback(CheckBoxMenuItem checkBoxMenuItem) {
+       public static CommonCallBack getCallback(CheckBoxMenuItem checkBoxMenuItem) {
                return checkBoxMenuItem.getAsSimpleCheckBoxMenuItem().getCallback();
        }
 
index 4eb7fe8..3ec5df6 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.utils.Position;
@@ -210,7 +210,7 @@ public class ScilabContextMenu extends ScilabWidget implements ContextMenu {
         * Add a callback to the ContextMenu, this callback is a Scilab command
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
index 3ded49e..6e2b443 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menuitem.MenuItem;
 
@@ -177,7 +177,7 @@ public class ScilabContextMenuBridge {
         * @param contextMenu the contextMenu we want to set the callback of
         * @param callback the Callback to set.
         */
-       public static void setCallback(ContextMenu contextMenu, CallBack callback) {
+       public static void setCallback(ContextMenu contextMenu, CommonCallBack callback) {
                contextMenu.getAsSimpleContextMenu().setCallback(callback);
        }
 
index 28c9052..7a3323d 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -182,7 +182,7 @@ public class ScilabEditBox extends ScilabWidget implements EditBox {
         * Add a callback to the EditBox
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 8429621..20c71b2 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.editbox.SwingScilabEditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabEditBoxBridge {
         * @param editBox the EditBox we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(EditBox editBox, CallBack callback) {
+       public static void setCallback(EditBox editBox, CommonCallBack callback) {
                editBox.getAsSimpleEditBox().setCallback(callback);
        }
        
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CallBack.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CallBack.java
deleted file mode 100644 (file)
index c17f5b0..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- *  Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
- *
- *  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-en.txt
- *
- */
-package org.scilab.modules.gui.events.callback;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.scilab.modules.gui.events.GlobalEventFilter;
-import org.scilab.modules.gui.events.GlobalEventWatcher;
-
-/**
- * Abstract class to manage all callbacks.
- * Those that need Java code, and those that need Scilab execution.
- *
- * @author bruno
- *
- */
-public abstract class CallBack extends AbstractAction {
-
-    /**
-     * Unmanaged command type constant
-     */
-    public static final int UNTYPED = -1;
-    /**
-     * Scilab instruction command type constant
-     */
-    public static final int SCILAB_INSTRUCTION = 0;
-    /**
-     * C or Fortran function type constant
-     */
-    public static final int C_FORTRAN = 1;
-    /**
-     * Scilab function type constant
-     */
-    public static final int SCILAB_FUNCTION = 2;
-    /**
-     * Scilab function type constant (not trapped by scilab event listeners)
-     */
-    public static final int SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE = -2;
-    /**
-     * Java function type constant
-     */
-    public static final int JAVA = 3;
-    /**
-     * Java function type constant (not trapped by scilab event listeners)
-     */
-    public static final int JAVA_OUT_OF_XCLICK_AND_XGETMOUSE = -3;
-
-    /**
-     * Scilab instruction without GCBO setting (old addmenu compatibility)
-     */
-    public static final int SCILAB_INSTRUCTION_WITHOUT_GCBO = 4;
-
-    /**
-     * The Command to Store and remember.
-     */
-    protected String command;
-
-    /**
-     * Constructor to be seen by specifics CallBack.
-     * @param command the command associated to the ccallback
-     */
-    public CallBack(String command) {
-       this.command = command;
-    }
-
-    /**
-     * @return the command if it's a Scilab instruction.
-     */
-    public String getCommand() {
-       return command;
-    }
-
-    /**
-     * Callback function that will be call on some event.
-     */
-    public abstract void callBack();
-
-    /**
-     * Create a Callback from Scilab data
-     * @param command the instruction
-     * @param callbackType the type of the instruction
-     * @return the Callback
-     */
-    public static CallBack createCallback(String command, int callbackType) {
-       switch (callbackType) {
-       case JAVA :
-           return JavaCallBack.create(command);
-       case JAVA_OUT_OF_XCLICK_AND_XGETMOUSE :
-           return JavaCallBack.createOutOfXclickAndXgetmouse(command);
-       case SCILAB_INSTRUCTION_WITHOUT_GCBO :
-           return ScilabCallBack.create(command);
-       case SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE :
-           return ScilabCallBack.createOutOfXclickAndXgetmouse(command);
-       default:
-           return ScilabCallBack.create(command);
-       }
-    }
-
-    /**
-     * Create a Callback from Scilab data
-     * @param command the instruction
-     * @param callbackType the type of the instruction
-     * @param objectIndex the index of the object in the UIElementMapper
-     * @return the Callback
-     */
-    public static CallBack createCallback(String command, int callbackType, int objectIndex) {
-       switch (callbackType) {
-       case JAVA :
-           return JavaCallBack.create(command);
-       case JAVA_OUT_OF_XCLICK_AND_XGETMOUSE :
-           return JavaCallBack.createOutOfXclickAndXgetmouse(command);
-       case SCILAB_INSTRUCTION_WITHOUT_GCBO :
-           return ScilabCallBack.create(command);
-       case SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE :
-           return ScilabCallBack.createOutOfXclickAndXgetmouse(command);
-       default:
-           return ScilabCallBack.create("if exists(\"gcbo\") then %oldgcbo = gcbo; end;"
-                   + "gcbo = getcallbackobject(" + objectIndex + ");"
-                   + command
-                   + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;");
-       }
-    }
-
-    /**
-     * To match the standard Java Action management.
-     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-     * @param e The event that launch the callback.
-     */
-    public void actionPerformed(ActionEvent e) {
-       if (!GlobalEventWatcher.isActivated()) {
-           callBack();
-       } else {
-           if (this.command != null) {
-               GlobalEventFilter.filterCallback(this.command);
-           }
-       }
-    }
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CommonCallBack.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/CommonCallBack.java
new file mode 100644 (file)
index 0000000..28d7ce6
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ *  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-en.txt
+ *
+ */
+package org.scilab.modules.gui.events.callback;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
+import org.scilab.modules.gui.events.GlobalEventFilter;
+import org.scilab.modules.gui.events.GlobalEventWatcher;
+
+/**
+ * Abstract class to manage all callbacks.
+ * Those that need Java code, and those that need Scilab execution.
+ *
+ * @author bruno
+ *
+ */
+public abstract class CommonCallBack extends AbstractAction {
+
+    private static final long serialVersionUID = -919820581757579168L;
+
+    private CallBack callback;
+
+    /**
+     * @param command the callback command
+     * @param callbackType the callback command type
+     */
+    public CommonCallBack(String command) {
+        callback = new CallBack(command, CallBack.UNTYPED);
+    }
+    /**
+     * @param command the callback command
+     * @param callbackType the callback command type
+     */
+    public CommonCallBack(String command, int callbackType) {
+        callback = new CallBack(command, callbackType);
+    }
+
+    /**
+     * Callback function that will be call on some event.
+     */
+    public abstract void callBack();
+
+    /**
+     * Create a Callback from Scilab data
+     * @param command the instruction
+     * @param callbackType the type of the instruction
+     * @return the Callback
+     */
+    public static CommonCallBack createCallback(String command, int callbackType) {
+        CommonCallBack callback = null;
+        switch (callbackType) {
+        case CallBack.JAVA :
+            callback = JavaCallBack.create(command);
+            break;
+        case CallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE :
+            callback = JavaCallBack.createOutOfXclickAndXgetmouse(command);
+            break;
+        case CallBack.SCILAB_INSTRUCTION_WITHOUT_GCBO :
+            callback = ScilabCallBack.create(command);
+            break;
+        case CallBack.SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE :
+            callback = ScilabCallBack.createOutOfXclickAndXgetmouse(command);
+            break;
+        default:
+            callback = ScilabCallBack.create(command);
+            break;
+        }
+        return callback;
+    }
+
+    /**
+     * Create a Callback from Scilab data
+     * @param command the instruction
+     * @param callbackType the type of the instruction
+     * @param objectIndex the index of the object in the UIElementMapper
+     * @return the Callback
+     */
+    public static CommonCallBack createCallback(String command, int callbackType, int objectIndex) {
+        CommonCallBack callback = null;
+        switch (callbackType) {
+        case CallBack.JAVA :
+            callback = JavaCallBack.create(command);
+            break;
+        case CallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE :
+            callback = JavaCallBack.createOutOfXclickAndXgetmouse(command);
+            break;
+        case CallBack.SCILAB_INSTRUCTION_WITHOUT_GCBO :
+            callback = ScilabCallBack.create(command);
+            break;
+        case CallBack.SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE :
+            callback = ScilabCallBack.createOutOfXclickAndXgetmouse(command);
+            break;
+        default:
+            callback = ScilabCallBack.create("if exists(\"gcbo\") then %oldgcbo = gcbo; end;"
+                    + "gcbo = getcallbackobject(" + objectIndex + ");"
+                    + command
+                    + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;");
+            break;
+        }
+        return callback;
+    }
+
+    /**
+     * To match the standard Java Action management.
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     * @param e The event that launch the callback.
+     */
+    public void actionPerformed(ActionEvent e) {
+        if (!GlobalEventWatcher.isActivated()) {
+            callBack();
+        } else {
+            if (this.callback.getCommand() != null) {
+                GlobalEventFilter.filterCallback(this.callback.getCommand());
+            }
+        }
+    }
+
+    /**
+     * @return the command of the callback
+     */
+    public String getCommand() {
+        return callback.getCommand();
+    }
+}
index be97c52..9de7184 100644 (file)
 package org.scilab.modules.gui.events.callback;
 
 import java.awt.event.ActionEvent;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
+
 /**
  * Generic class to hide callback management
- * @author bruno
- *
+ * @author Bruno JOFRET
  */
-public abstract class JavaCallBack extends CallBack {
+public abstract class JavaCallBack extends CommonCallBack {
+
+    private static final long serialVersionUID = -6513057558261299432L;
+    
+    private static final String DOT = ".";
+
+    /**
+     * @param command : the command to execute.
+     */
+    private JavaCallBack(String command) {
+        super(command, CallBack.UNTYPED);
+    }
+
+    /**
+     * Callback Factory to easily create a callback
+     * just like in scilab.
+     * @param command : the command to execute.
+     * @return a usable Java callback
+     */
+    public static JavaCallBack create(String command) {
+        return (new JavaCallBack(command) {
+            private static final long serialVersionUID = 3116709592411260416L;
+
+            public void callBack() {
+                try {
+                    int lastPoint = getCommand().lastIndexOf(DOT);
+                    Class invokedClass;
+                    invokedClass = Class.forName(getCommand().substring(0, lastPoint));
+                    Method runMe;
+                    runMe = invokedClass.getMethod(getCommand().substring(lastPoint + 1));
+                    // Only able to launch method Class.
+                    runMe.invoke(invokedClass.getClass(), (Object[]) null);
+                } catch (ClassNotFoundException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (SecurityException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (NoSuchMethodException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (IllegalArgumentException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (InvocationTargetException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+
+    /**
+     * Callback Factory to easily create a callback
+     * just like in scilab.
+     * @param command : the command to execute.
+     * @return a usable Java callback
+     */
+    public static CommonCallBack createOutOfXclickAndXgetmouse(String command) {
+        return (new JavaCallBack(command) {
+            private static final long serialVersionUID = -7456188185148029043L;
 
-       /**
-        * @param command : the command to execute.
-        */
-       private JavaCallBack(String command) {
-               super(command);
-       }
+            public void callBack() {
+                try {
+                    int lastPoint = getCommand().lastIndexOf(DOT);
+                    Class invokedClass;
+                    invokedClass = Class.forName(getCommand().substring(0, lastPoint));
+                    Method runMe = invokedClass.getMethod(getCommand().substring(lastPoint + 1));
+                    // Only able to launch method Class.
+                    runMe.invoke(invokedClass.getClass(), (Object[]) null);
+                } catch (ClassNotFoundException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (NoSuchMethodException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                } catch (InvocationTargetException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
 
-       /**
-        * Callback Factory to easily create a callback
-        * just like in scilab.
-        * @param command : the command to execute.
-        * @return a usable Java callback
-        */
-       public static JavaCallBack create(String command) {
-               return (new JavaCallBack(command) {
-                       public void callBack() {
-                               try {
-                                       int lastPoint = command.lastIndexOf(".");
-                                       Class invokedClass = Class.forName(command.substring(0, lastPoint));
-                                       Method runMe = invokedClass.getMethod(command.substring(lastPoint + 1));
-                                       // Only able to launch method Class.
-                                       runMe.invoke(invokedClass.getClass(), (Object[]) null);
-                               } catch (Exception e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               }
-                       }
-               });
-       }
-       
-       /**
-        * Callback Factory to easily create a callback
-        * just like in scilab.
-        * @param command : the command to execute.
-        * @return a usable Java callback
-        */
-       public static CallBack createOutOfXclickAndXgetmouse(String command) {
-               return (new JavaCallBack(command) {
-                       public void callBack() {
-                               try {
-                                       int lastPoint = command.lastIndexOf(".");
-                                       Class invokedClass = Class.forName(command.substring(0, lastPoint));
-                                       Method runMe = invokedClass.getMethod(command.substring(lastPoint + 1));
-                                       // Only able to launch method Class.
-                                       runMe.invoke(invokedClass.getClass(), (Object[]) null);
-                               } catch (Exception e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               }
-                       }
-                       
-                       /**
-                        * To match the standard Java Action management.
-                        * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-                        * @param e The event that launch the callback.
-                        */
-                       public void actionPerformed(ActionEvent e) {
-                           callBack();
-                       } 
-               });        
-       }
+            /**
+             * To match the standard Java Action management.
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             * @param e The event that launch the callback.
+             */
+            public void actionPerformed(ActionEvent e) {
+                callBack();
+            } 
+        });       
+    }
 }
index 284bd49..4c7c3c4 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.gui.events.callback;
 import java.awt.event.ActionEvent;
 
 import org.scilab.modules.action_binding.InterpreterManagement;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 
 /**
  * ScilabCallback abstract class to easily manage callbacks
@@ -22,68 +23,70 @@ import org.scilab.modules.action_binding.InterpreterManagement;
  * @author Bruno JOFRET
  *
  */
-public abstract class ScilabCallBack extends CallBack {
+public abstract class ScilabCallBack extends CommonCallBack {
 
-       /**
-        * Constructor
-        * @param command : the command to execute.
-        */
-       private ScilabCallBack(String command) {
-               super(command);
-       }
+    private static final long serialVersionUID = -4923246233703990342L;
 
-       /**
-        * Callback Factory to easily create a callback
-        * just like in scilab.
-        * @param command : the command to execute.
-        * @return a usable Scilab callback
-        */
-       public static ScilabCallBack create(String command) {
-               return (new ScilabCallBack(command) {
+    /**
+     * Constructor
+     * @param command : the command to execute.
+     */
+    private ScilabCallBack(String command) {
+        super(command, CallBack.UNTYPED);
+    }
 
-                       private static final long serialVersionUID = -7286803341046313407L;
+    /**
+     * Callback Factory to easily create a callback
+     * just like in scilab.
+     * @param command : the command to execute.
+     * @return a usable Scilab callback
+     */
+    public static ScilabCallBack create(String command) {
+        return (new ScilabCallBack(command) {
 
-                       public void callBack() {
-                               Thread launchMe = new Thread() {
-                                       public void run() {
-                                               InterpreterManagement.putCommandInScilabQueue(getCommand());
-                                       }
-                               };
-                               launchMe.start();
-                       }
-               });
-       }
+            private static final long serialVersionUID = -7286803341046313407L;
 
-       /**
-        * Callback Factory to easily create a callback
-        * just like in scilab.
-        * WARNING : this callback will be ignored by xclick & xgetmouse
-        * @param command : the command to execute.
-        * @return a usable Scilab callback
-        */
-       public static ScilabCallBack createOutOfXclickAndXgetmouse(String command) {
-               return (new ScilabCallBack(command) {
-                                   
-                       private static final long serialVersionUID = -7286803341046313407L;
+            public void callBack() {
+                Thread launchMe = new Thread() {
+                    public void run() {
+                        InterpreterManagement.putCommandInScilabQueue(getCommand());
+                    }
+                };
+                launchMe.start();
+            }
+        });
+    }
+
+    /**
+     * Callback Factory to easily create a callback
+     * just like in scilab.
+     * WARNING : this callback will be ignored by xclick & xgetmouse
+     * @param command : the command to execute.
+     * @return a usable Scilab callback
+     */
+    public static ScilabCallBack createOutOfXclickAndXgetmouse(String command) {
+        return (new ScilabCallBack(command) {
+
+            private static final long serialVersionUID = -7286803341046313407L;
+
+            public void callBack() {
+                Thread launchMe = new Thread() {
+                    public void run() {
+                        InterpreterManagement.putCommandInScilabQueue(getCommand());
+                    }
+                };
+                launchMe.start();
+            }
+
+            /**
+             * To match the standard Java Action management.
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             * @param e The event that launch the callback.
+             */
+            public void actionPerformed(ActionEvent e) {
+                callBack();
+            }
+        });
+    }
 
-                       public void callBack() {
-                               Thread launchMe = new Thread() {
-                                       public void run() {
-                                               InterpreterManagement.putCommandInScilabQueue(getCommand());
-                                       }
-                               };
-                               launchMe.start();
-                       }
-                       
-                       /**
-                        * To match the standard Java Action management.
-                        * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-                        * @param e The event that launch the callback.
-                        */
-                       public void actionPerformed(ActionEvent e) {
-                           callBack();
-                       }
-               });
-       }
-       
 }
index 8075b2a..948cccf 100644 (file)
@@ -15,6 +15,7 @@ package org.scilab.modules.gui.events.callback;
 import java.awt.event.ActionEvent;
 
 import org.scilab.modules.action_binding.InterpreterManagement;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.events.GlobalEventFilter;
 import org.scilab.modules.gui.events.GlobalEventWatcher;
 import org.scilab.modules.gui.utils.SciTranslator;
@@ -26,62 +27,64 @@ import org.scilab.modules.gui.utils.SciTranslator;
  * @author Bruno JOFRET
  *
  */
-public abstract class ScilabCloseCallBack extends CallBack {
+public abstract class ScilabCloseCallBack extends CommonCallBack {
 
-       private int figureIndex;
-       
-       /**
-        * Constructor
-        * @param figureIndex : the figure ID where callback occured.
-        * @param command : the command to execute.
-        */
-       private ScilabCloseCallBack(int figureIndex, String command) {
-               super(command);
-               this.figureIndex = figureIndex;
-       }
+    private static final long serialVersionUID = 7712036428657481222L;
 
-       /**
-        * Callback Factory to easily create a callback
-        * just like in scilab.
-        * @param figureIndex : the figure ID where callback occured.
-        * @param command : the command to execute.
-        * @return a usable Scilab callback
-        */
-       public static ScilabCloseCallBack create(int figureIndex, String command) {
-               return (new ScilabCloseCallBack(figureIndex, command) {
+    private int figureIndex;
 
-                       private static final long serialVersionUID = -7286803341046313407L;
+    /**
+     * Constructor
+     * @param figureIndex : the figure ID where callback occured.
+     * @param command : the command to execute.
+     */
+    private ScilabCloseCallBack(int figureIndex, String command) {
+        super(command, CallBack.UNTYPED);
+        this.figureIndex = figureIndex;
+    }
 
-                       public void callBack() {
-                               Thread launchMe = new Thread() {
-                                       public void run() {
-                                               InterpreterManagement.putCommandInScilabQueue(getCommand());
-                                       }
-                               };
-                               launchMe.start();
-                       }
-               });
-       }
+    /**
+     * Callback Factory to easily create a callback
+     * just like in scilab.
+     * @param figureIndex : the figure ID where callback occured.
+     * @param command : the command to execute.
+     * @return a usable Scilab callback
+     */
+    public static ScilabCloseCallBack create(int figureIndex, String command) {
+        return (new ScilabCloseCallBack(figureIndex, command) {
 
-       /**
-        * To match the standard Java Action management.
-        * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-        * @param e The event that launch the callback.
-        */
-       public void actionPerformed(ActionEvent e) {
-       /**
-        * !! WARNING !!
-        * 
-        * We need a special behaviour when asking the window to close.
-        * We really need to close it (i.e exec the callback)
-        * THEN to inform the global listener close command has been activated (i.e filterCallback).
-        * 
-        */
-               callBack();
-               if (GlobalEventWatcher.isActivated()) {
-                       if (this.command != null) {
-                               GlobalEventFilter.filterCallback(this.command, SciTranslator.SCICLOSE, figureIndex);
-                       }
-               }
-       }
+            private static final long serialVersionUID = -7286803341046313407L;
+
+            public void callBack() {
+                Thread launchMe = new Thread() {
+                    public void run() {
+                        InterpreterManagement.putCommandInScilabQueue(getCommand());
+                    }
+                };
+                launchMe.start();
+            }
+        });
+    }
+
+    /**
+     * To match the standard Java Action management.
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     * @param e The event that launch the callback.
+     */
+    public void actionPerformed(ActionEvent e) {
+        /**
+         * !! WARNING !!
+         * 
+         * We need a special behaviour when asking the window to close.
+         * We really need to close it (i.e exec the callback)
+         * THEN to inform the global listener close command has been activated (i.e filterCallback).
+         * 
+         */
+        callBack();
+        if (GlobalEventWatcher.isActivated()) {
+            if (getCommand() != null) {
+                GlobalEventFilter.filterCallback(getCommand(), SciTranslator.SCICLOSE, figureIndex);
+            }
+        }
+    }
 }
index ae1ccba..3d8e212 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.container.Container;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 
 /**
  * Interface for Scilab frames in GUIs
@@ -94,7 +94,7 @@ public interface Frame extends Container {
         * Set the callback of the Frame
         * @param callback the callback to set
         */
-       void setCallback(CallBack callback);
+       void setCallback(CommonCallBack callback);
        
        /**
         * Set the Relief of the Frame
index 657bdee..07b9561 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
 import org.scilab.modules.gui.container.ScilabContainer;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -180,7 +180,7 @@ public class ScilabFrame extends ScilabContainer implements Frame {
         * Add a callback to the Frame
         * @param callback the callback to set
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index dbb3af5..73748ff 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -133,7 +133,7 @@ public class ScilabFrameBridge {
         * @param frame the Frame we want to set the callback of
         * @param callback the callback to set
         */
-       public static void setCallback(Frame frame, CallBack callback) {
+       public static void setCallback(Frame frame, CommonCallBack callback) {
                frame.getAsSimpleFrame().setCallback(callback);
        }
        
index fd3ecd0..b74c33e 100644 (file)
@@ -18,7 +18,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.container.Container;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 
 /**
  * Interface for SimpleFrame the associated object to Scilab GUIs Frame
@@ -92,7 +92,7 @@ public interface SimpleFrame extends Container {
         * Set the callback of the Frame
         * @param callback the callback to set
         */
-       void setCallback(CallBack callback);
+       void setCallback(CommonCallBack callback);
        
        /**
         * Set the Relief of the Frame
index 1f65cfa..5b8ca23 100644 (file)
@@ -22,6 +22,7 @@ import java.awt.event.KeyEvent;
 import javax.swing.SwingUtilities;
 
 import org.scilab.modules.commons.ScilabConstants;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.bridge.ScilabBridge;
 import org.scilab.modules.gui.bridge.helpbrowser.SwingScilabHelpBrowser;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
@@ -90,7 +91,7 @@ public class ScilabHelpBrowser extends ScilabDockable implements HelpBrowser {
             helpTab.addMember(instance);
             /* Action when the Browser tab is closed */
             helpTab.setCallback(ScilabCallBack
-                                .createCallback("org.scilab.modules.gui.bridge.CallScilabBridge.closeHelpBrowser", ScilabCallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE));
+                                .createCallback("org.scilab.modules.gui.bridge.CallScilabBridge.closeHelpBrowser", CallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE));
 
             MenuBar menubar = MenuBarBuilder.buildMenuBar(MENUBARXMLFILE);
             helpTab.addMenuBar(menubar);
index d2bc801..d8fd404 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabImageRenderer extends ScilabWidget implements ImageRenderer {
         * Add a callback to the ImageRenderer
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 306d23a..077e566 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.imagerenderer.SwingScilabImageRenderer;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -133,7 +133,7 @@ public class ScilabImageRendererBridge {
         * @param imageRender the ImageRenderer we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(ImageRenderer imageRender, CallBack callback) {
+       public static void setCallback(ImageRenderer imageRender, CommonCallBack callback) {
                imageRender.getAsSimpleImageRenderer().setCallback(callback);
        }
        
index 096b722..baa4a75 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabLabel extends ScilabWidget implements Label {
         * Add a callback to the Label
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index b22d3d8..a7819da 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.label.SwingScilabLabel;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabLabelBridge {
         * @param label the Label we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(Label label, CallBack callback) {
+       public static void setCallback(Label label, CommonCallBack callback) {
                label.getAsSimpleLabel().setCallback(callback);
        }
        
index f480963..f677648 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -181,7 +181,7 @@ public class ScilabListBox extends ScilabWidget implements ListBox {
         * Add a callback to the ListBox
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 38122ae..f264457 100644 (file)
@@ -18,7 +18,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -136,7 +136,7 @@ public class ScilabListBoxBridge {
         * @param listBox the ListBox we want to set the callback of
         * @param callback the callback to set.
         */
-       public static void setCallback(ListBox listBox, CallBack callback) {
+       public static void setCallback(ListBox listBox, CommonCallBack callback) {
                listBox.getAsSimpleListBox().setCallback(callback);
        }
        
index 3503aea..16a83c4 100644 (file)
@@ -14,7 +14,7 @@
 package org.scilab.modules.gui.menu;
 
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.widget.Widget;
 
@@ -76,5 +76,5 @@ public interface Menu extends Widget {
         * Retrieve the CallBack associated to this MenuItem
         * @return the CallBack
         */
-       CallBack getCallback();
+       CommonCallBack getCallback();
 }
index 62675fe..8e740fc 100644 (file)
@@ -18,7 +18,7 @@ import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
@@ -240,7 +240,7 @@ public class ScilabMenu extends ScilabWidget implements Menu {
         * Add a callback to the menu, this callback is a Scilab command
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
@@ -302,7 +302,7 @@ public class ScilabMenu extends ScilabWidget implements Menu {
         * Retrieve the CallBack associated to this MenuItem
         * @return the CallBack
         */
-       public CallBack getCallback() {
+       public CommonCallBack getCallback() {
                return ScilabBridge.getCallback(this);
        }
 
index dc699f1..fe6ae3c 100644 (file)
@@ -18,7 +18,7 @@ import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.menu.SwingScilabMenu;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 
 /**
@@ -230,7 +230,7 @@ public class ScilabMenuBridge {
         * @param menu the menu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(Menu menu, CallBack callback) {
+       public static void setCallback(Menu menu, CommonCallBack callback) {
                menu.getAsSimpleMenu().setCallback(callback);
        }
 
@@ -282,7 +282,7 @@ public class ScilabMenuBridge {
         * @param menuItem the Menu
         * @return the CallBack
         */
-       public static CallBack getCallback(Menu menu) {
+       public static CommonCallBack getCallback(Menu menu) {
                return menu.getAsSimpleMenu().getCallback();
        }
 
index f6eed34..516cfd5 100644 (file)
@@ -14,7 +14,7 @@
 package org.scilab.modules.gui.menu;
 
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.widget.Widget;
 
@@ -70,7 +70,7 @@ public interface SimpleMenu extends Widget {
          * Retrieve the CallBack associated to this Menu
          * @return the CallBack
          */
-        CallBack getCallback();
+        CommonCallBack getCallback();
 
         /**
          * Get the base text used for the Menu
index 2ed398e..89162ce 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.utils.Position;
@@ -213,7 +213,7 @@ public class ScilabMenuItem extends ScilabMenu implements MenuItem {
         * Add a callback to the menu, this callback is a Scilab command
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
@@ -291,7 +291,7 @@ public class ScilabMenuItem extends ScilabMenu implements MenuItem {
         * Retrieve the CallBack associated to this MenuItem
         * @return the CallBack
         */
-       public CallBack getCallback() {
+       public CommonCallBack getCallback() {
                return ScilabBridge.getCallback(this);
        }
 
index b0b08e5..32683fa 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 
 /**
@@ -212,7 +212,7 @@ public class ScilabMenuItemBridge {
         * @param menuItem the menu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(MenuItem menuItem, CallBack callback) {
+       public static void setCallback(MenuItem menuItem, CommonCallBack callback) {
                menuItem.getAsSimpleMenuItem().setCallback(callback);
        }
 
@@ -282,7 +282,7 @@ public class ScilabMenuItemBridge {
         * @param menuItem the MenuItem
         * @return the CallBack
         */
-       public static CallBack getCallback(MenuItem menuItem) {
+       public static CommonCallBack getCallback(MenuItem menuItem) {
                return menuItem.getAsSimpleMenuItem().getCallback();
        }
 
index 3b897b8..f25774c 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabPopupMenu extends ScilabWidget implements PopupMenu {
         * Add a callback to the PopupMenu
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 91c610e..bdad6ac 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabPopupMenuBridge {
         * @param popupMenu the PopupMenu we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(PopupMenu popupMenu, CallBack callback) {
+       public static void setCallback(PopupMenu popupMenu, CommonCallBack callback) {
                popupMenu.getAsSimplePopupMenu().setCallback(callback);
        }
        
index 9c44c84..5895a47 100644 (file)
@@ -20,7 +20,7 @@ import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 
 /**
  * Class for Scilab PushButtons in GUIs
@@ -142,7 +142,7 @@ public class ScilabPushButton extends ScilabWidget implements PushButton {
         * Add a callback to the pushbutton, this callback is a Scilab command
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
index de0c3a6..00ecf52 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabPushButtonBridge {
         * @param pushButton the PushButton we want to set the callback of
         * @param callback the callback to set.
         */
-       public static void setCallback(PushButton pushButton, CallBack callback) {
+       public static void setCallback(PushButton pushButton, CommonCallBack callback) {
                pushButton.getAsSimplePushButton().setCallback(callback);
        }
 
index eee23a4..d8f43c1 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabRadioButton extends ScilabWidget implements RadioButton {
         * Add a callback to the RadioButton
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 9a1cab5..9e78939 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabRadioButtonBridge {
         * @param radioButton the RadioButton we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(RadioButton radioButton, CallBack callback) {
+       public static void setCallback(RadioButton radioButton, CommonCallBack callback) {
                radioButton.getAsSimpleRadioButton().setCallback(callback);
        }
        
index 8638481..fcd959b 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabSlider extends ScilabWidget implements Slider {
         * Add a callback to the Slider
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index ca5af26..b817758 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -135,7 +135,7 @@ public class ScilabSliderBridge {
         * @param slider the Slider we want to set the callback of
         * @param callback the callback to set.
         */
-       public static void setCallback(Slider slider, CallBack callback) {
+       public static void setCallback(Slider slider, CommonCallBack callback) {
                slider.getAsSimpleSlider().setCallback(callback);
        }
        
index f9dca32..9e94f76 100644 (file)
@@ -20,7 +20,7 @@ import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.container.ScilabContainer;
 import org.scilab.modules.gui.dockable.Dockable;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
@@ -507,7 +507,7 @@ public class ScilabTab extends ScilabContainer implements Tab {
         * Set the callback of the tab
         * @param callback the CallBack to set
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index 03a6563..b1b96b8 100644 (file)
@@ -18,7 +18,7 @@ import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.checkbox.CheckBox;
 import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
@@ -462,7 +462,7 @@ public class ScilabTabBridge {
         * @param tab the tab which we want to set the callback of
         * @param callback the CallBack to set
         */
-       public static void setCallback(Tab tab, CallBack callback) {
+       public static void setCallback(Tab tab, CommonCallBack callback) {
                tab.getAsSimpleTab().setCallback(callback);
        }
 
index 61165a5..c97ce15 100644 (file)
@@ -18,7 +18,7 @@ import org.scilab.modules.gui.checkbox.CheckBox;
 import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
@@ -345,7 +345,7 @@ public interface SimpleTab {
         * Set the callback of the tab
         * @param callback the CallBack to set
         */
-       void setCallback(CallBack callback);
+       void setCallback(CommonCallBack callback);
 
        /**
         * Set this tab as the current tab of its parent Window
index bd6e000..050dd24 100644 (file)
@@ -17,7 +17,7 @@ import org.scilab.modules.gui.console.Console;
 import org.scilab.modules.gui.canvas.Canvas;
 import org.scilab.modules.gui.container.Container;
 import org.scilab.modules.gui.editbox.EditBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.frame.Frame;
 import org.scilab.modules.gui.helpbrowser.HelpBrowser;
 import org.scilab.modules.gui.label.Label;
@@ -232,7 +232,7 @@ public interface Tab extends Container {
         * Set the callback of the tab
         * @param callback the CallBack to set
         */
-       void setCallback(CallBack callback);
+       void setCallback(CommonCallBack callback);
        
        /**
         * Get the parent Window
index 8effa33..a4ab8a4 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.text.ScilabText;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
@@ -199,7 +199,7 @@ public class ScilabTextBox extends ScilabText implements TextBox {
         * Add a callback to the TextBox
         * @param callback the callback to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
 
index 5ef195a..d5d6d4c 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.textbox.SwingScilabTextBox;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -208,7 +208,7 @@ public class ScilabTextBoxBridge {
         * @param textBox the TextBox we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(TextBox textBox, CallBack callback) {
+       public static void setCallback(TextBox textBox, CommonCallBack callback) {
                textBox.getAsSimpleTextBox().setCallback(callback);
        }
        
index ae80896..d39c90d 100644 (file)
@@ -21,9 +21,10 @@ import java.util.Vector;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 import org.scilab.modules.gui.bridge.ScilabBridge;
 import org.scilab.modules.gui.bridge.tree.ScilabTreeCellRenderer;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
@@ -40,37 +41,37 @@ public class ScilabTree implements Tree {
 
     private String label;
     private Icon icon;
-    private CallBack callback;
+    private CommonCallBack callback;
     private Vector<Tree> children;
 
     private SimpleTree component = null;
 
     public ScilabTree(String label, String iconPath, String callbackString) {
-       this.label = label;
+        this.label = label;
 
-       // Creating an Iconimage with the image's path 
-       Toolkit toolkit = Toolkit.getDefaultToolkit();
-       if (iconPath.equals("default")) {
-           this.icon = ScilabTreeCellRenderer.iconDefaut;
-       } else if (iconPath.equals("")) {
-           this.icon = null;
-       } else {
-           //Image image = (toolkit.getImage(iconPath)).getScaledInstance(25, 25, Image.SCALE_DEFAULT);
-               Image image = (toolkit.getImage(iconPath));
-           this.icon = new ImageIcon(image);
-       }
+        // Creating an Iconimage with the image's path 
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        if (iconPath.equals("default")) {
+            this.icon = ScilabTreeCellRenderer.iconDefaut;
+        } else if (iconPath.equals("")) {
+            this.icon = null;
+        } else {
+            //Image image = (toolkit.getImage(iconPath)).getScaledInstance(25, 25, Image.SCALE_DEFAULT);
+            Image image = (toolkit.getImage(iconPath));
+            this.icon = new ImageIcon(image);
+        }
 
-       // Creating a callback with the callback's string
-       this.callback = CallBack.createCallback(callbackString, CallBack.SCILAB_FUNCTION);
+        // Creating a callback with the callback's string
+        this.callback = CommonCallBack.createCallback(callbackString, CallBack.SCILAB_FUNCTION);
 
-       this.children = new Vector<Tree>();
+        this.children = new Vector<Tree>();
     }
 
     /**
      * GUI display of this tree 
      */
     public void showTree() {
-       ScilabBridge.showTree(this);            
+        ScilabBridge.showTree(this);           
     }
 
     /**
@@ -78,7 +79,7 @@ public class ScilabTree implements Tree {
      * @return node's label
      */
     public String getLabel() {
-       return label;
+        return label;
     }
 
     /**
@@ -86,7 +87,7 @@ public class ScilabTree implements Tree {
      * @param label of the node
      */
     public void setLabel(String label) {
-       this.label = label;
+        this.label = label;
     }
 
     /**
@@ -94,7 +95,7 @@ public class ScilabTree implements Tree {
      * @return node's icon
      */
     public Icon getIcon() {
-       return icon;
+        return icon;
     }
 
     /**
@@ -102,23 +103,23 @@ public class ScilabTree implements Tree {
      * @param icon of the node
      */
     public void setIcon(Icon icon) {
-       this.icon = icon;
+        this.icon = icon;
     }
 
     /**
      * Get callback of a node
      * @return node's callback
      */
-    public CallBack getCallback() {
-       return callback;
+    public CommonCallBack getCallback() {
+        return callback;
     }
 
     /**
      * Set callback for a node
      * @param callback of the node
      */
-    public void setCallback(CallBack callback) {
-       this.callback = callback;
+    public void setCallback(CommonCallBack callback) {
+        this.callback = callback;
     }  
 
     /**
@@ -126,7 +127,7 @@ public class ScilabTree implements Tree {
      * @return children
      */        
     public Vector<Tree> getChildren() {
-       return children;
+        return children;
     }
 
     /**
@@ -134,13 +135,13 @@ public class ScilabTree implements Tree {
      * @param firstChild of the tree
      */
     public void addChild(Tree firstChild) {
-       children.add(firstChild);
+        children.add(firstChild);
     }
 
     private void updateComponent() {
-       if (component == null) {
-           component = ScilabBridge.createTree(this);
-       }
+        if (component == null) {
+            component = ScilabBridge.createTree(this);
+        }
     }
 
     /**
@@ -148,147 +149,147 @@ public class ScilabTree implements Tree {
      * @return this Bridge component object
      */
     public SimpleTree getAsSimpleTree() {
-       updateComponent();
-       return component;
+        updateComponent();
+        return component;
     }
 
     public void destroy() {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public Color getBackground() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public Font getFont() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public Color getForeground() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public String getText() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public boolean isEnabled() {
-       // TODO Auto-generated method stub
-       return false;
+        // TODO Auto-generated method stub
+        return false;
     }
 
     public void requestFocus() {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setBackground(Color color) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setEnabled(boolean status) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setFont(Font font) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setForeground(Color color) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setHorizontalAlignment(String alignment) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setRelief(String reliefType) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setText(String text) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void setVerticalAlignment(String alignment) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void addInfoBar(TextBox infoBarToAdd) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void addMenuBar(MenuBar menuBarToAdd) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void addToolBar(ToolBar toolBarToAdd) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public void draw() {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
     public Size getDims() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public TextBox getInfoBar() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public MenuBar getMenuBar() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public Position getPosition() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public ToolBar getToolBar() {
-       // TODO Auto-generated method stub
-       return null;
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public boolean isVisible() {
-       // TODO Auto-generated method stub
-       return false;
+        // TODO Auto-generated method stub
+        return false;
     }
 
     public void setDims(Size newSize) {
-       updateComponent();
-       component.setDims(newSize);
+        updateComponent();
+        component.setDims(newSize);
     }
 
     public void setPosition(Position newPosition) {
-       updateComponent();
-       component.setPosition(newPosition);
+        updateComponent();
+        component.setPosition(newPosition);
     }
 
     public void setVisible(boolean newVisibleState) {
-       // TODO Auto-generated method stub
+        // TODO Auto-generated method stub
 
     }
 
index 0893442..aff19a6 100644 (file)
@@ -16,7 +16,7 @@ import java.util.Vector;
 
 import javax.swing.Icon;
 
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.widget.Widget;
 
 
@@ -48,7 +48,7 @@ public interface Tree extends Widget {
         * Get the callback of a tree node
         * @return callback of a node
         */
-       CallBack getCallback();
+       CommonCallBack getCallback();
        
        /**
         * Add child to a tree
index c8b9f66..cf25101 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabUiDisplayTree extends ScilabWidget implements UiDisplayTree {
         * Add a callback to the UiDisplayTree
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index e2931e6..296c6c5 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.uidisplaytree.SwingScilabUiDisplayTree;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -133,7 +133,7 @@ public class ScilabUiDisplayTreeBridge {
         * @param uiTree the UiDisplayTree we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(UiDisplayTree uiTree, CallBack callback) {
+       public static void setCallback(UiDisplayTree uiTree, CommonCallBack callback) {
                uiTree.getAsSimpleUiDisplayTree().setCallback(callback);
        }
        
index 3455ac9..8742247 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.ScilabBridge;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.widget.ScilabWidget;
@@ -180,7 +180,7 @@ public class ScilabUiTable extends ScilabWidget implements UiTable {
         * Add a callback to the UiTable
         * @param callback the CallBack to set.
         */
-       public void setCallback(CallBack callback) {
+       public void setCallback(CommonCallBack callback) {
                ScilabBridge.setCallback(this, callback);
        }
        
index e5ccedc..596516e 100644 (file)
@@ -16,7 +16,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.bridge.uitable.SwingScilabUiTable;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 
@@ -133,7 +133,7 @@ public class ScilabUiTableBridge {
         * @param uiTable the UiTable we want to set the callback of
         * @param callback the CallBack to set.
         */
-       public static void setCallback(UiTable uiTable, CallBack callback) {
+       public static void setCallback(UiTable uiTable, CommonCallBack callback) {
                uiTable.getAsSimpleUiTable().setCallback(callback);
        }
        
index 0a341d8..f25ec6e 100644 (file)
@@ -31,7 +31,8 @@ import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
 import org.scilab.modules.commons.xml.ScilabDocumentBuilderFactory;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -261,7 +262,7 @@ public final class MenuBarBuilder {
                                                                }
                                                        }
                                                        if (command != null && commandType != CallBack.UNTYPED) {
-                                                       menuItem.setCallback(CallBack.createCallback(replaceFigureID(command), commandType));
+                                                       menuItem.setCallback(CommonCallBack.createCallback(replaceFigureID(command), commandType));
                                                        }
                                                } else if (callback.getNodeName() == SUBMENU) {
                                                        addSubMenuItem(menuItem, callback);
@@ -312,7 +313,7 @@ public final class MenuBarBuilder {
                                                }
                                        }
                                        if (command != null && commandType != CallBack.UNTYPED) {
-                                               subMenuItem.setCallback(CallBack.createCallback(replaceFigureID(command), commandType));
+                                               subMenuItem.setCallback(CommonCallBack.createCallback(replaceFigureID(command), commandType));
                                        }
                                } else if (callback.getNodeName() == SUBMENU) {
                                        addSubMenuItem(subMenuItem, callback);
index f287a7f..7fcb593 100644 (file)
@@ -30,7 +30,8 @@ import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
 import org.scilab.modules.commons.xml.ScilabDocumentBuilderFactory;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.graphic_objects.graphicObject.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.pushbutton.PushButton;
 import org.scilab.modules.gui.pushbutton.ScilabPushButton;
 import org.scilab.modules.gui.toolbar.ScilabToolBar;
@@ -43,223 +44,223 @@ import org.scilab.modules.localization.Messages;
  */
 public final class ToolBarBuilder {
 
-       private static final String FILE_NOT_FOUND = "Could not find file: ";
-
-       private static final String CANNOT_CREATE_TOOLBAR = "Cannot create ToolBar.\n"
-                                                       + "Check if file *_toolbar.xml is available and valid.";        
-       
-       private static int figureIndex;
-
-       /**
-        * Default constructor
-        */
-       private ToolBarBuilder() {
-               throw new UnsupportedOperationException();
-       }
-
-       /**
-        * Create a proxy to access a XML file
-        * @param resultClass class for the return value
-        * @param fileToLoad XML file to load
-        * @return a proxy used to read the XML file
-        * @throws SAXException can be thrown when an error occurs while reading the file
-        * @throws IOException can be thrown when an error occurs while accessing the file
-        * @throws ParserConfigurationException can be thrown when an error occurs while parsing the file
-        */
-       public static Object buildToolBar(Class[] resultClass, String fileToLoad) throws SAXException, IOException, ParserConfigurationException {
-               
-               InvocationHandler invocationHandler = new ToolBarConfigurationHandler(fileToLoad);
-               
-               return Proxy.newProxyInstance(invocationHandler.getClass().getClassLoader(), resultClass, invocationHandler);
-       }
-
-       /**
-        * Create a Scilab toolbar from data in a XML file
-        * @param fileToLoad XML file to load
-        * @return the toolbar created
-        */
-       public static ToolBar buildToolBar(String fileToLoad) {
-               return buildToolBar(fileToLoad, 0);
-       }
-       
-       /**
-        * Create a Scilab toolbar from data in a XML file
-        * @param fileToLoad XML file to load
-        * @param figureIndex the index of the figure in Scilab (for graphics figures only)
-        * @return the toolbar created
-        */
-       public static ToolBar buildToolBar(String fileToLoad, int figureIndex) {
-               
-               ToolBarBuilder.figureIndex = figureIndex;
-               
-               ToolBar toolbar = ScilabToolBar.createToolBar();
-               
-               try {
-                       ToolBarConfiguration toolBarConfig = 
-                                       (ToolBarConfiguration) buildToolBar(new Class[] {ToolBarConfiguration.class}, fileToLoad);
-                       toolBarConfig.addPushButtons(toolbar);
-               } catch (IllegalArgumentException e) {
-                       System.err.println(CANNOT_CREATE_TOOLBAR);
-                       System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
-               } catch (SAXException e) {
-                       System.err.println(CANNOT_CREATE_TOOLBAR);
-                       System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
-               } catch (IOException e) {
-                       System.err.println(CANNOT_CREATE_TOOLBAR);
-                       System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
-               } catch (ParserConfigurationException e) {
-                       System.err.println(CANNOT_CREATE_TOOLBAR);
-                       System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
-               }
-               
-               return toolbar;
-       }       
-
-       /**
-        * Class used to read the XMl file 
-        */
-       private static class ToolBarConfigurationHandler implements InvocationHandler {
-               protected static final String BUTTON = "button";
-               protected static final String ICON = "icon";
-               protected static final String SEPARATOR = "separator";
-               protected static final String ENABLED = "enabled";
-               protected static final String CALLBACK = "callback";
-               protected static final String TYPE = "type";
-               protected static final String INSTRUCTION = "instruction";
-               protected static final String TRUE = "true";
-               protected static final String FALSE = "false";
-               protected static final String TOOLTIPTEXT = "tooltiptext";
-               
-               protected static final String DEFAULT_ICON_PATH = System.getenv("SCI") + "/modules/gui/images/icons/";
-
-               private Document dom;
-               private Collection<String> internalMethodNames;
-
-
-               /**
-                * Constructor
-                * @param xmlFile XML file to load
-                * @throws SAXException can be thrown when an error occurs while reading the file
-                * @throws IOException can be thrown when an error occurs while accessing the file
-                * @throws ParserConfigurationException can be thrown when an error occurs while parsing the file
-                */
-               public ToolBarConfigurationHandler(String xmlFile) throws SAXException, IOException, ParserConfigurationException {
-                       
-                       if (!new File(xmlFile).exists()) {
-                               throw new java.io.IOException();
-                       }
-
-                       // Build dictionary for internal method
-                       internalMethodNames = new TreeSet<String>();
-                       Method[] internalMethodes = this.getClass().getMethods();
-                       for (Method method : internalMethodes) {
-                               internalMethodNames.add(method.getName());
-                       }
-
-                       // Build xml document for request
-                       dom = ScilabDocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(xmlFile));
-               }
-
-               /**
-                * Invoke a proxy to get data
-                * @param proxy the proxy to call
-                * @param method the method to call
-                * @param args the arguments for the method
-                * @return the object read
-                * @throws IllegalAccessException thrown when the method called is inaccessible
-                * @throws InvocationTargetException thorwn when the method called threw an exception
-                * @throws NoSuchMethodException thrown when invoking a non-existing method
-                * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
-                */
-               public Object invoke(Object proxy, Method method, Object[] args) 
-                       throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-                       
-                       if (internalMethodNames.contains(method.getName())) {
-                               return getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
-                       } else {
-                               return null;
-                       }
-               }
-
-               /**
-                * Add tools to a toolbar
-                * @param tb the toolbar which the buttons will be added to
-                * @see org.scilab.modules.gui.utils.ToolBarConfiguration#addButtons(org.scilab.modules.gui.toolbar.ToolBar)
-                */
-               public void addPushButtons(ToolBar tb) {
-                       // First Child of this XML file is a menubar
-                       Node menubar = dom.getFirstChild();
-                       // Children of the menubar are buttons (or separators)
-                       Node button = menubar.getFirstChild();
-
-                       NamedNodeMap buttonAttributes = null;
-                       PushButton pushButton = null;
-
-                       // Get all children
-                       while (button != null) {
-                               
-                               if (button.getNodeName().equals(BUTTON)) {
-                                       // The child is a button
-                                       pushButton = ScilabPushButton.createPushButton();
-                                       // Read all its attributes
-                                       buttonAttributes = button.getAttributes();
-                                       
-                                       for (int i = 0; i < buttonAttributes.getLength(); i++) {
-                                       
-                                               if (buttonAttributes.item(i).getNodeName().equals(ICON)) {
-                                                       // Icon file
-                                                       pushButton.setIcon(DEFAULT_ICON_PATH + buttonAttributes.item(i).getNodeValue());
-                                               } else if (buttonAttributes.item(i).getNodeName().equals(ENABLED)) {
-                                                       // Enable are disable the button
-                                                       pushButton.setEnabled(buttonAttributes.item(i).getNodeValue().equals(TRUE));
-                                               } else if (buttonAttributes.item(i).getNodeName().equals(TOOLTIPTEXT)) {
-                                                       // Add a ToolTip on the button
-                                                       pushButton.setToolTipText(Messages.gettext(buttonAttributes.item(i).getNodeValue()));
-                                               }
-                                       }
-                                       // Add the button to the toolbar
-                                       tb.add(pushButton);
-                                       
-                                       // Then we get its callback (if exists)
-                                       Node callback = button.getFirstChild();
-                                       while (callback != null) {
-                                               if (callback.getNodeName() == CALLBACK) {
-                                                       NamedNodeMap cbAttributes = callback.getAttributes();
-                                                       String command = null;
-                                                       int commandType = CallBack.UNTYPED;
-                                                       for (int j = 0; j < cbAttributes.getLength(); j++) {
-                                                               if (cbAttributes.item(j).getNodeName() == INSTRUCTION) {
-                                                                       command = cbAttributes.item(j).getNodeValue();
-                                                               } else if (cbAttributes.item(j).getNodeName() == TYPE) {
-                                                                       commandType = Integer.parseInt(cbAttributes.item(j).getNodeValue());
-                                                               }
-                                                       }
-                                               if (command != null && commandType != CallBack.UNTYPED) {
-                                                       pushButton.setCallback(CallBack.createCallback(replaceFigureID(command), commandType));
-                                                       }
-                                               }
-                                               // Read next child
-                                               callback = callback.getNextSibling();
-                                       }
-
-                               } else if (button.getNodeName().equals(SEPARATOR)) {
-                                       // The child is a separator
-                                       tb.addSeparator();
-                               }
-                               // Get next child
-                               button = button.getNextSibling();
-                       }
-               }
-               
-               
-               /**
-                * Replace pattern [SCILAB_FIGURE_ID] by the figure index
-                * @param initialString string read in XML file
-                * @return callback string
-                */
-               private String replaceFigureID(String initialString) {
-                       return initialString.replaceAll("\\[SCILAB_FIGURE_ID\\]", Integer.toString(ToolBarBuilder.figureIndex));
-               }
-
-       }
+    private static final String FILE_NOT_FOUND = "Could not find file: ";
+
+    private static final String CANNOT_CREATE_TOOLBAR = "Cannot create ToolBar.\n"
+        + "Check if file *_toolbar.xml is available and valid.";       
+
+    private static int figureIndex;
+
+    /**
+     * Default constructor
+     */
+    private ToolBarBuilder() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Create a proxy to access a XML file
+     * @param resultClass class for the return value
+     * @param fileToLoad XML file to load
+     * @return a proxy used to read the XML file
+     * @throws SAXException can be thrown when an error occurs while reading the file
+     * @throws IOException can be thrown when an error occurs while accessing the file
+     * @throws ParserConfigurationException can be thrown when an error occurs while parsing the file
+     */
+    public static Object buildToolBar(Class[] resultClass, String fileToLoad) throws SAXException, IOException, ParserConfigurationException {
+
+        InvocationHandler invocationHandler = new ToolBarConfigurationHandler(fileToLoad);
+
+        return Proxy.newProxyInstance(invocationHandler.getClass().getClassLoader(), resultClass, invocationHandler);
+    }
+
+    /**
+     * Create a Scilab toolbar from data in a XML file
+     * @param fileToLoad XML file to load
+     * @return the toolbar created
+     */
+    public static ToolBar buildToolBar(String fileToLoad) {
+        return buildToolBar(fileToLoad, 0);
+    }
+
+    /**
+     * Create a Scilab toolbar from data in a XML file
+     * @param fileToLoad XML file to load
+     * @param figureIndex the index of the figure in Scilab (for graphics figures only)
+     * @return the toolbar created
+     */
+    public static ToolBar buildToolBar(String fileToLoad, int figureIndex) {
+
+        ToolBarBuilder.figureIndex = figureIndex;
+
+        ToolBar toolbar = ScilabToolBar.createToolBar();
+
+        try {
+            ToolBarConfiguration toolBarConfig = 
+                (ToolBarConfiguration) buildToolBar(new Class[] {ToolBarConfiguration.class}, fileToLoad);
+            toolBarConfig.addPushButtons(toolbar);
+        } catch (IllegalArgumentException e) {
+            System.err.println(CANNOT_CREATE_TOOLBAR);
+            System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
+        } catch (SAXException e) {
+            System.err.println(CANNOT_CREATE_TOOLBAR);
+            System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
+        } catch (IOException e) {
+            System.err.println(CANNOT_CREATE_TOOLBAR);
+            System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
+        } catch (ParserConfigurationException e) {
+            System.err.println(CANNOT_CREATE_TOOLBAR);
+            System.err.println(FILE_NOT_FOUND + e.getLocalizedMessage());
+        }
+
+        return toolbar;
+    }  
+
+    /**
+     * Class used to read the XMl file 
+     */
+    private static class ToolBarConfigurationHandler implements InvocationHandler {
+        protected static final String BUTTON = "button";
+        protected static final String ICON = "icon";
+        protected static final String SEPARATOR = "separator";
+        protected static final String ENABLED = "enabled";
+        protected static final String CALLBACK = "callback";
+        protected static final String TYPE = "type";
+        protected static final String INSTRUCTION = "instruction";
+        protected static final String TRUE = "true";
+        protected static final String FALSE = "false";
+        protected static final String TOOLTIPTEXT = "tooltiptext";
+
+        protected static final String DEFAULT_ICON_PATH = System.getenv("SCI") + "/modules/gui/images/icons/";
+
+        private Document dom;
+        private Collection<String> internalMethodNames;
+
+
+        /**
+         * Constructor
+         * @param xmlFile XML file to load
+         * @throws SAXException can be thrown when an error occurs while reading the file
+         * @throws IOException can be thrown when an error occurs while accessing the file
+         * @throws ParserConfigurationException can be thrown when an error occurs while parsing the file
+         */
+        public ToolBarConfigurationHandler(String xmlFile) throws SAXException, IOException, ParserConfigurationException {
+
+            if (!new File(xmlFile).exists()) {
+                throw new java.io.IOException();
+            }
+
+            // Build dictionary for internal method
+            internalMethodNames = new TreeSet<String>();
+            Method[] internalMethodes = this.getClass().getMethods();
+            for (Method method : internalMethodes) {
+                internalMethodNames.add(method.getName());
+            }
+
+            // Build xml document for request
+            dom = ScilabDocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(xmlFile));
+        }
+
+        /**
+         * Invoke a proxy to get data
+         * @param proxy the proxy to call
+         * @param method the method to call
+         * @param args the arguments for the method
+         * @return the object read
+         * @throws IllegalAccessException thrown when the method called is inaccessible
+         * @throws InvocationTargetException thorwn when the method called threw an exception
+         * @throws NoSuchMethodException thrown when invoking a non-existing method
+         * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
+         */
+        public Object invoke(Object proxy, Method method, Object[] args) 
+        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+
+            if (internalMethodNames.contains(method.getName())) {
+                return getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
+            } else {
+                return null;
+            }
+        }
+
+        /**
+         * Add tools to a toolbar
+         * @param tb the toolbar which the buttons will be added to
+         * @see org.scilab.modules.gui.utils.ToolBarConfiguration#addButtons(org.scilab.modules.gui.toolbar.ToolBar)
+         */
+        public void addPushButtons(ToolBar tb) {
+            // First Child of this XML file is a menubar
+            Node menubar = dom.getFirstChild();
+            // Children of the menubar are buttons (or separators)
+            Node button = menubar.getFirstChild();
+
+            NamedNodeMap buttonAttributes = null;
+            PushButton pushButton = null;
+
+            // Get all children
+            while (button != null) {
+
+                if (button.getNodeName().equals(BUTTON)) {
+                    // The child is a button
+                    pushButton = ScilabPushButton.createPushButton();
+                    // Read all its attributes
+                    buttonAttributes = button.getAttributes();
+
+                    for (int i = 0; i < buttonAttributes.getLength(); i++) {
+
+                        if (buttonAttributes.item(i).getNodeName().equals(ICON)) {
+                            // Icon file
+                            pushButton.setIcon(DEFAULT_ICON_PATH + buttonAttributes.item(i).getNodeValue());
+                        } else if (buttonAttributes.item(i).getNodeName().equals(ENABLED)) {
+                            // Enable are disable the button
+                            pushButton.setEnabled(buttonAttributes.item(i).getNodeValue().equals(TRUE));
+                        } else if (buttonAttributes.item(i).getNodeName().equals(TOOLTIPTEXT)) {
+                            // Add a ToolTip on the button
+                            pushButton.setToolTipText(Messages.gettext(buttonAttributes.item(i).getNodeValue()));
+                        }
+                    }
+                    // Add the button to the toolbar
+                    tb.add(pushButton);
+
+                    // Then we get its callback (if exists)
+                    Node callback = button.getFirstChild();
+                    while (callback != null) {
+                        if (callback.getNodeName() == CALLBACK) {
+                            NamedNodeMap cbAttributes = callback.getAttributes();
+                            String command = null;
+                            int commandType = CallBack.UNTYPED;
+                            for (int j = 0; j < cbAttributes.getLength(); j++) {
+                                if (cbAttributes.item(j).getNodeName() == INSTRUCTION) {
+                                    command = cbAttributes.item(j).getNodeValue();
+                                } else if (cbAttributes.item(j).getNodeName() == TYPE) {
+                                    commandType = Integer.parseInt(cbAttributes.item(j).getNodeValue());
+                                }
+                            }
+                            if (command != null && commandType != CallBack.UNTYPED) {
+                                pushButton.setCallback(CommonCallBack.createCallback(replaceFigureID(command), commandType));
+                            }
+                        }
+                        // Read next child
+                        callback = callback.getNextSibling();
+                    }
+
+                } else if (button.getNodeName().equals(SEPARATOR)) {
+                    // The child is a separator
+                    tb.addSeparator();
+                }
+                // Get next child
+                button = button.getNextSibling();
+            }
+        }
+
+
+        /**
+         * Replace pattern [SCILAB_FIGURE_ID] by the figure index
+         * @param initialString string read in XML file
+         * @return callback string
+         */
+        private String replaceFigureID(String initialString) {
+            return initialString.replaceAll("\\[SCILAB_FIGURE_ID\\]", Integer.toString(ToolBarBuilder.figureIndex));
+        }
+
+    }
 }
index 9309010..01da80e 100644 (file)
@@ -17,7 +17,7 @@ import java.awt.Color;
 import java.awt.Font;
 
 import org.scilab.modules.gui.dockable.Dockable;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 
 /**
  * Interface for widget associated to objects in Scilab GUIs
@@ -90,7 +90,7 @@ public interface Widget extends Dockable {
         * Set the callback of the widget
         * @param callback the callback to set
         */
-       void setCallback(CallBack callback);
+       void setCallback(CommonCallBack callback);
 
        /**
         * Set the horizontal alignment for the widget text
index e22fb8d..de7e53e 100644 (file)
@@ -92,7 +92,6 @@ set(h, "backgroundcolor", "0.2|0.3|0.4");
 assert_checkequal(get(h, "backgroundcolor"), [0.2 0.3 0.4]);
 // TODO Test with wrong format values: 'aze', '', [], ...
 
-if 0 // TODO Activate this test
 // --- Callback tests ---
 // Default values
 assert_checkequal(get(h, "callback"), "");
@@ -111,7 +110,6 @@ set(h, "callback", "");
 assert_checkequal(get(h, "callback"), "");
 assert_checkequal(get(h, "callback_type"), -1);
 // TODO tests with wrong callbackType ??
-end
 
 // --- Enable ---
 assert_checkequal(get(h, "enable"), "on"); // Default value
index 1aa2eae..ef5c692 100644 (file)
@@ -54,12 +54,10 @@ import org.scilab.modules.gui.bridge.filechooser.SwingScilabFileChooser;
 import org.scilab.modules.gui.bridge.messagebox.SwingScilabMessageBox;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
 import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.filechooser.Juigetfile;
 import org.scilab.modules.gui.filechooser.ScilabFileChooser;
 import org.scilab.modules.gui.menubar.MenuBar;
-import org.scilab.modules.gui.messagebox.MessageBox;
-import org.scilab.modules.gui.messagebox.ScilabMessageBox;
 import org.scilab.modules.gui.messagebox.ScilabModalDialog;
 import org.scilab.modules.gui.messagebox.ScilabModalDialog.AnswerOption;
 import org.scilab.modules.gui.messagebox.ScilabModalDialog.ButtonType;
@@ -71,7 +69,6 @@ import org.scilab.modules.gui.utils.ConfigManager;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.SciFileFilter;
 import org.scilab.modules.gui.utils.Size;
-import org.scilab.modules.gui.window.SimpleWindow;
 import org.scilab.modules.scinotes.actions.ConfigTabulationsAction;
 import org.scilab.modules.scinotes.actions.EncodingAction;
 import org.scilab.modules.scinotes.actions.EndOfLineAction;
@@ -84,16 +81,16 @@ import org.scilab.modules.scinotes.actions.OpenSourceFileOnKeywordAction;
 import org.scilab.modules.scinotes.actions.RecentFileAction;
 import org.scilab.modules.scinotes.actions.RestoreOpenedFilesAction;
 import org.scilab.modules.scinotes.actions.SciNotesCompletionAction;
-import org.scilab.modules.scinotes.actions.SetColorsAction;
 import org.scilab.modules.scinotes.actions.SearchWordInFilesAction;
+import org.scilab.modules.scinotes.actions.SetColorsAction;
 import org.scilab.modules.scinotes.utils.ConfigSciNotesManager;
 import org.scilab.modules.scinotes.utils.DropFilesListener;
 import org.scilab.modules.scinotes.utils.NavigatorWindow;
-import org.scilab.modules.scinotes.utils.SearchFile;
 import org.scilab.modules.scinotes.utils.SaveFile;
-import org.scilab.modules.scinotes.utils.ScilabTabbedPane;
 import org.scilab.modules.scinotes.utils.SciNotesContents;
 import org.scilab.modules.scinotes.utils.SciNotesMessages;
+import org.scilab.modules.scinotes.utils.ScilabTabbedPane;
+import org.scilab.modules.scinotes.utils.SearchFile;
 
 /**
  * Main SciNotes class.
@@ -495,7 +492,7 @@ public class SciNotes extends SwingScilabTab {
         final SciNotes editorInstance = new SciNotes(mainWindow);
 
         SciNotesGUI.init(mainWindow, editorInstance, SCINOTES);
-        editorInstance.setCallback(new CallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
+        editorInstance.setCallback(new CommonCallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
                 /**
                  * serialVersionUID
                  */
index 0c55431..e774a66 100644 (file)
@@ -21,7 +21,7 @@ import javax.swing.KeyStroke;
 
 import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.gui.pushbutton.PushButton;
@@ -34,7 +34,7 @@ import org.scilab.modules.scinotes.utils.SciNotesMessages;
  * @author Bruno JOFRET
  * @author Calixte DENIZET
  */
-public class DefaultAction extends CallBack {
+public class DefaultAction extends CommonCallBack {
 
     private static final long serialVersionUID = 3597772070169671017L;
 
index d71218d..81e47ab 100644 (file)
@@ -21,7 +21,7 @@ import javax.swing.KeyStroke;
 import org.scilab.modules.gui.bridge.checkboxmenuitem.SwingScilabCheckBoxMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
 import org.scilab.modules.gui.checkboxmenuitem.SimpleCheckBoxMenuItem;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.SimpleMenu;
 import org.scilab.modules.gui.menuitem.SimpleMenuItem;
 import org.scilab.modules.scinotes.SciNotes;
@@ -50,7 +50,7 @@ public class DefaultCheckAction extends SwingScilabCheckBoxMenuItem implements C
         setState(true);
         editorBackup = editor;
 
-        setCallback(new CallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
+        setCallback(new CommonCallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
                 public void callBack() {
                     doAction();
                 }
@@ -72,7 +72,7 @@ public class DefaultCheckAction extends SwingScilabCheckBoxMenuItem implements C
         setText(label);
         setState(true);
         editorBackup = editor;
-        setCallback(new CallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
+        setCallback(new CommonCallBack(SciNotesMessages.DEFAULT + SciNotesMessages.DOTS) {
                 public void callBack() {
                     doAction();
                 }
index 42a82cd..40f4eb4 100644 (file)
 package org.scilab.modules.scinotes.utils;
 
 import java.awt.Color;
-import java.awt.Dimension;
 import java.awt.Component;
 import java.awt.Container;
+import java.awt.Dimension;
 import java.awt.FocusTraversalPolicy;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
-import java.awt.event.KeyAdapter;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.GroupLayout;
-import javax.swing.GroupLayout.Alignment;
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 import javax.swing.JMenuItem;
@@ -43,37 +42,36 @@ import javax.swing.JSeparator;
 import javax.swing.JTextField;
 import javax.swing.JTree;
 import javax.swing.KeyStroke;
-import javax.swing.tree.TreePath;
+import javax.swing.GroupLayout.Alignment;
 import javax.swing.LayoutStyle.ComponentPlacement;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.text.Element;
-import javax.swing.event.DocumentListener;
 import javax.swing.event.DocumentEvent;
-import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.DocumentListener;
 import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.text.Element;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
 
-import org.flexdock.docking.event.DockingEvent;
 import org.flexdock.docking.defaults.DockingSplitPane;
-
-import org.scilab.modules.gui.events.callback.CallBack;
-import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
+import org.flexdock.docking.event.DockingEvent;
+import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
-import org.scilab.modules.gui.menuitem.MenuItem;
-import org.scilab.modules.gui.menuitem.ScilabMenuItem;
-import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.menubar.ScilabMenuBar;
-import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.menuitem.MenuItem;
+import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.gui.textbox.ScilabTextBox;
 import org.scilab.modules.gui.textbox.TextBox;
-
-import org.scilab.modules.scinotes.ScilabEditorPane;
-import org.scilab.modules.scinotes.ScilabDocument;
-import org.scilab.modules.scinotes.SciNotesGUI;
+import org.scilab.modules.gui.toolbar.ToolBar;
 import org.scilab.modules.scinotes.SciNotes;
+import org.scilab.modules.scinotes.SciNotesGUI;
+import org.scilab.modules.scinotes.ScilabDocument;
+import org.scilab.modules.scinotes.ScilabEditorPane;
 
 /**
  *
@@ -454,7 +452,7 @@ public final class NavigatorWindow extends SwingScilabTab implements DocumentLis
         parentWindow.pack();
         parentWindow.setVisible(true);
 
-        CallBack callback = new CallBack(null) {
+        CommonCallBack callback = new CommonCallBack(null) {
                 public void callBack() {
                     NavigatorWindow.this.closeNavigator();
                 }
@@ -479,7 +477,7 @@ public final class NavigatorWindow extends SwingScilabTab implements DocumentLis
         orderMenu.setText(SciNotesMessages.ORDER);
         orderMenu.setMnemonic('O');
         menu = ScilabMenuItem.createMenuItem();
-        menu.setCallback(new CallBack(null) {
+        menu.setCallback(new CommonCallBack(null) {
                 public void callBack() {
                     doc.setAlphaOrderInTree(true);
                     updateTree();
@@ -494,7 +492,7 @@ public final class NavigatorWindow extends SwingScilabTab implements DocumentLis
         orderMenu.add(menu);
 
         menu = ScilabMenuItem.createMenuItem();
-        menu.setCallback(new CallBack(null) {
+        menu.setCallback(new CommonCallBack(null) {
                 public void callBack() {
                     doc.setAlphaOrderInTree(false);
                     updateTree();
index 20b9322..ea6e1c4 100644 (file)
@@ -15,8 +15,8 @@ package org.scilab.modules.scinotes.utils;
 import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
@@ -38,26 +38,24 @@ import javax.swing.tree.DefaultTreeCellRenderer;
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
-import org.flexdock.docking.event.DockingEvent;
 import org.flexdock.docking.defaults.DockingSplitPane;
-
-import org.scilab.modules.gui.events.callback.CallBack;
-import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
+import org.flexdock.docking.event.DockingEvent;
 import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
+import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
-import org.scilab.modules.gui.menuitem.MenuItem;
-import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.menubar.ScilabMenuBar;
-import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.menuitem.MenuItem;
+import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.gui.textbox.ScilabTextBox;
 import org.scilab.modules.gui.textbox.TextBox;
-
-import org.scilab.modules.scinotes.ScilabEditorPane;
-import org.scilab.modules.scinotes.SciNotesGUI;
+import org.scilab.modules.gui.toolbar.ToolBar;
 import org.scilab.modules.scinotes.SciNotes;
+import org.scilab.modules.scinotes.SciNotesGUI;
+import org.scilab.modules.scinotes.ScilabEditorPane;
 import org.scilab.modules.scinotes.SearchManager;
 
 /**
@@ -445,7 +443,7 @@ public class SearchFile extends SwingScilabTab {
             tab.updateUI();
 
             final SearchFile ftab = tab;
-            CallBack callback = new CallBack(null) {
+            CommonCallBack callback = new CommonCallBack(null) {
                     public void callBack() {
                         ftab.closeCurrent();
                     }
index c169b75..81e3301 100644 (file)
@@ -52,7 +52,7 @@ import org.scilab.modules.graph.utils.StyleMap;
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
 import org.scilab.modules.gui.contextmenu.ContextMenu;
 import org.scilab.modules.gui.contextmenu.ScilabContextMenu;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.menuitem.MenuItem;
@@ -1340,7 +1340,7 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
            MenuItem addTo = ScilabMenuItem.createMenuItem();
 
            addTo.setText(XcosMessages.ADDTO_NEW_DIAGRAM);
-           addTo.setCallback(new CallBack(XcosMessages.ADDTO_NEW_DIAGRAM) {
+           addTo.setCallback(new CommonCallBack(XcosMessages.ADDTO_NEW_DIAGRAM) {
                @Override
                public void callBack() {
                        
@@ -1364,7 +1364,7 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
 
            addTo.setText(XcosMessages.ADDTO + " " + allDiagrams.get(0).getParentTab().getName());
            final XcosDiagram theDiagram = allDiagrams.get(0);
-           addTo.setCallback(new CallBack(theDiagram.getTitle()) {
+           addTo.setCallback(new CommonCallBack(theDiagram.getTitle()) {
                private static final long serialVersionUID = -99601763227525686L;
 
                @Override
@@ -1391,7 +1391,7 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
                MenuItem diagram = ScilabMenuItem.createMenuItem();
                final XcosDiagram theDiagram = allDiagrams.get(i);
                diagram.setText(allDiagrams.get(i).getParentTab().getName());
-               diagram.setCallback(new CallBack(theDiagram.getTitle()) {
+               diagram.setCallback(new CommonCallBack(theDiagram.getTitle()) {
                    private static final long serialVersionUID = 3345416658377835057L;
 
                        @Override
@@ -1415,7 +1415,7 @@ public class BasicBlock extends ScilabGraphUniqueObject implements Serializable
 
        MenuItem help = ScilabMenuItem.createMenuItem();
        help.setText(XcosMessages.BLOCK_DOCUMENTATION);
-       help.setCallback(new CallBack(XcosMessages.BLOCK_DOCUMENTATION) {
+       help.setCallback(new CommonCallBack(XcosMessages.BLOCK_DOCUMENTATION) {
            private static final long serialVersionUID = -1480947262397441951L;
 
                @Override
index 6cbfef6..9b0911d 100644 (file)
@@ -24,7 +24,7 @@ import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.I
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
 import org.scilab.modules.gui.contextmenu.ContextMenu;
 import org.scilab.modules.gui.contextmenu.ScilabContextMenu;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menu.Menu;
 import org.scilab.modules.gui.menu.ScilabMenu;
 import org.scilab.modules.gui.menuitem.MenuItem;
@@ -65,7 +65,7 @@ public final class PaletteBlockMouseListener implements MouseListener {
 
                                addTo.setText(XcosMessages.ADDTO + " " + allDiagrams.get(0).getParentTab().getName());
                                final XcosDiagram theDiagram = allDiagrams.get(0);
-                               addTo.setCallback(new CallBack(e.toString()) {
+                               addTo.setCallback(new CommonCallBack(e.toString()) {
                                        @Override
                                        public void callBack() {
                                                BasicBlock current = control.getBlock();
@@ -85,7 +85,7 @@ public final class PaletteBlockMouseListener implements MouseListener {
                                        MenuItem diagram = ScilabMenuItem.createMenuItem();
                                        final XcosDiagram theDiagram = allDiagrams.get(i);
                                        diagram.setText(allDiagrams.get(i).getParentTab().getName());
-                                       diagram.setCallback(new CallBack(e.toString()) {
+                                       diagram.setCallback(new CommonCallBack(e.toString()) {
                                                @Override
                                                public void callBack() {
                                                        BasicBlock current = control.getBlock();
@@ -103,7 +103,7 @@ public final class PaletteBlockMouseListener implements MouseListener {
 
                        MenuItem help = ScilabMenuItem.createMenuItem();
                        help.setText("Block help");
-                       help.setCallback(new CallBack(e.toString()) {
+                       help.setCallback(new CommonCallBack(e.toString()) {
                                @Override
                                public void callBack() {
                                        try {
index d3dee02..ed81d28 100644 (file)
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
 import org.scilab.modules.gui.contextmenu.ContextMenu;
 import org.scilab.modules.gui.contextmenu.ScilabContextMenu;
-import org.scilab.modules.gui.events.callback.CallBack;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menuitem.MenuItem;
 import org.scilab.modules.gui.menuitem.ScilabMenuItem;
 import org.scilab.modules.xcos.palette.PaletteManager;
@@ -100,7 +100,7 @@ public class PaletteManagerMouseListener implements MouseListener {
                        throw new IllegalArgumentException("Invalid node selected");
                }
                
-               create.setCallback(new CallBack(XcosMessages.CREATE) {
+               create.setCallback(new CommonCallBack(XcosMessages.CREATE) {
                        @Override
                        public void callBack() {
                                Category nonModifiedRoot = currentNode.getParent();
@@ -142,7 +142,7 @@ public class PaletteManagerMouseListener implements MouseListener {
        private void setupRemove(final JTree paletteTree, final TreePath path,
                        final MenuItem remove) {
                remove.setText(XcosMessages.REMOVE);
-               remove.setCallback(new CallBack(XcosMessages.REMOVE) {
+               remove.setCallback(new CommonCallBack(XcosMessages.REMOVE) {
                        @Override
                        public void callBack() {
                                if (path == null) {