Lordui library interface
Lordui library interface consists only single Java Class:: ktm.lordui.Lordui
. To initialize Lordui you have to call the static method createInstance. You may create only one instance of Lordui class - every next call will return the previously returned object. When ending the work, call close method. Please find below the list of functions available over Lordui class:
- public final void loadProject(File luiFile) throws IOException - opens project from given *.lui file,
- public final void setValue(String name, Object value) - stores in Lordui given object (like instance of Window, int, String, Point, etc.) under given global name,
- public final Object getValue(String name) - gets from Lordui the object stored under given global name,
- public final void runProcedure(String procedureName) - Executes the procedure,
- public final void runProcedureAndWait(String procedureName) - Executes the procedure. Function runProcedureAndWait won't end execution until all procedures from the player won't stop running,
- public static final Lordui createInstance() - returns the instance of Lordui object,
- public final void close() - close Lordui library. Without calling it, Lordui may not dispose all the objects correctly. After calling it, you should no more use the Lordui class instance neither call Lordui:createInstance function,
- public final void setVisible(boolean visible) - shows/hides Lordui editor window.
Here is the example of using Lordui library:
public class LorduiLibraryUsage {
private Lordui lui;
public void useLordui() {
lui = Lordui.createInstance();
try {
lui.loadProject(new File("myLorduiProcedureFile.lui"));
} catch (IOException e) {
e.printStackTrace();
return;
}
//Here implement the code start your application, show your user interface
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JFrame fr = new JFrame("Test window");
fr.setSize(800, 600);
fr.setVisible(true);
}
});
} catch (InvocationTargetException e) {
e.printStackTrace();
return;
} catch (InterruptedException e) {
e.printStackTrace();
return;
}
lui.runProcedureAndWait("LorduiProcedureName");
lui.close();
}
}
krzys
2017-07-19