Skip to content

Commit 202ef13

Browse files
author
jeremy.lin1
committed
JSInterop Image Viewer.js
1 parent ad6fb8e commit 202ef13

File tree

3 files changed

+257
-0
lines changed

3 files changed

+257
-0
lines changed

src/main/java/gwt/material/design/incubator/client/viewer/ImageViewer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import gwt.material.design.client.MaterialDesignBase;
2424
import gwt.material.design.client.ui.MaterialImage;
2525
import gwt.material.design.incubator.client.viewer.js.JsImageViewer;
26+
import gwt.material.design.incubator.client.viewer.js.ViewerMethod;
2627
import gwt.material.design.incubator.client.viewer.js.ViewerOptions;
2728

2829
public class ImageViewer {
@@ -34,6 +35,7 @@ public class ImageViewer {
3435

3536
protected JsImageViewer viewer;
3637
protected ViewerOptions options = new ViewerOptions();
38+
protected ViewerMethod methods = new ViewerMethod();
3739
protected MaterialImage image = new MaterialImage();
3840

3941
public ImageViewer() {
@@ -58,4 +60,12 @@ public ViewerOptions getOptions() {
5860
public void setOptions(ViewerOptions options) {
5961
this.options = options;
6062
}
63+
64+
public ViewerMethod getMethods() {
65+
return methods;
66+
}
67+
68+
public void setMethods(ViewerMethod methods) {
69+
this.methods = methods;
70+
}
6171
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package gwt.material.design.incubator.client.viewer.js;
2+
3+
import jsinterop.annotations.JsMethod;
4+
import jsinterop.annotations.JsPackage;
5+
import jsinterop.annotations.JsType;
6+
7+
@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
8+
public class ViewerMethod {
9+
10+
@JsMethod
11+
public native void show(boolean fireEvent);
12+
13+
@JsMethod
14+
public native void hide(boolean fireEvent);
15+
16+
@JsMethod
17+
public native void view(Integer index);
18+
19+
@JsMethod
20+
public native void prev(boolean fireEvent);
21+
22+
@JsMethod
23+
public native void next(boolean fireEvent);
24+
25+
@JsMethod
26+
public native void move(Integer scaleX, Integer scaleY);
27+
28+
@JsMethod
29+
public native void moveTo(Integer scaleX, Integer scaleY);
30+
31+
@JsMethod
32+
public native void rotate(Integer degree);
33+
34+
@JsMethod
35+
public native void rotateTo(Integer degree);
36+
37+
@JsMethod
38+
public native void rotateTo(Integer scaleX, Integer scaleY);
39+
40+
@JsMethod
41+
public native void scaleX(Integer scaleX);
42+
43+
@JsMethod
44+
public native void scaleY(Integer scaleX);
45+
46+
@JsMethod
47+
public native void zoom(Integer ratio, boolean hasToolTip);
48+
49+
@JsMethod
50+
public native void zoomTo(Integer ratio, boolean hasToolTip);
51+
52+
@JsMethod
53+
public native void play(boolean fullScreen);
54+
55+
@JsMethod
56+
public native void stop();
57+
58+
@JsMethod
59+
public native void full();
60+
61+
@JsMethod
62+
public native void exit();
63+
64+
@JsMethod
65+
public native void tooltip();
66+
67+
@JsMethod
68+
public native void toggle();
69+
70+
@JsMethod
71+
public native void reset();
72+
73+
@JsMethod
74+
public native void update();
75+
76+
@JsMethod
77+
public native void destroy();
78+
79+
}

src/main/java/gwt/material/design/incubator/client/viewer/js/ViewerOptions.java

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
package gwt.material.design.incubator.client.viewer.js;
2121

2222
import gwt.material.design.jquery.client.api.Functions;
23+
import jsinterop.annotations.JsFunction;
2324
import jsinterop.annotations.JsPackage;
2425
import jsinterop.annotations.JsProperty;
2526
import jsinterop.annotations.JsType;
2627

28+
import java.util.Arrays;
29+
2730
/**
2831
* Options for Image Viewer
2932
*
@@ -34,5 +37,170 @@ public class ViewerOptions {
3437

3538
@JsProperty
3639
public Integer tapZoomFactor;
40+
41+
@JsProperty
42+
public String className;
43+
44+
@JsProperty
45+
public String container;
46+
47+
@JsProperty
48+
public Functions.FuncRet2<Object, Boolean> filter;
49+
50+
@JsProperty
51+
public Boolean fullScreen;
52+
53+
@JsProperty
54+
public Arrays inheritedAttributes;
55+
56+
@JsProperty
57+
public Integer initialViewIndex;
58+
59+
@JsProperty
60+
public Boolean inline;
61+
62+
@JsProperty
63+
public Integer interval;
64+
65+
@JsProperty
66+
public Boolean keyboard;
67+
68+
@JsProperty
69+
public Boolean focus;
70+
71+
@JsProperty
72+
public Boolean loading;
73+
74+
@JsProperty
75+
public Boolean loop;
76+
77+
@JsProperty
78+
public Integer minWidth;
79+
80+
@JsProperty
81+
public Integer minHeight;
82+
83+
@JsProperty
84+
public Boolean movable;
85+
86+
@JsProperty
87+
public Boolean rotatable;
88+
89+
@JsProperty
90+
public Boolean scalable;
91+
92+
@JsProperty
93+
public Boolean zoomable;
94+
95+
@JsProperty
96+
public Boolean zoomOnTouch;
97+
98+
@JsProperty
99+
public Boolean zoomOnWheel;
100+
101+
@JsProperty
102+
public Boolean slideOnTouch;
103+
104+
@JsProperty
105+
public Boolean toggleOnDblclick;
106+
107+
@JsProperty
108+
public Boolean tooltip;
109+
110+
@JsProperty
111+
public Boolean transition;
112+
113+
@JsProperty
114+
public Integer zIndex;
115+
116+
@JsProperty
117+
public Integer zIndexInline;
118+
119+
@JsProperty
120+
public Integer zoomRatio;
121+
122+
@JsProperty
123+
public Integer minZoomRatio;
124+
125+
@JsProperty
126+
public Integer maxZoomRatio;
127+
128+
@JsProperty
129+
public Functions.FuncRet2<Object, Object> url;
130+
131+
@JsProperty
132+
public Functions.Func1 ready;
133+
134+
@JsProperty
135+
public Functions.Func1 show;
136+
137+
@JsProperty
138+
public Functions.Func1 shown;
139+
140+
@JsProperty
141+
public Functions.Func1 hide;
142+
143+
@JsProperty
144+
public Functions.Func1 hidden;
145+
146+
@JsProperty
147+
public Functions.Func1 view;
148+
149+
@JsProperty
150+
public Functions.Func1 viewed;
151+
152+
@JsProperty
153+
public Functions.Func1 move;
154+
155+
@JsProperty
156+
public Functions.Func1 moved;
157+
158+
@JsProperty
159+
public Functions.Func1 rotate;
160+
161+
@JsProperty
162+
public Functions.Func1 rotated;
163+
164+
@JsProperty
165+
public Functions.Func1 scale;
166+
167+
@JsProperty
168+
public Functions.Func1 scaled;
169+
170+
@JsProperty
171+
public Functions.Func1 zoomed;
172+
173+
@JsProperty
174+
public Functions.Func1 play;
175+
176+
@JsProperty
177+
public Functions.Func1 stop;
178+
179+
180+
181+
182+
183+
184+
185+
186+
187+
188+
189+
190+
191+
192+
193+
194+
195+
196+
197+
198+
199+
200+
201+
202+
203+
204+
37205

38206
}

0 commit comments

Comments
 (0)