The class ObjectLoader contains methods to load objects from eva/3 Application Builder components.
The method Color getColor(String colorName) return the named color as Color Objekt, whereas the argument
colorName defines the color name.
Example:
try{ // Read the color Hintergrund and return java.awt.Color Color color = ObjectLoader.getColor("Hintergrund"); } catch (InvocationTargetException e) { e.printStackTrace(); }
The method SFrame getSFrame(String name) returns the form named in the argument name as SFrame. It does not
care if the form is opened. With the SFrame, the access
to its components is possible.
Example:
try{ // ObjectLoader gets the form Auswahl and returns as SFrame SFrame sFrame = (SFrame) ObjectLoader.getSFrame("test1.form"); // Load the SFrame sFrame.afterLoading(); // Get the button with the name SButton from the form SButton button = (SButton) sFrame.getObject("SButton"); // Get the panel which contains the toolbar- and the mainpanel SPane sPane = (SPane) sFrame.getSPane(); // Get the ToolbarPanel ToolBarPanel toolbarPanel = sPane.getToolBarPanel(); // Get the MainPanel MainPanel mainPanel = sPane.getMainPanel(); // Get the MiddlePanel MiddlePanel middlePanel = mainPanel.getMiddlePanel(); // Get the SidePanel SidePanel sidePanel = mainPanel.getSidePanel(); } catch (Exception e) { e.printStackTrace(); }
The class method getMacro (String name) of the ObjectLoader returns a macro. The parameter name is the project relative path of the macro file. Calling the method execute (String [] s) of the macro object excutes the macro. The parameter s are the arguments for the macro.
Beispiel:
String objectName = "macro/PrintParams.macro"; Macro macro = null; try { macro = ObjectLoader.getMacro(objectName); } catch (IOException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } String macroParams[] = { "par1", "par2" }; macro.execute(macroParams);