Skip to content

Commit faca8b3

Browse files
committed
Updated to newest JsInterops
1 parent 65042de commit faca8b3

File tree

76 files changed

+945
-1403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+945
-1403
lines changed

Diff for: dygraphs-gwt-sample/pom.xml

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33
<parent>
4-
<groupId>com.github.timeu.dygraphs-gwt</groupId>
4+
<groupId>com.github.timeu.gwt-libs.dygraphs-gwt</groupId>
55
<artifactId>dygraphs-gwt-parent</artifactId>
66
<version>1.0.0-SNAPSHOT</version>
77
</parent>
@@ -48,17 +48,11 @@
4848
<dependency>
4949
<groupId>com.google.gwt</groupId>
5050
<artifactId>gwt-dev</artifactId>
51-
<scope>provided</scope>
5251
</dependency>
5352
<dependency>
54-
<groupId>com.github.timeu.dygraphs-gwt</groupId>
53+
<groupId>com.github.timeu.gwt-libs.dygraphs-gwt</groupId>
5554
<artifactId>dygraphs-gwt</artifactId>
56-
<type>gwt-lib</type>
55+
<type>gwt-lib</type>
5756
</dependency>
58-
<!--<dependency>
59-
<groupId>com.github.timeu.dygraphs-gwt</groupId>
60-
<artifactId>dygraphs-gwt</artifactId>
61-
<type>jar</type>
62-
</dependency>-->
6357
</dependencies>
6458
</project>

Diff for: dygraphs-gwt-sample/src/main/java/sample/client/SampleEntryPoint.java

-6
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,9 @@
1515
*/
1616
package sample.client;
1717

18-
import com.github.timeu.dygraphsgwt.client.DygraphsOptionsImpl;
19-
import com.github.timeu.dygraphsgwt.client.Dygraphs;
20-
import com.github.timeu.dygraphsgwt.client.DygraphsOptions;
2118
import com.github.timeu.dygraphsgwt.client.ScriptInjector;
22-
import com.github.timeu.dygraphsgwt.client.callbacks.xValueParserCallback;
2319
import com.google.gwt.core.client.EntryPoint;
24-
import com.google.gwt.core.client.GWT;
2520
import com.google.gwt.user.client.ui.RootLayoutPanel;
26-
import com.google.gwt.user.client.ui.RootPanel;
2721

2822
/**
2923
* Initializes the application. Nothing to see here: everything interesting

Diff for: dygraphs-gwt-sample/src/main/java/sample/client/examples/AnnotationExample.java

+30-30
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22

33
import com.github.timeu.dygraphsgwt.client.Dygraphs;
44
import com.github.timeu.dygraphsgwt.client.DygraphsOptions;
5-
import com.github.timeu.dygraphsgwt.client.DygraphsOptionsImpl;
65
import com.github.timeu.dygraphsgwt.client.callbacks.Annotation;
7-
import com.github.timeu.dygraphsgwt.client.callbacks.DataFunction;
8-
import com.google.gwt.core.client.GWT;
9-
import com.google.gwt.dom.client.DivElement;
106
import com.google.gwt.dom.client.Style;
117
import com.google.gwt.user.client.DOM;
128
import com.google.gwt.user.client.ui.Button;
139
import com.google.gwt.user.client.ui.Composite;
1410
import com.google.gwt.user.client.ui.FlowPanel;
1511
import com.google.gwt.user.client.ui.HTML;
16-
import com.google.gwt.user.client.ui.HTMLPanel;
1712
import com.google.gwt.user.client.ui.HorizontalPanel;
18-
import com.google.gwt.user.client.ui.SimplePanel;
1913
import com.google.gwt.user.client.ui.VerticalPanel;
2014

2115
import java.util.ArrayList;
@@ -43,7 +37,9 @@ public AnnotationExample() {
4337
Button addBtn = new Button("Add Annotation");
4438
addBtn.addClickHandler(event -> {
4539
int x = lastAnnotationX + 2;
46-
Annotation annotation = new Annotation("line","200610"+x);
40+
Annotation annotation = new Annotation();
41+
annotation.series = "line";
42+
annotation.x = "200610"+x;
4743
annotation.shortText = String.valueOf(x);
4844
annotation.text="Line "+x;
4945
annotation.tickHeight=10;
@@ -78,7 +74,9 @@ public AnnotationExample() {
7874
}
7975

8076
private static Annotation createAnnotation(int x) {
81-
Annotation annotation = new Annotation("sine wave","200610" +x);
77+
Annotation annotation = new Annotation();
78+
annotation.series = "sine wave";
79+
annotation.x = "200610" +x;
8280
annotation.shortText=String.valueOf(x);
8381
annotation.text="Stock Market Crash "+ x;
8482
return annotation;
@@ -93,21 +91,23 @@ public void initDygraphs() {
9391
annotations.add(createAnnotation(x));
9492
lastAnnotationX = x;
9593
}
96-
Annotation specialAnnot = new Annotation("another line", "20061013");
94+
Annotation specialAnnot = new Annotation();
95+
specialAnnot.series = "another line";
96+
specialAnnot.x = "20061013";
9797
specialAnnot.icon ="http://dygraphs.com/gallery/images/dollar.png";
9898
specialAnnot.width=18D;
9999
specialAnnot.height=23D;
100100
specialAnnot.tickHeight=4;
101-
specialAnnot.text="Anothjer one";
102-
specialAnnot.setCssClas("annotation");
101+
specialAnnot.text="Another one";
102+
specialAnnot.cssClass = "annotation";
103103
specialAnnot.clickHandler =(annot, point, dygraph, event) -> events.add(new HTML("Special Handler"));
104104
annotations.add(specialAnnot);
105-
DygraphsOptions options = new DygraphsOptionsImpl();
106-
options.setRollPeriod(1);
107-
options.setShowRoller(true);
108-
options.setWidth(480);
109-
options.setHeight(320);
110-
options.setDrawCallback((g, initialDraw) -> {
105+
DygraphsOptions options = new DygraphsOptions();
106+
options.rollPeriod = 1;
107+
options.showRoller = true;
108+
options.width = 480;
109+
options.height = 320;
110+
options.drawCallback = (g, initialDraw) -> {
111111
Annotation[] anns = g.annotations();
112112
list.clear();
113113
for (Annotation annotation : anns) {
@@ -116,36 +116,36 @@ public void initDygraphs() {
116116
HTML listItem = new HTML("<div id='" + name + "'>" + name + ": " + shortText + " -> " + annotation.text + " </div>");
117117
list.add(listItem);
118118
}
119-
});
120-
options.setAnnotationClickHandler((ann, point, dygraphjs, event) -> {
119+
};
120+
options.annotationClickHandler = (ann, point, dygraphjs, event) -> {
121121
events.add(new HTML("<div>click: " + getNameFromAnnotation(ann) + "</div>"));
122-
});
122+
};
123123

124-
options.setAnnotationDblClickHandler((ann, point, dygraphjs, event) -> {
124+
options.annotationDblClickHandler = (ann, point, dygraphjs, event) -> {
125125
events.add(new HTML("<div>dblclick: " + getNameFromAnnotation(ann) + "</div>"));
126-
});
127-
options.setAnnotationMouseOverHandler((ann, point, dygraphjs, event) -> {
126+
};
127+
options.annotationMouseOverHandler = (ann, point, dygraphjs, event) -> {
128128
DOM.getElementById(getNameFromAnnotation(ann)).getStyle().setFontWeight(Style.FontWeight.BOLD);
129129
saveBg = ann.div.getStyle().getBackgroundColor();
130130
ann.div.getStyle().setBackgroundColor("#ddd");
131-
});
132-
options.setAnnotationMouseOutHandler((ann, point, dygraphjs, event) -> {
131+
};
132+
options.annotationMouseOutHandler = (ann, point, dygraphjs, event) -> {
133133
DOM.getElementById(getNameFromAnnotation(ann)).getStyle().setFontWeight(Style.FontWeight.NORMAL);
134134
ann.div.getStyle().setBackgroundColor(saveBg);
135-
GWT.log("mouseout");
136-
});
137-
options.setPointClickCallback((event, point) -> {
135+
};
136+
options.pointClickCallback = (event, point) -> {
138137
if (point.getAnnotation()!=null) return;
139138

140139
// If not, add one.
141-
Annotation annotation = new Annotation(point.getName());
140+
Annotation annotation = new Annotation();
141+
annotation.series = point.getName();
142142
annotation.xval = point.getXval();
143143
annotation.shortText = String.valueOf(num);
144144
annotation.text = "Annotation #"+num;
145145
annotations.add(annotation);
146146
dygraphs.getJSO().setAnnotations(annotations.toArray(new Annotation[]{}));
147147
num++;
148-
});
148+
};
149149

150150

151151

Diff for: dygraphs-gwt-sample/src/main/java/sample/client/examples/CSSLabelStylingExample.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.github.timeu.dygraphsgwt.client.Dygraphs;
44
import com.github.timeu.dygraphsgwt.client.DygraphsOptions;
5-
import com.github.timeu.dygraphsgwt.client.DygraphsOptionsImpl;
65
import com.github.timeu.dygraphsgwt.client.options.Properties;
76
import com.google.gwt.user.client.ui.Composite;
87
import com.google.gwt.user.client.ui.FlowPanel;
@@ -15,21 +14,21 @@
1514
public class CSSLabelStylingExample extends Composite {
1615

1716
FlowPanel panel = new FlowPanel();
18-
DygraphsOptions options = new DygraphsOptionsImpl();
17+
DygraphsOptions options = new DygraphsOptions();
1918

2019
public CSSLabelStylingExample() {
2120
initWidget(panel);
22-
options.setRollPeriod(7);
23-
options.setLegend(DygraphsOptions.SHOW_LEGEND.always.name());
24-
options.setTitle("High and Low Temperatures");
25-
options.setTitleHeight(32);
26-
options.setYlabel("Temperature (F)");
27-
options.setXlabel("Date (Ticks indicate the start of the indicated time period)");
21+
options.rollPeriod = 7;
22+
options.legend = DygraphsOptions.SHOW_LEGEND.always.name();
23+
options.title = "High and Low Temperatures";
24+
options.titleHeight = 32;
25+
options.ylabel = "Temperature (F)";
26+
options.xlabel = "Date (Ticks indicate the start of the indicated time period)";
2827
Properties styles = Properties.create();
2928
styles.set("text-align","right");
3029
styles.set("background","none");
31-
options.setLabelsDivStyles(styles);
32-
options.setStrokeWidth(1.5);
30+
options.labelsDivStyles = styles;
31+
options.strokeWidth = 1.5;
3332
panel.add(new HTML("<p class=\"infotext\">This chart's labels are styled</p>"));
3433
initDygraphs1();
3534
panel.add(new HTML("<p class=\"infotext\">This version of the chart uses the default styles:</p>"));

Diff for: dygraphs-gwt-sample/src/main/java/sample/client/examples/CustomInteractioModelsExample.java

+13-18
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
import com.github.timeu.dygraphsgwt.client.Dygraphs;
44
import com.github.timeu.dygraphsgwt.client.DygraphsJs;
55
import com.github.timeu.dygraphsgwt.client.DygraphsOptions;
6-
import com.github.timeu.dygraphsgwt.client.DygraphsOptionsImpl;
76
import com.github.timeu.dygraphsgwt.client.Position;
87
import com.github.timeu.dygraphsgwt.client.ScriptInjector;
98
import com.github.timeu.dygraphsgwt.client.options.interactions.InteractionModel;
10-
import com.github.timeu.dygraphsgwt.client.options.interactions.MouseWheelHandler;
119
import com.google.gwt.canvas.dom.client.Context2d;
12-
import com.google.gwt.core.client.GWT;
13-
import com.google.gwt.dom.client.Document;
1410
import com.google.gwt.dom.client.NativeEvent;
1511
import com.google.gwt.event.dom.client.ClickEvent;
1612
import com.google.gwt.event.dom.client.MouseWheelEvent;
@@ -19,7 +15,6 @@
1915
import com.google.gwt.user.client.ui.FlowPanel;
2016
import com.google.gwt.user.client.ui.HTML;
2117
import com.google.gwt.user.client.ui.RootLayoutPanel;
22-
import com.google.gwt.user.client.ui.ScrollPanel;
2318
import sample.client.DataUtils;
2419

2520
import java.util.ArrayList;
@@ -110,10 +105,10 @@ private void initFun() {
110105
}
111106
};
112107
model.dblclick =(event,g,context)-> restorePosition(g);
113-
options.setUnderlayCallback((canvas,area,g)->{
108+
options.underlayCallback = (canvas,area,g)->{
114109
funCanvas = canvas;
115-
});
116-
options.setInteractionModel(model);
110+
};
111+
options.interactionModel = model;
117112
Dygraphs dygraphjs =new Dygraphs(DataUtils.noisyData(),options);
118113
dygraphjs.setPixelSize(600, 300);
119114
panel.add(dygraphjs);
@@ -199,7 +194,7 @@ private void initCustom() {
199194
Dygraphs.cancelEvent(event);
200195
};
201196

202-
options.setInteractionModel(model);
197+
options.interactionModel = model;
203198

204199
Dygraphs g = new Dygraphs(DataUtils.noisyData(),options);
205200
g.setPixelSize(600, 300);
@@ -215,7 +210,7 @@ private void initEmpty() {
215210

216211

217212
DygraphsOptions options = createOptions();
218-
options.setInteractionModel(new InteractionModel());
213+
options.interactionModel = new InteractionModel();
219214
Dygraphs g = new Dygraphs(DataUtils.noisyData(),options);
220215
g.setPixelSize(600, 300);
221216
panel.add(g);
@@ -232,15 +227,15 @@ private void initDefault() {
232227
}
233228

234229
private DygraphsOptions createOptions() {
235-
DygraphsOptions options = new DygraphsOptionsImpl();
236-
options.setErrorBars(true);
230+
DygraphsOptions options = new DygraphsOptions();
231+
options.errorBars = true;
237232
return options;
238233
}
239234

240235
private void restorePosition(DygraphsJs g) {
241-
DygraphsOptions options = new DygraphsOptionsImpl();
242-
options.setDateWindow(null);
243-
options.setValueRange(null);
236+
DygraphsOptions options = new DygraphsOptions();
237+
options.dateWindow = null;
238+
options.valueRange = null;
244239
g.updateOptions(options, false);
245240
}
246241

@@ -296,9 +291,9 @@ private void zoom(DygraphsJs g, double zoomInPercentage, Double xBias, Double yB
296291
for (int i = 0; i < yAxes.length; i++) {
297292
newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias);
298293
}
299-
DygraphsOptions options = new DygraphsOptionsImpl();
300-
options.setDateWindow(adjustAxis(g.xAxisRange(),zoomInPercentage,xBias));
301-
options.setValueRange(newYAxes[0]);
294+
DygraphsOptions options = new DygraphsOptions();
295+
options.dateWindow = adjustAxis(g.xAxisRange(),zoomInPercentage,xBias);
296+
options.valueRange = newYAxes[0];
302297
g.updateOptions(options,false);
303298
}
304299
private double[] adjustAxis(double[] axis, double zoomInPercentage, double bias) {

Diff for: dygraphs-gwt-sample/src/main/java/sample/client/examples/DynamicExample.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22

33
import com.github.timeu.dygraphsgwt.client.Dygraphs;
44
import com.github.timeu.dygraphsgwt.client.DygraphsOptions;
5-
import com.github.timeu.dygraphsgwt.client.DygraphsOptionsImpl;
65
import com.google.gwt.animation.client.AnimationScheduler;
7-
import com.google.gwt.core.client.GWT;
86
import com.google.gwt.core.client.JsArray;
97
import com.google.gwt.core.client.JsArrayMixed;
108
import com.google.gwt.user.client.ui.Composite;
119
import com.google.gwt.user.client.ui.FlowPanel;
1210
import com.google.gwt.user.client.ui.HTML;
1311

14-
import java.util.ArrayList;
1512
import java.util.Date;
16-
import java.util.List;
1713

1814
/**
1915
* Created by uemit.seren on 7/30/15.
@@ -46,10 +42,10 @@ private void initDygraphs() {
4642
data.push(row);
4743
}
4844

49-
DygraphsOptions options = new DygraphsOptionsImpl();
50-
options.setDrawPoints(true);
51-
options.setShowRoller(true);
52-
options.setLabels(new String[]{"Time", "Random"});
45+
DygraphsOptions options = new DygraphsOptions();
46+
options.drawPoints = true;
47+
options.showRoller = true;
48+
options.labels = new String[]{"Time", "Random"};
5349
dygraphs = new Dygraphs(data,options);
5450
dygraphs.setPixelSize(600,300);
5551
// It sucks that these things aren't objects, and we need to store state in window.
@@ -66,7 +62,7 @@ public void render(double currentTimeStamp) {
6662
row.push(currentTime.getTime());
6763
row.push(y);
6864
data.push(row);
69-
DygraphsOptions opt = new DygraphsOptionsImpl();
65+
DygraphsOptions opt = new DygraphsOptions();
7066
opt.setArrayFile(data);
7167
dygraphs.getJSO().updateOptions(opt,false);
7268
}

0 commit comments

Comments
 (0)