Nicozan-Blog

Knowledge Seeking

Drools and Gwt – Small Post, Big Issue May 11, 2011

Filed under: Drools,GWT — nicozan @ 3:47 pm
Tags: , , ,

Short Approach…

It’s an excellent idea to combine 2 two technologies such as Drools and GWT to build Intelligent Web Applications. But there is a little bit of a problem at the moment to integrate them. Because Drools and GWT include the org.eclipse.jdt classes but with different JDT version. And when you run your application (mvn gwt:run) you will have an error like this:

Unable to parse module: com.google.gwt.user.User
java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getErrors()
[Lorg/eclipse/jdt/core/compiler/IProblem;
at com.google.gwt.dev.jdt.AbstractCompiler$ICompilerRequestorImpl.
acceptResult(AbstractCompiler.java:213)
at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:417)
...

Solution…

So to solve this problem you need to add an exclusion to your dependecy (that has the Drools-Core dependency) added in your Maven Gwt Application pom.xml. The exclusion in your pom should look like this:

<dependencies>
    [...]
<dependency>
           <groupId>com.wordpress.nicozan</groupId>
           <artifactId>dependency-with-drools-core</artifactId>
           <version>1.0</version>
           <exclusions>
                   <exclusion>
                           <groupId>org.eclipse.jdt.core.compiler</groupId>
                           <artifactId>ecj</artifactId>
                   </exclusion>
           </exclusions>
</dependency>
    [...]
</dependencies>

Short but helpful 😉

 

GWT Visualization – Transform Data into Information March 30, 2011

Filed under: GWT,Java — nicozan @ 12:22 pm
Tags: , ,

Introduction

Beginning with the concept, that data it is not information. A table full of rows (i.e. 1000 rows) it can be consider data, and you’ll agree with me that trying to find meaningful data (Information) from the table it’s going to be a tedious task. At this point of the reasoning is when we use Charts (i.e. Line Charts, Pie Charts, Scatter Charts, etc) to summarize the data from the table and in that way we obtain information to make a decision. GWT Visualization will help us to add Charts to our GWT webapp, by using its simple API.

Using the GWT Visualization API

If you are not familiarized with the GWT Framework, you need to have a look at its documentation or my post. Considering that you are using the Maven GWT Plugin, all you have to do is define the next dependency in the projects pom.xml.

<dependency>
  <groupId>com.google.gwt.google-apis</groupId>
  <artifactId>gwt-visualization</artifactId>
  <version>1.0.2</version>
</dependency>

The next thing to do is define the module inheritance so the client side of the webapp can use it. In the “myWebApp”.gwt.xml you have to write:

<inherits name='com.google.gwt.visualization.Visualization'/>

Now that we have GWT Visualization ready to use, let’s see the elements that are part of a Chart:
-DataTable (Data Format that is going to be injected into the Chart so it can display information)
-Options (Set of characteristics of the Chart: width, height,background,color,etc. )

If you want to see a basic example working go to this page: GWT Visualization Example.

Short Tip:

If you want to draw a Line Chart and you have dots or coordinates best thing, you should use a Scatter Chart and set the option ScatterChart.Option.setLineSize(1); . The line size has to be 1 or greater than 1.