Public Methods | |
| JavaFuncAction (String menuItemName, Object target, CallableMethod targetMethod) | |
| JavaFuncAction (String menuItemName, Object target, CallableMethod targetMethod, Object[] argVals) | |
| JavaFuncAction (String menuItemName, Object target, CallableMethod targetMethod, Object user, String userMethodName) | |
| JavaFuncAction (String menuItemName, Object target, CallableMethod targetMethod, Object user, String userMethodName, Object[] argVals) | |
| void | invoke (Object[] argVals) |
| void | actionPerformed (ActionEvent e) |
| Implementation of ActionListener. More... | |
|
||||||||||||||||
|
00032 {
00033 this(menuItemName, target, targetMethod, null, null, null);
00034 }
|
|
||||||||||||||||||||
|
00040 {
00041 this(menuItemName, target, targetMethod, null, null, argVals);
00042 }
|
|
||||||||||||||||||||||||
|
00048 {
00049 this(menuItemName, target, targetMethod, user, userMethodName, null);
00050 }
|
|
||||||||||||||||||||||||||||
|
00056 {
00057 super(menuItemName);
00058 _target = target;
00059 _targetMethod = targetMethod;
00060 _user = user;
00061 _userMethodName = userMethodName;
00062
00063 _argVals = (_targetMethod.getNumArgs() == 0)? new Object[0] : argVals;
00064 }
|
|
|
00067 {
00068 _argVals = (_targetMethod.getNumArgs() == 0)? new Object[0] : argVals;
00069 actionPerformed(null);
00070 }
|
|
|
Implementation of ActionListener.
00075 {
00076 Method method = null;
00077 if(_argVals != null) { // direct invocation
00078 try {
00079 if (_user == null) {
00080 _targetMethod.invoke(_target, _argVals);
00081 } else {
00082 Class[] userArgClass = new Class[3];
00083 userArgClass[0] = Object.class;
00084 userArgClass[1] = CallableMethod.class;
00085 userArgClass[2] = _argVals.getClass();
00086 method = _user.getClass().getMethod(_userMethodName, userArgClass);
00087 Object[] userArgsVals = new Object[3];
00088 userArgsVals[0] = _target;
00089 userArgsVals[1] = _targetMethod;
00090 userArgsVals[2] = _argVals;
00091 method.invoke(_user, userArgsVals);
00092 }
00093 } catch (Exception ex) {
00094 ErrorStreamArea.println("JavaFuncAction: " + ex + ", method: " + method);
00095 }
00096
00097
00098 return;
00099 }
00100 new JavaFuncDialog(_target, _targetMethod, _user, _userMethodName, false);
00101 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001