Class vjv.RadJaIF.RadJaIF
All Packages Class Hierarchy This Package Previous Next Index
Class vjv.RadJaIF.RadJaIF
java.lang.Object
|
+----vjv.RadJaIF.RadJaIF
- public class RadJaIF
- extends Object
Class RadJaIF is the RadJa interface API. It provides a set routines
for accessing and controlling RadJa applications from Java programs.
In order to use RadJa application in your Java programs follow these steps:
- Build your RadJa application
- In the Logical View Window add RadJa IF control to your RadJa
application and specify its name in its properties window.
RadJa IF control is an access point to your RadJa application.
Connect RadJa IF control actions and/or parameters to the control
you want to access from your Java program.
- Use class RadJaIF in order bind callback/data to a RadJa IF control or
to give order or take data with a RadJa IF control.
The following example shows how to use RadJaIF. It controls RadJa application
residing in \radja\vjv\demos\radjaif.vjv file.
import vjv.base.*;
import vjv.RadJaIF.*;
import java.util.*;
import java.awt.*;
public class Test {
public static void main(String args[]) {
String[] args1 = new String[1];
args1[0] = "\\radja\\vjv\\demos\\radjaif.vjv";
ExecutorTsk tsk = ExecutorTsk.main(args1,new Frame()); //starts the execution of RadJa application
//binding of the callback
if(RadJaIF.bindCallback(tsk,"b1",new TestCallback()) != RadJaIF.rifSuccess) {
System.out.println("can not bind callback");
System.exit(1);
};
//binding of the data
if(RadJaIF.bindData(tsk,"b1",new TestGiveDt()) != RadJaIF.rifSuccess) {
System.out.println("can not bind data");
System.exit(2);
};
try {
while(true) {
Vector res = new Vector();
//RadJa IF control gives to order "Take New Name" to the button
RadJaIF.giveOrder(tsk,"b1");
Thread.sleep(3000);
//RadJa IF control takes data from the TxtField
if(RadJaIF.takeData(tsk,"b1",res) != RadJaIF.rifSuccess) {
System.out.println("can not read data");
System.exit(3);
};
System.out.println(res.lastElement());
}
}
catch(Exception e) {};
};
};
//Data provided to RadJa is wrapped in class implementing ParamIf
class TestGiveDt implements ParamIf {
int i=0;
public int giveData(Integer portNm,Object data) throws VjvRunTimeEx {
Vector vect = (Vector)data;
if(vect.size() == 0)
vect.addElement("test"+(new Integer(i)).toString());
else
vect.setElementAt("test"+(new Integer(i)).toString(),vect.size()-1);
i++;
return DataPortRetCodes.success;
};
};
//Callback to be called by RadJa is wrapped in class implementing ActionIf
class TestCallback implements ActionIf {
public int takeControl(Integer portNm) throws VjvRunTimeEx {
System.out.println("got control with port:" + portNm.toString());
return CntrlPortRetCodes.success;
};
};
-
rifInterfaceNotFound
- This integer will be returned by RadJaIF routines, if operation does
not succeed because RadJa IF control with the specified name does not exist
-
rifSuccess
- This integer will be returned by RadJaIF routines, if operation succeeds
-
RadJaIF()
-
-
bindCallback(ExecutorTsk, String, ActionIf)
- Binds a callback to RadJa IF control specified by the name, a callback will be called when RadJa IF control service is called
-
bindData(ExecutorTsk, String, ParamIf)
- Binds a data to RadJa IF control specified by the name, a data will be used by RadJa IF when other control
will request output parameter from it.
-
giveOrder(ExecutorTsk, String)
- Gives order to a control connected to RadJa IF control specified by the name.
-
takeData(ExecutorTsk, String, Vector)
- Takes a data from a control connected to RadJa IF control specified by the name.
rifSuccess
public final static int rifSuccess
- This integer will be returned by RadJaIF routines, if operation succeeds
rifInterfaceNotFound
public final static int rifInterfaceNotFound
- This integer will be returned by RadJaIF routines, if operation does
not succeed because RadJa IF control with the specified name does not exist
RadJaIF
public RadJaIF()
bindCallback
public static int bindCallback(ExecutorTsk rap,
String name,
ActionIf clbck)
- Binds a callback to RadJa IF control specified by the name, a callback will be called when RadJa IF control service is called
- Parameters:
- rap - RadJa application
- name - name of the RadJa IF control
- clbck - an object wrapping callback and implementing ActionIf interface
bindData
public static int bindData(ExecutorTsk rap,
String name,
ParamIf data)
- Binds a data to RadJa IF control specified by the name, a data will be used by RadJa IF when other control
will request output parameter from it.
- Parameters:
- rap - RadJa application
- name - name of the RadJa IF control
- data - an object wrapping the data and implementing ParamIf interface
- Returns:
- rifSuccess or rifInterfaceNotFound
giveOrder
public static int giveOrder(ExecutorTsk rap,
String name) throws VjvRunTimeEx
- Gives order to a control connected to RadJa IF control specified by the name.
- Parameters:
- rap - RadJa application
- name - name of the RadJa IF control
- Returns:
- rifSuccess or rifInterfaceNotFound
- Throws: VjvRunTimeEx
- may be thrown if something goes wrong while giving order
takeData
public static int takeData(ExecutorTsk rap,
String name,
Vector res) throws VjvRunTimeEx
- Takes a data from a control connected to RadJa IF control specified by the name.
- Parameters:
- rap - RadJa application
- name - name of the RadJa IF control
- res - a vector is a placeholder for the result
- Returns:
- rifSuccess or rifInterfaceNotFound
- Throws: VjvRunTimeEx
- may be thrown if something goes wrong while retrieving data
All Packages Class Hierarchy This Package Previous Next Index