The folks at Metawidget have added support to render the sections as tabbed panels. I have integrated this into the application the results speak for themselves.
Fixed so that the JTabbedPane with the lists of the domain objects is aligned correctly by modifying the TableGroupLayout.
Using the classes in NetBeans 6.0 RCP application but I needed to changed the classes that load the Metawidget XML configuration to not validate the schema or I get a error.
SEVERE [org.metawidget.inspector.ConfigReader]: Unable to parse config
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
Developing forms to update, delete and create domain objects in a business application usually all follow the same style, layout and functionality. So would it not be great if these forms could be created at runtime instead of hand-coded. Introducing MetaWidget ...
Metawidget uses inspectors (annotations, XML and JavaBeans) to define the back-end architecture of the application and using this information constructs the front-end at runtime for numerous technologies (Swing, Andriod, Struts, JSF).
The strength of Metawidget is that is allows the developer flexibility to change how the front-end is rendered because Metawidget does not exclusively own the front-end like many other frameworks. To demonstrate this I have changed how my domain objects are presented by configuring and overriding how Metawidget renders them. I also created a single panel and dialog that could display any of my domain objects by inspecting them at runtime and applying a certain layout or style to the panel.
The model for the domain is a simple Organization, Company, Departments object model.
Showing the dialog
The following code constructs a new organization object and adds a company. The dialog and panel that use Metawidget are constructed and instructed to inspect the object and render the user interface.
The organization has a list of companies and when a company is double-clicked then a dialog showing the company is opened. This is all handled by the AbstractDomainObjectPanel class. The JTabbedPanel is an addition that I created for the demo, whereas the original rendering of Metawidget for the Organization class would have been to have each table below each other.
No demo would be complete without some screen shots, so here are mine.
Areas that still need work
The columns shown by the tables are still under construction and of course the editors used by the tables.
The icons for the JDialog still needs to be ironed out.
The table does not take up the correct width but for this I would need to write a new layout for Metawidget.
The close action on the main (or first dialog) does not close the application, it just sets it invisible.
The basic idea behind connext-graphs is to make integrating the Open Flash Chart (http://teethgrinder.co.uk/open-flash-chart/) as easy as possible.
The project was started because I wanted to use a chart library that looked similar to the Google charts in their Analyzer application. Struts 2.0 has a plug-in for the JFreeChart library but I wanted a chart that a user could interact with. When the user hovers over a chart point the properties of that point is shown and in this way the chart does not feel like an empty piece of information plonked on the site to take up space.
To Be Done
Open Flash Chart is shown as an alternative because it includes a Java class to output the data file used by the chart library. This Java class was not used when developing connext-graphs.
The sketch chart is based upon the bar chart but has an extra `fun` option that indicates how interesting the chart should be rendered.
How to use
1. Create a chart controller that specifies the properties of the charting area
OFCGraphController controller = new OFCGraphController();
controller.getTitle().setText("Example Sketch Bar Chart");
controller.getYLegend().setText("No. of tasks");
2. Create the chart data series
It is possible to mix and match the different series types so you could a line chart and a sketch chart combined.
DefaultOFCGraphDataModel model = new DefaultOFCGraphDataModel();
model.setSeriesType(new OFCBarSketchSeriesType(55, 10, "#d070ac", "#000000", "Test", 10));
The offset parameter of OFCBarSketchSeriesType(alpha, offset, color, outlineColor, text, size) specifies the fun aspect of the chart.
The following values can be used:-
3. Add the series to the charting area
4. Render the chart data
value = controller.render();
Here the data string used by Open Flash Chart is assigned to the value property and this property is read by the graph.jsp view.
<%@ include file="include.jsp" %>
<s:property value="value" escape="false" />
5. Include the Flash component
Of course none of this would work if the Open Flash Chart object was not embedded into the Struts view.
The following :-
<%@ taglib prefix="m" uri="/connext" %>
Figure 1 : Hovering over a chart point