Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EDT:Tutorial: RUI With DataBase Lesson 2"
(→Lesson 2: Connect to a new Derby database) |
|||
Line 5: | Line 5: | ||
|[[EDT:Tutorial: RUI With DataBase Lesson 1|< Previous]] | [[EDT:Tutorial: RUI With DataBase Lesson 3|Next >]] | |[[EDT:Tutorial: RUI With DataBase Lesson 1|< Previous]] | [[EDT:Tutorial: RUI With DataBase Lesson 3|Next >]] | ||
|} | |} | ||
− | = Lesson 2: | + | = Lesson 2: Set up the projects = |
− | + | An EGL application is organized in one or more ''projects'', | |
+ | each of which is a physical folder in the workspace. A project contains | ||
+ | an EGL source folder that is provided for you, and that folder contains | ||
+ | one or more ''packages'', which in turn contain EGL source | ||
+ | files. This hierarchy is basic to your work in EGL: a project, then | ||
+ | an EGL source folder, then a package with EGL source files. | ||
− | + | The | |
+ | EGL source files include EGL ''parts'', which are type definitions | ||
+ | that you create. For example, a Service part contains logic, and a | ||
+ | Record part can be the basis of a variable that you declare in your | ||
+ | Service part. | ||
− | + | Packages are important because they separate parts | |
+ | into different contexts, or ''namespaces'': | ||
− | + | <ul><li>A part name might be duplicated in two different packages, and | |
− | + | any EGL source code can reference each part precisely. The main benefit | |
− | + | of namespaces is that different teams can develop different EGL parts | |
− | + | without causing name collisions. | |
− | + | <li>Each part name in a given package is unique within that package: | |
− | < | + | <ul><li>A part in one package can easily reference another part in the |
+ | same package by specifying the part name. For example, here is a declaration | ||
+ | of a record that is based on the Record part <tt>MyRecordPart</tt>: | ||
− | + | myRecord MyRecordPart{}; | |
− | + | <li>A part in one package can also reference a part in a second package | |
− | + | by giving the package name and part name, or by a shortcut that involves | |
− | + | importing the part. | |
− | + | </ul> | |
− | + | </ul> | |
− | + | ||
− | + | ||
− | + | One project can reference the parts in a second project, | |
+ | but only if the EGL build path of the referencing project identifies | ||
+ | the referenced project. Again, this tutorial gives examples. However, | ||
+ | in all cases, avoid using the same package name in different projects, | ||
+ | as that usage can cause problems in name resolution. | ||
− | + | Your next | |
+ | task in this tutorial is to create the following projects: | ||
− | + | <dl><dt>PaymentShared | |
− | + | <dd>Holds parts used both on the Web client (the browser) by the handlers and on the Web application server by the EGL services. | |
− | + | <dt>PaymentService | |
− | + | <dd>Holds an EGL Service part and related definitions | |
− | + | <dt>PaymentClient | |
− | + | <dd>Holds the Rich UI handlers and related definitions | |
− | + | </dl> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | You can include all your code in a single project, | |
+ | but the separation shown here lets you easily deploy the two kinds | ||
+ | of code in different ways. | ||
− | + | Parts in one project can use parts | |
+ | in a different project. EGL uses a ''build path'' to search | ||
+ | for unresolved references. Later in this lesson, you will add the '''PaymentService''' project | ||
+ | to the build path for the '''PaymentClient''' project. | ||
− | + | == Create the PaymentShared project == | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | #From the file menu,left clink on '''New''' and select the '''EGL > EGL Project''' wizard. | |
+ | #On the '''EGL Project''' window, enter project name '''PaymentShared''', select template '''basic''', and left click on '''Next'''.[[Image:EDT Tutorial edt richui sql02 create shared project.jpg|Create PaymentShared EGL project]] | ||
+ | #On the '''EGL Settings''' window, accept the default values and left click on '''Finish'''.[[Image:EDT Tutorial edt richui sql02 shared project settings.jpg|PaymentShared project EGL settings]] | ||
− | + | EGL creates a project named <tt>PaymentShared</tt>. | |
+ | Note the folders inside the directory: | ||
− | + | <dl><dt>EGLSource | |
+ | <dd>Put your packages and source files here. | ||
+ | <dt>EGLGen/JavaSource | ||
+ | <dd>EGL places the Java files | ||
+ | it generates here. | ||
+ | <dt>JavaSource | ||
+ | <dd>Put any custom Java source | ||
+ | files here. These files are not overwritten during the generation | ||
+ | process. | ||
+ | <dt>JRE System Library | ||
+ | <dd>EGL uses this folder for JAR files that support the Java Runtime Environment. | ||
+ | </dl> | ||
+ | [[Image:EDT_Tutorial_edt_richui_sql03_service_explore.jpg|The Project Explorer view shows the new project and folders.]] | ||
− | + | == Create the PaymentService project == | |
− | + | To create an EGL service project: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | #From the file menu,left clink on '''New''' and select the '''EGL > EGL Project''' wizard. | |
+ | #On the '''EGL Project''' window, enter project name '''PaymentService''', select template '''basic''', and left click on '''Next'''.[[Image:EDT Tutorial edt richui sql02 create service project.jpg|Create PaymentService EGL project]] | ||
+ | #On the '''EGL Settings''' window, check '''Override Generation Settings''', uncheck '''JavaScript Generator''' and left click on '''Next'''.[[Image:EDT Tutorial edt richui sql02 service project settings.jpg|PaymentService project EGL settings]] | ||
+ | #On the '''EGL BuildPath''' window, check '''PaymentShared''' (the service project uses parts in the shared project) and left click on '''Finish'''.[[Image:EDT Tutorial edt richui sql02 service project EGL path.jpg|PaymentService project EGL build path]] | ||
− | + | == Create the PaymentClient project == | |
− | + | An EGL Rich UI project includes many shortcuts to speed | |
− | + | the development of a user interface for the web. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | To create an EGL Rich UI project: | |
− | + | #From the file menu,left clink on '''New''' and select the '''EGL > EGL Project''' wizard. | |
+ | #On the '''EGL Project''' window, enter project name '''PaymentClient''', select template '''basis''', and left click on '''Next'''.[[Image:EDT Tutorial edt richui sql02 create client project.jpg|Create PaymentClient EGL project]] | ||
+ | #On the '''Web 2.0 Client Application Settings''' window, accept the default values and left click on '''Next'''.[[Image:EDT Tutorial edt richui sql02 client project web settings.jpg|PaymentClient project Web settings]] | ||
+ | #On the '''EGL BuildPath''' window, check '''PaymentShared''' and '''PaymentService''' (the client project uses parts in the shared and service projects) and left click on '''Finish'''.[[Image:EDT Tutorial edt richui sql02 service project EGL path.jpg|PaymentClient project EGL build path]] | ||
− | + | EGL creates a project named <tt>PaymentClient</tt> and | |
− | + | adds support projects to the workspace for Rich UI, Dojo Widgets, | |
− | + | and the Dojo runtime library. In addition to the directories that | |
+ | EGL created for the General project, a Rich UI project includes the | ||
+ | following directory: | ||
− | + | <dl><dt>WebContent | |
+ | <dd>Contains support files, such as cascading style sheets (CSS) and | ||
+ | images. | ||
+ | </dl> | ||
+ | [[Image:EDT_Tutorial_edt_richui_sql03_explore.jpg|The Project Explorer view shows the new project and folders.]] | ||
− | < | + | When you first add a Rich UI project to your workspace, two |
+ | other projects are added automatically: | ||
+ | |||
+ | <ul> | ||
+ | <li>org.eclipse.edt.rui.dojo_0.7.0 | ||
+ | <li>org.eclipse.edt.rui.widgets_0.7.0 | ||
+ | </ul> | ||
+ | |||
+ | These two projects contain widgets and other support | ||
+ | files that you use in creating a Rich UI application. | ||
+ | |||
+ | == Lesson checkpoint == | ||
+ | |||
+ | In this lesson, you completed the following tasks: | ||
+ | |||
+ | <ul><li>Created an EGL project for developing parts used in both in the service and the RichUI application | ||
+ | <li>Created an EGL project for developing a Rich UI application. | ||
+ | <li>Modified the build descriptors in a build file; specifically, | ||
+ | by adding database information from a connection definition in the | ||
+ | workbench. | ||
+ | </ul? | ||
+ | |||
+ | In the next lesson, you will | ||
+ | <ul><li>Set up the database connection | ||
+ | <li>Create the database table | ||
+ | <li>Create a Record part, retrieving most information from a database. | ||
+ | </ul> | ||
{| style="float: right" | {| style="float: right" | ||
− | + | |[[EDT:Tutorial: RUI With DataBase Lesson 1|< Previous]] | [[EDT:Tutorial: RUI With DataBase Lesson 3|Next >]] | |
− | | [[EDT:Tutorial: RUI With DataBase Lesson 1|< Previous]] | + | |
|} | |} | ||
+ | |||
[[Category:EDT]] | [[Category:EDT]] |
Revision as of 13:24, 23 November 2011
Access a database with EGL Rich UI
< Previous | Next > |
Contents
Lesson 2: Set up the projects
An EGL application is organized in one or more projects, each of which is a physical folder in the workspace. A project contains an EGL source folder that is provided for you, and that folder contains one or more packages, which in turn contain EGL source files. This hierarchy is basic to your work in EGL: a project, then an EGL source folder, then a package with EGL source files.
The EGL source files include EGL parts, which are type definitions that you create. For example, a Service part contains logic, and a Record part can be the basis of a variable that you declare in your Service part.
Packages are important because they separate parts into different contexts, or namespaces:
- A part name might be duplicated in two different packages, and any EGL source code can reference each part precisely. The main benefit of namespaces is that different teams can develop different EGL parts without causing name collisions.
- Each part name in a given package is unique within that package:
- A part in one package can easily reference another part in the same package by specifying the part name. For example, here is a declaration of a record that is based on the Record part MyRecordPart: myRecord MyRecordPart{};
- A part in one package can also reference a part in a second package by giving the package name and part name, or by a shortcut that involves importing the part.
One project can reference the parts in a second project, but only if the EGL build path of the referencing project identifies the referenced project. Again, this tutorial gives examples. However, in all cases, avoid using the same package name in different projects, as that usage can cause problems in name resolution.
Your next task in this tutorial is to create the following projects:
- PaymentShared
- Holds parts used both on the Web client (the browser) by the handlers and on the Web application server by the EGL services.
- PaymentService
- Holds an EGL Service part and related definitions
- PaymentClient
- Holds the Rich UI handlers and related definitions
You can include all your code in a single project, but the separation shown here lets you easily deploy the two kinds of code in different ways.
Parts in one project can use parts in a different project. EGL uses a build path to search for unresolved references. Later in this lesson, you will add the PaymentService project to the build path for the PaymentClient project.
- From the file menu,left clink on New and select the EGL > EGL Project wizard.
- On the EGL Project window, enter project name PaymentShared, select template basic, and left click on Next.
- On the EGL Settings window, accept the default values and left click on Finish.
EGL creates a project named PaymentShared. Note the folders inside the directory:
- EGLSource
- Put your packages and source files here.
- EGLGen/JavaSource
- EGL places the Java files it generates here.
- JavaSource
- Put any custom Java source files here. These files are not overwritten during the generation process.
- JRE System Library
- EGL uses this folder for JAR files that support the Java Runtime Environment.
Create the PaymentService project
To create an EGL service project:
- From the file menu,left clink on New and select the EGL > EGL Project wizard.
- On the EGL Project window, enter project name PaymentService, select template basic, and left click on Next.
- On the EGL Settings window, check Override Generation Settings, uncheck JavaScript Generator and left click on Next.
- On the EGL BuildPath window, check PaymentShared (the service project uses parts in the shared project) and left click on Finish.
Create the PaymentClient project
An EGL Rich UI project includes many shortcuts to speed the development of a user interface for the web.
To create an EGL Rich UI project:
- From the file menu,left clink on New and select the EGL > EGL Project wizard.
- On the EGL Project window, enter project name PaymentClient, select template basis, and left click on Next.
- On the Web 2.0 Client Application Settings window, accept the default values and left click on Next.
- On the EGL BuildPath window, check PaymentShared and PaymentService (the client project uses parts in the shared and service projects) and left click on Finish.
EGL creates a project named PaymentClient and adds support projects to the workspace for Rich UI, Dojo Widgets, and the Dojo runtime library. In addition to the directories that EGL created for the General project, a Rich UI project includes the following directory:
- WebContent
- Contains support files, such as cascading style sheets (CSS) and images.
When you first add a Rich UI project to your workspace, two other projects are added automatically:
- org.eclipse.edt.rui.dojo_0.7.0
- org.eclipse.edt.rui.widgets_0.7.0
These two projects contain widgets and other support files that you use in creating a Rich UI application.
Lesson checkpoint
In this lesson, you completed the following tasks:
- Created an EGL project for developing parts used in both in the service and the RichUI application
- Created an EGL project for developing a Rich UI application.
- Modified the build descriptors in a build file; specifically,
by adding database information from a connection definition in the
workbench.
</ul?
In the next lesson, you will
- Set up the database connection
- Create the database table
- Create a Record part, retrieving most information from a database.
< Previous | Next >