2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 package org.scilab.modules.gui.events.callback;
14 import java.awt.event.ActionEvent;
16 import org.scilab.modules.action_binding.InterpreterManagement;
17 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
20 * ScilabCallback abstract class to easily manage callbacks
21 * that throws commands to Scilab.
23 * @author Bruno JOFRET
26 public abstract class ScilabCallBack extends CommonCallBack {
28 private static final long serialVersionUID = -4923246233703990342L;
32 * @param command : the command to execute.
34 private ScilabCallBack(String command) {
35 super(command, CallBack.UNTYPED);
39 * Callback Factory to easily create a callback
40 * just like in scilab.
41 * @param command : the command to execute.
42 * @return a usable Scilab callback
44 public static ScilabCallBack create(String command) {
45 return (new ScilabCallBack(command) {
47 private static final long serialVersionUID = -7286803341046313407L;
49 public void callBack() {
50 Thread launchMe = new Thread() {
52 InterpreterManagement.putCommandInScilabQueue(getCommand());
61 * Callback Factory to easily create a callback
62 * just like in scilab.
63 * WARNING : this callback will be ignored by xclick & xgetmouse
64 * @param command : the command to execute.
65 * @return a usable Scilab callback
67 public static ScilabCallBack createOutOfXclickAndXgetmouse(String command) {
68 return (new ScilabCallBack(command) {
70 private static final long serialVersionUID = -7286803341046313407L;
72 public void callBack() {
73 Thread launchMe = new Thread() {
75 InterpreterManagement.putCommandInScilabQueue(getCommand());
82 * To match the standard Java Action management.
83 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
84 * @param e The event that launch the callback.
86 public void actionPerformed(ActionEvent e) {