arrow_back history picture_as_pdf This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~Title: How to use Client Actions~~ Client actions are defined as methods/functions that are automatically called at the client at a predetermined time, such as the click of a button, a switch between lines in a table, the insertion of a table, etc. The action concept is based on Java´s listener concept and simplifies listener handling. In JVx, the methods/functions used to define actions begin with event (e.g. eventAction). This facilitates the search for possible actions in javadoc and with IDE. == Usage == The definition of an action can be accomplished in two different ways. First, through the combination of object and method name: <file java> /** * Initializes the UI components. */ private void init() { UIButton butCancel = new UIButton(); butCancel.setText("Cancel"); butCancel.eventAction().addListener(this, "doCancel"); } /** * * public void doCancel() { dispose(); } </file> The following line <file java> butCancel.eventAction().addListener(this, "doCancel"); </file> defines that the method doCancel in the object this is executed upon clicking the cancel button. In this example, the method <file java> public void doCancel() </file> is defined without parameters and without a throws clause, since there are no respective requirements. However, the method could also be defined as follows: <file java> public void doCancel(UIActionEvent pEvent) throws Exception </file> The paramater will only be passed on by JVx if it is included in the parameter description. If the throws clause is used, exceptions are caught by JVx and sent to the error dialogue. However, if specific error handling is required, a try/catch block has to be used and the throws clause has to be removed. Since our action concept is based on the Java listener concept, it is also possible to use listeners: <file java> butCancel.eventAction().addListener(new IActionListener() { public void action(UIActionEvent pActionEvent) { dispose(); } }); </file> or <file java> public class MyFrame implements IActionListener { public void action(UIActionEvent pActionEvent) } </file>