Getting Started with web-based Designer

From JRapid

Jump to: navigation, search

Contents

Introduction

It's very easy to get started with JRapid! Just follow the steps in this short guide and you’ll have a running application in a few minutes.

JRapid generates fully functional standard Java web applications based on a high level model definition that you provide. This application definition is written in AML, (JRapid Application Modeling Language), an XML-based format.The AML can be easily generated through our web-based point and click designer or typed in. It is based on the principles of MDD.

Once the definition is ready, you just need to click the generate button and JRapid creates every layer of the application stack. JRapid uses the same open source frameworks that you would find in any other Java project and automatically does all the plumbing and connecting that would take you hours to complete. Like other MVC frameworks it has models referred to as entities. These entities are persistable and generate the underlying database schema out-of-the-box.

A strength of JRapid is that it produces an outstanding, fully functional front end and with no need of programming. It produces not just simple CRUD forms, but complete production-ready interfaces. See the JRapid Showcase.

For our example we'll be creating a simple contact management system using JRapid Designer. The application will store contacts and companies, and will allow you to relate a contact to a company.

Let's start by creating our first entity: Company. Click the New Entity button in the Entity Diagram toolbar.


Create new entity


The new entity form opens. Fill in the form as shown below.


Company entity definition


Click OK. Note that the new Company entity is added to the Entity Diagram.


Company entity in Entity Diagram

Click the New Entity button again to create the Contact entity. Add the corresponding properties as shown in the following image.


Contact entity definition


As you can see, we're already using the recently created Company entity to establish a relationship with the Contact.

Click OK to close the new entity form. JRapid automatically runs the generation process. You may click the Generate button in the main toolbar to run this process manually at any moment. A few status messages are shown and your app is ready and running in the JRapid development cloud.

Go to the entities tree on the left of the screen and click on the Company entity.


Entities Tree


The Company form is shown in the Preview pane.


Company Form in Preview Pane


Now click on the List link on the Preview pane toolbar. The preview shows the empty Company list.


Company List in Preview Pane


Go to the Manage menu and click on the Preview Index option.


Preview Index


This will open the application preview in a new browser tab. JRapid automatically generates a default Panel for your application and includes a menu bar that allows users to access the entities' lists.

Click on the Company option in the menu to open the Company list. Click on the Add button and an empty Company form is shown. Go ahead and fill in the form fields and click OK. Yes, the application preview is already working.


Preview Index


When the form is submitted, the list refreshes with the record you've just entered.


Preview Index


That's it! You've created your first basic application. By default, JRapid generates a form and a standard listing for each entity, and a basic Panel that includes a default menu. You can now download the source code for your app, download a WAR for deploying or, even easier, click and deploy to the JRapid Cloud.

You can always come back later and modify your application. If you add custom code to your entities, you may still keep on adding entities and properties without losing what you have written.

What was all this about?

These simple steps actually performed a lot of tasks under the hood. First, all the necessary tables and relationships were created in the database schema.


Database


On top of that sits the entire generated application.


Application generated file structure


The application architecture conforms to the MVC pattern. A RESTful controller provides the necessary services and routes requests to the services classes. These perform the CRUD operations plus some other very useful methods for listing, initializing and more. Every entity is also supported by a domain java class, hibernate mapping file, marshalling and unmarshalling XML files and the HTML front end files.

After you click the generate button, the application is up and running in seconds. It is automatically deployed in the JRapid development environment that consists mainly of an Apache Tomcat Servlet Container and a MySQL database schema. Every time you make changes to the app definition and re generate, the files are updated and the Tomcat context is refreshed.

Once you've reached the point where custom code is needed in order to add business logic, you may download the full source code. Or even better, you can use JRapid Eclipse Plugin to download the project to your Eclipse workspace and keep the code synchronized with the JRapid Development environment. Read the Getting Started with Eclipse Guide for more on this.

Taking it a little bit further

Let's take this example a little bit further. We'll begin by creating the Country entity as shown below.


Country entity definition


Next, create the State entity according to the next image. Notice that a Country property is defined.


State entity definition


The two entities are shown in the Entity Diagram. Go over the Add button on the corner of the State entity to display the options menu.


Options menu


Select the Subset option. A Subset is used to restrict the records shown in listings or select combos for a given entity. For example, in this case we’ll create a subset to filter the states that belong to a selected country.

Complete the Subset form as shown below.


Create a Subset


This defines a subset that receives a parameter named forCountry of type Country and establishes the condition that the property country of entity State must be equal to the received countryParam.

After creating this Subset, we must now apply it to a property of type State. First, we'll add these two properties to the Company entity. Click on the Company name in the Entity Diagram to edit it.


Add country and state properties to Company entity


Once the new properties are shown in the Entity Diagram, click on the State property. In the property form, select the forCountry subset and enter the corresponding property as a parameter. Click OK. This should perform a full generation.


Edit state property


We need to enter some testing values for the Country and State entities. For the example to be illustrative, enter at least two countries and one or more states for each of the countries. You may use the listing preview for each entity to do this. It's easier if you first enter the countries and then the states.


States list


So now we're all set to finally see what this is all about. Click on Company in the entities tree to view the generated form. If you select a value for the Country property the State property refreshes to show the corresponding values.


States list


To end this simple guide we'll customize the default listings. Suppose our Company list gets very long. We may start by ordering the records by name. Click on Company in the Entity Diagram and then switch to the Advanced tab. Fill in the property by which it should be ordered by default and click OK.


Edit Entity Advanced tab


The listing should look like this.


Companies list


Now, we may add the country as a column in the listing. To do this, click again on Company in the Entity Diagram and change the display value for the Country entity to secondary, as shown below. Click OK to submit the changes.


Add secondary value to display attribute


If you take a look at the listing, it now shows two columns: name and country.


Companies list with name and country columns


Now, suppose we want to be able to filter the companies by name. We can create a simple Filter. Again, go to the Add button of the Company entity and select Filter.


Add Filter to company entity


Enter the following in the Filter form.


Filter definition


Test the new filter in the Company listing.


Test the filter


Let's create one last quick filter. Repeat the Add -> Filter and complete the filter definition as shown here. Then click OK.


Country filter definition


The result in action looks like this!


Company list with filters


That's all for now. This is just a quick introduction to some simple JRapid features. If you want to learn more take a look at the JRapid Showcase and the JRapid Wiki.

Sign Up at www.jrapid.com and create small projects for free!


See also

Personal tools