Dear Jspresso users,
The 3.0.1-SNAPSHOT is less and less a 3.0.1 but more a 4.0.0 ;-)
Following Prakash suggestion, I've included a charting library (the excellent fusioncharts-free flash charting) in Jspresso. As usual, computing and displaying a chart is quite straightforward. I've included a basic chart in the HR sample application (SVN trunk). It is located on the "Company view". Here is the code extract :
in view.xml :
<bean parent="chartAction">
<property name="chartDescriptor">
<bean class="org.jspresso.hrsample.chart.CompanyChart">
<property name="url" value="classpath:com/fusioncharts/FCF_Column3D.swf" />
<property name="title" value="company.chart"/>
</bean>
</property>
<property name="description" value="company.chart"/>
</bean>
and the org.jspresso.hrsample.chart.CompanyChart source code :
package org.jspresso.hrsample.chart;
import java.sql.Connection;
import java.util.Locale;
import java.util.Random;
import org.jspresso.framework.application.charting.descriptor.AbstractChartDescriptor;
import org.jspresso.framework.util.i18n.ITranslationProvider;
import org.jspresso.hrsample.model.Company;
import org.jspresso.hrsample.model.Employee;
/**
* The company sample chart.
* <p>
* Copyright (c) 2005-2009 Vincent Vandenschrick. All rights reserved.
* <p>
*
* @version $LastChangedRevision: 2047 $
* @author Vincent Vandenschrick
*/
public class CompanyChart extends AbstractChartDescriptor {
/**
* {@inheritDoc}
*/
public String getData(Object model,
@SuppressWarnings("unused") Connection jdbcConnection,
ITranslationProvider translationProvider, Locale locale) {
Company company = (Company) model;
StringBuffer chartData = new StringBuffer("<graph caption='"
+ translationProvider.getTranslation(getTitle(), locale)
+ "' xAxisName='"
+ translationProvider.getTranslation(Employee.class.getName(), locale)
+ "' yAxisName='" + translationProvider.getTranslation("age", locale)
+ "' showNames='1' decimalPrecision='0' formatNumberScale='0'>");
for (Employee emp : company.getEmployees()) {
Random r = new Random();
String color = Integer.toHexString(r.nextInt(255))
+ Integer.toHexString(r.nextInt(255))
+ Integer.toHexString(r.nextInt(255));
chartData.append("<set name='" + emp.getName() + "' value='"
+ emp.getAge().intValue() + "' color='" + color + "' />");
}
chartData.append("</graph>");
return chartData.toString();
}
}
Running the flash chart in swing requires some extra library (dj-nativeswing + dependencies). They are included in the new archetype but you have to update your existing applications eclipse projects :
in .classpath, add :
<classpathentry
kind="var"
path="M2_REPO/chrriis/dj-nativeswing/0.9.8/dj-nativeswing-0.9.8.jar">
<attributes>
<attribute
name="org.eclipse.jst.component.nondependency"
value="" />
</attributes>
</classpathentry>
<classpathentry
kind="var"
path="M2_REPO/chrriis/dj-nativeswing-swt/0.9.8/dj-nativeswing-swt-0.9.8.jar">
<attributes>
<attribute
name="org.eclipse.jst.component.nondependency"
value="" />
</attributes>
</classpathentry>
<classpathentry
kind="var"
path="M2_REPO/org/eclipse/swt/3.5.1/swt-3.5.1-win32-win32-x86.jar">
<attributes>
<attribute
name="org.eclipse.jst.component.nondependency"
value="" />
</attributes>
</classpathentry>
I've also refactored and aligned the way Jspresso retrieves the HTTP session for server-based UIs (all except swing). This refactoring also requires a change on your existing projects :
in noulc-web.xml, add :
<filter-mapping>
<filter-name>HttpRequestHolder</filter-name>
<servlet-name>ApplicationWingsServlet</servlet-name>
</filter-mapping>
in ulc-web.xml, add :
<filter-mapping>
<filter-name>HttpRequestHolder</filter-name>
<servlet-name>ApplicationUlcServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>HttpRequestHolder</filter-name>
<servlet-name>ApplicationWingsServlet</servlet-name>
</filter-mapping>
I've also included Pierre-Michel Jspresso contribution : SJS (Sugar For Jspresso). It is a groovy DSL to use as a replacement of Spring XML (it actually generates Spring config files behind the scene). SJS is almost complete for the domain model description, and is on its way for the view description. SJS-based description is approx. 1/10th of the Spring equivallent and much clearer. Whenever the DSL is missing something, you can still override the generated Spring beans in the classic "model.xml".
For those of you who are interested, the HR sample application has been migrated to SJS :
https://svn.jspresso.org/websvn/filedetails.php?repname=jspresso&path=%2...
Last but not least, I've also changed the UI design of the Flex and Qooxdoo frontends. They now use an accordion to navigate the workspaces. I've attached a screenshot to the thread including this new UI as well as a running chart.
You can give a live try to these new features by building the HR sample application from the trunk:
svn co https://svn.jspresso.org/jspresso/app-hrsample/trunk/ hrsample
cd hrsample
mvn package
Don't hesitate to comment in this thread whenever you have any problem.
Best,
Vincent
| Attachment | Size |
|---|---|
| 3.0.1-sceenshot.jpg | 29.82 KB |
