Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
jvx:firstapp_step-by-step [2020/06/08 12:55]
cduncan
jvx:firstapp_step-by-step [2021/03/22 14:09] (current)
admin
Line 1: Line 1:
-~~Title: First JVx Application (Step-by-Step)~~+~~Title: First JVx Application (Step by Step)~~
  
 The aim of this tutorial is to create an application with the Enterprise Application Framework – [[https://​jvx.sibvisions.com|JVx]]. Moreover, a quick overview of the framework'​s possibilities will be given. The aim of this tutorial is to create an application with the Enterprise Application Framework – [[https://​jvx.sibvisions.com|JVx]]. Moreover, a quick overview of the framework'​s possibilities will be given.
  
-The application'​s task is to display the data from a database table and make them editable. The application requests authentication with user name and password.+The application'​s task is to display the data from a database table and make them editable. The application requests authentication with username ​and password.
  
 The following skills and tools are needed: The following skills and tools are needed:
Line 11: Line 11:
   * JDK 6.0 (1.6) or higher   * JDK 6.0 (1.6) or higher
   * HSQLDB library (http://​www.hsqldb.org)   * HSQLDB library (http://​www.hsqldb.org)
 +  * [[https://​search.maven.org/​artifact/​org.swinglabs.swingx/​swingx-all/​1.6.4/​jar|SwingX]] lib
   * Database and SQL skills   * Database and SQL skills
  
 This documentation covers the following areas: This documentation covers the following areas:
  
-  * [[#​folder_structure|JVx ​folder structure]] +  * [[#​folder_structure|JVx ​Folder Structure]] 
-  * [[#​project_configuration|Eclipse ​project configuration]] +  * [[#​project_configuration|Eclipse ​Project Configuration]] 
-  * [[#​application_development|Application ​development]]+  * [[#​application_development|Application ​Development]]
       * Client       * Client
       * Server       * Server
-  * [[#create_a_work_screen|Creation of a work screen]] +  * [[#create_a_workscreen|Creation of a Workscreen]] 
-  * [[#​create_database|Use of a HyperSQL ​database]]+  * [[#​create_database|Use of a HyperSQL ​Database]]
  
 == Folder Structure == == Folder Structure ==
Line 56: Line 57:
   * Note that the project has to be set up in the application folder ''​firstapp''​ \\ {{:​jvx:​newproject.png?​nolink|}}   * Note that the project has to be set up in the application folder ''​firstapp''​ \\ {{:​jvx:​newproject.png?​nolink|}}
   * **Remove** the ''​src''​ folder from the **Source Folders** \\ **Set** the folders ''​src.client'',​ ''​src.server''​ and ''​test''​ as **Source Folder** \\ {{:​jvx:​newproject_folders.png?​nolink|}}   * **Remove** the ''​src''​ folder from the **Source Folders** \\ **Set** the folders ''​src.client'',​ ''​src.server''​ and ''​test''​ as **Source Folder** \\ {{:​jvx:​newproject_folders.png?​nolink|}}
-  * **Add** the ''​jvx.jar''​ library, from the project directory ''​JVxFirstApp/​libs/​server''​ \\ {{:​jvx:​newproject_libs.png?​nolink|}}+  * **Add** the ''​jvx.jar''​ library, from the project directory ''​JVxFirstApp/​libs/​server''​ \\ **Add** the ''​swingx-all-1.6.4.jar''​ library, from the project directory ''​JVxFirstApp/​libs/​client''​ \\ {{:​jvx:​newproject_libs.png?​nolink|}}
   * The project can now be created   * The project can now be created
  
Line 91: Line 92:
  
 ^Parameter^Description^ ^Parameter^Description^
-|securitymanager/​class|The security manager for verification of the user names/password when logging into the application.|+|securitymanager/​class|The security manager for verification of the usernames/password when logging into the application.|
 |securitymanager/​usersfile|The file with the username/​password combinations allowed.| |securitymanager/​usersfile|The file with the username/​password combinations allowed.|
 |lifecycle/​mastersession|The class name of the server object that is instantiated when the client performs a login or starts a new MasterSession.| |lifecycle/​mastersession|The class name of the server object that is instantiated when the client performs a login or starts a new MasterSession.|
Line 98: Line 99:
 The server configuration file must be stored in the folder ''​../​JVxFirstApp/​rad/​server''​. The server configuration file must be stored in the folder ''​../​JVxFirstApp/​rad/​server''​.
  
-However, the folder does not appear in our Eclipse projectbecause it is at a higher folder level. The configuration file could be created directly in the file system, or we can create a folder link in our project:+However, the folder does not appear in our Eclipse project because it is at a higher folder level. The configuration file could be created directly in the file system, or we can create a folder link in our project:
  
   * **File** / **New** / **Folder** \\ {{:​jvx:​server_link.png?​nolink|}}   * **File** / **New** / **Folder** \\ {{:​jvx:​server_link.png?​nolink|}}
Line 174: Line 175:
 ^Method^Description^ ^Method^Description^
 |Constructor|The standard constructor cannot be used, as each application is started with a technology-dependent launcher. This launcher is already passed to the application in the constructor.| |Constructor|The standard constructor cannot be used, as each application is started with a technology-dependent launcher. This launcher is already passed to the application in the constructor.|
-|createConnection|The communication protocol is initialized. A ''​DirectServerConnection''​ is sufficient for our applicationbecause both the client and the server are started in the same VM. However, if an application server is in use, a ''​HttpConnection''​ could also be used.|+|createConnection|The communication protocol is initialized. A ''​DirectServerConnection''​ is sufficient for our application because both the client and the server are started in the same VM. However, if an application server is in use, a ''​HttpConnection''​ could also be used.|
 |getApplicationName|Sets the application name. This name is needed for the communication with the server, as the  latter uses the appropriate application configuration depending on the application name. \\ In our case, the application name must be ''​firstapp'',​ because the work directory is also called ''​../​JVxFirstApp/​rad/​**firstapp**/''​. The application name MUST always match the directory name!| |getApplicationName|Sets the application name. This name is needed for the communication with the server, as the  latter uses the appropriate application configuration depending on the application name. \\ In our case, the application name must be ''​firstapp'',​ because the work directory is also called ''​../​JVxFirstApp/​rad/​**firstapp**/''​. The application name MUST always match the directory name!|
  
Line 213: Line 214:
 == Create a Workscreen== == Create a Workscreen==
  
-Before we create a Workscreen, we prepare the application to display the Workscreen. To do so, we extend our ''​FirstApplication''​ class as follows:+Before we create a workscreen, we prepare the application to display the workscreen. To do so, we extend our ''​FirstApplication''​ class as follows:
  
 <file java FirstApplication.java>​ <file java FirstApplication.java>​
Line 325: Line 326:
 ^Method^Description^ ^Method^Description^
 |afterLogin|This method is invoked form the super class after a successful login. We use this method to extend our menu and our toolbar. \\ \\ It is not necessary to undo our changes after logout as this is done by the super class.| |afterLogin|This method is invoked form the super class after a successful login. We use this method to extend our menu and our toolbar. \\ \\ It is not necessary to undo our changes after logout as this is done by the super class.|
-|doOpenDBEdit|This method is called when the Menu or the toolbar button is selected.| +|doOpenDBEdit|This method is called when the menu or the toolbar button is selected.| 
-|createMenuItem|Provided by the super class to create menu entries. The first parameter contains the name of the method that is to be called when the menu entry is selected. The second parameter contains the command (ActionCommand) which does not play any role in our case. The text of the menu entry is to be defined in the third parameter and, lastly, the image for the entry is passed.|+|createMenuItem|Provided by the super class to create menu entries. The first parameter contains the name of the method that is to be called when the menu entry is selected. The second parameter contains the command (ActionCommand) which does not play any role in our case. The text of the menu entry is to be defined in the third parameterand, lastly, the image for the entry is passed.|
 |createToolBarButton|Similar to ''​createMenuItem'',​ except here a button is created which adjusts itself to the layout of the toolbar.| |createToolBarButton|Similar to ''​createMenuItem'',​ except here a button is created which adjusts itself to the layout of the toolbar.|
 |UIImage.getImage|Provides a predefined image from the image library of JVx. \\ We use a predefined image for convenience.| |UIImage.getImage|Provides a predefined image from the image library of JVx. \\ We use a predefined image for convenience.|
Line 469: Line 470:
 |initializeModel|Instantiates the objects for access to the server or data.| |initializeModel|Instantiates the objects for access to the server or data.|
 |InitializeUI|Layout of the workscreen.| |InitializeUI|Layout of the workscreen.|
-|dispose|Ends the connection to the server for the Workscreen ​and closes the frame. The connection must not be explicitly closed, as this takes place fully automatically by the GarbageCollector. This is, however, not a drawback in our first application.| +|dispose|Ends the connection to the server for the workscreen ​and closes the frame. The connection must not be explicitly closed, as this takes place fully automatically by the GarbageCollector. This is, however, not a drawback in our first application.| 
-|createSubConnection|We create our own connection to the server. This has the advantage that a separate lifecycle object is used on the server. This object contains all objects which are needed by the Workscreen. Once the Workscreen ​is closed, the used memory is released. Moreover, each connection can have special parameters and timeouts. The requested lifecycle object is defined with the class name: ''​apps.firstapp.frames.DBEdit''​. \\ \\ The class we will create later.|+|createSubConnection|We create our own connection to the server. This has the advantage that a separate lifecycle object is used on the server. This object contains all objects which are needed by the workscreen. Once the workscreen ​is closed, the used memory is released. Moreover, each connection can have special parameters and timeouts. The requested lifecycle object is defined with the class name: ''​apps.firstapp.frames.DBEdit''​. \\ \\ The class we will create later.|
  
 ^Member^Description^ ^Member^Description^
-|connection|The connection to the server, especially for the Workscreen. A special communication protocol is used in the background. In our case, it is represented by the class ''​DirectServerConnection''​.| +|connection|The connection to the server, especially for the workscreen. A special communication protocol is used in the background. In our case, it is represented by the class ''​DirectServerConnection''​.| 
-|dataSource|The ​datasource ​is independent of the communication protocol and takes care of the data transfer between client and server. The connection defines under which name the server-side object is to be found in the Lifecycle ​object.|+|dataSource|The ​data source ​is independent of the communication protocol and takes care of the data transfer between client and server. The connection defines under which name the server-side object is to be found in the lifecycle ​object.|
 |rdbContacts|The model and the controller for data display. \\ The name ''​contacts''​ defines under which name the server-side business object can be found.| |rdbContacts|The model and the controller for data display. \\ The name ''​contacts''​ defines under which name the server-side business object can be found.|
 |table|The view for data display.| |table|The view for data display.|
  
-The Workscreen ​is now ready and can be integrated in the application. We now implement the missing call:+The workscreen ​is now ready and can be integrated in the application. We now implement the missing call:
  
 <file java FirstApplication.java>​ <file java FirstApplication.java>​
Line 667: Line 668:
 {{:​jvx:​app_finished.png?​nolink|}} {{:​jvx:​app_finished.png?​nolink|}}
  
-The source code and the Eclipse project can be found in the [[https://​www.sibvisions.com/​en/​jvxmdownload|Download]] section.+The source code and the Eclipse project can be found in the [[jvx:example_applications|Download]] section.
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information