I’m trying to create a custom OrgChart component using the google visualization libray (http://code.google.com/p/gwt-google-apis/). Documentation on the OrgChart is located at…
This library contains a java wrapper for the following Visualization…
http://code.google.com/apis/visualization/documentation/gallery/orgchart.html
My client side widget currently looks like this…
[font=Courier New]
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.visualization.client.DataTable;
import com.google.gwt.visualization.client.AbstractDataTable.ColumnType;
import com.google.gwt.visualization.client.visualizations.OrgChart;
import com.google.gwt.visualization.client.visualizations.OrgChart.Options;
import com.google.gwt.visualization.client.visualizations.OrgChart.Size;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
/**
-
Client side widget which communicates with the server. Messages from the
-
server are shown as HTML and mouse clicks are sent to the server.
*/
public class VOrgChart extends Composite implements Paintable, ClickHandler {public static final String CLICK_EVENT_IDENTIFIER = “click”;
/** The client side widget identifier */
protected String paintableId;/** Reference to the server connection object. */
protected ApplicationConnection client;protected VerticalPanel panel = new VerticalPanel();
/**
- The constructor should first call super() to initialize the component and
- then handle any initialization relevant to Vaadin.
*/
public VOrgChart() {
initWidget(panel);
initOrgChart();
}
private void initOrgChart() {
Options options = Options.create();
options.setSize(Size.LARGE);
options.setAllowCollapse(true);
options.setColor(“#00FF00”);
options.setSelectionColor(“#FF0000”);DataTable data = DataTable.create(); data.addColumn(ColumnType.STRING, "Name"); data.addColumn(ColumnType.STRING, "Manager"); data.addRows(5); data.setValue(0, 0, "Goofy"); data.setValue(1, 0, "Mickey Mouse"); data.setValue(1, 1, "Donald Duck"); data.setValue(2, 0, "Alice"); data.setValue(2, 1, "Mike"); data.setValue(3, 0, "Bob"); data.setValue(3, 1, "Jim"); data.setValue(4, 0, "Carol"); data.setValue(4, 1, "Bob"); OrgChart viz = new OrgChart(data, options); Label status = new Label(); viz.addSelectHandler(new SelectionDemo(viz, status)); panel.add(status); panel.add(viz);
}
/**
-
Called whenever an update is received from the server
*/
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// This call should be made first.
// It handles sizes, captions, tooltips, etc. automatically.
if (client.updateComponent(this, uidl, true)) {
// If client.updateComponent returns true there has been no changes
// and we
// do not need to update anything.
return;
}// Save reference to server connection object to be able to send
// user interaction later
this.client = client;// Save the client side identifier (paintable id) for the widget
paintableId = uidl.getId();
}
/**
- Called when a native click event is fired.
- @param event
-
the {@link ClickEvent} that was fired
*/
public void onClick(ClickEvent event) {
}
}
[/font]
On the line “DataTable data = DataTable.create()”, I get the following error message in the Debug Window.
(TypeError): Cannot read property ‘DataTable’ of undefined stack: TypeError: Cannot read property ‘DataTable’ of undefined at E6 (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:80:268) at uyc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1740:1466) at cpc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1505:156) at ilc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1365:72) at Object.zXc [as Bg]
(http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:2287:308) at yid (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:3009:787) at qlc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1370:1010) at Bjc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1412:120) at Djc (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:1414:365) at Cnb (http://localhost:8080/soa4j-vaadin/VAADIN/widgetsets/com.example.soa4j_vaadin.widgetset.Soa4j_vaadinWidgetset/B7877ED87A76724850AB6692806F2388.cache.html:328:149) type: non_object_property_load arguments: DataTable,
Any ideas would be extremely helpful. Thanks!