]> git.argeo.org Git - gpl/argeo-suite.git/blob - swt/chart/AbstractJsChart.java
Prepare next development cycle
[gpl/argeo-suite.git] / swt / chart / AbstractJsChart.java
1 package org.argeo.app.swt.chart;
2
3 import org.argeo.app.swt.js.SwtBrowserJsPart;
4 import org.eclipse.swt.widgets.Composite;
5
6 /** Base class for charts. */
7 public abstract class AbstractJsChart extends SwtBrowserJsPart {
8 private String chartName;
9
10 protected abstract String getJsImplementation();
11
12 public AbstractJsChart(String chartName, Composite parent, int style) {
13 super(parent, style, "/pkg/org.argeo.app.js/chart.html");
14 this.chartName = chartName;
15 }
16
17 @Override
18 protected void init() {
19 // create chart
20 doExecute(getJsChartVar() + " = new " + getJsImplementation() + "('" + chartName + "');");
21 }
22
23 protected String getJsChartVar() {
24 return getJsVarName(chartName);
25 }
26
27 protected void executeChartMethod(String methodCall, Object... args) {
28 executeMethod(getJsChartVar(), methodCall, args);
29 }
30
31 }