Introduction
This tutorial shows how to design and use RPC designed in VistaFei.
It uses a simple application as an example. A login Dialog performs a Remote
Call Procedure to authenticate user based on some hard-coded username and
password.
The VistaFei project for this tutorial may be found
here.
Assumptions
The reader is assumed familiar with creating and using Design Sheets in
VistaFei.
The Application
The application consists of one UI Design Sheet (demo.GWTApp) which is also
the entry point to the application, and one RPC Design Sheet demo.RPC. These two
Design Sheets will be under the WXDesignFolder under project.
The demo.GWTApp contains a vertical panel with components to simulate a login
screen.

The RPC is a simple authentication process

Generate Code
We can now generate code for these two Design Sheets, by
either clicking on the G Tool in the Tool Bar or right
clicking on Project then Wirelexsoft ->Generate Code.

After you generate code you get following source files.

Business Logic of Application
The demo.Java will create the necessary Login screen.
The Code Generator will generate all needed code for
this purpose.
The set of Classes generated for the RPC will have
stubs, rather than full code, because we haven't
specified how the authentication will be carried out
yet.

There are two tasks for the developer.
1- Populate the Classes generated for the RPC based on
the kind of service required,
2- Create the Business Logic for the Operation, i.e.
create user-defined Java Classes to contain the Business
Logic.
Populating Classes for RPC
In this example, the backend authentication is
simulated, i.e. not real. The RPC Classes are populated
to achieve this purpose. Screenshot below shows contents
for Class shown in the screenshot above. For other
Classes, you may find them in the
Project Code.

User Defined Classes
For this application we created three Java Classes to
allow for the Business Logic -we created a user-defined
package com.wirelexsoft.rpc.client.login.
-
LoginController.java
-
LoginMapping.java
-
LoginShell.java
The screenshot below shows the code for one of these
Classes. The others may be inspected in the Project Code.

Application Entry Point
demo.java is the Application Entry Point. We need to add
code there to complete the application, as follows. Open
demo.java and perform the following:
Step 1
Add the code below
// TODO 1
import com.wirelexsoft.rpc.client.login.*;
public class demo extends AbsolutePanel implements
EntryPoint,ChangeListener,ClickListener,LoginShell{
Step 3
Add the code below
// TODO 3
private LoginController controller = new LoginController();
private LoginMapping mapping = new LoginMapping();
Step 4
Add the code below
// TODO 4
public void inBound() {
btLogin.setEnabled(mapping.isEnabled());
lbStatus.setText(mapping.getStatus());
}
public void outBound() {
mapping.setUsername(txtUserName.getText());
mapping.setPassword(txtPassword.getText());
}
public LoginMapping getMapping() {
return mapping;
}
Building and Launching your application
When you build and launch your application you should get the following

End
of Tutorial