Skip to content

Commit 5579a87

Browse files
committed
WIP - Image Viewer Plugin
1 parent 6a76da9 commit 5579a87

File tree

9 files changed

+4252
-0
lines changed

9 files changed

+4252
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package gwt.material.design.incubator.client.viewer;
2+
3+
import com.google.gwt.user.client.Element;
4+
import gwt.material.design.client.MaterialDesignBase;
5+
import gwt.material.design.client.ui.MaterialImage;
6+
import gwt.material.design.incubator.client.viewer.js.JsImageViewer;
7+
import gwt.material.design.incubator.client.viewer.js.ViewerOptions;
8+
9+
public class ImageViewer {
10+
11+
static {
12+
MaterialDesignBase.injectCss(ImageViewerDebugClientBundle.INSTANCE.viewerCss());
13+
MaterialDesignBase.injectJs(ImageViewerDebugClientBundle.INSTANCE.viewerJs());
14+
}
15+
16+
protected JsImageViewer viewer;
17+
protected ViewerOptions options = new ViewerOptions();
18+
protected MaterialImage image = new MaterialImage();
19+
20+
public ImageViewer() {
21+
}
22+
23+
public void load(Element element) {
24+
viewer = new JsImageViewer(element, options);
25+
}
26+
27+
public void destroy() {
28+
viewer.destroy();
29+
}
30+
31+
public void update() {
32+
viewer.update();
33+
}
34+
35+
public ViewerOptions getOptions() {
36+
return options;
37+
}
38+
39+
public void setOptions(ViewerOptions options) {
40+
this.options = options;
41+
}
42+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2017 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.incubator.client.viewer;
21+
22+
import com.google.gwt.core.client.GWT;
23+
import com.google.gwt.resources.client.ClientBundle;
24+
import com.google.gwt.resources.client.TextResource;
25+
26+
/**
27+
* Client Bundle resources for GroupToggleButton component<br>
28+
*
29+
* @author kevzlou7979
30+
*/
31+
public interface ImageViewerClientBundle extends ClientBundle {
32+
ImageViewerClientBundle INSTANCE = GWT.create(ImageViewerClientBundle.class);
33+
34+
@Source("resources/css/viewer.min.css")
35+
TextResource viewerCss();
36+
37+
@Source("resources/js/viewer.min.js")
38+
TextResource viewerJs();
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2017 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.incubator.client.viewer;
21+
22+
import com.google.gwt.core.client.GWT;
23+
import com.google.gwt.resources.client.ClientBundle;
24+
import com.google.gwt.resources.client.TextResource;
25+
26+
/**
27+
* Client Bundle resources for GroupToggleButton component<br>
28+
*
29+
* @author kevzlou7979
30+
*/
31+
public interface ImageViewerDebugClientBundle extends ClientBundle {
32+
ImageViewerDebugClientBundle INSTANCE = GWT.create(ImageViewerDebugClientBundle.class);
33+
34+
@Source("resources/css/viewer.css")
35+
TextResource viewerCss();
36+
37+
@Source("resources/js/viewer.js")
38+
TextResource viewerJs();
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package gwt.material.design.incubator.client.viewer.js;
2+
3+
import jsinterop.annotations.JsConstructor;
4+
import jsinterop.annotations.JsMethod;
5+
import jsinterop.annotations.JsPackage;
6+
import jsinterop.annotations.JsType;
7+
8+
@JsType(isNative = true, name = "Viewer", namespace = JsPackage.GLOBAL)
9+
public class JsImageViewer {
10+
11+
@JsConstructor
12+
public JsImageViewer(Object element, ViewerOptions options) {
13+
14+
}
15+
16+
@JsMethod
17+
public native void destroy();
18+
19+
@JsMethod
20+
public native void update();
21+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2017 GwtMaterialDesign
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package gwt.material.design.incubator.client.viewer.js;
21+
22+
import gwt.material.design.jquery.client.api.Functions;
23+
import jsinterop.annotations.JsPackage;
24+
import jsinterop.annotations.JsProperty;
25+
import jsinterop.annotations.JsType;
26+
27+
/**
28+
* Options for Image Viewer
29+
*
30+
* @author kevzlou7979
31+
*/
32+
@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
33+
public class ViewerOptions {
34+
35+
@JsProperty
36+
public Integer tapZoomFactor;
37+
38+
}

0 commit comments

Comments
 (0)