Skip to content

Commit

Permalink
Updated to RWT 2.0 M3. Update documentation. First 0.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwolff committed Nov 18, 2012
1 parent 3644b5d commit 00bef01
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 41 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
grails-rwt
==========

The first alpha release is there! It works, but I'm still finishing the documentation before I'll
release the plugin into the official Grails plugin repository.
This plugin integrates RWT - the web-ported Standard Widget Toolkit (SWT) - into your Grails
application. It enables you to build your RWT and JFace powered user interfaces using Groovy and the
complete Grails framework stack with all its powerful features and syntactic DSL sugar.

Stay tuned!!
The RWT plugin is available here: http://grails.org/plugin/rwt

The documentation is available here: http://bwolff.github.com/grails-rwt/
1 change: 0 additions & 1 deletion RwtGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ complete Grails framework stack with all its powerful features and syntactic DSL
'''

def documentation = "http://bwolff.github.com/grails-rwt/"

def license = "APACHE"
def issueManagement = [ system: "github", url: "https://github.com/bwolff/grails-rwt/issues" ]
def scm = [ url: "https://github.com/bwolff/grails-rwt/" ]
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed lib/org.eclipse.rap.jface_2.0.0.20121001-1623.jar
Binary file not shown.
Binary file not shown.
Binary file removed lib/org.eclipse.rap.rwt_2.0.0.20121001-1623.jar
Binary file not shown.
Binary file added lib/org.eclipse.rap.rwt_2.0.0.20121112-1148.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions src/docs/guide/advancedTopics.gdoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h3. URL Mapping of Entry Points
h3. Custom URL Mapping of Entry Points

By default RWT entry points are mapped to their name under the applications base URL. If the
application name would be 'foo' and the entry point name 'hello', the URL would look like this:
Expand All @@ -13,9 +13,8 @@ file:
class UrlMappings {

static mappings = {
...

"/"(uri: "/hello")
...
}
}
{code}
Expand Down
11 changes: 10 additions & 1 deletion src/docs/guide/configuration.gdoc
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
Configuration...
The RWT application goes into a special configuration block in the @Config.groovy@ file.

{code}
rwt {
// RWT configuration goes here.
}
{code}

There are two aspects that can be configured, the global RWT settings, and the settings
specific to the single entry points.
2 changes: 1 addition & 1 deletion src/docs/guide/configuration/applicationConfiguration.gdoc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Application configuration...
Options to configure global aspects of the RWT application will come in future versions of this plugin.
38 changes: 37 additions & 1 deletion src/docs/guide/configuration/entryPointConfiguration.gdoc
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
EntryPoint configuration...
An RWT application can consist of one or more entry points. Each entry point is configured as a
configuration block within the @rwt@ section.

{code}
rwt {
hello {
bean = 'entryPointBean'
pageTitle = 'Hello RWT World!'
}
}
{code}

The given example configures an entry point with the name @hello@. By default, this entry point will
be mapped to the relative URL path '/hello'. The following settings need to be provided for an
entry point configuration:

* *bean* - The name (string) of the bean that implements the IEntryPoint interface (mandatory).
* *pageTitle* - The title (string) that will be displayed as the browser's title (optional).

A Grails-RWT application can contain an arbitrary number of entry points, which usually refer to
different entry point beans.

{code}
rwt {
hello {
bean = 'helloEntryPoint'
pageTitle = 'Hello RWT World!'
}

helloAgain {
bean = 'helloAgainEntryPoint'
pageTitle = 'Hello again, RWT World!'
}
}
{code}

In this example there will be two entry points accessible under '/hello' and '/helloAgain'.
3 changes: 1 addition & 2 deletions src/docs/guide/configuration/loggingConfiguration.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ the [log4j section|http://grails.org/doc/latest/guide/conf.html#logging] in your

{code}
log4j = {
...

debug 'grails.app.conf.RwtPluginBootStrap'
debug 'grails.plugins.rwt'
debug 'RwtGrailsPlugin'
...
}
{code}
24 changes: 22 additions & 2 deletions src/docs/guide/gettingStarted.gdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
Getting started...
This short guide will get you started with all you need to know to create your first Grails-RWT
application. You should be familiar with how to [create a Grails application|http://grails.org/doc/latest/guide/gettingStarted.html#creatingAnApplication]
and artifacts like [domain classes|http://grails.org/doc/latest/guide/GORM.html#quickStartGuide] and
[services|http://grails.org/doc/latest/guide/services.html].

This plugin requires at least Grails version 2.0.
The RWT setup process is based on the [standalone guide|http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/rwt-standalone.html].
However, the Grails-RWT plugin does most of the setup for you, as you will see in this guide.

Start with creating an example Grails application and then follow the instructions below. The next
sections assume that the applications is called @grails-rwt-example@. Replace the occurences in the example
URLs with the actual name of your example application.

h3. Example Code

There is an example project available on GitHub that can be used as a kickstart. It contains the
example code shown in this guide and is properly configured to get started immediately.

{code}
git clone https://github.com/bwolff/grails-rwt-example
{code}

After you checked out the project you can inspect the code and start the application as described
in the [Running the Application|guide:runApplication] section below.
25 changes: 17 additions & 8 deletions src/docs/guide/gettingStarted/configureEntryPoint.gdoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
Configure entry point ...
The only thing that is missing now is the configuration of our new RWT entry point. This is done
in an own [configuration|http://grails.org/doc/latest/guide/conf.html#config] block in the
@Config.groovy@ file.

{code}
// The RWT configuration block
// RWT configuration
rwt {

// Entry Point configuration block
// Entry points configuration
entrypoints {
// Configuration of an entry point named 'hello'

// Configuration of an entry point named 'hello', the relative URL path will be '/hello'.
hello {
bean = 'helloEntryPointService'
pageTitle = 'Hello RWT!'
bean = 'helloEntryPointService' // The name of the entry point bean (required)
pageTitle = 'Hello RWT!' // The browser title that will be displayed (optional)
}
}
}
{code}
{code}

Here we simply specify our entry point as a block under @entrypoints@ and provide the name of the
entry point bean, which is described above. We can also specify a string that will be displayed as
the browser's page title.

More information about the configuration of an RWT application and the entry points is available
[here|guide:configuration].
39 changes: 32 additions & 7 deletions src/docs/guide/gettingStarted/createEntryPoint.gdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Create entry point ...
The first step is to create a so called RWT _entry point_ class. An instance of this class needs to
be registered as a Spring bean to be picked up by the RWT configuration. The
suggested approach is to use a Grails [service|http://grails.org/doc/latest/guide/services.html]
for that. Being a Grails artifact, a service is registered as a Spring bean by default
and other dependencies and functionalities are added/injected out of the box.

The following code snippet shows an example entry point service implementation
(in the @grails-app/services@ sub-folder). To demonstrate the usage,
another service (@FooService@) and a domain class (@Foo@) are used. They don't do anything useful and
their code can be obtained from the example application, as described above. The comments in the code
snippet highlight interesting points.

{code}
package grails.rwt.example

import org.eclipse.jface.viewers.ArrayContentProvider
import org.eclipse.jface.viewers.LabelProvider
import org.eclipse.jface.viewers.ListViewer
Expand All @@ -16,6 +28,8 @@ import org.eclipse.swt.widgets.Label
import org.eclipse.swt.widgets.List
import org.eclipse.swt.widgets.Shell

// "Note the use of Groovy syntax"

class HelloEntryPointService implements IEntryPoint { // "The service needs to implement IEntryPoint"

def fooService // "Other services will get injected by Grails"
Expand All @@ -26,29 +40,40 @@ class HelloEntryPointService implements IEntryPoint { // "The service needs to i
Shell shell = new Shell(display)
shell.setSize(500, 400)
shell.layout = new GridLayout()
shell.setText("Hello RWT!")

Label label = new Label(shell, SWT.NONE)
label.text = fooService.serviceMethod() // "Call methods of other services"
final Label label = new Label(shell, SWT.NONE)
label.layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false)

// "JFace is available"
ListViewer viewer = new ListViewer(shell, SWT.V_SCROLL | SWT.H_SCROLL)
viewer.list.layoutData = new GridData(SWT.FILL, SWT.FILL, true, true)
viewer.contentProvider = ArrayContentProvider.instance
viewer.labelProvider = new LabelProvider()
viewer.input = Foo.list() // "Use domain objects and GORM, no DTOs required!"
viewer.input = Foo.list() // "Use domain objects and GORM directly, no DTOs required!"

Button button = new Button(shell, SWT.PUSH)
button.layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false)
button.text = "Hello!"
button.text = "Click me!"
button.addSelectionListener(new SelectionAdapter() {
Integer num = 0

@Override
public void widgetSelected(SelectionEvent e) {
println "Hello RWT!"
label.text = fooService.serviceMethod(num++) // "Call methods of other services"
}
})

shell.open()
return 0
}
}
{code}
{code}

According to the Grails conventions, a Spring bean called @helloEntryPointService@ will be registered
automatically on application start. The next step is to configure our newly create entry point.

{note}
The given code snippet is just a very simple example to demonstrate the usage. You should develop
your application using a cleaner separation of concerns, i.e. by employing the MVC or MVP pattern.
{note}
13 changes: 8 additions & 5 deletions src/docs/guide/gettingStarted/deployApplication.gdoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
You can now package your first Grails/RWT application into a WAR file and deploy to the servlet
You can now package your application into a WAR file and deploy it to the [servlet container|http://grails.org/Deployment]
of your choice. The [deployment procedure|http://grails.org/doc/latest/guide/deployment.html] is the
same as for any other Grails application, by simply issuing the following command in the command
same as for a default Grails application, by simply issuing the following command in the command
line:

{code}
grails war
{code}

The resulting WAR file is created in the @target/@ folder and can now be deployed to e.g. a [Tomcat|http://tomcat.apache.org/]
container. All necessary jar files for RWT/JFace will be contained and the web.xml is also properly
set up.
The resulting WAR file is created in the @target/@ sub-folder and can now be deployed to e.g. a
[Tomcat|http://tomcat.apache.org/] container. All necessary jar files for RWT/JFace will be
packaged and the web.xml will also be properly set up.

Congratulations! You should now be able to create a more sophisticated Grails-RWT applications and
explore the features that RWT provides.
11 changes: 7 additions & 4 deletions src/docs/guide/gettingStarted/installation.gdoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
The plugin is installed using the default [Grails plugin installation mechanism|http://grails.org/doc/latest/guide/conf.html#pluginDependencies].
Simply add the following lines to the plugin dependency section in the @BuildConfig.groovy@ file:
Simply add/modify the following lines to the plugin dependency section in the @BuildConfig.groovy@ file:

{code}
grails.project.dependency.resolution = {
...

plugins {
compile ':rwt:0.1'
}
...
}
{code}
{code}

The plugin will be installed automatically on the next invocation of a Grails command. Your IDE
(e.g. [STS/GGTS|http://grails.org/products/ggts]) should also pick up the new installed plugin and should make the contained jar
libraries available in your Grails project.
3 changes: 2 additions & 1 deletion src/docs/guide/gettingStarted/runApplication.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ command line in the project root folder:
grails run-app
{code}

After the application started you should be able to access your first Grails/RWT example under the following URL: @http://localhost/foo/hello@
After the application has been started you should be able to access your first Grails-RWT example under the
following URL: @http://localhost:8080/grails-rwt-example/hello@
2 changes: 1 addition & 1 deletion src/docs/guide/introduction.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RWT. Have fun!

h3. RWT Version

The current version of this plugin comes with the [RWT/JFace version 2.0 M3|http://www.eclipse.org/rap/noteworthy/2.0/?build=M3].
The current version of this plugin comes with [RWT 2.0 M3|http://www.eclipse.org/rap/noteworthy/2.0/?build=M3].

h3. License

Expand Down
9 changes: 8 additions & 1 deletion src/docs/guide/introduction/knownIssues.gdoc
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Known and open issues...
This section sums up a few issues that will be tackled/resolved in upcoming versions of this plugin.

* *Theming & Branding*
** Support the RWT custom CSS and theming options.
* *Use Maven for the RWT dependencies*
** Unfortunately there is no maven repository available that can server the required RWT dependency jar files. Currently, the required jars are bundled with the plugin. This is no ideal, as it doesn't allow to switch the RWT version. This situation can be improved if the jar files will become available in a public Maven repository.

Please file any issues/requests/ideas in the [GitHub issue tracker|http://github.com/bwolff/grails-rwt/issues].

0 comments on commit 00bef01

Please sign in to comment.