Here is a small example focusing on how to create a methodAction and an invokeAction in a pageDef. Those properties in a pageDef can be very helpful especially when we want to do things more declaratively or have automated actions for your page.
Download The Sample Application.
What we are going to do here is a slight difference of a previous post.
In the previous post we entered a page in insert mode.
Now, we are not going to use the feature of methodCall.
We are going to have the logic in our pageDef.
We are going to use the methodAction and the invokeAction.
First, we create the model, for this example we are going to use the HR schema in the ORACLE XE.
We create BC(entities and views) for employees table.
We generate the Application module as well.
We create the method in the application Module as in the previous post here
We create the java class for our Applciation Module (AM).
We create the java classes for Employees View the same as we did for the AM.
In the java class of the AM we create the method that creates and inserts a new row in the Employees View.
We will now expose the method in the client interface of the AM
After exposing the Method from AM, we will create a methodAction pointing to method exposed.
NOTE: we have to create a jspx page with a pageDef. To create a pageDef simply drag a drop on the jspx or right click on the jspx and select create page Definition.
1) Open the pageDef of the jspx. and in the Bindings Column add a new binding of type methodAction
On the second screen:
With the result:
Now, this methodAction can be called as any other operation in the bindings.
In our case, we want to call this method every time we enter the jspx.
In the previous post, we did it with a separate methodCall.
In this case we will create an InvokeAction tha calls this methodAction
In our pageDef again, we will create an invokeAction.
After ok is pressed:
The result to this is:
We are not just done yet.
We need to set when this invokeAction will be invoked.
We go on the property Inspector of this executable and change the refresh condition
At this point we have created an invokeAction that binds a methodAction and it will be invoked everytime the prepareModel is invoked.
For more details on the refresh property, please refer to the documentation:
The last thing to do is to drop the Employees form into the page.
On the wizard window check the navigation buttons check Box.
As a final, also drag an drop the Commit operation onto the jspx.
Thats about it.
When we run the page:
Download the sample Application.