diff options
author | Austin Riddle | 2012-12-14 18:34:29 +0000 |
---|---|---|
committer | Austin Riddle | 2012-12-14 18:34:29 +0000 |
commit | 9aa719d317b068b3fde465a0536adda9f922307b (patch) | |
tree | 98311d1daf496aa5c51ceb58851086332b6f4d69 | |
parent | 9a702c2afa3a2275a1695bacb6502c2e38084510 (diff) | |
download | org.eclipse.rap.incubator.visualization-9aa719d317b068b3fde465a0536adda9f922307b.tar.gz org.eclipse.rap.incubator.visualization-9aa719d317b068b3fde465a0536adda9f922307b.tar.xz org.eclipse.rap.incubator.visualization-9aa719d317b068b3fde465a0536adda9f922307b.zip |
Update to RAP 2.0
44 files changed, 2661 insertions, 2126 deletions
diff --git a/bundles/org.eclipse.rap.rwt.excanvas/src/org/eclipse/rap/rwt/excanvas/ExCanvasResource.java b/bundles/org.eclipse.rap.rwt.excanvas/src/org/eclipse/rap/rwt/excanvas/ExCanvasResource.java index 13a09ad..50c794c 100644 --- a/bundles/org.eclipse.rap.rwt.excanvas/src/org/eclipse/rap/rwt/excanvas/ExCanvasResource.java +++ b/bundles/org.eclipse.rap.rwt.excanvas/src/org/eclipse/rap/rwt/excanvas/ExCanvasResource.java @@ -16,8 +16,7 @@ *****************************************************************************/ package org.eclipse.rap.rwt.excanvas; -import org.eclipse.rap.rwt.resources.IResource; -import org.eclipse.rap.rwt.resources.IResourceManager.RegisterOptions; +import org.eclipse.rap.ui.resources.IResource; public class ExCanvasResource implements IResource { @@ -32,10 +31,6 @@ public class ExCanvasResource implements IResource { return this.getClass().getClassLoader(); } - public RegisterOptions getOptions() { - return RegisterOptions.VERSION_AND_COMPRESS; - } - public String getLocation() { if( location == null ) { location = "org/eclipse/rap/rwt/excanvas/excanvas.compiled.js"; diff --git a/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch b/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch index 7f42a57..3966a6a 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch +++ b/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch @@ -1,43 +1,43 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.rap.ui.launch.RAPLauncher"> -<booleanAttribute key="append.args" value="true"/> -<booleanAttribute key="askclear" value="false"/> -<booleanAttribute key="automaticAdd" value="false"/> -<booleanAttribute key="automaticValidate" value="false"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="[NONE]"/> -<booleanAttribute key="clearConfig" value="false"/> -<booleanAttribute key="clearws" value="false"/> -<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/RAP Google Visualizations Demo"/> -<booleanAttribute key="default" value="true"/> -<booleanAttribute key="default_auto_start" value="true"/> -<intAttribute key="default_start_level" value="4"/> -<booleanAttribute key="includeOptional" value="false"/> -<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer"/> -<stringAttribute key="org.eclipse.rap.launch.browserMode" value="INTERNAL"/> -<stringAttribute key="org.eclipse.rap.launch.contextpath" value=""/> -<stringAttribute key="org.eclipse.rap.launch.dataLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.rap.ui.launch/RAPGoogleVisualizationsDemo"/> -<stringAttribute key="org.eclipse.rap.launch.entryPoint" value="demo"/> -<stringAttribute key="org.eclipse.rap.launch.libraryVariant" value="DEBUG"/> -<stringAttribute key="org.eclipse.rap.launch.logLevel" value="ALL"/> -<booleanAttribute key="org.eclipse.rap.launch.openBrowser" value="true"/> -<intAttribute key="org.eclipse.rap.launch.port" value="9090"/> -<stringAttribute key="org.eclipse.rap.launch.servletName" value="googlevis"/> -<intAttribute key="org.eclipse.rap.launch.sessionTimeout" value="0"/> -<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/> -<booleanAttribute key="org.eclipse.rap.launch.useDefaultDataLocation" value="true"/> -<booleanAttribute key="org.eclipse.rap.launch.useManualContextPath" value="false"/> -<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/> -<booleanAttribute key="org.eclipse.rap.launch.useSessionTimeout" value="false"/> -<stringAttribute key="pde.version" value="3.3"/> -<booleanAttribute key="show_selected_only" value="false"/> -<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true"/> -<booleanAttribute key="tracing" value="false"/> -<booleanAttribute key="useCustomFeatures" value="false"/> -<booleanAttribute key="useDefaultConfigArea" value="true"/> -<stringAttribute key="workspace_bundles" value="org.eclipse.rap.jettycustomizer@default:default,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.excanvas@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.visualization.google.demo@default:default,org.eclipse.rap.rwt.visualization.google@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default,org.json@default:default"/> -</launchConfiguration> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.rap.ui.launch.RAPLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<booleanAttribute key="clearws" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/RAP Google Visualizations Demo"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer"/>
+<stringAttribute key="org.eclipse.rap.launch.browserMode" value="INTERNAL"/>
+<stringAttribute key="org.eclipse.rap.launch.contextpath" value=""/>
+<stringAttribute key="org.eclipse.rap.launch.dataLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.rap.ui.launch/RAPGoogleVisualizationsDemo"/>
+<stringAttribute key="org.eclipse.rap.launch.entryPoint" value=""/>
+<stringAttribute key="org.eclipse.rap.launch.libraryVariant" value="DEBUG"/>
+<stringAttribute key="org.eclipse.rap.launch.logLevel" value="ALL"/>
+<booleanAttribute key="org.eclipse.rap.launch.openBrowser" value="true"/>
+<intAttribute key="org.eclipse.rap.launch.port" value="9090"/>
+<stringAttribute key="org.eclipse.rap.launch.servletName" value="googlevis"/>
+<intAttribute key="org.eclipse.rap.launch.sessionTimeout" value="0"/>
+<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/>
+<booleanAttribute key="org.eclipse.rap.launch.useDefaultDataLocation" value="true"/>
+<booleanAttribute key="org.eclipse.rap.launch.useManualContextPath" value="false"/>
+<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/>
+<booleanAttribute key="org.eclipse.rap.launch.useSessionTimeout" value="false"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="org.eclipse.rap.jettycustomizer@default:false,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.excanvas@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.visualization.google.demo@default:default,org.eclipse.rap.rwt.visualization.google@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default,org.json@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google.demo/plugin.xml b/bundles/org.eclipse.rap.rwt.visualization.google.demo/plugin.xml index 0f99ab8..5010f9a 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google.demo/plugin.xml +++ b/bundles/org.eclipse.rap.rwt.visualization.google.demo/plugin.xml @@ -6,8 +6,8 @@ point="org.eclipse.rap.ui.entrypoint"> <entrypoint class="org.eclipse.rap.rwt.visualization.google.demo.Application" - parameter="demo" - id="org.eclipse.rap.rwt.visualization.google.demo.Application"> + id="org.eclipse.rap.rwt.visualization.google.demo.Application" + path="/googlevis"> </entrypoint> </extension> <extension @@ -15,7 +15,6 @@ <branding defaultEntrypointId="org.eclipse.rap.rwt.visualization.google.demo.Application" id="org.eclipse.rap.rwt.visualization.google.demo.branding" - servletName="googlevis" title="RWT Google Visualizations"> </branding> </extension> diff --git a/bundles/org.eclipse.rap.rwt.visualization.google.demo/src/org/eclipse/rap/rwt/visualization/google/demo/Application.java b/bundles/org.eclipse.rap.rwt.visualization.google.demo/src/org/eclipse/rap/rwt/visualization/google/demo/Application.java index 19e4250..f1960fe 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google.demo/src/org/eclipse/rap/rwt/visualization/google/demo/Application.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google.demo/src/org/eclipse/rap/rwt/visualization/google/demo/Application.java @@ -21,7 +21,7 @@ package org.eclipse.rap.rwt.visualization.google.demo; import java.util.Date; -import org.eclipse.rap.rwt.lifecycle.IEntryPoint; +import org.eclipse.rap.rwt.application.EntryPoint; import org.eclipse.rap.rwt.visualization.google.AnnotatedTimeLine; import org.eclipse.rap.rwt.visualization.google.AreaChart; import org.eclipse.rap.rwt.visualization.google.BarChart; @@ -49,7 +49,7 @@ import org.eclipse.ui.part.ViewPart; * This class controls all aspects of the application's execution * and is contributed through the plugin.xml. */ -public class Application implements IEntryPoint +public class Application implements EntryPoint { public static Listener createSelectionListener () { diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/META-INF/MANIFEST.MF b/bundles/org.eclipse.rap.rwt.visualization.google/META-INF/MANIFEST.MF index a20a6ca..eac453e 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.rap.rwt.visualization.google/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.rap.rwt, org.json;bundle-version="1.0.0" Import-Package: javax.servlet;version="2.5.0", - javax.servlet.http;version="2.5.0" + javax.servlet.http;version="2.5.0", + org.eclipse.rap.ui.resources;version="2.0.0" Export-Package: org.eclipse.rap.rwt.visualization.google, org.eclipse.rap.rwt.visualization.google.json diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js index b85f24f..61be8bd 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js @@ -13,33 +13,33 @@ //The reason this is still a qooxdoo widget is because google embeds the chart in an iframe. qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { type: "abstract", - extend: qx.ui.layout.CanvasLayout, + extend: rwt.widgets.base.Parent, statics : { registerAdapter : function(className, constructor) { - org.eclipse.rwt.protocol.AdapterRegistry.add( className, { + rwt.protocol.AdapterRegistry.add( className, { factory : function( properties ) { var result = new constructor(); - org.eclipse.rwt.protocol.AdapterUtil.addStatesForStyles( result, properties.style ); + rwt.protocol.AdapterUtil.addStatesForStyles( result, properties.style ); result.setUserData( "isControl", true ); - org.eclipse.rwt.protocol.AdapterUtil.setParent( result, properties.parent ); + rwt.protocol.AdapterUtil.setParent( result, properties.parent ); return result; }, - destructor : org.eclipse.rwt.protocol.AdapterUtil.getControlDestructor(), + destructor : rwt.protocol.AdapterUtil.getControlDestructor(), - properties : org.eclipse.rwt.protocol.AdapterUtil.extendControlProperties( [ + properties : rwt.protocol.AdapterUtil.extendControlProperties( [ "widgetData", "widgetOptions", ] ), - propertyHandler : org.eclipse.rwt.protocol.AdapterUtil.extendControlPropertyHandler( {} ), + propertyHandler : rwt.protocol.AdapterUtil.extendControlPropertyHandler( {} ), - listeners : org.eclipse.rwt.protocol.AdapterUtil.extendControlListeners( [] ), + listeners : rwt.protocol.AdapterUtil.extendControlListeners( [] ), - listenerHandler : org.eclipse.rwt.protocol.AdapterUtil.extendControlListenerHandler( {} ), + listenerHandler : rwt.protocol.AdapterUtil.extendControlListenerHandler( {} ), methods : [ "redraw" @@ -131,7 +131,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { this.selectedValue = dataTable.getValue(selObj.row, selObj.column); //fire selection event - var req = org.eclipse.swt.Request.getInstance(); + var req = rwt.remote.Server.getInstance(); req.addParameter(widgetId + ".selectedItem", this.selectedItem); req.addParameter(widgetId + ".selectedRow", this.selectedRow); req.addParameter(widgetId + ".selectedColumn", this.selectedColumn); @@ -146,9 +146,12 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { refreshWidgetData : function() { try { - var data = eval('(' + this.getWidgetData() + ')'); + var jsonData = this.getWidgetData(); + if (jsonData != null && jsonData != "") { + var data = eval('(' + jsonData + ')'); this._dataTable = new google.visualization.DataTable(data); this.info("Setting data set to : "+this._dataTable); + } } catch (err) { this.info("Attempted to set data but failed."); @@ -158,7 +161,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { refreshWidgetOptions : function() { try { - qx.ui.core.Widget.flushGlobalQueues(); + rwt.widgets.base.Widget.flushGlobalQueues(); var opString = this.getWidgetOptions(); opString = opString.replace(new RegExp("~","g"), "\""); var evalStr = "({" + opString; @@ -171,7 +174,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { }, redraw : function () { - qx.client.Timer.once( function() { + rwt.client.Timer.once( function() { try { this.initialize(); this.info("Attempting to redraw: "+this._dataTable+", "+this._options); @@ -190,7 +193,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { //if (!org.eclipse.swt.EventUtil.getSuspended()) { var wm = org.eclipse.swt.WidgetManager.getInstance(); var canvasId = wm.findIdByWidget(widget); - var req = org.eclipse.swt.Request.getInstance(); + var req = rwt.remote.Server.getInstance(); req.addParameter(canvasId + "." + field, value); req.send(); //} diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleAPIResource.java index c989f9b..5dfb0f1 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleAPIResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleAPIResource.java @@ -10,8 +10,8 @@ ******************************************************************************/ package org.eclipse.rap.rwt.visualization.google.internal; -import org.eclipse.rap.rwt.resources.IResource; -import org.eclipse.rap.rwt.resources.IResourceManager.RegisterOptions; +import org.eclipse.rap.ui.resources.IResource; + public class GoogleAPIResource implements IResource { @@ -25,10 +25,6 @@ public class GoogleAPIResource implements IResource { return this.getClass().getClassLoader(); } - public RegisterOptions getOptions() { - return RegisterOptions.VERSION; - } - public String getLocation() { //TODO this should be converted to use bundle properties return System.getProperty(API_KEY, "https://www.google.com/jsapi"); diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleVisualizationResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleVisualizationResource.java index 5507cde..0e90bc8 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleVisualizationResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/GoogleVisualizationResource.java @@ -10,8 +10,7 @@ ******************************************************************************/ package org.eclipse.rap.rwt.visualization.google.internal; -import org.eclipse.rap.rwt.resources.IResource; -import org.eclipse.rap.rwt.resources.IResourceManager.RegisterOptions; +import org.eclipse.rap.ui.resources.IResource; /** * <p>Base type for visualization resources.</p> @@ -27,10 +26,6 @@ public abstract class GoogleVisualizationResource implements IResource { return this.getClass().getClassLoader(); } - public RegisterOptions getOptions() { - return RegisterOptions.VERSION; - } - public abstract String getLocation(); public boolean isJSLibrary() { diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java index 708a565..a6852dc 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java @@ -51,7 +51,8 @@ public abstract class VisualizationWidgetLCA extends AbstractWidgetLCA { public void renderInitialization( final Widget widget ) throws IOException { Control control = (Control)widget; IClientObject clientObject = ClientObjectFactory.getClientObject( control ); - clientObject.create( getWidgetType().getCanonicalName() ); + String canonicalName = getWidgetType().getCanonicalName(); + clientObject.create( canonicalName ); // clientObject.set( "id", WidgetUtil.getId( control ) ); clientObject.set( "parent", WidgetUtil.getId( control.getParent() ) ); clientObject.set( "style", WidgetLCAUtil.getStyles( control, ALLOWED_STYLES ) ); diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js index 81e1f0d..63dca89 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js @@ -24,7 +24,7 @@ catch (e) { } qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Geomap", { - extend: qx.ui.layout.CanvasLayout, + extend: rwt.widgets.base.Parent, construct: function() { this.base( arguments ); @@ -94,7 +94,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Geomap", { this.selectedItem = selection; //fire selection event - var req = org.eclipse.swt.Request.getInstance(); + var req = rwt.remote.Server.getInstance(); req.addParameter(widgetId + ".selectedItem", this.selectedItem); req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); req.send(); @@ -118,7 +118,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Geomap", { refreshWidgetOptions : function() { try { - qx.ui.core.Widget.flushGlobalQueues(); + rwt.widgets.base.Widget.flushGlobalQueues(); var opString = this.getWidgetOptions(); opString = opString.replace(new RegExp("~","g"), "\""); var evalStr = "({" + opString; @@ -148,7 +148,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Geomap", { //if (!org.eclipse.swt.EventUtil.getSuspended()) { var wm = org.eclipse.swt.WidgetManager.getInstance(); var canvasId = wm.findIdByWidget(widget); - var req = org.eclipse.swt.Request.getInstance(); + var req = rwt.remote.Server.getInstance(); req.addParameter(canvasId + "." + field, value); req.send(); //} diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js index b709baf..4da7ac1 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js @@ -24,7 +24,7 @@ catch (e) { } qx.Class.define( "org.eclipse.rap.rwt.visualization.google.MotionChart", { - extend: qx.ui.layout.CanvasLayout, + extend: rwt.widgets.base.Parent, construct: function( ) { this.base( arguments ); @@ -96,7 +96,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.MotionChart", { refreshWidgetOptions : function() { try { - qx.ui.core.Widget.flushGlobalQueues(); + rwt.widgets.base.Widget.flushGlobalQueues(); var opString = this.getWidgetOptions(); opString = opString.replace(new RegExp("~","g"), "\""); var evalStr = "({" + opString; @@ -126,7 +126,7 @@ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.MotionChart", { //if (!org.eclipse.swt.EventUtil.getSuspended()) { var wm = org.eclipse.swt.WidgetManager.getInstance(); var canvasId = wm.findIdByWidget(widget); - var req = org.eclipse.swt.Request.getInstance(); + var req = rwt.remote.Server.getInstance(); req.addParameter(canvasId + "." + field, value); req.send(); //} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/META-INF/MANIFEST.MF b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/META-INF/MANIFEST.MF index 143ca00..0b88f27 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/META-INF/MANIFEST.MF @@ -1,12 +1,12 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.rap.rwt.visualization.jit.demo;singleton:=true -Bundle-Version: 1.5.0.qualifier -Require-Bundle: org.eclipse.rap.ui, - org.eclipse.rap.rwt.visualization.jit;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.4 -Import-Package: javax.servlet;version="2.4.0", - javax.servlet.http;version="2.4.0" -Bundle-Vendor: %Bundle-Vendor -Bundle-Activator: org.eclipse.rap.rwt.visualization.jit.demo.Activator +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.rap.rwt.visualization.jit.demo;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Require-Bundle: org.eclipse.rap.ui,
+ org.eclipse.rap.rwt.visualization.jit;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Import-Package: javax.servlet;version="2.4.0",
+ javax.servlet.http;version="2.4.0"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Activator: org.eclipse.rap.rwt.visualization.jit.demo.Activator
diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/RAP Javascript InfoVis Toolkit Demo.launch b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/RAP Javascript InfoVis Toolkit Demo.launch index a04ff0b..7635d1c 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/RAP Javascript InfoVis Toolkit Demo.launch +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/RAP Javascript InfoVis Toolkit Demo.launch @@ -1,42 +1,43 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.rap.ui.launch.RAPLauncher"> -<booleanAttribute key="append.args" value="true"/> -<booleanAttribute key="askclear" value="false"/> -<booleanAttribute key="automaticAdd" value="false"/> -<booleanAttribute key="automaticValidate" value="false"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="[NONE]"/> -<booleanAttribute key="clearConfig" value="true"/> -<booleanAttribute key="clearws" value="false"/> -<stringAttribute key="configLocation" value="${system_property:java.io.tmpdir}/org.eclipse.rap.rwt.visualization.jit.demo"/> -<booleanAttribute key="default" value="true"/> -<booleanAttribute key="default_auto_start" value="true"/> -<intAttribute key="default_start_level" value="4"/> -<booleanAttribute key="includeOptional" value="false"/> -<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer"/> -<stringAttribute key="org.eclipse.rap.launch.browserMode" value="INTERNAL"/> -<stringAttribute key="org.eclipse.rap.launch.contextpath" value=""/> -<stringAttribute key="org.eclipse.rap.launch.dataLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.rap.ui.launch/RAPJavascriptInfoVisToolkitDemo"/> -<stringAttribute key="org.eclipse.rap.launch.entryPoint" value="jit"/> -<stringAttribute key="org.eclipse.rap.launch.libraryVariant" value="DEBUG"/> -<stringAttribute key="org.eclipse.rap.launch.logLevel" value="ALL"/> -<booleanAttribute key="org.eclipse.rap.launch.openBrowser" value="true"/> -<intAttribute key="org.eclipse.rap.launch.port" value="9090"/> -<stringAttribute key="org.eclipse.rap.launch.servletName" value="visualization"/> -<intAttribute key="org.eclipse.rap.launch.sessionTimeout" value="0"/> -<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/> -<booleanAttribute key="org.eclipse.rap.launch.useDefaultDataLocation" value="true"/> -<booleanAttribute key="org.eclipse.rap.launch.useManualContextPath" value="false"/> -<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="true"/> -<booleanAttribute key="org.eclipse.rap.launch.useSessionTimeout" value="false"/> -<stringAttribute key="pde.version" value="3.3"/> -<booleanAttribute key="show_selected_only" value="true"/> -<stringAttribute key="target_bundles" value="com.ibm.icu@default:default,javax.servlet@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs*3.5.100.v20110404@default:default,org.eclipse.core.jobs*3.5.200.v20110721-1714@default:default,org.eclipse.core.runtime*3.7.0.v20110110@default:true,org.eclipse.core.runtime*3.8.0.v20110920-2042@default:true,org.eclipse.equinox.app*1.3.100.v20110321@default:default,org.eclipse.equinox.app*1.3.100.v20111010-1614@default:default,org.eclipse.equinox.common*3.6.0.v20110523@2:true,org.eclipse.equinox.common*3.6.100.v20111010-1614@2:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences*3.4.0.v20110502@default:default,org.eclipse.equinox.preferences*3.4.100.v20111129-1548@default:default,org.eclipse.equinox.registry*3.5.100.v20110502@default:default,org.eclipse.equinox.registry*3.5.200.v20111010-1614@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi*3.7.0.v20110613@-1:true,org.eclipse.osgi*3.8.0.v20111111-1618@-1:true,org.eclipse.osgi.services*3.3.0.v20110513@default:default,org.eclipse.osgi.services*3.3.0.v20111117-1210@default:default,org.eclipse.rap.jettycustomizer@default:false,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.excanvas@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.cheatsheets@default:default,org.eclipse.rap.ui.cheatsheets@default:default,org.eclipse.rap.ui.forms@default:default,org.eclipse.rap.ui.forms@default:default,org.eclipse.rap.ui.views@default:default,org.eclipse.rap.ui.views@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default,org.eclipse.rap.ui@default:default"/> -<booleanAttribute key="tracing" value="false"/> -<booleanAttribute key="useCustomFeatures" value="false"/> -<booleanAttribute key="useDefaultConfigArea" value="false"/> -<stringAttribute key="workspace_bundles" value="org.eclipse.rap.rwt.visualization.jit.demo@default:default,org.eclipse.rap.rwt.visualization.jit@default:default"/> -</launchConfiguration> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.rap.ui.launch.RAPLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="false"/>
+<stringAttribute key="configLocation" value="${system_property:java.io.tmpdir}/org.eclipse.rap.rwt.visualization.jit.demo"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer"/>
+<stringAttribute key="org.eclipse.rap.launch.browserMode" value="INTERNAL"/>
+<stringAttribute key="org.eclipse.rap.launch.contextpath" value=""/>
+<stringAttribute key="org.eclipse.rap.launch.dataLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.rap.ui.launch/RAPJavascriptInfoVisToolkitDemo"/>
+<stringAttribute key="org.eclipse.rap.launch.entryPoint" value=""/>
+<stringAttribute key="org.eclipse.rap.launch.libraryVariant" value="DEBUG"/>
+<stringAttribute key="org.eclipse.rap.launch.logLevel" value="ALL"/>
+<booleanAttribute key="org.eclipse.rap.launch.openBrowser" value="true"/>
+<intAttribute key="org.eclipse.rap.launch.port" value="9090"/>
+<stringAttribute key="org.eclipse.rap.launch.servletName" value="jit"/>
+<intAttribute key="org.eclipse.rap.launch.sessionTimeout" value="0"/>
+<booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/>
+<booleanAttribute key="org.eclipse.rap.launch.useDefaultDataLocation" value="true"/>
+<booleanAttribute key="org.eclipse.rap.launch.useManualContextPath" value="false"/>
+<booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/>
+<booleanAttribute key="org.eclipse.rap.launch.useSessionTimeout" value="false"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<stringAttribute key="workspace_bundles" value="org.eclipse.rap.jettycustomizer@default:false,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.visualization.jit.demo@default:default,org.eclipse.rap.rwt.visualization.jit@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.views@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/plugin.xml b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/plugin.xml index d5c3a83..7c36ad0 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/plugin.xml +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/plugin.xml @@ -6,8 +6,8 @@ point="org.eclipse.rap.ui.entrypoint"> <entrypoint class="org.eclipse.rap.rwt.visualization.jit.demo.Application" - parameter="jit" - id="visualization.jit.Application"> + id="visualization.jit.Application" + path="/jit"> </entrypoint> </extension> <extension @@ -15,7 +15,6 @@ <branding defaultEntrypointId="visualization.jit.Application" id="visualization.jit.branding" - servletName="visualization" title="JIT Visualizations Demo"> </branding> </extension> @@ -53,6 +52,18 @@ name="Space Tree" restorable="true"> </view> + <view + class="org.eclipse.rap.rwt.visualization.jit.demo.Application$BarChartExample" + id="org.eclipse.rap.rwt.visualization.jit.demo.Application$BarChartExample" + name="Bar Chart" + restorable="true"> + </view> + <view + class="org.eclipse.rap.rwt.visualization.jit.demo.Application$AreaChartExample" + id="org.eclipse.rap.rwt.visualization.jit.demo.Application$AreaChartExample" + name="Area Chart" + restorable="true"> + </view> </extension> <extension point="org.eclipse.ui.perspectiveExtensions"> @@ -102,6 +113,28 @@ showTitle="true" visible="true"> </view> + <view + closeable="true" + id="org.eclipse.rap.rwt.visualization.jit.demo.Application$BarChartExample" + minimized="false" + moveable="true" + ratio="0.5" + relationship="stack" + relative="org.eclipse.rap.rwt.visualization.jit.demo.Application$SpaceTreeExample" + showTitle="true" + visible="true"> + </view> + <view + closeable="true" + id="org.eclipse.rap.rwt.visualization.jit.demo.Application$AreaChartExample" + minimized="false" + moveable="true" + ratio="0.5" + relationship="stack" + relative="org.eclipse.rap.rwt.visualization.jit.demo.Application$BarChartExample" + showTitle="true" + visible="true"> + </view> </perspectiveExtension> </extension> </plugin> diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/areachart.json b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/areachart.json new file mode 100644 index 0000000..67003b1 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/areachart.json @@ -0,0 +1,29 @@ +{
+ 'label': ['label A', 'label B', 'label C', 'label D'],
+ 'values': [
+ {
+ 'label': 'date A',
+ 'values': [20, 40, 15, 5]
+ },
+ {
+ 'label': 'date B',
+ 'values': [30, 10, 45, 10]
+ },
+ {
+ 'label': 'date E',
+ 'values': [38, 20, 35, 17]
+ },
+ {
+ 'label': 'date F',
+ 'values': [58, 10, 35, 32]
+ },
+ {
+ 'label': 'date D',
+ 'values': [55, 60, 34, 38]
+ },
+ {
+ 'label': 'date C',
+ 'values': [26, 40, 25, 40]
+ }]
+
+}
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/barchart.json b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/barchart.json new file mode 100644 index 0000000..67003b1 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/barchart.json @@ -0,0 +1,29 @@ +{
+ 'label': ['label A', 'label B', 'label C', 'label D'],
+ 'values': [
+ {
+ 'label': 'date A',
+ 'values': [20, 40, 15, 5]
+ },
+ {
+ 'label': 'date B',
+ 'values': [30, 10, 45, 10]
+ },
+ {
+ 'label': 'date E',
+ 'values': [38, 20, 35, 17]
+ },
+ {
+ 'label': 'date F',
+ 'values': [58, 10, 35, 32]
+ },
+ {
+ 'label': 'date D',
+ 'values': [55, 60, 34, 38]
+ },
+ {
+ 'label': 'date C',
+ 'values': [26, 40, 25, 40]
+ }]
+
+}
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/treemap.json b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/treemap.json index 90196d7..df577a1 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/treemap.json +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/samples/treemap.json @@ -1,530 +1,857 @@ { - "children" : [ { "children" : [ { "children" : [ ], - "data" : { "$area" : "80", - "$color" : "30", - "image" : "http://images.amazon.com/images/P/B0007DAZW8.01.MZZZZZZZ.jpg" - }, - "id" : "056e4f3e-d505-4dad-8ec1-d04f521cbb56Human After All", - "name" : "Human After All" - } ], - "data" : { "$area" : 80 }, - "id" : "056e4f3e-d505-4dad-8ec1-d04f521cbb56a", - "name" : "Daft Punk" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "94", - "$color" : "23", - "image" : "http://cdn.last.fm/coverart/130x130/2393956.jpg" - }, - "id" : "f2fa5cf6-e0b0-4559-8641-e033f1a9e6fcClearing the Channel", - "name" : "Clearing the Channel" - } ], - "data" : { "$area" : 94 }, - "id" : "f2fa5cf6-e0b0-4559-8641-e033f1a9e6fca", - "name" : "Sinch" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "211", - "$color" : "2", - "image" : "http://cdn.last.fm/coverart/130x130/2564320-1193176651.jpg" - }, - "id" : "4bd95eea-b9f6-4d70-a36c-cfea77431553Music Bank", - "name" : "Music Bank" - } ], - "data" : { "$area" : 211 }, - "id" : "4bd95eea-b9f6-4d70-a36c-cfea77431553a", - "name" : "Alice in Chains" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "153", - "$color" : "6", - "image" : "http://userserve-ak.last.fm/serve/174s/8590493.jpg" - }, - "id" : "8bfac288-ccc5-448d-9573-c33ea2aa5c30One Hot Minute", - "name" : "One Hot Minute" - }, - { "children" : [ ], - "data" : { "$area" : "69", - "$color" : "35", - "image" : "http://userserve-ak.last.fm/serve/174s/8593509.jpg" - }, - "id" : "8bfac288-ccc5-448d-9573-c33ea2aa5c30Californication", - "name" : "Californication" - }, - { "children" : [ ], - "data" : { "$area" : "69", - "$color" : "35", - "image" : "http://userserve-ak.last.fm/serve/174s/8672727.jpg" - }, - "id" : "8bfac288-ccc5-448d-9573-c33ea2aa5c30Greatest Hits", - "name" : "Greatest Hits" - } - ], - "data" : { "$area" : 291 }, - "id" : "8bfac288-ccc5-448d-9573-c33ea2aa5c30a", - "name" : "Red Hot Chili Peppers" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "114", - "$color" : "15", - "image" : "http://images.amazon.com/images/P/B0000UX5IY.01._SCMZZZZZZZ_.jpg" - }, - "id" : "ff6e677f-91dd-4986-a174-8db0474b1799Thicker Than Water", - "name" : "Thicker Than Water" - }, - { "children" : [ ], - "data" : { "$area" : "83", - "$color" : "28", - "image" : "http://userserve-ak.last.fm/serve/174s/8599099.jpg" - }, - "id" : "ff6e677f-91dd-4986-a174-8db0474b1799On and On", - "name" : "On and On" - }, - { "children" : [ ], - "data" : { "$area" : "62", - "$color" : "41", - "image" : "http://userserve-ak.last.fm/serve/174s/8664981.jpg" - }, - "id" : "ff6e677f-91dd-4986-a174-8db0474b1799Brushfire Fairytales", - "name" : "Brushfire Fairytales" - } - ], - "data" : { "$area" : 259 }, - "id" : "ff6e677f-91dd-4986-a174-8db0474b1799a", - "name" : "Jack Johnson" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "65", - "$color" : "38", - "image" : "http://userserve-ak.last.fm/serve/174s/23727633.jpg" - }, - "id" : "83b9cbe7-9857-49e2-ab8e-b57b01038103Vs.", - "name" : "Vs." - }, - { "children" : [ ], - "data" : { "$area" : "61", - "$color" : "44", - "image" : "http://userserve-ak.last.fm/serve/174s/19611679.jpg" - }, - "id" : "83b9cbe7-9857-49e2-ab8e-b57b01038103Riot Act", - "name" : "Riot Act" - }, - { "children" : [ ], - "data" : { "$area" : "61", - "$color" : "44", - "image" : "http://userserve-ak.last.fm/serve/174s/17492447.jpg" - }, - "id" : "83b9cbe7-9857-49e2-ab8e-b57b01038103Yield", - "name" : "Yield" - } - ], - "data" : { "$area" : 187 }, - "id" : "83b9cbe7-9857-49e2-ab8e-b57b01038103a", - "name" : "Pearl Jam" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "115", - "$color" : "14", - "image" : "http://userserve-ak.last.fm/serve/174s/17484209.jpg" - }, - "id" : "bfd085b8-0bbf-46b3-8ab9-193bca5c85e7Above", - "name" : "Above" - } ], - "data" : { "$area" : 115 }, - "id" : "bfd085b8-0bbf-46b3-8ab9-193bca5c85e7a", - "name" : "Mad Season" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "108", - "$color" : "17", - "image" : "http://images.amazon.com/images/P/B000002J8M.01._SCMZZZZZZZ_.jpg" - }, - "id" : "8c32bb01-58a3-453b-8050-8c0620edb0e5Tiny Music... Songs From the Vatican Gift Shop", - "name" : "Tiny Music... Songs From the Vatican Gift Shop" - }, - { "children" : [ ], - "data" : { "$area" : "60", - "$color" : "46", - "image" : "http://images.amazon.com/images/P/B000002IU3.01.MZZZZZZZ.jpg" - }, - "id" : "8c32bb01-58a3-453b-8050-8c0620edb0e5Core", - "name" : "Core" - } - ], - "data" : { "$area" : 168 }, - "id" : "8c32bb01-58a3-453b-8050-8c0620edb0e5a", - "name" : "Stone Temple Pilots" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "63", - "$color" : "40", - "image" : "http://images.amazon.com/images/P/B00005NWLC.01.MZZZZZZZ.jpg" - }, - "id" : "7b2f87f6-db90-464e-a27a-deb4f7219e90Leitmotif", - "name" : "Leitmotif" - } ], - "data" : { "$area" : 63 }, - "id" : "7b2f87f6-db90-464e-a27a-deb4f7219e90a", - "name" : "dredg" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "188", - "$color" : "3", - "image" : "http://images.amazon.com/images/P/B000EULJLU.01._SCMZZZZZZZ_.jpg" - }, - "id" : "66fc5bf8-daa4-4241-b378-9bc9077939d210,000 Days", - "name" : "10,000 Days" - } ], - "data" : { "$area" : 188 }, - "id" : "66fc5bf8-daa4-4241-b378-9bc9077939d2a", - "name" : "Tool" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "62", - "$color" : "41", - "image" : "http://images.amazon.com/images/P/B00001P4TH.01._SCMZZZZZZZ_.jpg" - }, - "id" : "b7ffd2af-418f-4be2-bdd1-22f8b48613daThe Fragile (Left)", - "name" : "The Fragile (Left)" - } ], - "data" : { "$area" : 62 }, - "id" : "b7ffd2af-418f-4be2-bdd1-22f8b48613daa", - "name" : "Nine Inch Nails" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "240", - "$color" : "1", - "image" : "http://userserve-ak.last.fm/serve/174s/21881921.jpg" - }, - "id" : "a5585acd-9b65-49a7-a63b-3cc4ee18846eMother Love Bone", - "name" : "Mother Love Bone" - } ], - "data" : { "$area" : 240 }, - "id" : "a5585acd-9b65-49a7-a63b-3cc4ee18846ea", - "name" : "Mother Love Bone" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "67", - "$color" : "37", - "image" : "http://userserve-ak.last.fm/serve/174s/8634595.jpg" - }, - "id" : "7527f6c2-d762-4b88-b5e2-9244f1e34c46Around the Fur", - "name" : "Around the Fur" - } ], - "data" : { "$area" : 67 }, - "id" : "7527f6c2-d762-4b88-b5e2-9244f1e34c46a", - "name" : "Deftones" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "62", - "$color" : "41", - "image" : "http://images.amazon.com/images/P/B0000A5BYD.03.MZZZZZZZ.jpg" - }, - "id" : "7bdb6921-8380-422c-8514-87cf30d5d8ccIt All Makes Sense Now", - "name" : "It All Makes Sense Now" - } ], - "data" : { "$area" : 62 }, - "id" : "7bdb6921-8380-422c-8514-87cf30d5d8cca", - "name" : "Kr�m" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "57", - "$color" : "48", - "image" : "http://images-eu.amazon.com/images/P/B00005IABM.02.MZZZZZZZ.jpg" - }, - "id" : "cb67438a-7f50-4f2b-a6f1-2bb2729fd53810,000 Hz Legend", - "name" : "10,000 Hz Legend" - } ], - "data" : { "$area" : 57 }, - "id" : "cb67438a-7f50-4f2b-a6f1-2bb2729fd538a", - "name" : "Air" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "168", - "$color" : "5", - "image" : "http://userserve-ak.last.fm/serve/174s/23091681.jpg" - }, - "id" : "c5998351-be49-49d8-8593-3e96f129c1fcMamagubida", - "name" : "Mamagubida" - }, - { "children" : [ ], - "data" : { "$area" : "141", - "$color" : "7", - "image" : "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_mega.png" - }, - "id" : "c5998351-be49-49d8-8593-3e96f129c1fcReggae � Coup de Cirque", - "name" : "Reggae � Coup de Cirque" - }, - { "children" : [ ], - "data" : { "$area" : "135", - "$color" : "8", - "image" : "http://userserve-ak.last.fm/serve/174s/16799743.jpg" - }, - "id" : "c5998351-be49-49d8-8593-3e96f129c1fcGrain de sable", - "name" : "Grain de sable" - }, - { "children" : [ ], - "data" : { "$area" : "80", - "$color" : "30", - "image" : "http://userserve-ak.last.fm/serve/174s/8635653.jpg" - }, - "id" : "c5998351-be49-49d8-8593-3e96f129c1fcFaut qu'ils s'activent...", - "name" : "Faut qu'ils s'activent..." - } - ], - "data" : { "$area" : 524 }, - "id" : "c5998351-be49-49d8-8593-3e96f129c1fca", - "name" : "Tryo" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "57", - "$color" : "48", - "image" : "http://userserve-ak.last.fm/serve/174s/8634627.jpg" - }, - "id" : "4bb4e4e4-5f66-4509-98af-62dbb90c45c5The Sickness", - "name" : "The Sickness" - } ], - "data" : { "$area" : 57 }, - "id" : "4bb4e4e4-5f66-4509-98af-62dbb90c45c5a", - "name" : "Disturbed" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "72", - "$color" : "34", - "image" : "http://userserve-ak.last.fm/serve/174s/8673813.jpg" - }, - "id" : "95f5b748-d370-47fe-85bd-0af2dc450bc0Second-Hand Smoke", - "name" : "Second-Hand Smoke" - } ], - "data" : { "$area" : 72 }, - "id" : "95f5b748-d370-47fe-85bd-0af2dc450bc0a", - "name" : "Sublime" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "73", - "$color" : "33", - "image" : "http://userserve-ak.last.fm/serve/174s/7737695.jpg" - }, - "id" : "020bfbb4-05c3-4c86-b372-17825c262094Audioslave", - "name" : "Audioslave" - } ], - "data" : { "$area" : 73 }, - "id" : "020bfbb4-05c3-4c86-b372-17825c262094a", - "name" : "Audioslave" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "124", - "$color" : "10", - "image" : "http://userserve-ak.last.fm/serve/174s/8605651.jpg" - }, - "id" : "e9571c17-817f-4d34-ae3f-0c7a96f822c1Temple of the Dog", - "name" : "Temple of the Dog" - } ], - "data" : { "$area" : 124 }, - "id" : "e9571c17-817f-4d34-ae3f-0c7a96f822c1a", - "name" : "Temple of the Dog" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "82", - "$color" : "29", - "image" : "http://images.amazon.com/images/P/B0002ZEUKO.01._SCMZZZZZZZ_.jpg" - }, - "id" : "06fb1c8b-566e-4cb2-985b-b467c90781d4Are You Experienced?", - "name" : "Are You Experienced?" - }, - { "children" : [ ], - "data" : { "$area" : "64", - "$color" : "39", - "image" : "http://userserve-ak.last.fm/serve/174s/8729219.jpg" - }, - "id" : "06fb1c8b-566e-4cb2-985b-b467c90781d4First Rays of the New Rising Sun", - "name" : "First Rays of the New Rising Sun" - } - ], - "data" : { "$area" : 146 }, - "id" : "06fb1c8b-566e-4cb2-985b-b467c90781d4a", - "name" : "Jimi Hendrix" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "56", - "$color" : "50", - "image" : "http://images.amazon.com/images/P/B0000DZDYN.01.MZZZZZZZ.jpg" - }, - "id" : "fbd2a255-1d57-4d31-ac11-65b671c19958The Singles 1992-2003", - "name" : "The Singles 1992-2003" - } ], - "data" : { "$area" : 56 }, - "id" : "fbd2a255-1d57-4d31-ac11-65b671c19958a", - "name" : "No Doubt" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "123", - "$color" : "11", - "image" : "http://userserve-ak.last.fm/serve/174s/11393921.jpg" - }, - "id" : "078a9376-3c04-4280-b7d7-b20e158f345dMer de Noms", - "name" : "Mer de Noms" - }, - { "children" : [ ], - "data" : { "$area" : "93", - "$color" : "24", - "image" : "http://userserve-ak.last.fm/serve/174s/11403219.jpg" - }, - "id" : "078a9376-3c04-4280-b7d7-b20e158f345dThirteenth Step", - "name" : "Thirteenth Step" - } - ], - "data" : { "$area" : 216 }, - "id" : "078a9376-3c04-4280-b7d7-b20e158f345da", - "name" : "A Perfect Circle" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "109", - "$color" : "16", - "image" : "http://images.amazon.com/images/P/B00005LNP5.01._SCMZZZZZZZ_.jpg" - }, - "id" : "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fElija y Gane", - "name" : "Elija y Gane" - }, - { "children" : [ ], - "data" : { "$area" : "85", - "$color" : "26", - "image" : "http://images.amazon.com/images/P/B0000B193V.01._SCMZZZZZZZ_.jpg" - }, - "id" : "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fPara los Arboles", - "name" : "Para los Arboles" - } - ], - "data" : { "$area" : 194 }, - "id" : "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fa", - "name" : "Luis Alberto Spinetta" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "87", - "$color" : "25", - "image" : "http://userserve-ak.last.fm/serve/174s/8772827.jpg" - }, - "id" : "e795e03d-b5d5-4a5f-834d-162cfb308a2c4-Track Demos", - "name" : "4-Track Demos" - }, - { "children" : [ ], - "data" : { "$area" : "77", - "$color" : "32", - "image" : "http://userserve-ak.last.fm/serve/174s/9929071.jpg" - }, - "id" : "e795e03d-b5d5-4a5f-834d-162cfb308a2cRid of Me", - "name" : "Rid of Me" - } - ], - "data" : { "$area" : 164 }, - "id" : "e795e03d-b5d5-4a5f-834d-162cfb308a2ca", - "name" : "PJ Harvey" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "102", - "$color" : "19", - "image" : "http://userserve-ak.last.fm/serve/174s/7410551.jpg" - }, - "id" : "e3e0abcd-7671-4482-a9d8-462f5acc9be5Make Yourself", - "name" : "Make Yourself" - }, - { "children" : [ ], - "data" : { "$area" : "84", - "$color" : "27", - "image" : "http://images.amazon.com/images/P/B00018D5CQ.01._SCMZZZZZZZ_.jpg" - }, - "id" : "e3e0abcd-7671-4482-a9d8-462f5acc9be5A Crow Left of the Murder", - "name" : "A Crow Left of the Murder" - }, - { "children" : [ ], - "data" : { "$area" : "60", - "$color" : "46", - "image" : "http://userserve-ak.last.fm/serve/174s/19681051.jpg" - }, - "id" : "e3e0abcd-7671-4482-a9d8-462f5acc9be5Morning View", - "name" : "Morning View" - } - ], - "data" : { "$area" : 246 }, - "id" : "e3e0abcd-7671-4482-a9d8-462f5acc9be5a", - "name" : "Incubus" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "130", - "$color" : "9", - "image" : "http://userserve-ak.last.fm/serve/174s/15113951.jpg" - }, - "id" : "38c5cdab-5d6d-43d1-85b0-dac41bde186eNico", - "name" : "Nico" - }, - { "children" : [ ], - "data" : { "$area" : "120", - "$color" : "12", - "image" : "http://images.amazon.com/images/P/B00005V5PW.01.MZZZZZZZ.jpg" - }, - "id" : "38c5cdab-5d6d-43d1-85b0-dac41bde186eClassic Masters", - "name" : "Classic Masters" - }, - { "children" : [ ], - "data" : { "$area" : "103", - "$color" : "18", - "image" : "http://images.amazon.com/images/P/B000002TPF.01.MZZZZZZZ.jpg" - }, - "id" : "38c5cdab-5d6d-43d1-85b0-dac41bde186eSoup", - "name" : "Soup" - }, - { "children" : [ ], - "data" : { "$area" : "99", - "$color" : "20", - "image" : "http://userserve-ak.last.fm/serve/174s/15157989.jpg" - }, - "id" : "38c5cdab-5d6d-43d1-85b0-dac41bde186eBlind Melon", - "name" : "Blind Melon" - } - ], - "data" : { "$area" : 452 }, - "id" : "38c5cdab-5d6d-43d1-85b0-dac41bde186ea", - "name" : "Blind Melon" - }, - { "children" : [ { "children" : [ ], - "data" : { "$area" : "173", - "$color" : "4", - "image" : "http://userserve-ak.last.fm/serve/174s/8590515.jpg" - }, - "id" : "153c9281-268f-4cf3-8938-f5a4593e5df4Superunknown", - "name" : "Superunknown" - }, - { "children" : [ ], - "data" : { "$area" : "117", - "$color" : "13", - "image" : "http://userserve-ak.last.fm/serve/174s/5269310.jpg" - }, - "id" : "153c9281-268f-4cf3-8938-f5a4593e5df4Louder Than Love", - "name" : "Louder Than Love" - }, - { "children" : [ ], - "data" : { "$area" : "96", - "$color" : "21", - "image" : "http://userserve-ak.last.fm/serve/174s/8600371.jpg" - }, - "id" : "153c9281-268f-4cf3-8938-f5a4593e5df4Down on the Upside", - "name" : "Down on the Upside" - }, - { "children" : [ ], - "data" : { "$area" : "95", - "$color" : "22", - "image" : "http://images.amazon.com/images/P/B000000M4A.01.MZZZZZZZ.jpg" - }, - "id" : "153c9281-268f-4cf3-8938-f5a4593e5df4Ultramega OK", - "name" : "Ultramega OK" - } - ], - "data" : { "$area" : 481 }, - "id" : "153c9281-268f-4cf3-8938-f5a4593e5df4a", - "name" : "Soundgarden" - } - ], - "data" : { "$area" : 4949 }, - "id" : "topAlbums", - "name" : "top albums" +"children": [ + { + "children": [ + { + "children": [], + "data": { + "playcount": "276", + "$color": "#8E7032", + "image": "http://userserve-ak.last.fm/serve/300x300/11403219.jpg", + "$area": 276 + }, + "id": "album-Thirteenth Step", + "name": "Thirteenth Step" + }, + { + "children": [], + "data": { + "playcount": "271", + "$color": "#906E32", + "image": "http://userserve-ak.last.fm/serve/300x300/11393921.jpg", + "$area": 271 + }, + "id": "album-Mer De Noms", + "name": "Mer De Noms" + } + ], + "data": { + "playcount": 547, + "$area": 547 + }, + "id": "artist_A Perfect Circle", + "name": "A Perfect Circle" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "209", + "$color": "#AA5532", + "image": "http://userserve-ak.last.fm/serve/300x300/32349839.jpg", + "$area": 209 + }, + "id": "album-Above", + "name": "Above" + } + ], + "data": { + "playcount": 209, + "$area": 209 + }, + "id": "artist_Mad Season", + "name": "Mad Season" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "260", + "$color": "#956932", + "image": "http://userserve-ak.last.fm/serve/300x300/38753425.jpg", + "$area": 260 + }, + "id": "album-Tiny Music... Songs From the Vatican Gift Shop", + "name": "Tiny Music... Songs From the Vatican Gift Shop" + }, + { + "children": [], + "data": { + "playcount": "254", + "$color": "#976732", + "image": "http://images.amazon.com/images/P/B000002IU3.01.LZZZZZZZ.jpg", + "$area": 254 + }, + "id": "album-Core", + "name": "Core" + } + ], + "data": { + "playcount": 514, + "$area": 514 + }, + "id": "artist_Stone Temple Pilots", + "name": "Stone Temple Pilots" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "181", + "$color": "#B54932", + "image": "http://userserve-ak.last.fm/serve/300x300/8673371.jpg", + "$area": 181 + }, + "id": "album-The Science of Things", + "name": "The Science of Things" + } + ], + "data": { + "playcount": 181, + "$area": 181 + }, + "id": "artist_Bush", + "name": "Bush" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "229", + "$color": "#A15D32", + "image": "http://userserve-ak.last.fm/serve/300x300/32579429.jpg", + "$area": 229 + }, + "id": "album-Echoes, Silence, Patience & Grace", + "name": "Echoes, Silence, Patience & Grace" + }, + { + "children": [], + "data": { + "playcount": "185", + "$color": "#B34B32", + "image": "http://images.amazon.com/images/P/B0009HLDFU.01.MZZZZZZZ.jpg", + "$area": 185 + }, + "id": "album-In Your Honor (disc 2)", + "name": "In Your Honor (disc 2)" + } + ], + "data": { + "playcount": 414, + "$area": 414 + }, + "id": "artist_Foo Fighters", + "name": "Foo Fighters" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "398", + "$color": "#5DA132", + "image": "http://images.amazon.com/images/P/B00005LNP5.01._SCMZZZZZZZ_.jpg", + "$area": 398 + }, + "id": "album-Elija Y Gane", + "name": "Elija Y Gane" + }, + { + "children": [], + "data": { + "playcount": "203", + "$color": "#AC5232", + "image": "http://images.amazon.com/images/P/B0000B193V.01._SCMZZZZZZZ_.jpg", + "$area": 203 + }, + "id": "album-Para los Arboles", + "name": "Para los Arboles" + } + ], + "data": { + "playcount": 601, + "$area": 601 + }, + "id": "artist_Luis Alberto Spinetta", + "name": "Luis Alberto Spinetta" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "224", + "$color": "#A35B32", + "image": "http://userserve-ak.last.fm/serve/300x300/26497553.jpg", + "$area": 224 + }, + "id": "album-Music Bank", + "name": "Music Bank" + }, + { + "children": [], + "data": { + "playcount": "217", + "$color": "#A65832", + "image": "http://images.amazon.com/images/P/B0000296JW.01.MZZZZZZZ.jpg", + "$area": 217 + }, + "id": "album-Music Bank (disc 1)", + "name": "Music Bank (disc 1)" + }, + { + "children": [], + "data": { + "playcount": "215", + "$color": "#A75732", + "image": "http://images.amazon.com/images/P/B0000296JW.01.MZZZZZZZ.jpg", + "$area": 215 + }, + "id": "album-Music Bank (disc 2)", + "name": "Music Bank (disc 2)" + }, + { + "children": [], + "data": { + "playcount": "181", + "$color": "#B54932", + "image": "http://images.amazon.com/images/P/B0000296JW.01.MZZZZZZZ.jpg", + "$area": 181 + }, + "id": "album-Music Bank (disc 3)", + "name": "Music Bank (disc 3)" + } + ], + "data": { + "playcount": 837, + "$area": 837 + }, + "id": "artist_Alice in Chains", + "name": "Alice in Chains" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "627", + "$color": "#00FF32", + "image": "http://userserve-ak.last.fm/serve/300x300/8480501.jpg", + "$area": 627 + }, + "id": "album-10,000 Days", + "name": "10,000 Days" + } + ], + "data": { + "playcount": 627, + "$area": 627 + }, + "id": "artist_Tool", + "name": "Tool" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "261", + "$color": "#946A32", + "image": "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_medium.png", + "$area": 261 + }, + "id": "album-2006-09-07: O-Bar, Stockholm, Sweden", + "name": "2006-09-07: O-Bar, Stockholm, Sweden" + }, + { + "children": [], + "data": { + "playcount": "211", + "$color": "#A95532", + "image": "http://userserve-ak.last.fm/serve/300x300/25402479.jpg", + "$area": 211 + }, + "id": "album-Lost and Found", + "name": "Lost and Found" + } + ], + "data": { + "playcount": 472, + "$area": 472 + }, + "id": "artist_Chris Cornell", + "name": "Chris Cornell" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "197", + "$color": "#AE5032", + "image": "http://userserve-ak.last.fm/serve/300x300/8634627.jpg", + "$area": 197 + }, + "id": "album-The Sickness", + "name": "The Sickness" + } + ], + "data": { + "playcount": 197, + "$area": 197 + }, + "id": "artist_Disturbed", + "name": "Disturbed" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "493", + "$color": "#36C832", + "image": "http://userserve-ak.last.fm/serve/300x300/8591345.jpg", + "$area": 493 + }, + "id": "album-Mama's Gun", + "name": "Mama's Gun" + } + ], + "data": { + "playcount": 493, + "$area": 493 + }, + "id": "artist_Erykah Badu", + "name": "Erykah Badu" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "249", + "$color": "#996532", + "image": "http://userserve-ak.last.fm/serve/300x300/32070871.jpg", + "$area": 249 + }, + "id": "album-Audioslave", + "name": "Audioslave" + } + ], + "data": { + "playcount": 249, + "$area": 249 + }, + "id": "artist_Audioslave", + "name": "Audioslave" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "359", + "$color": "#6C9232", + "image": "http://userserve-ak.last.fm/serve/300x300/15858421.jpg", + "$area": 359 + }, + "id": "album-Comfort y M\u00fasica Para Volar", + "name": "Comfort y M\u00fasica Para Volar" + } + ], + "data": { + "playcount": 359, + "$area": 359 + }, + "id": "artist_Soda Stereo", + "name": "Soda Stereo" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "302", + "$color": "#847A32", + "image": "http://userserve-ak.last.fm/serve/300x300/8776205.jpg", + "$area": 302 + }, + "id": "album-Clearing the Channel", + "name": "Clearing the Channel" + } + ], + "data": { + "playcount": 302, + "$area": 302 + }, + "id": "artist_Sinch", + "name": "Sinch" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "177", + "$color": "#B74732", + "image": "http://userserve-ak.last.fm/serve/300x300/32457599.jpg", + "$area": 177 + }, + "id": "album-Crash", + "name": "Crash" + } + ], + "data": { + "playcount": 177, + "$area": 177 + }, + "id": "artist_Dave Matthews Band", + "name": "Dave Matthews Band" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "207", + "$color": "#AA5432", + "image": "http://userserve-ak.last.fm/serve/300x300/30352203.jpg", + "$area": 207 + }, + "id": "album-Vs.", + "name": "Vs." + } + ], + "data": { + "playcount": 207, + "$area": 207 + }, + "id": "artist_Pearl Jam", + "name": "Pearl Jam" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "486", + "$color": "#39C532", + "image": "http://userserve-ak.last.fm/serve/300x300/26053425.jpg", + "$area": 486 + }, + "id": "album-It All Makes Sense Now", + "name": "It All Makes Sense Now" + }, + { + "children": [], + "data": { + "playcount": "251", + "$color": "#986632", + "image": "http://userserve-ak.last.fm/serve/300x300/9658733.jpg", + "$area": 251 + }, + "id": "album-Air", + "name": "Air" + } + ], + "data": { + "playcount": 737, + "$area": 737 + }, + "id": "artist_Kr\u00f8m", + "name": "Kr\u00f8m" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "345", + "$color": "#728C32", + "image": "http://userserve-ak.last.fm/serve/300x300/8605651.jpg", + "$area": 345 + }, + "id": "album-Temple Of The Dog", + "name": "Temple Of The Dog" + } + ], + "data": { + "playcount": 345, + "$area": 345 + }, + "id": "artist_Temple of the Dog", + "name": "Temple of the Dog" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "318", + "$color": "#7D8132", + "image": "http://userserve-ak.last.fm/serve/300x300/29274729.jpg", + "$area": 318 + }, + "id": "album-And All That Could Have Been (Still)", + "name": "And All That Could Have Been (Still)" + } + ], + "data": { + "playcount": 318, + "$area": 318 + }, + "id": "artist_Nine Inch Nails", + "name": "Nine Inch Nails" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "256", + "$color": "#966832", + "image": "http://userserve-ak.last.fm/serve/300x300/32595059.jpg", + "$area": 256 + }, + "id": "album-Mamagubida", + "name": "Mamagubida" + }, + { + "children": [], + "data": { + "playcount": "220", + "$color": "#A55932", + "image": "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_medium.png", + "$area": 220 + }, + "id": "album-Reggae \u00e0 Coup de Cirque", + "name": "Reggae \u00e0 Coup de Cirque" + }, + { + "children": [], + "data": { + "playcount": "181", + "$color": "#B54932", + "image": "http://userserve-ak.last.fm/serve/300x300/16799743.jpg", + "$area": 181 + }, + "id": "album-Grain de sable", + "name": "Grain de sable" + } + ], + "data": { + "playcount": 657, + "$area": 657 + }, + "id": "artist_Tryo", + "name": "Tryo" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "258", + "$color": "#966832", + "image": "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_medium.png", + "$area": 258 + }, + "id": "album-Best Of", + "name": "Best Of" + }, + { + "children": [], + "data": { + "playcount": "176", + "$color": "#B74732", + "image": "http://userserve-ak.last.fm/serve/300x300/5264426.jpg", + "$area": 176 + }, + "id": "album-Robbin' The Hood", + "name": "Robbin' The Hood" + } + ], + "data": { + "playcount": 434, + "$area": 434 + }, + "id": "artist_Sublime", + "name": "Sublime" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "418", + "$color": "#55AA32", + "image": "http://userserve-ak.last.fm/serve/300x300/8590493.jpg", + "$area": 418 + }, + "id": "album-One Hot Minute", + "name": "One Hot Minute" + } + ], + "data": { + "playcount": 418, + "$area": 418 + }, + "id": "artist_Red Hot Chili Peppers", + "name": "Red Hot Chili Peppers" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "275", + "$color": "#8F6F32", + "image": "http://userserve-ak.last.fm/serve/300x300/17597653.jpg", + "$area": 275 + }, + "id": "album-Chinese Democracy", + "name": "Chinese Democracy" + }, + { + "children": [], + "data": { + "playcount": "203", + "$color": "#AC5232", + "image": "http://userserve-ak.last.fm/serve/300x300/15231979.jpg", + "$area": 203 + }, + "id": "album-Use Your Illusion II", + "name": "Use Your Illusion II" + } + ], + "data": { + "playcount": 478, + "$area": 478 + }, + "id": "artist_Guns N' Roses", + "name": "Guns N' Roses" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "208", + "$color": "#AA5432", + "image": "http://images.amazon.com/images/P/B0007LCNNE.01.MZZZZZZZ.jpg", + "$area": 208 + }, + "id": "album-Tales of the Forgotten Melodies", + "name": "Tales of the Forgotten Melodies" + } + ], + "data": { + "playcount": 208, + "$area": 208 + }, + "id": "artist_Wax Tailor", + "name": "Wax Tailor" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "208", + "$color": "#AA5432", + "image": "http://userserve-ak.last.fm/serve/300x300/7862623.png", + "$area": 208 + }, + "id": "album-In Rainbows", + "name": "In Rainbows" + } + ], + "data": { + "playcount": 208, + "$area": 208 + }, + "id": "artist_Radiohead", + "name": "Radiohead" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "317", + "$color": "#7E8032", + "image": "http://userserve-ak.last.fm/serve/300x300/8600371.jpg", + "$area": 317 + }, + "id": "album-Down On The Upside", + "name": "Down On The Upside" + }, + { + "children": [], + "data": { + "playcount": "290", + "$color": "#897532", + "image": "http://userserve-ak.last.fm/serve/300x300/8590515.jpg", + "$area": 290 + }, + "id": "album-Superunknown", + "name": "Superunknown" + } + ], + "data": { + "playcount": 607, + "$area": 607 + }, + "id": "artist_Soundgarden", + "name": "Soundgarden" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "247", + "$color": "#9A6432", + "image": "http://userserve-ak.last.fm/serve/300x300/15113951.jpg", + "$area": 247 + }, + "id": "album-Nico", + "name": "Nico" + }, + { + "children": [], + "data": { + "playcount": "218", + "$color": "#A65832", + "image": "http://userserve-ak.last.fm/serve/300x300/45729417.jpg", + "$area": 218 + }, + "id": "album-Soup", + "name": "Soup" + }, + { + "children": [], + "data": { + "playcount": "197", + "$color": "#AE5032", + "image": "http://images.amazon.com/images/P/B00005V5PW.01.MZZZZZZZ.jpg", + "$area": 197 + }, + "id": "album-Classic Masters", + "name": "Classic Masters" + }, + { + "children": [], + "data": { + "playcount": "194", + "$color": "#B04E32", + "image": "http://userserve-ak.last.fm/serve/300x300/15157989.jpg", + "$area": 194 + }, + "id": "album-Blind Melon", + "name": "Blind Melon" + } + ], + "data": { + "playcount": 856, + "$area": 856 + }, + "id": "artist_Blind Melon", + "name": "Blind Melon" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "537", + "$color": "#24DA32", + "image": "http://userserve-ak.last.fm/serve/300x300/17594883.jpg", + "$area": 537 + }, + "id": "album-Make Yourself", + "name": "Make Yourself" + }, + { + "children": [], + "data": { + "playcount": "258", + "$color": "#966832", + "image": "http://userserve-ak.last.fm/serve/300x300/31550385.jpg", + "$area": 258 + }, + "id": "album-Light Grenades", + "name": "Light Grenades" + }, + { + "children": [], + "data": { + "playcount": "181", + "$color": "#B54932", + "image": "http://userserve-ak.last.fm/serve/300x300/32309285.jpg", + "$area": 181 + }, + "id": "album-Morning View", + "name": "Morning View" + } + ], + "data": { + "playcount": 976, + "$area": 976 + }, + "id": "artist_Incubus", + "name": "Incubus" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "198", + "$color": "#AE5032", + "image": "http://userserve-ak.last.fm/serve/300x300/8599099.jpg", + "$area": 198 + }, + "id": "album-On And On", + "name": "On And On" + }, + { + "children": [], + "data": { + "playcount": "186", + "$color": "#B34B32", + "image": "http://userserve-ak.last.fm/serve/300x300/30082075.jpg", + "$area": 186 + }, + "id": "album-Brushfire Fairytales", + "name": "Brushfire Fairytales" + } + ], + "data": { + "playcount": 384, + "$area": 384 + }, + "id": "artist_Jack Johnson", + "name": "Jack Johnson" + }, + { + "children": [ + { + "children": [], + "data": { + "playcount": "349", + "$color": "#718D32", + "image": "http://userserve-ak.last.fm/serve/300x300/21881921.jpg", + "$area": 349 + }, + "id": "album-Mother Love Bone", + "name": "Mother Love Bone" + } + ], + "data": { + "playcount": 349, + "$area": 349 + }, + "id": "artist_Mother Love Bone", + "name": "Mother Love Bone" + } + ], + "data": {}, + "id": "root", + "name": "Top Albums" }
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/src/org/eclipse/rap/rwt/visualization/jit/demo/Application.java b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/src/org/eclipse/rap/rwt/visualization/jit/demo/Application.java index 79a649f..eb2199e 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit.demo/src/org/eclipse/rap/rwt/visualization/jit/demo/Application.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit.demo/src/org/eclipse/rap/rwt/visualization/jit/demo/Application.java @@ -1,282 +1,326 @@ -/****************************************************************************** - * Copyright (C) 2010-2011 Texas Center for Applied Technology - * Texas Engineering Experiment Station - * The Texas A&M University System - * All Rights Reserved. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Austin Riddle (Texas Center for Applied Technology) - - * initial API and implementation - * - *****************************************************************************/ -package org.eclipse.rap.rwt.visualization.jit.demo; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -import org.eclipse.rap.rwt.lifecycle.IEntryPoint; -import org.eclipse.rap.rwt.visualization.jit.HyperTree; -import org.eclipse.rap.rwt.visualization.jit.JITVisualizationWidget; -import org.eclipse.rap.rwt.visualization.jit.RGraph; -import org.eclipse.rap.rwt.visualization.jit.SpaceTree; -import org.eclipse.rap.rwt.visualization.jit.TreeMap; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; -import org.osgi.framework.Bundle; - -/** - * This class controls all aspects of the application's execution - * and is contributed through the plugin.xml. - */ -public class Application implements IEntryPoint { - - public static Listener createSelectionListener () { - return new Listener() - { - - public void handleEvent(Event event) - { - JITVisualizationWidget widget = (JITVisualizationWidget)event.widget; - System.out.println( "Selected node id = " + widget.getSelectedNodeId()); - } - - }; - } - - - public int createUI() - { - Display display = PlatformUI.createDisplay(); - PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); - return 0; - } - - public static class HyperTreeExample extends ViewPart - { - - private SashForm mainSash; - protected HyperTree topTree; - protected HyperTree bottomTree; - - public void createPartControl (Composite parent) - { - mainSash = new SashForm(parent, SWT.VERTICAL); - Group group = new Group(mainSash,SWT.NONE); - group.setText("Default"); - group.setLayout(new GridLayout(1,false)); - Button backBtn = new Button(group, SWT.PUSH); - backBtn.setText("Previous State"); - backBtn.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - topTree.previousState(); - } - }); - backBtn.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,false,false)); - topTree = new HyperTree(group, SWT.BORDER); - String sampleData = loadSampleData("samples/hypertree.json"); - topTree.setJSONData(sampleData); - topTree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - topTree.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - // leave this hyper tree with default colors - topTree.addListener(SWT.Selection, createSelectionListener()); - topTree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true)); - - group = new Group(mainSash,SWT.NONE); - group.setText("Weighted"); - group.setLayout(new GridLayout(1,false)); - backBtn = new Button(group, SWT.PUSH); - backBtn.setText("Previous State"); - backBtn.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - bottomTree.previousState(); - } - }); - backBtn.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,false,false)); - bottomTree = new HyperTree(group, SWT.BORDER); - sampleData = loadSampleData("samples/hypertree-weighted.json"); - bottomTree.setJSONData(sampleData); - bottomTree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - bottomTree.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); - - //Demo change of node and edge colors - //JSON data can override colors. - bottomTree.setNodeColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE).getRGB()); - bottomTree.setEdgeColor(new RGB(51,34,102)); //purple - bottomTree.addListener(SWT.Selection, createSelectionListener()); - bottomTree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true)); - } - - public void setFocus() - { - topTree.setFocus(); - } - - } - - public static class TreeMapExample extends ViewPart - { - - private SashForm oneSash; - private SashForm twoSash; - private TreeMap sqViz; - private TreeMap sliceViz; - private TreeMap stripViz; - private int seedId = 0; - - public void createPartControl (Composite parent) - { - String sampleData = loadSampleData("samples/treemap.json"); - oneSash = new SashForm(parent, SWT.VERTICAL); - twoSash = new SashForm(oneSash, SWT.HORIZONTAL); - - Group group = new Group(twoSash,SWT.NONE); - group.setText("Squarified"); - group.setLayout(new FillLayout()); - sqViz = new TreeMap(group, TreeMap.SQUARIFY, SWT.BORDER); - sqViz.setJSONData(makeUnique(sampleData)); - sqViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - sqViz.addListener(SWT.Selection, createSelectionListener()); - - group = new Group(twoSash,SWT.NONE); - group.setText("Strip"); - group.setLayout(new FillLayout()); - stripViz = new TreeMap(group, TreeMap.STRIP, SWT.BORDER); - stripViz.setJSONData(makeUnique(sampleData)); - stripViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - stripViz.addListener(SWT.Selection, createSelectionListener()); - - group = new Group(oneSash,SWT.NONE); - group.setText("Slice and Dice"); - group.setLayout(new FillLayout()); - sliceViz = new TreeMap(group, TreeMap.SLICE_AND_DICE, SWT.BORDER); - sliceViz.setJSONData(makeUnique(sampleData)); - sliceViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - sliceViz.addListener(SWT.Selection, createSelectionListener()); - } - - public void setFocus() - { - oneSash.setFocus(); - } - - /** - * Replaces all of the ids in the srcJSON with a unique set. - * Widgets cannot share datasets with the same ids. - * @param srcJSON - * @return the JSON string with unique ids substituted for all ids - */ - public String makeUnique (String srcJSON) { - String[] split = srcJSON.split("\"id\" : .*,"); - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < split.length; i++) { - sb.append(split[i]); - if ((i+1) < split.length) { - seedId++; - sb.append("\"id\" : ").append("\"").append(seedId).append("\"").append(","); - } - } -// System.out.println(sb.toString()); - return sb.toString(); - } - - } - - public static class RGraphExample extends ViewPart - { - - private RGraph viz; - - public void createPartControl (Composite parent) - { - viz = new RGraph(parent, SWT.BORDER); - String sampleData = loadSampleData("samples/rgraph.json"); - viz.setJSONData(sampleData); - viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - viz.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - //Demo change of node colors - //JSON data can override colors. - viz.setNodeColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE).getRGB()); - viz.addListener(SWT.Selection, createSelectionListener()); - } - - public void setFocus() - { - viz.setFocus(); - } - - } - - public static class SpaceTreeExample extends ViewPart - { - - private SpaceTree viz; - - public void createPartControl (Composite parent) - { - viz = new SpaceTree(parent, SWT.BORDER); - String sampleData = loadSampleData("samples/spacetree.json"); - viz.setJSONData(sampleData); - viz.setProperty("orientation", "top"); - viz.setEdgeProperty("type", "bezier"); - viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - viz.addListener(SWT.Selection, createSelectionListener()); - } - - public void setFocus() - { - viz.setFocus(); - } - - } - - public static String loadSampleData (String sampleFilePath) - { - StringBuffer data = new StringBuffer(); - try - { - Bundle bundle = Activator.getDefault().getBundle(); - InputStream in = FileLocator.openStream(bundle,new Path(sampleFilePath),true); - BufferedReader br = new BufferedReader(new InputStreamReader(in)); - try - { - String line = null; - while ((line = br.readLine()) != null) - { - data.append(line).append("\n"); - } - } - finally - { - br.close(); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - return data.toString(); - } - -} +/******************************************************************************
+ * Copyright � 2010-2011 Texas Center for Applied Technology
+ * Texas Engineering Experiment Station
+ * The Texas A&M University System
+ * All Rights Reserved.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Austin Riddle (Texas Center for Applied Technology) -
+ * initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.rap.rwt.visualization.jit.demo;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.rap.rwt.application.EntryPoint;
+import org.eclipse.rap.rwt.visualization.jit.AreaChart;
+import org.eclipse.rap.rwt.visualization.jit.BarChart;
+import org.eclipse.rap.rwt.visualization.jit.HyperTree;
+import org.eclipse.rap.rwt.visualization.jit.JITVisualizationWidget;
+import org.eclipse.rap.rwt.visualization.jit.RGraph;
+import org.eclipse.rap.rwt.visualization.jit.SpaceTree;
+import org.eclipse.rap.rwt.visualization.jit.TreeMap;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.osgi.framework.Bundle;
+
+/**
+ * This class controls all aspects of the application's execution
+ * and is contributed through the plugin.xml.
+ */
+public class Application implements EntryPoint {
+
+ public static Listener createSelectionListener () {
+ return new Listener()
+ {
+
+ public void handleEvent(Event event)
+ {
+ JITVisualizationWidget widget = (JITVisualizationWidget)event.widget;
+ System.out.println( "Selected node id = " + widget.getSelectedNodeId());
+ }
+
+ };
+ }
+
+
+ public int createUI()
+ {
+ Display display = PlatformUI.createDisplay();
+ PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
+ return 0;
+ }
+
+ public static class HyperTreeExample extends ViewPart
+ {
+
+ private SashForm mainSash;
+ protected HyperTree topTree;
+ protected HyperTree bottomTree;
+
+ public void createPartControl (Composite parent)
+ {
+ mainSash = new SashForm(parent, SWT.VERTICAL);
+ Group group = new Group(mainSash,SWT.NONE);
+ group.setText("Default");
+ group.setLayout(new GridLayout(1,false));
+ Button backBtn = new Button(group, SWT.PUSH);
+ backBtn.setText("Previous State");
+ backBtn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ topTree.previousState();
+ }
+ });
+ backBtn.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,false,false));
+ topTree = new HyperTree(group, SWT.BORDER);
+ String sampleData = loadSampleData("samples/hypertree.json");
+ topTree.setJSONData(sampleData);
+ topTree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ topTree.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ // leave this hyper tree with default colors
+ topTree.addListener(SWT.Selection, createSelectionListener());
+ topTree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
+
+ group = new Group(mainSash,SWT.NONE);
+ group.setText("Weighted");
+ group.setLayout(new GridLayout(1,false));
+ backBtn = new Button(group, SWT.PUSH);
+ backBtn.setText("Previous State");
+ backBtn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ bottomTree.previousState();
+ }
+ });
+ backBtn.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,false,false));
+ bottomTree = new HyperTree(group, SWT.BORDER);
+ sampleData = loadSampleData("samples/hypertree-weighted.json");
+ bottomTree.setJSONData(sampleData);
+ bottomTree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ bottomTree.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
+
+ //Demo change of node and edge colors
+ //JSON data can override colors.
+ bottomTree.setNodeColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE).getRGB());
+ bottomTree.setEdgeColor(new RGB(51,34,102)); //purple
+ bottomTree.addListener(SWT.Selection, createSelectionListener());
+ bottomTree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
+ }
+
+ public void setFocus()
+ {
+ topTree.setFocus();
+ }
+
+ }
+
+ public static class TreeMapExample extends ViewPart
+ {
+
+ private SashForm oneSash;
+ private SashForm twoSash;
+ private TreeMap sqViz;
+ private TreeMap sliceViz;
+ private TreeMap stripViz;
+ private int seedId = 0;
+
+ public void createPartControl (Composite parent)
+ {
+ String sampleData = loadSampleData("samples/treemap.json");
+ oneSash = new SashForm(parent, SWT.VERTICAL);
+ twoSash = new SashForm(oneSash, SWT.HORIZONTAL);
+
+ Group group = new Group(twoSash,SWT.NONE);
+ group.setText("Squarified");
+ group.setLayout(new FillLayout());
+ sqViz = new TreeMap(group, TreeMap.SQUARIFY, SWT.BORDER);
+ sqViz.setJSONData(makeUnique(sampleData));
+ sqViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ sqViz.addListener(SWT.Selection, createSelectionListener());
+
+ group = new Group(twoSash,SWT.NONE);
+ group.setText("Strip");
+ group.setLayout(new FillLayout());
+ stripViz = new TreeMap(group, TreeMap.STRIP, SWT.BORDER);
+ stripViz.setJSONData(makeUnique(sampleData));
+ stripViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ stripViz.addListener(SWT.Selection, createSelectionListener());
+
+ group = new Group(oneSash,SWT.NONE);
+ group.setText("Slice and Dice");
+ group.setLayout(new FillLayout());
+ sliceViz = new TreeMap(group, TreeMap.SLICE_AND_DICE, SWT.BORDER);
+ sliceViz.setJSONData(makeUnique(sampleData));
+ sliceViz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ sliceViz.addListener(SWT.Selection, createSelectionListener());
+ }
+
+ public void setFocus()
+ {
+ oneSash.setFocus();
+ }
+
+ /**
+ * Replaces all of the ids in the srcJSON with a unique set.
+ * Widgets cannot share datasets with the same ids.
+ * @param srcJSON
+ * @return the JSON string with unique ids substituted for all ids
+ */
+ public String makeUnique (String srcJSON) {
+ String[] split = srcJSON.split("\"id\" : .*,");
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < split.length; i++) {
+ sb.append(split[i]);
+ if ((i+1) < split.length) {
+ seedId++;
+ sb.append("\"id\" : ").append("\"").append(seedId).append("\"").append(",");
+ }
+ }
+// System.out.println(sb.toString());
+ return sb.toString();
+ }
+
+ }
+
+ public static class RGraphExample extends ViewPart
+ {
+
+ private RGraph viz;
+
+ public void createPartControl (Composite parent)
+ {
+ viz = new RGraph(parent, SWT.BORDER);
+ String sampleData = loadSampleData("samples/rgraph.json");
+ viz.setJSONData(sampleData);
+ viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ viz.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ //Demo change of node colors
+ //JSON data can override colors.
+ viz.setNodeColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE).getRGB());
+ viz.addListener(SWT.Selection, createSelectionListener());
+ }
+
+ public void setFocus()
+ {
+ viz.setFocus();
+ }
+
+ }
+
+ public static class SpaceTreeExample extends ViewPart
+ {
+
+ private SpaceTree viz;
+
+ public void createPartControl (Composite parent)
+ {
+ viz = new SpaceTree(parent, SWT.BORDER);
+ String sampleData = loadSampleData("samples/spacetree.json");
+ viz.setJSONData(sampleData);
+ viz.setProperty("orientation", "top");
+ viz.setEdgeProperty("type", "bezier");
+ viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ viz.addListener(SWT.Selection, createSelectionListener());
+ }
+
+ public void setFocus()
+ {
+ viz.setFocus();
+ }
+
+ }
+
+ public static class BarChartExample extends ViewPart
+ {
+
+ private BarChart viz;
+
+ public void createPartControl (Composite parent)
+ {
+ viz = new BarChart(parent, SWT.BORDER);
+ String sampleData = loadSampleData("samples/barchart.json");
+ viz.setJSONData(sampleData);
+ viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ viz.addListener(SWT.Selection, createSelectionListener());
+ }
+
+ public void setFocus()
+ {
+ viz.setFocus();
+ }
+
+ }
+
+ public static class AreaChartExample extends ViewPart
+ {
+
+ private AreaChart viz;
+
+ public void createPartControl (Composite parent)
+ {
+ viz = new AreaChart(parent, SWT.BORDER);
+ String sampleData = loadSampleData("samples/areachart.json");
+ viz.setJSONData(sampleData);
+ viz.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ viz.addListener(SWT.Selection, createSelectionListener());
+ }
+
+ public void setFocus()
+ {
+ viz.setFocus();
+ }
+
+ }
+
+ public static String loadSampleData (String sampleFilePath)
+ {
+ StringBuffer data = new StringBuffer();
+ try
+ {
+ Bundle bundle = Activator.getDefault().getBundle();
+ InputStream in = FileLocator.openStream(bundle,new Path(sampleFilePath),true);
+ BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ try
+ {
+ String line = null;
+ while ((line = br.readLine()) != null)
+ {
+ data.append(line).append("\n");
+ }
+ }
+ finally
+ {
+ br.close();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return data.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/META-INF/MANIFEST.MF b/bundles/org.eclipse.rap.rwt.visualization.jit/META-INF/MANIFEST.MF index 0d2bc44..9383d20 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/META-INF/MANIFEST.MF @@ -1,13 +1,13 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-SymbolicName: org.eclipse.rap.rwt.visualization.jit;singleton:=true -Bundle-Version: 1.5.0.qualifier -Bundle-Localization: plugin -Require-Bundle: org.eclipse.rap.rwt, - org.eclipse.rap.jface, - org.eclipse.rap.ui.workbench, - org.eclipse.equinox.http.registry -Export-Package: org.eclipse.rap.rwt.visualization.jit -Bundle-RequiredExecutionEnvironment: J2SE-1.4 -Bundle-Vendor: %Bundle-Vendor +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.rap.rwt.visualization.jit;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.rap.rwt,
+ org.eclipse.rap.jface,
+ org.eclipse.rap.ui.workbench,
+ org.eclipse.equinox.http.registry
+Export-Package: org.eclipse.rap.rwt.visualization.jit
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %Bundle-Vendor
diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/plugin.xml b/bundles/org.eclipse.rap.rwt.visualization.jit/plugin.xml index e649b92..efe0a83 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/plugin.xml +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/plugin.xml @@ -8,6 +8,9 @@ class="org.eclipse.rap.rwt.visualization.jit.internal.JITAPIResource"> </resource> <resource + class="org.eclipse.rap.rwt.visualization.jit.internal.BaseVisualizationResource"> + </resource> + <resource class="org.eclipse.rap.rwt.visualization.jit.internal.hypertreekit.HyperTreeResource"> </resource> <resource @@ -19,5 +22,11 @@ <resource class="org.eclipse.rap.rwt.visualization.jit.internal.spacetreekit.SpaceTreeResource"> </resource> + <resource + class="org.eclipse.rap.rwt.visualization.jit.internal.barchartkit.BarChartResource"> + </resource> + <resource + class="org.eclipse.rap.rwt.visualization.jit.internal.areachartkit.AreaChartResource"> + </resource> </extension> </plugin> diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/AreaChart.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/AreaChart.java new file mode 100644 index 0000000..6b648f2 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/AreaChart.java @@ -0,0 +1,26 @@ +/****************************************************************************** + * Copyright � 2010-2011 Austin Riddle + * All Rights Reserved. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API and implementation + * + *****************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit; + +import org.eclipse.swt.widgets.Composite; + +public class AreaChart extends JITVisualizationWidget +{ + + public AreaChart( final Composite parent, final int style ) + { + super( parent, style ); + } + +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/BarChart.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/BarChart.java new file mode 100644 index 0000000..f93b7a8 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/BarChart.java @@ -0,0 +1,26 @@ +/****************************************************************************** + * Copyright � 2010-2011 Austin Riddle + * All Rights Reserved. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API and implementation + * + *****************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit; + +import org.eclipse.swt.widgets.Composite; + +public class BarChart extends JITVisualizationWidget +{ + + public BarChart( final Composite parent, final int style ) + { + super( parent, style ); + } + +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/HyperTree.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/HyperTree.java index 6745ae5..202c904 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/HyperTree.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/HyperTree.java @@ -13,6 +13,8 @@ *****************************************************************************/ package org.eclipse.rap.rwt.visualization.jit; +import java.util.HashMap; + import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; @@ -34,7 +36,9 @@ public class HyperTree extends JITGraphWidget } if (!navStack.isEmpty()) { Object id = navStack.pop(); - addCommand("selectNode", new Object[] {id}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "id", id ); + addCommand("selectNode", args); } } } diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITGraphWidget.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITGraphWidget.java index c49eea3..989b94b 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITGraphWidget.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITGraphWidget.java @@ -1,5 +1,7 @@ package org.eclipse.rap.rwt.visualization.jit; +import java.util.HashMap; + import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; @@ -55,7 +57,10 @@ public abstract class JITGraphWidget extends JITVisualizationWidget { * @param propValue - the value of the property */ public void setProperty (String propName, Object propValue) { - addCommand("setProperty", new Object[] {propName, propValue}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "propName", propName ); + args.put( "propValue", propValue ); + addCommand("setProperty", args); } /** @@ -67,7 +72,10 @@ public abstract class JITGraphWidget extends JITVisualizationWidget { */ public void setNodeProperty(String propName, Object propValue) { - addCommand("setNodeProperty", new Object[] {propName, propValue}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "propName", propName ); + args.put( "propValue", propValue ); + addCommand("setNodeProperty", args); } /** @@ -78,7 +86,10 @@ public abstract class JITGraphWidget extends JITVisualizationWidget { */ public void setEdgeProperty(String propName, Object propValue) { - addCommand("setEdgeProperty", new Object[] {propName, propValue}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "propName", propName ); + args.put( "propValue", propValue ); + addCommand("setEdgeProperty", args); } /** @@ -87,7 +98,9 @@ public abstract class JITGraphWidget extends JITVisualizationWidget { * @param percent - the percentage zoom level */ public void setZoom(double percent) { - addCommand("setZoom", new Object[] {Double.valueOf(percent)}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "percent", Double.valueOf(percent) ); + addCommand("setZoom", args); } protected String convertRGBToCSSString(RGB color) { diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITVisualizationWidget.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITVisualizationWidget.java index 1e41b57..6d9bbf9 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITVisualizationWidget.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/JITVisualizationWidget.java @@ -1,5 +1,7 @@ package org.eclipse.rap.rwt.visualization.jit; +import java.util.HashMap; +import java.util.Map; import java.util.Stack; import org.eclipse.rap.rwt.visualization.jit.internal.JITWidgetLCA.WidgetCommandQueue; @@ -61,7 +63,9 @@ public abstract class JITVisualizationWidget extends Composite { */ public void setSelectedNodeId (String selectedNodeId) { this.selectedNodeId = selectedNodeId; - addCommand("selectNode",new Object[]{selectedNodeId}); + HashMap<String,Object> args = new HashMap<String,Object>(); + args.put( "id", selectedNodeId ); + addCommand("selectNode",args); } /** @@ -77,7 +81,7 @@ public abstract class JITVisualizationWidget extends Composite { * @param cmd - the name of the function to execute. * @param args and array of function arguments. Can be <code>null</code>. */ - protected synchronized void addCommand (String cmd, Object[] args) { + protected synchronized void addCommand (String cmd, Map<String,Object> args) { if (cmdQueue == null) { cmdQueue = new WidgetCommandQueue(); } diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualization.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualization.js new file mode 100644 index 0000000..f9caf0a --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualization.js @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2009-2010 David Donahue and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Donahue - initial API, implementation and documentation + * Austin Riddle - improvements to widget hierarchy and data flow for + * consistency with SWT behavior. + ******************************************************************************/ +//The reason this is still a qooxdoo widget is because google embeds the chart in an iframe. +qx.Class.define( "org.eclipse.rap.rwt.visualization.jit.BaseVisualization", { + type: "abstract", + extend: rwt.widgets.base.Parent, + + statics : + { + registerAdapter : function(className, constructor) { + rwt.protocol.AdapterRegistry.add( className, { + + factory : function( properties ) { + var result = new constructor(); + rwt.protocol.AdapterUtil.addStatesForStyles( result, properties.style ); + result.setUserData( "isControl", true ); + rwt.protocol.AdapterUtil.setParent( result, properties.parent ); + return result; + }, + + destructor : rwt.protocol.AdapterUtil.getControlDestructor(), + + properties : rwt.protocol.AdapterUtil.extendControlProperties( [ + "visible", + "widgetData" + ] ), + + propertyHandler : rwt.protocol.AdapterUtil.extendControlPropertyHandler( {} ), + + listeners : rwt.protocol.AdapterUtil.extendControlListeners( [] ), + + listenerHandler : rwt.protocol.AdapterUtil.extendControlListenerHandler( {} ), + + methods : [ + "setEdgeProperty", + "setNodeProperty", + "setProperty", + "selectNode", + "setZoom" + ], + + methodHandler : { + "setEdgeProperty" : function( widget, args ) { + widget.setEdgeProperty(args["propName"],args["propValue"]); + }, + "setNodeProperty" : function( widget, args ) { + widget.setEdgeProperty(args["propName"],args["propValue"]); + }, + "setProperty" : function( widget, args ) { + widget.setEdgeProperty(args["propName"],args["propValue"]); + }, + "selectNode" : function( widget, args ) { + widget.setEdgeProperty(args["id"]); + }, + "setZoom" : function( widget, args ) { + widget.setEdgeProperty(args["percent"]); + } + } + } ); + } + }, + + construct: function() { + this.base( arguments ); + this._viz = null; + }, + + destruct : function() { + }, + + properties : { + visible : { + init :"", + apply :"initialize" + }, + widgetData : { + init :"", + apply :"refreshData" + } + }, + + members : { + _doActivate : function() { + var shell = null; + var parent = this.getParent(); + while( shell == null && parent != null ) { + if( parent.classname == "org.eclipse.swt.widgets.Shell" ) { + shell = parent; + } + parent = parent.getParent(); + } + if( shell != null ) { + shell.setActiveChild( this ); + } + }, + + _createViz : function(domElement) { + + }, + + initialize : function() { + try { + var viz = this._viz; + if (this.getVisible() == "false") { + // make invisible + return; + } + rwt.widgets.base.Widget.flushGlobalQueues(); + if (viz == null) { + this.info("Creating new visualization instance."); + var wm = org.eclipse.swt.WidgetManager.getInstance(); + var widgetId = wm.findIdByWidget(this); + this._getTargetNode().setAttribute("id",widgetId+"_targetNode"); + this._viz = this._createViz(this._getTargetNode()); + viz = this._viz; + } + } + catch (e) { + this.info(e); + } + }, + + refreshData : function () { + try { + var rg = this._viz; + if (rg != null) { + var data = this.getWidgetData(); + if (data != null) { + this.info("Loading visualization data."); + rg.loadJSON(data); + this.info("Refreshing visualization."); + rg.refresh(); + rg.controller.onAfterCompute(); + } + } + } + catch (e) { + this.info(e); + } + }, + + addTreeEvent : function (obj, type, fn) { + if (obj.addEventListener) obj.addEventListener(type, fn, false); + else obj.attachEvent('on' + type, fn); + }, + + setProperty : function (propName, propValue) { + try { + var st = this._viz; + if (st != null) { + st.controller[propName] = propValue; + st.refresh(); + } + } + catch (e) { + this.info(e); + } + }, + + setNodeProperty : function (propName, propValue) { + try { + var st = this._viz; + if (st != null) { + st.controller.Node[propName] = propValue; + st.refresh(); + } + } + catch (e) { + this.info(e); + } + }, + + setEdgeProperty : function (propName, propValue) { + try { + var st = this._viz; + if (st != null) { + st.controller.Edge[propName] = propValue; + st.refresh(); + } + } + catch (e) { + this.info(e); + } + }, + + setZoom : function (percent) { + try { + var st = this._viz; + if (st != null) { + st.canvas.scale(percent,percent); + st.refresh(); + } + } + catch (e) { + this.info(e); + } + }, + + selectNode : function (id) { + try { + this.info("Forcing selection to : "+id); + var ht = this._viz; + if (ht != null) { + ht.onClick(id); + } + } + catch (e) { + this.info(e); + } + }, + + _sendResponse : function(widget, field, value) { + //if (!org.eclipse.swt.EventUtil.getSuspended()) { + var wm = org.eclipse.swt.WidgetManager.getInstance(); + var canvasId = wm.findIdByWidget(widget); + var req = rwt.remote.Server.getInstance(); + req.addParameter(canvasId + "." + field, value); + req.send(); + //} + } + } + +} );
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualizationResource.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualizationResource.java new file mode 100644 index 0000000..4915c6a --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualizationResource.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2009-2010 David Donahue. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Donahue - initial API, implementation and documentation + ******************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit.internal; + + +public class BaseVisualizationResource extends JITVisualizationResource { + + @Override + public String getLocation() { + return "org/eclipse/rap/rwt/visualization/jit/internal/BaseVisualization.js"; + } + +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITAPIResource.java index 1662831..727ab22 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITAPIResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITAPIResource.java @@ -13,8 +13,7 @@ *****************************************************************************/ package org.eclipse.rap.rwt.visualization.jit.internal; -import org.eclipse.rap.rwt.resources.IResource; -import org.eclipse.rap.rwt.resources.IResourceManager.RegisterOptions; +import org.eclipse.rap.ui.resources.IResource; public class JITAPIResource implements IResource { @@ -30,10 +29,6 @@ public class JITAPIResource implements IResource { return this.getClass().getClassLoader(); } - public RegisterOptions getOptions() { - return RegisterOptions.VERSION; - } - public String getLocation() { if( location == null ) { location = System.getProperty( KEY_SYSTEM_PROPERTY, "org/eclipse/rap/rwt/visualization/jit/internal/jit.js"); diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITVisualizationResource.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITVisualizationResource.java index 948e857..2d2a370 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITVisualizationResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITVisualizationResource.java @@ -10,8 +10,7 @@ ******************************************************************************/ package org.eclipse.rap.rwt.visualization.jit.internal; -import org.eclipse.rap.rwt.resources.IResource; -import org.eclipse.rap.rwt.resources.IResourceManager.RegisterOptions; +import org.eclipse.rap.ui.resources.IResource; public abstract class JITVisualizationResource implements IResource { @@ -23,10 +22,6 @@ public abstract class JITVisualizationResource implements IResource { return this.getClass().getClassLoader(); } - public RegisterOptions getOptions() { - return RegisterOptions.VERSION; - } - public abstract String getLocation(); public boolean isJSLibrary() { diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITWidgetLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITWidgetLCA.java index 23b73a4..59291ac 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITWidgetLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/JITWidgetLCA.java @@ -16,13 +16,14 @@ package org.eclipse.rap.rwt.visualization.jit.internal; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Map; import java.util.Vector; +import org.eclipse.rap.rwt.internal.protocol.ClientObjectFactory; +import org.eclipse.rap.rwt.internal.protocol.IClientObject; import org.eclipse.rap.rwt.lifecycle.AbstractWidgetLCA; import org.eclipse.rap.rwt.lifecycle.ControlLCAUtil; import org.eclipse.rap.rwt.lifecycle.IWidgetAdapter; -import org.eclipse.rap.rwt.lifecycle.JSVar; -import org.eclipse.rap.rwt.lifecycle.JSWriter; import org.eclipse.rap.rwt.lifecycle.WidgetLCAUtil; import org.eclipse.rap.rwt.lifecycle.WidgetUtil; import org.eclipse.rap.rwt.visualization.jit.JITVisualizationWidget; @@ -34,6 +35,8 @@ public abstract class JITWidgetLCA extends AbstractWidgetLCA { private static final String WIDGET_DATA = "widgetData"; private static final String PROP_VISIBLE = "visible"; + private static final String[] ALLOWED_STYLES = new String[] { "BORDER" }; + public abstract Class getWidgetType(); protected Collection getInitializationParameters (JITVisualizationWidget vWidget) { @@ -44,12 +47,12 @@ public abstract class JITWidgetLCA extends AbstractWidgetLCA { } public void renderInitialization( final Widget widget ) throws IOException { - JITVisualizationWidget vWidget = (JITVisualizationWidget)widget; - JSWriter writer = JSWriter.getWriterFor( vWidget ); - writer.newWidget( getWidgetType().getName(), getInitializationParameters(vWidget).toArray() ); - writer.set( "appearance", "composite" ); - writer.set( "overflow", "hidden" ); - ControlLCAUtil.writeStyleFlags( ( Control ) widget ); + Control control = (Control)widget; + IClientObject clientObject = ClientObjectFactory.getClientObject( control ); + clientObject.create( getWidgetType().getCanonicalName() ); +// clientObject.set( "id", WidgetUtil.getId( control ) ); + clientObject.set( "parent", WidgetUtil.getId( control.getParent() ) ); + clientObject.set( "style", WidgetLCAUtil.getStyles( control, ALLOWED_STYLES ) ); } public void preserveValues( final Widget widget ) { @@ -57,36 +60,38 @@ public abstract class JITWidgetLCA extends AbstractWidgetLCA { ControlLCAUtil.preserveValues( vWidget ); IWidgetAdapter adapter = WidgetUtil.getAdapter( vWidget ); adapter.preserve( PROP_VISIBLE, String.valueOf(vWidget.isVisible())); - adapter.preserve( WIDGET_DATA, new JSVar(vWidget.getJSONData())); + adapter.preserve( WIDGET_DATA, vWidget.getJSONData()); // only needed for custom variants (theming) WidgetLCAUtil.preserveCustomVariant( vWidget ); } public void renderChanges( final Widget widget ) throws IOException { + ControlLCAUtil.renderChanges( ( Control )widget ); + WidgetLCAUtil.renderCustomVariant( widget ); + JITVisualizationWidget vWidget = ( JITVisualizationWidget )widget; - JSWriter writer = JSWriter.getWriterFor( vWidget ); - writer.set( PROP_VISIBLE, PROP_VISIBLE, String.valueOf(vWidget.isVisible())); - //We compare the JSON text directly because JSVar does not override Object.equals(); - IWidgetAdapter adapter = WidgetUtil.getAdapter( vWidget ); - JSVar oldValue = (JSVar)adapter.getPreserved( WIDGET_DATA ); - String jsonData = vWidget.getJSONData(); - if (jsonData != null && (oldValue == null || !jsonData.equals(oldValue.toString()))) { - writer.set( WIDGET_DATA, WIDGET_DATA, new JSVar(jsonData)); + IClientObject clientObject = ClientObjectFactory.getClientObject( vWidget ); + IWidgetAdapter adapter = WidgetUtil.getAdapter(widget); + boolean changed = !adapter.isInitialized() || WidgetLCAUtil.hasChanged(widget, PROP_VISIBLE, vWidget.isVisible()); + if (changed) { + clientObject.set(PROP_VISIBLE, vWidget.isVisible()); + } + changed = WidgetLCAUtil.hasChanged(widget, WIDGET_DATA, vWidget.getJSONData()); + if (changed) { + clientObject.set(WIDGET_DATA, vWidget.getJSONData()); } - ControlLCAUtil.writeChanges( vWidget ); WidgetCommandQueue cmdQueue = (WidgetCommandQueue) vWidget.getAdapter(WidgetCommandQueue.class); if (cmdQueue != null) { while (cmdQueue.peek() != null) { Object[] functionCall = (Object[])cmdQueue.poll(); - writer.call((String)functionCall[0], (Object[])functionCall[1]); + clientObject.call((String)functionCall[0], (Map<String,Object>)functionCall[1]); } } } public void renderDispose( final Widget widget ) throws IOException { - JSWriter writer = JSWriter.getWriterFor( widget ); - writer.dispose(); + ClientObjectFactory.getClientObject( widget ).destroy(); } public void createResetHandlerCalls( String typePoolId ) throws IOException { diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChart.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChart.js new file mode 100644 index 0000000..3d21e37 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChart.js @@ -0,0 +1,108 @@ +/****************************************************************************** + * Copyright � 2010-2011 Texas Center for Applied Technology + * Texas Engineering Experiment Station + * The Texas A&M University System + * All Rights Reserved. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle (Texas Center for Applied Technology) - + * initial API and implementation + * + *****************************************************************************/ +qx.Class.define("org.eclipse.rap.rwt.visualization.jit.AreaChart", +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, + + members : { + + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + var st = new $jit.AreaChart({ + injectInto: vizId, + animate: true, + Margin: { + top:5, + left:5, + right:5, + bottom:5 + }, + labelOffset: 10, + type: 'stacked:gradient', + showAggregates:true, + showLabels:true, + Label: { + type: "Native", //Native or HTML + size: 13, + family: 'Arial', + color: 'white' + }, + Tips: { + enable: true, + force: true, + type: 'auto', + offsetX: 10, + offsetY: 10, + onShow: function(tip, node) { + tip.style.border = "1px solid #c0c0c0"; + tip.style.backgroundColor = "#ddd"; + tip.style.color = "#000"; + tip.innerHTML = node.name; + tip.style.zIndex = 1000000000; + } + } + }); + this.addEventListener("changeWidth", function(e) { + if (domElement != null) { + domElement.width = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + var size = st.delegate.canvas.getSize(); + var margin = st.config.Margin; +// if(horz) { +// delegate.config.offsetX = size.width/2 - margin.left +// - (config.showLabels && (config.labelOffset + config.Label.size)); +// delegate.config.offsetY = (margin.bottom - margin.top)/2; +// } else { + st.delegate.config.offsetY = -size.height/2 + margin.bottom + + (st.config.showLabels && (st.config.labelOffset + st.config.Label.size)); + st.delegate.config.offsetX = (margin.right - margin.left)/2; +// } + st.normalizeDims(); + st.delegate.refresh(); + } + } + }); + this.addEventListener("changeHeight", function(e) { + if (domElement != null) { + domElement.height = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + var size = st.delegate.canvas.getSize(); + var margin = st.config.Margin; +// if(horz) { +// delegate.config.offsetX = size.width/2 - margin.left +// - (config.showLabels && (config.labelOffset + config.Label.size)); +// delegate.config.offsetY = (margin.bottom - margin.top)/2; +// } else { + st.delegate.config.offsetY = -size.height/2 + margin.bottom + + (st.config.showLabels && (st.config.labelOffset + st.config.Label.size)); + st.delegate.config.offsetX = (margin.right - margin.left)/2; +// } + st.normalizeDims(); + st.delegate.refresh(); + } + } + }); + return st; + } + } +}); + +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.AreaChart", + org.eclipse.rap.rwt.visualization.jit.AreaChart);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartLCA.java new file mode 100644 index 0000000..cd58569 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartLCA.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010-2011 Austin Riddle, and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API, implementation and documentation + * Cole Markham (Texas Center for Applied Technology) - + * widget data passing to client side + ******************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit.internal.areachartkit; + +import org.eclipse.rap.rwt.visualization.jit.AreaChart; +import org.eclipse.rap.rwt.visualization.jit.internal.JITWidgetLCA; + +public class AreaChartLCA extends JITWidgetLCA { + + @Override + public Class<?> getWidgetType() { + return AreaChart.class; + } +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartResource.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartResource.java new file mode 100644 index 0000000..ce1a8e7 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChartResource.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2010-2011 Austin Riddle. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API, implementation and documentation + ******************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit.internal.areachartkit; + +import org.eclipse.rap.rwt.visualization.jit.internal.JITVisualizationResource; + +public class AreaChartResource extends JITVisualizationResource { + + public String getLocation() { + return "org/eclipse/rap/rwt/visualization/jit/internal/areachartkit/AreaChart.js"; + } + +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChart.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChart.js new file mode 100644 index 0000000..da039aa --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChart.js @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright � 2010-2011 Texas Center for Applied Technology + * Texas Engineering Experiment Station + * The Texas A&M University System + * All Rights Reserved. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle (Texas Center for Applied Technology) - + * initial API and implementation + * + *****************************************************************************/ +qx.Class.define("org.eclipse.rap.rwt.visualization.jit.BarChart", +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, + + members : { + + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + + var st = new $jit.BarChart({ + injectInto: vizId, + orientation: "vertical", + barsOffset: 20, + Margin: { + top:5, + left:5, + right:5, + bottom:5 + }, + labelOffset: 5, + type: 'stacked:gradient', + showAggregates:true, + showLabels:true, + Label: { + type: "Native", //Native or HTML + size: 13, + family: 'Arial', + color: 'white' + }, + Tips: { + enable: true, + force: true, + type: 'auto', + offsetX: 10, + offsetY: 10, + onShow: function(tip, node) { + tip.style.border = "1px solid #c0c0c0"; + tip.style.backgroundColor = "#ddd"; + tip.style.color = "#000"; + tip.innerHTML = node.name; + tip.style.zIndex = 1000000000; + } + } + }); + this.addEventListener("changeWidth", function(e) { + if (domElement != null) { + domElement.width = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + var size = st.delegate.canvas.getSize(); + var margin = st.config.Margin; +// if(horz) { +// delegate.config.offsetX = size.width/2 - margin.left +// - (config.showLabels && (config.labelOffset + config.Label.size)); +// delegate.config.offsetY = (margin.bottom - margin.top)/2; +// } else { + st.delegate.config.offsetY = -size.height/2 + margin.bottom + + (st.config.showLabels && (st.config.labelOffset + st.config.Label.size)); + st.delegate.config.offsetX = (margin.right - margin.left)/2; +// } + st.normalizeDims(); + st.delegate.refresh(); + } + } + }); + this.addEventListener("changeHeight", function(e) { + if (domElement != null) { + domElement.height = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + var size = st.delegate.canvas.getSize(); + var margin = st.config.Margin; +// if(horz) { +// delegate.config.offsetX = size.width/2 - margin.left +// - (config.showLabels && (config.labelOffset + config.Label.size)); +// delegate.config.offsetY = (margin.bottom - margin.top)/2; +// } else { + st.delegate.config.offsetY = -size.height/2 + margin.bottom + + (st.config.showLabels && (st.config.labelOffset + st.config.Label.size)); + st.delegate.config.offsetX = (margin.right - margin.left)/2; +// } + st.normalizeDims(); + st.delegate.refresh(); + } + } + }); + return st; + } + } +}); +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.BarChart", + org.eclipse.rap.rwt.visualization.jit.BarChart);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartLCA.java new file mode 100644 index 0000000..aa5e96a --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartLCA.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010-2011 Austin Riddle, and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API, implementation and documentation + * Cole Markham (Texas Center for Applied Technology) - + * widget data passing to client side + ******************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit.internal.barchartkit; + +import org.eclipse.rap.rwt.visualization.jit.BarChart; +import org.eclipse.rap.rwt.visualization.jit.internal.JITWidgetLCA; + +public class BarChartLCA extends JITWidgetLCA { + + @Override + public Class<?> getWidgetType() { + return BarChart.class; + } +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartResource.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartResource.java new file mode 100644 index 0000000..c31bcdc --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChartResource.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2010-2011 Austin Riddle. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Austin Riddle - initial API, implementation and documentation + ******************************************************************************/ +package org.eclipse.rap.rwt.visualization.jit.internal.barchartkit; + +import org.eclipse.rap.rwt.visualization.jit.internal.JITVisualizationResource; + +public class BarChartResource extends JITVisualizationResource { + + public String getLocation() { + return "org/eclipse/rap/rwt/visualization/jit/internal/barchartkit/BarChart.js"; + } + +} diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTree.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTree.js index 6117b04..ee42a46 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTree.js +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTree.js @@ -12,273 +12,123 @@ * *****************************************************************************/ qx.Class.define("org.eclipse.rap.rwt.visualization.jit.HyperTree", -{ extend :qx.ui.layout.CanvasLayout, +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, - construct : function(id) { - this.base(arguments); - this.setHtmlProperty("id", id); - this._id = id; - this._viz = null; - }, - - properties : { - visible : { - init :"", - apply :"load" - }, - widgetData : { - init :"", - apply :"refreshData" - } - }, - - destruct : function() { - - }, - members : { - - _doActivate : function() { - var shell = null; - var parent = this.getParent(); - while (shell == null && parent != null) { - if (parent.classname == "org.eclipse.swt.widgets.Shell") { - shell = parent; - } - parent = parent.getParent(); - } - if (shell != null) { - shell.setActiveChild(this); - } - }, - load : function() { - var parent = this; - try { - var vis = this.getVisible(); - if (vis == "false") { - // make invisible - return; - } - qx.ui.core.Widget.flushGlobalQueues(); - if (this._viz == null) { - this.info("Creating hypertree."); - - var qParent = document.getElementById(this._id); - var vizParent = document.createElement("div"); - var vizId = "vizParent"+this._id; - vizParent.setAttribute("id", vizId); - qParent.appendChild(vizParent); - vizParent.width = this.getWidth(); - vizParent.height = this.getHeight(); - var widgetId = this._id; - var config = { - injectInto: vizId, - Navigation: { - enable:true, - panning:true, - zooming: 20 - }, - //Change node and edge styles such as - //color, width and dimensions. - Node: { - dim: 9, - overridable: true, - color: "#f00" - }, - - Edge: { - overridable: true, - lineWidth: 2, - color: "#088" - }, - - onBeforeCompute: function(node){ - //Log.write("centering"); - }, - //Attach event handlers and add text to the - //labels. This method is only triggered on label - //creation - onCreateLabel: function(domElement, node){ - domElement.innerHTML = node.name; - domElement.style.cursor = "pointer"; - parent.addTreeEvent(domElement, 'click', function () { - ht.onClick(node.id); - }); - }, - - //This method is called right before plotting an - //edge. This method is useful for adding individual - //styles to edges. - onBeforePlotLine: function(adj){ - //Set lineWidth for edges. + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + var config = { + injectInto: vizId, + Navigation: { + enable:true, + panning:true, + zooming: 20 + }, + //Change node and edge styles such as + //color, width and dimensions. + Node: { + dim: 9, + overridable: true, + color: "#f00" + }, + + Edge: { + overridable: true, + lineWidth: 2, + color: "#088" + }, + + onBeforeCompute: function(node){ + //Log.write("centering"); + }, + //Attach event handlers and add text to the + //labels. This method is only triggered on label + //creation + onCreateLabel: function(domElement, node){ + domElement.innerHTML = node.name; + domElement.style.cursor = "pointer"; + parent.addTreeEvent(domElement, 'click', function () { + ht.onClick(node.id); + }); + }, + + //This method is called right before plotting an + //edge. This method is useful for adding individual + //styles to edges. + onBeforePlotLine: function(adj){ + //Set lineWidth for edges. // if (!adj.data.$lineWidth) // adj.data.$lineWidth = Math.random() * 5 + 1; - }, - //Change node styles when labels are placed - //or moved. - onPlaceLabel: function(domElement, node){ - var style = domElement.style; - style.display = ''; - style.cursor = 'pointer'; - var font = parent.getFont(); - style.fontFamily = font.getFamily(); - try { - style.fontStyle = font.generateStyle(); - } - catch (e) { - //ignore..some items are not cross - browser compatible - } - var color = parent.getTextColor(); - if (node._depth <= 1) { - style.fontSize = font.getSize(); - style.color = color; - - } else if(node._depth == 2){ - style.fontSize = font.getSize()-2; - style.color = "#555"; - - } else { - style.display = 'none'; - } - - var left = parseInt(style.left); - var w = domElement.offsetWidth; - style.left = (left - w / 2) + 'px'; - }, - - onAfterCompute: function(){ - var node = $jit.Graph.Util.getClosestNodeToOrigin(ht.graph, "current"); - qParent.selection = node; - //fire selection event - parent.info("Sending selected node: "+node.id); - var req = org.eclipse.swt.Request.getInstance(); - req.addParameter(widgetId + ".selectedNode", node.id); - req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); - req.send(); - } - }; - var ht = new $jit.Hypertree(config); - - this.addEventListener("changeWidth", function(e) { - if (vizParent != null) { - vizParent.width = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - ht.canvas.resize(vizParent.width, vizParent.height); - ht.refresh(); - } - } - }); - this.addEventListener("changeHeight", function(e) { - if (vizParent != null) { - vizParent.height = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - ht.canvas.resize(vizParent.width, vizParent.height); - ht.refresh(); - } - } - }); - - this._viz = ht; - this._vizParent = vizParent; - } - } - catch (e) { - this.info(e); - } - }, - - addTreeEvent : function (obj, type, fn) { - if (obj.addEventListener) obj.addEventListener(type, fn, false); - else obj.attachEvent('on' + type, fn); - }, - - refreshData : function (data) { - try { - var ht = this._viz; - if (ht != null) { - if (data != null) { - this.info("Loading hypertree data."); - ht.loadJSON(data); - this.info("Refreshing hypertree."); - ht.refresh(); - ht.controller.onAfterCompute(); + }, + //Change node styles when labels are placed + //or moved. + onPlaceLabel: function(domElement, node){ + var style = domElement.style; + style.display = ''; + style.cursor = 'pointer'; + var font = parent.getFont(); + style.fontFamily = font.getFamily(); + try { + style.fontStyle = font.generateStyle(); + } + catch (e) { + //ignore..some items are not cross - browser compatible + } + var color = parent.getTextColor(); + if (node._depth <= 1) { + style.fontSize = font.getSize(); + style.color = color; + + } else if(node._depth == 2){ + style.fontSize = font.getSize()-2; + style.color = "#555"; + + } else { + style.display = 'none'; + } + + var left = parseInt(style.left); + var w = domElement.offsetWidth; + style.left = (left - w / 2) + 'px'; + }, + + onAfterCompute: function(){ + var node = $jit.Graph.Util.getClosestNodeToOrigin(ht.graph, "current"); + //qParent.selection = node; + //fire selection event + parent.info("Sending selected node: "+node.id); + var req = rwt.remote.Server.getInstance(); + req.addParameter(widgetId + ".selectedNode", node.id); + req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); + req.send(); + } + }; + var ht = new $jit.Hypertree(config); + this.addEventListener("changeWidth", function(e) { + if (domElement != null) { + domElement.width = e.getValue(); + if (domElement.height != null && domElement.width != null) { + ht.canvas.resize(domElement.width, domElement.height); + ht.refresh(); } } - } - catch (e) { - this.info(e); - } - }, - - setProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setNodeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Node[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setEdgeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Edge[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setZoom : function (percent) { - try { - var st = this._viz; - if (st != null) { - st.canvas.scale(percent,percent); - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - selectNode : function (id) { - try { - this.info("Forcing selection to : "+id); - var ht = this._viz; - if (ht != null) { - ht.onClick(id); + }); + this.addEventListener("changeHeight", function(e) { + if (domElement != null) { + domElement.height = e.getValue(); + if (domElement.height != null && domElement.width != null) { + ht.canvas.resize(domElement.width, domElement.height); + ht.refresh(); + } } - } - catch (e) { - this.info(e); - } - }, - - _doResize : function() { - qx.ui.core.Widget.flushGlobalQueues(); - + }); + return ht; } } -});
\ No newline at end of file +}); + +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.HyperTree", + org.eclipse.rap.rwt.visualization.jit.HyperTree);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTreeLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTreeLCA.java index c59a328..0461484 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTreeLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/hypertreekit/HyperTreeLCA.java @@ -17,8 +17,8 @@ import org.eclipse.rap.rwt.visualization.jit.internal.JITGraphLCA; public class HyperTreeLCA extends JITGraphLCA { - public Class getWidgetType () { + @Override + public Class<?> getWidgetType() { return HyperTree.class; } - } diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraph.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraph.js index 96069b7..2f5a8b9 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraph.js +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraph.js @@ -15,285 +15,136 @@ * *****************************************************************************/ qx.Class.define("org.eclipse.rap.rwt.visualization.jit.RGraph", -{ extend :qx.ui.layout.CanvasLayout, +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, - construct : function(id) { - this.base(arguments); - this.setHtmlProperty("id", id); - this._id = id; - this._viz = null; - }, - - properties : { - visible : { - init :"", - apply :"load" - }, - widgetData : { - init :"", - apply :"refreshData" - } - }, - - destruct : function() { - - }, - members : { - _doActivate : function() { - var shell = null; - var parent = this.getParent(); - while (shell == null && parent != null) { - if (parent.classname == "org.eclipse.swt.widgets.Shell") { - shell = parent; - } - parent = parent.getParent(); - } - if (shell != null) { - shell.setActiveChild(this); - } - }, - - load : function() { - var parent = this; - try { - var vis = this.getVisible(); - if (vis == "false") { - // make invisible - return; - } - qx.ui.core.Widget.flushGlobalQueues(); - if (this._viz == null) { - this.info("Creating rgraph."); - var qParent = document.getElementById(this._id); - var vizParent = document.createElement("div"); - var vizId = "vizParent"+this._id; - vizParent.setAttribute("id", vizId); - qParent.appendChild(vizParent); - var widgetId = this._id; - vizParent.width = this.getWidth(); - vizParent.height = this.getHeight(); - var rg = new $jit.RGraph({ - injectInto: vizId, - //Optional: create a background canvas that plots - //concentric circles. - background: { - CanvasStyles: { - strokeStyle: '#555' - } - }, - //interpolation type, can be linear or polar - //interpolation: 'linear', - //parent-children distance - //levelDistance: 100, - //withLabels: true, - duration: 1000, - fps: 25, - Navigation: { - enable:true, - panning:true, - zooming: 20 - }, - Node: { + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + var rg = new $jit.RGraph({ + injectInto: vizId, + //Optional: create a background canvas that plots + //concentric circles. + background: { + CanvasStyles: { + strokeStyle: '#555' + } + }, + //interpolation type, can be linear or polar + //interpolation: 'linear', + //parent-children distance + //levelDistance: 100, + //withLabels: true, + duration: 1000, + fps: 25, + Navigation: { + enable:true, + panning:true, + zooming: 20 + }, + Node: { // overridable: false, // type: 'circle', - color: '#ccddee' + color: '#ccddee' // lineWidth: 1, // height: 5, // width: 5, // dim: 3 - }, - Edge: { + }, + Edge: { // overridable: false, // type: 'line', - color: '#772277' + color: '#772277' // lineWidth: 1 - }, - onBeforeCompute: function(node) { - //do something onBeforeCompute - }, - onAfterCompute: function(){ - var node = $jit.Graph.Util.getClosestNodeToOrigin(rg.graph, "current"); - qParent.selection = node; - //fire selection event - parent.info("Sending selected node: "+node.id); - var req = org.eclipse.swt.Request.getInstance(); - req.addParameter(widgetId + ".selectedNode", node.id); - req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); - req.send(); - }, - //Change some label dom properties. - //This method is called each time a label is plotted. - onPlaceLabel: function(domElement, node){ - var style = domElement.style; - style.display = ''; - style.cursor = 'pointer'; - var font = parent.getFont(); - style.fontFamily = font.getFamily(); - try { - style.fontStyle = font.generateStyle(); - } - catch (e) { - //ignore..some items are not cross - browser compatible - } - var color = parent.getTextColor(); - if (node._depth <= 1) { - style.fontSize = font.getSize(); - style.color = color; - - } else if(node._depth == 2){ - style.fontSize = font.getSize()-2; - style.color = "#555"; - - } else { - style.display = 'none'; - } - var left = parseInt(style.left); - var w = domElement.offsetWidth; - style.left = (left - w / 2) + 'px'; - }, - - //Add a controller to make the tree move on click. - onCreateLabel: function(domElement, node) { - domElement.innerHTML = node.name; - domElement.onclick = function() { - rg.onClick(node.id); - }; - }, - onBeforePlotNode:function(node) { - //do something onBeforePlotNode - }, - onAfterPlotNode: function(node) { - //do something onAfterPlotNode - }, - onBeforePlotLine:function(adj) { - //do something onBeforePlotLine - }, - onAfterPlotLine: function(adj) { - //do something onAfterPlotLine - } - }); - - this.addEventListener("changeWidth", function(e) { - if (vizParent != null) { - vizParent.width = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - rg.canvas.resize(vizParent.width, vizParent.height); - rg.refresh(); - } - } - }); - this.addEventListener("changeHeight", function(e) { - if (vizParent != null) { - vizParent.height = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - rg.canvas.resize(vizParent.width, vizParent.height); - rg.refresh(); - } - } - }); - - this._viz = rg; - this._vizParent = vizParent; - } - } - catch (e) { - this.info(e); - } - }, - - addTreeEvent : function (obj, type, fn) { - if (obj.addEventListener) obj.addEventListener(type, fn, false); - else obj.attachEvent('on' + type, fn); - }, - - refreshData : function () { - try { - var rg = this._viz; - if (rg != null) { - var data = this.getWidgetData(); - if (data != null) { - this.info("Loading rgraph data."); - rg.loadJSON(data); - this.info("Refreshing rgraph."); - rg.refresh(); - rg.controller.onAfterCompute(); - } - } - } - catch (e) { - this.info(e); - } - }, - - setProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setNodeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Node[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setEdgeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Edge[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setZoom : function (percent) { - try { - var st = this._viz; - if (st != null) { - st.canvas.scale(percent,percent); - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - selectNode : function (id) { - try { - var rg = this._viz; - if (rg != null) { - rg.onClick(id); + }, + onBeforeCompute: function(node) { + //do something onBeforeCompute + }, + onAfterCompute: function(){ + var node = $jit.Graph.Util.getClosestNodeToOrigin(rg.graph, "current"); + //qParent.selection = node; + //fire selection event + parent.info("Sending selected node: "+node.id); + var req = rwt.remote.Server.getInstance(); + req.addParameter(widgetId + ".selectedNode", node.id); + req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); + req.send(); + }, + //Change some label dom properties. + //This method is called each time a label is plotted. + onPlaceLabel: function(domElement, node){ + var style = domElement.style; + style.display = ''; + style.cursor = 'pointer'; + var font = parent.getFont(); + style.fontFamily = font.getFamily(); + try { + style.fontStyle = font.generateStyle(); + } + catch (e) { + //ignore..some items are not cross - browser compatible + } + var color = parent.getTextColor(); + if (node._depth <= 1) { + style.fontSize = font.getSize(); + style.color = color; + + } else if(node._depth == 2){ + style.fontSize = font.getSize()-2; + style.color = "#555"; + + } else { + style.display = 'none'; + } + var left = parseInt(style.left); + var w = domElement.offsetWidth; + style.left = (left - w / 2) + 'px'; + }, + + //Add a controller to make the tree move on click. + onCreateLabel: function(domElement, node) { + domElement.innerHTML = node.name; + domElement.onclick = function() { + rg.onClick(node.id); + }; + }, + onBeforePlotNode:function(node) { + //do something onBeforePlotNode + }, + onAfterPlotNode: function(node) { + //do something onAfterPlotNode + }, + onBeforePlotLine:function(adj) { + //do something onBeforePlotLine + }, + onAfterPlotLine: function(adj) { + //do something onAfterPlotLine + } + }); + this.addEventListener("changeWidth", function(e) { + if (domElement != null) { + domElement.width = e.getValue(); + if (domElement.height != null && domElement.width != null) { + rg.canvas.resize(domElement.width, domElement.height); + rg.refresh(); + } + } + }); + this.addEventListener("changeHeight", function(e) { + if (domElement != null) { + domElement.height = e.getValue(); + if (domElement.height != null && domElement.width != null) { + rg.canvas.resize(domElement.width, domElement.height); + rg.refresh(); + } } - } - catch (e) { - this.info(e); - } - }, - - _doResize : function() { - qx.ui.core.Widget.flushGlobalQueues(); - + }); + return rg; } } -});
\ No newline at end of file +}); + +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.RGraph", + org.eclipse.rap.rwt.visualization.jit.RGraph);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraphLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraphLCA.java index 2ced709..c9528c0 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraphLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/rgraphkit/RGraphLCA.java @@ -17,8 +17,8 @@ import org.eclipse.rap.rwt.visualization.jit.internal.JITGraphLCA; public class RGraphLCA extends JITGraphLCA { - public Class getWidgetType () { + @Override + public Class<?> getWidgetType() { return RGraph.class; } - } diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTree.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTree.js index 168107d..cc8a284 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTree.js +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTree.js @@ -15,395 +15,229 @@ * *****************************************************************************/ qx.Class.define("org.eclipse.rap.rwt.visualization.jit.SpaceTree", -{ extend :qx.ui.layout.CanvasLayout, +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, - construct : function(id) { - this.base(arguments); - this.setHtmlProperty("id", id); - this._id = id; - this._viz = null; - }, - - properties : { - visible : { - init :"", - apply :"load" - }, - widgetData : { - init :"", - apply :"refreshData" - } - }, - - destruct : function() { - - }, - members : { - - _doActivate : function() { - var shell = null; - var parent = this.getParent(); - while (shell == null && parent != null) { - if (parent.classname == "org.eclipse.swt.widgets.Shell") { - shell = parent; - } - parent = parent.getParent(); - } - if (shell != null) { - shell.setActiveChild(this); - } - }, - load : function() { - var parent = this; - try { - var vis = this.getVisible(); - if (vis == "false") { - // make invisible - return; - } - qx.ui.core.Widget.flushGlobalQueues(); - if (this._viz == null) { - this.info("Creating spacetree."); - var qParent = document.getElementById(this._id); - var vizParent = document.createElement("div"); - var vizId = "vizParent"+this._id; - vizParent.setAttribute("id", vizId); - qParent.appendChild(vizParent); - vizParent.width = this.getWidth(); - vizParent.height = this.getHeight(); - var widgetId = this._id; - - //Create a node rendering function that plots a fill - //rectangle and a stroke rectangle for borders - $jit.ST.Plot.NodeTypes.implement({ - 'stroke-rect': { - 'render': function(node, canvas) { - var width = node.getData('width'), - height = node.getData('height'), - pos = this.getAlignedPos(node.pos.getc(true), width, height), - posX = pos.x + width/2, - posY = pos.y + height/2; - this.nodeHelper.rectangle.render('fill', {x: posX, y: posY}, - width, height, canvas); - this.nodeHelper.rectangle.render('stroke', {x: posX, y: posY}, - width, height, canvas); - } - } - }); - - var st = new $jit.ST({ - injectInto: vizId, - orientation: "left", - levelsToShow: 2, - subtreeOffset: 8, - siblingOffset: 5, - levelDistance: 30, - withLabels: true, - align: "center", - multitree: false, - indent: 10, - //set distance between node and its children - levelDistance: 50, - Navigation: { - enable:true, - panning:true, - zooming: 20 - }, - Node: { - overridable: true, - type: 'stroke-rect', - /*type: 'rectangle',*/ - color: '#ccb', - lineWidth: 1, - height: 20, - width: 90, - dim: 15, - align: "center", - CanvasStyles: { - fillStyle: '#ccb', - strokeStyle: '#829bcd', - lineWidth: 2 - } - }, - Edge: { - overridable: true, - type: 'bezier', - dim: 15, - lineWidth: 1 - }, - Tips: { - enable: true, - force: true, - type: 'auto', - offsetX: 10, - offsetY: 10, - onShow: function(tip, node) { - tip.style.border = "1px solid #c0c0c0"; - tip.style.backgroundColor = "#ddd"; - tip.innerHTML = node.name; - tip.style.zIndex = 1000000000; - } - }, - duration: 700, - fps: 25, - transition: $jit.Trans.Quart.easeInOut, - clearCanvas: true, - - onBeforeCompute: function(node) { - //do something onBeforeCompute - }, - onAfterCompute: function(){ - var node = $jit.Graph.Util.getClosestNodeToOrigin(st.graph, "current"); - qParent.selection = node; - //fire selection event - parent.info("Sending selected node: "+node.id); - var req = org.eclipse.swt.Request.getInstance(); - req.addParameter(widgetId + ".selectedNode", node.id); - req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); - req.send(); - }, - onCreateLabel: function(domElement, node) { - domElement.id = node.id; - domElement.innerHTML = node.name; - domElement.onclick = function(){ - st.onClick(node.id); - }; - //set label styles - var style = domElement.style; - var font = parent.getFont(); - style.fontFamily = font.getFamily(); - try { - style.fontStyle = font.generateStyle(); - } - catch (e) { - //ignore..some items are not cross - browser compatible - } - style.fontSize = font.getSize(); - style.width = st.controller.Node.width + 'px'; - style.height = st.controller.Node.height + 'px'; - style.cursor = 'pointer'; - style.textAlign= 'center'; - style.verticalAlign = 'middle'; - style.padding = '3px'; - var color = parent.getTextColor(); - style.color = color; - }, - onPlaceLabel: function(domElement, node) { - //future use - var style = domElement.style; - //todo align top and left based on scale - var width = st.controller.Node.width*st.canvas.scaleOffsetX; - var height = st.controller.Node.height*st.canvas.scaleOffsetY; - style.width = width + 'px'; - style.height = height + 'px'; - - var pos = node.pos.getc(true); - var w = node.getData('width'); - var h = node.getData('height'); - var radius = st.canvas.getSize(); - - var ox = st.canvas.translateOffsetX; - var oy = st.canvas.translateOffsetY; - var sx = st.canvas.scaleOffsetX; - var sy = st.canvas.scaleOffsetY; - var posx = pos.x * sx + ox; - var posy = pos.y * sy + oy; - //use scaled width - var left = Math.round(posx - width / 2 + radius.width/2); - var top = Math.round(posy - height / 2 + radius.height/2); - style.left = left+'px'; - style.top = top+'px'; - var font = parent.getFont(); - style.fontSize = Math.ceil(font.getSize()*sx)+'pt'; - - //don't show if not in canvas - var canvasSize = st.canvas.getSize(); - if(left >= canvasSize.width || left < 0 || top >= canvasSize.height || top < 0) { - style.display = 'none'; - } - else { - style.display = ''; - } - }, - onBeforePlotNode:function(node) { - //add some color to the nodes in the path between the - //root node and the selected node. - if (node.selected) { - node.setCanvasStyle('strokeStyle', "#fff"); - node.setCanvasStyle('fillStyle', "#ff7"); + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + //Create a node rendering function that plots a fill + //rectangle and a stroke rectangle for borders + $jit.ST.Plot.NodeTypes.implement({ + 'stroke-rect': { + 'render': function(node, canvas) { + var width = node.getData('width'), + height = node.getData('height'), + pos = this.getAlignedPos(node.pos.getc(true), width, height), + posX = pos.x + width/2, + posY = pos.y + height/2; + this.nodeHelper.rectangle.render('fill', {x: posX, y: posY}, + width, height, canvas); + this.nodeHelper.rectangle.render('stroke', {x: posX, y: posY}, + width, height, canvas); + } + } + }); + + var st = new $jit.ST({ + injectInto: vizId, + orientation: "left", + levelsToShow: 2, + subtreeOffset: 8, + siblingOffset: 5, + levelDistance: 30, + withLabels: true, + align: "center", + multitree: false, + indent: 10, + //set distance between node and its children + levelDistance: 50, + Navigation: { + enable:true, + panning:true, + zooming: 20 + }, + Node: { + overridable: true, + type: 'stroke-rect', + /*type: 'rectangle',*/ + color: '#ccb', + lineWidth: 1, + height: 20, + width: 90, + dim: 15, + align: "center", + CanvasStyles: { + fillStyle: '#ccb', + strokeStyle: '#829bcd', + lineWidth: 2 + } + }, + Edge: { + overridable: true, + type: 'bezier', + dim: 15, + lineWidth: 1 + }, + Tips: { + enable: true, + force: true, + type: 'auto', + offsetX: 10, + offsetY: 10, + onShow: function(tip, node) { + tip.style.border = "1px solid #c0c0c0"; + tip.style.backgroundColor = "#ddd"; + tip.innerHTML = node.name; + tip.style.zIndex = 1000000000; + } + }, + duration: 700, + fps: 25, + transition: $jit.Trans.Quart.easeInOut, + clearCanvas: true, + + onBeforeCompute: function(node) { + //do something onBeforeCompute + }, + onAfterCompute: function(){ + var node = $jit.Graph.Util.getClosestNodeToOrigin(st.graph, "current"); +// qParent.selection = node; + //fire selection event + parent.info("Sending selected node: "+node.id); + var req = rwt.remote.Server.getInstance(); + req.addParameter(widgetId + ".selectedNode", node.id); + req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); + req.send(); + }, + onCreateLabel: function(domElement, node) { + domElement.id = node.id; + domElement.innerHTML = node.name; + domElement.onclick = function(){ + st.onClick(node.id); + }; + //set label styles + var style = domElement.style; + var font = parent.getFont(); + style.fontFamily = font.getFamily(); + try { + style.fontStyle = font.generateStyle(); + } + catch (e) { + //ignore..some items are not cross - browser compatible + } + style.fontSize = font.getSize(); + style.width = st.controller.Node.width + 'px'; + style.height = st.controller.Node.height + 'px'; + style.cursor = 'pointer'; + style.textAlign= 'center'; + style.verticalAlign = 'middle'; + style.padding = '3px'; + var color = parent.getTextColor(); + style.color = color; + }, + onPlaceLabel: function(domElement, node) { + //future use + var style = domElement.style; + //todo align top and left based on scale + var width = st.controller.Node.width*st.canvas.scaleOffsetX; + var height = st.controller.Node.height*st.canvas.scaleOffsetY; + style.width = width + 'px'; + style.height = height + 'px'; + + var pos = node.pos.getc(true); + var w = node.getData('width'); + var h = node.getData('height'); + var radius = st.canvas.getSize(); + + var ox = st.canvas.translateOffsetX; + var oy = st.canvas.translateOffsetY; + var sx = st.canvas.scaleOffsetX; + var sy = st.canvas.scaleOffsetY; + var posx = pos.x * sx + ox; + var posy = pos.y * sy + oy; + //use scaled width + var left = Math.round(posx - width / 2 + radius.width/2); + var top = Math.round(posy - height / 2 + radius.height/2); + style.left = left+'px'; + style.top = top+'px'; + var font = parent.getFont(); + style.fontSize = Math.ceil(font.getSize()*sx)+'pt'; + + //don't show if not in canvas + var canvasSize = st.canvas.getSize(); + if(left >= canvasSize.width || left < 0 || top >= canvasSize.height || top < 0) { + style.display = 'none'; + } + else { + style.display = ''; + } + }, + onBeforePlotNode:function(node) { + //add some color to the nodes in the path between the + //root node and the selected node. + if (node.selected) { + node.setCanvasStyle('strokeStyle', "#fff"); + node.setCanvasStyle('fillStyle', "#ff7"); // node.data.$color = "#ff7"; - } - else { + } + else { // delete node.data.$color; - node.setCanvasStyle('strokeStyle', "#829bcd"); - var GUtil = $jit.Graph.Util; - //if the node belongs to the last plotted level - if(!GUtil.anySubnode(node, "exist")) { - //count children number - var count = 0; - GUtil.eachSubnode(node, function(n) { count++; }); - //assign a node color based on - //how many children it has - node.setCanvasStyle('fillStyle', ['#aaa', '#baa', '#caa', '#daa', '#eaa', '#faa'][count]); + node.setCanvasStyle('strokeStyle', "#829bcd"); + var GUtil = $jit.Graph.Util; + //if the node belongs to the last plotted level + if(!GUtil.anySubnode(node, "exist")) { + //count children number + var count = 0; + GUtil.eachSubnode(node, function(n) { count++; }); + //assign a node color based on + //how many children it has + node.setCanvasStyle('fillStyle', ['#aaa', '#baa', '#caa', '#daa', '#eaa', '#faa'][count]); // node.data.$color = ['#aaa', '#baa', '#caa', '#daa', '#eaa', '#faa'][count]; - } - } - }, - onAfterPlotNode: function(node) { - //do something onAfterPlotNode - }, - onBeforePlotLine:function(adj) { - if (adj.nodeFrom.selected && adj.nodeTo.selected) { - adj.data.$color = "#fff"; - adj.data.$lineWidth = 3; - } - else { - delete adj.data.$color; - delete adj.data.$lineWidth; - } - }, - onAfterPlotLine: function(adj) { - //do something onAfterPlotLine - }, - request: false - }); - this.addEventListener("changeWidth", function(e) { - if (vizParent != null) { - vizParent.width = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - st.canvas.resize(vizParent.width, vizParent.height); - st.refresh(); - } - } - }); - this.addEventListener("changeHeight", function(e) { - if (vizParent != null) { - vizParent.height = e.getValue(); - if (vizParent.height != null && vizParent.width != null) { - st.canvas.resize(vizParent.width, vizParent.height); - st.refresh(); - } - } - }); - - this._viz = st; - this._vizParent = vizParent; - } - } - catch (e) { - this.info(e); - } - }, - - addTreeEvent : function (obj, type, fn) { - if (obj.addEventListener) obj.addEventListener(type, fn, false); - else obj.attachEvent('on' + type, fn); - }, - - refreshData : function () { - try { - var st = this._viz; - if (st != null) { - this.info("Loading spacetree data."); - var data = this.getWidgetData(); - if (data != null) { - st.loadJSON(data); - //compute node positions and layout - st.compute(); - //Emulate a click on the root node. - st.onClick(st.root); - } - } - } - catch (e) { - this.info(e); - } - }, - - setProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setNodeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Node[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setEdgeProperty : function (propName, propValue) { - try { - var st = this._viz; - if (st != null) { - st.controller.Edge[propName] = propValue; - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - - setZoom : function (percent) { - try { - var st = this._viz; - if (st != null) { - st.canvas.scale(percent,percent); - st.refresh(); - } - } - catch (e) { - this.info(e); - } - }, - -// zoomToFit : function () { -// try { -// var st = this._viz; -// if (st != null) { -// var sz = st.canvas.getSize(); -// var xratio = sz.width/st.canvas.virtualWidth; -// var yratio = sz.height/st.canvas.virtualHeight; -// st.canvas.scale(xratio,yratio); -// st.refresh(); -// } -// } -// catch (e) { -// this.info(e); -// } -// }, - - selectNode : function (id) { - try { - var st = this._viz; - if (st != null) { - st.onClick(id); + } + } + }, + onAfterPlotNode: function(node) { + //do something onAfterPlotNode + }, + onBeforePlotLine:function(adj) { + if (adj.nodeFrom.selected && adj.nodeTo.selected) { + adj.data.$color = "#fff"; + adj.data.$lineWidth = 3; + } + else { + delete adj.data.$color; + delete adj.data.$lineWidth; + } + }, + onAfterPlotLine: function(adj) { + //do something onAfterPlotLine + }, + request: false + }); + this.addEventListener("changeWidth", function(e) { + if (domElement != null) { + domElement.width = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + st.refresh(); + } } - } - catch (e) { - this.info(e); - } - }, - - _doResize : function() { - qx.ui.core.Widget.flushGlobalQueues(); + }); + this.addEventListener("changeHeight", function(e) { + if (domElement != null) { + domElement.height = e.getValue(); + if (domElement.height != null && domElement.width != null) { + st.canvas.resize(domElement.width, domElement.height); + st.refresh(); + } + } + }); } } -});
\ No newline at end of file +}); + +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.SpaceTree", + org.eclipse.rap.rwt.visualization.jit.SpaceTree);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTreeLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTreeLCA.java index 4bbe94e..407650d 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTreeLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/spacetreekit/SpaceTreeLCA.java @@ -17,8 +17,8 @@ import org.eclipse.rap.rwt.visualization.jit.internal.JITGraphLCA; public class SpaceTreeLCA extends JITGraphLCA { - public Class getWidgetType () { + @Override + public Class<?> getWidgetType() { return SpaceTree.class; } - } diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMap.js b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMap.js index fc4377c..3c0d613 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMap.js +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMap.js @@ -15,144 +15,92 @@ * *****************************************************************************/ qx.Class.define("org.eclipse.rap.rwt.visualization.jit.TreeMap", -{ extend :qx.ui.layout.CanvasLayout, +{ extend :org.eclipse.rap.rwt.visualization.jit.BaseVisualization, - construct : function(id,type) { - this.base(arguments); - this.setHtmlProperty("id", id); - this._id = id; - this._viz = null; - this._type = type; - }, - - properties : { - visible : { - init :"", - apply :"load" - }, - widgetData : { - init :"", - apply :"refreshData" - } - }, - - destruct : function() { - - }, - members : { - - _doActivate : function() { - var shell = null; - var parent = this.getParent(); - while (shell == null && parent != null) { - if (parent.classname == "org.eclipse.swt.widgets.Shell") { - shell = parent; - } - parent = parent.getParent(); + + _createViz : function(domElement) { + var vizId = domElement.getAttribute("id"); + var parent = this; + domElement.setAttribute("style","position:absolute;overflow:hidden;display:table-cell;width:100%;vertical-align:middle;height:100%;z-order:auto;"); + domElement.width = this.getWidth(); + domElement.height = this.getHeight(); + qParent.appendChild(domElement); + var vizStyle = "#infovis div {position:absolute;overflow:hidden;font-size:11px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;}#infovis .content {background-color:#333;border:0px solid #111;} #infovis .head {color:white;background-color:#444;} #infovis .head.in-path {background-color:#655;} #infovis .body {background-color:black;} #infovis .leaf {color:white;background-color:#111;display:table-cell;vertical-align:middle;border:1px solid #000;} #infovis .over-leaf {border:1px solid #9FD4FF;} #infovis .over-content {background-color: #9FD4FF;} #infovis .over-head {background-color:#A4D9FF;color:black;} .tip {color: #fff;width: 139px;background-color: black;opacity:0.9;filter:alpha(opacity=90);font-size:10px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;padding:7px;} .album {width:100px;margin:3px;} input {font-size:10px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;}"; + vizStyle = vizStyle.replace(/infovis/gi,vizId); + qx.html.StyleSheet.createElement(vizStyle); + + var tm = null; + var config = { + titleHeight: 15, + animate: true, + //The id of the treemap container + injectInto: vizId, + //Set the max. depth to be shown for a subtree + levelsToShow: 2, + offset:1, + Events: { + enable: true, + onClick: function(node) { + if(node) tm.enter(node); + }, + onRightClick: function() { + tm.out(); + } + }, + duration: 800, + //Enable tips + Tips: { + enable: true, + //add positioning offsets + offsetX: 20, + offsetY: 20, + //implement the onShow method to + //add content to the tooltip when a node + //is hovered + onShow: function(tip, node, isLeaf, domElement) { + tip.style.zIndex="100000000"; + var html = "<div class=\"tip-title\">" + node.name + + "</div><div class=\"tip-text\">"; + var data = node.data; + if(data.usecount) { + html += "Usage Count: " + data.usecount; + } + tip.innerHTML = html; + } + }, + //Add the name of the node in the correponding label + //This method is called once, on label creation. + onCreateLabel: function(domElement, node){ + domElement.innerHTML = node.name; + var style = domElement.style; + style.display = ''; + style.border = '1px solid transparent'; + domElement.onmouseover = function() { + style.border = '1px solid #9FD4FF'; + }; + domElement.onmouseout = function() { + style.border = '1px solid transparent'; + }; + } + }; + + if (this._type == 2) { + tm = new $jit.TM.Strip(config); } - if (shell != null) { - shell.setActiveChild(this); + else if (this._type == 1) { + tm = new $jit.TM.Squarified(config); } - }, - - load : function() { - var parent = this; - try { - var vis = this.getVisible(); - if (vis == "false") { - // make invisible - return; - } - qx.ui.core.Widget.flushGlobalQueues(); - if (this._viz == null) { - this.info("Creating treemap."); - - var qParent = document.getElementById(this._id); - var vizParent = document.createElement("div"); - var vizId = "vizParent"+this._id; - vizParent.setAttribute("id", vizId); - vizParent.setAttribute("style","position:absolute;overflow:hidden;display:table-cell;width:100%;vertical-align:middle;height:100%;z-order:auto;"); - vizParent.width = this.getWidth(); - vizParent.height = this.getHeight(); - qParent.appendChild(vizParent); - var vizStyle = "#infovis div {position:absolute;overflow:hidden;font-size:11px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;}#infovis .content {background-color:#333;border:0px solid #111;} #infovis .head {color:white;background-color:#444;} #infovis .head.in-path {background-color:#655;} #infovis .body {background-color:black;} #infovis .leaf {color:white;background-color:#111;display:table-cell;vertical-align:middle;border:1px solid #000;} #infovis .over-leaf {border:1px solid #9FD4FF;} #infovis .over-content {background-color: #9FD4FF;} #infovis .over-head {background-color:#A4D9FF;color:black;} .tip {color: #fff;width: 139px;background-color: black;opacity:0.9;filter:alpha(opacity=90);font-size:10px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;padding:7px;} .album {width:100px;margin:3px;} input {font-size:10px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;}"; - vizStyle = vizStyle.replace(/infovis/gi,vizId); - qx.html.StyleSheet.createElement(vizStyle); - - var tm = null; - var config = { - titleHeight: 15, - animate: true, - //The id of the treemap container - injectInto: vizId, - //Set the max. depth to be shown for a subtree - levelsToShow: 1, - offset:1, - Events: { - enable: true, - onClick: function(node) { - if(node) tm.enter(node); - }, - onRightClick: function() { - tm.out(); - } - }, - duration: 800, - //Enable tips - Tips: { - enable: true, - //add positioning offsets - offsetX: 20, - offsetY: 20, - //implement the onShow method to - //add content to the tooltip when a node - //is hovered - onShow: function(tip, node, isLeaf, domElement) { - var html = "<div class=\"tip-title\">" + node.name - + "</div><div class=\"tip-text\">"; - var data = node.data; - if(data.playcount) { - html += "play count: " + data.playcount; - } - if(data.image) { - html += "<img src=\""+ data.image +"\" class=\"album\" />"; - } - tip.innerHTML = html; - } - }, - //Add the name of the node in the correponding label - //This method is called once, on label creation. - onCreateLabel: function(domElement, node){ - domElement.innerHTML = node.name; - var style = domElement.style; - style.display = ''; - style.border = '1px solid transparent'; - domElement.onmouseover = function() { - style.border = '1px solid #9FD4FF'; - }; - domElement.onmouseout = function() { - style.border = '1px solid transparent'; - }; - } - }; - - if (this._type == 2) { - tm = new $jit.TM.Strip(config); - } - else if (this._type == 1) { - tm = new $jit.TM.Squarified(config); - } - else { - tm = new $jit.TM.SliceAndDice(config); - } - + else { + tm = new $jit.TM.SliceAndDice(config); + } + // tm.onLeftClick = function(elem) { // this.enter(elem); // var node = elem; // qParent.selection = node; // //fire selection event -// var req = org.eclipse.swt.Request.getInstance(); +// var req = rwt.remote.Server.getInstance(); // req.addParameter(widgetId + ".selectedNode", node.id); // req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); // req.send(); @@ -162,82 +110,42 @@ qx.Class.define("org.eclipse.rap.rwt.visualization.jit.TreeMap", // this.out(); // qParent.selection = node; // //fire selection event -// var req = org.eclipse.swt.Request.getInstance(); +// var req = rwt.remote.Server.getInstance(); // req.addParameter(widgetId + ".selectedNode", this.shownTree.id); // req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId ); // req.send(); // // }; - - this.addEventListener("changeWidth", function(e) { - vizParent.width = this.getWidth(); - if (vizParent.height != null && vizParent.width != null) { - tm.canvas.resize(vizParent.width, vizParent.height); -// qx.client.Timer.once(function() { + + this.addEventListener("changeWidth", function(e) { + domElement.width = this.getWidth(); + if (domElement.height != null && domElement.width != null) { + tm.canvas.resize(domElement.width, domElement.height); +// rwt.client.Timer.once(function() { // parent.refreshData(); // },this,100); - } - }); - this.addEventListener("changeHeight", function(e) { - vizParent.height = this.getHeight(); - if (vizParent.height != null && vizParent.width != null) { - tm.canvas.resize(vizParent.width, vizParent.height); -// qx.client.Timer.once(function() { + } + }); + this.addEventListener("changeHeight", function(e) { + domElement.height = this.getHeight(); + if (domElement.height != null && domElement.width != null) { + tm.canvas.resize(domElement.width, domElement.height); +// rwt.client.Timer.once(function() { // parent.refreshData(); // },this,100); - } - }); - - this._viz = tm; - this._vizParent = vizParent; - //This is a hack to ensure that a refresh is called after the style tag above is - //initialized -// qx.client.Timer.once(function() { + } + }); + + //This is a hack to ensure that a refresh is called after the style tag above is + //initialized +// rwt.client.Timer.once(function() { // this.refreshData(); // },this,100); - } - } - catch (e) { - this.info(e); - } - }, - - addTreeEvent : function (obj, type, fn) { - if (obj.addEventListener) obj.addEventListener(type, fn, false); - else obj.attachEvent('on' + type, fn); - }, - - refreshData : function () { - try { - var tm = this._viz; - if (tm != null) { - var data = this.getWidgetData(); - if (data != null) { - this.info("Loading treemap data."); - tm.loadJSON(data); - } - } - } - catch (e) { - this.info(e); - } - }, - - selectNode : function (id) { - try { - var tm = this._viz; - if (tm != null) { - tm.onLeftClick(id); - } - } - catch (e) { - this.info(e); - } - }, - - - _doResize : function() { - qx.ui.core.Widget.flushGlobalQueues(); + return tm; } } -});
\ No newline at end of file +}); + +org.eclipse.rap.rwt.visualization.jit.BaseVisualization.registerAdapter( + "org.eclipse.rap.rwt.visualization.jit.TreeMap", + org.eclipse.rap.rwt.visualization.jit.TreeMap);
\ No newline at end of file diff --git a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMapLCA.java b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMapLCA.java index 7ca59e1..86e8169 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMapLCA.java +++ b/bundles/org.eclipse.rap.rwt.visualization.jit/src/org/eclipse/rap/rwt/visualization/jit/internal/treemapkit/TreeMapLCA.java @@ -19,14 +19,15 @@ import org.eclipse.rap.rwt.visualization.jit.internal.JITWidgetLCA; public class TreeMapLCA extends JITWidgetLCA { - public Class getWidgetType () { + @Override + public Class<?> getWidgetType() { return TreeMap.class; } - - protected Collection getInitializationParameters(JITVisualizationWidget vWidget) { - Collection params = super.getInitializationParameters(vWidget); - params.add(new Integer(((TreeMap)vWidget).getType())); + + @Override + protected Collection<?> getInitializationParameters( JITVisualizationWidget vWidget ) { + Collection params = super.getInitializationParameters( vWidget ); + params.add( new Integer( ( ( TreeMap )vWidget ).getType() ) ); return params; } - } |