Skip to content

Commit a3eacae

Browse files
committed
Merge pull request #346 from GwtMaterialDesign/release_1.5.1
Release 1.5.1
2 parents 439a1ca + de0b6be commit a3eacae

File tree

100 files changed

+2327
-678
lines changed

Some content is hidden

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

100 files changed

+2327
-678
lines changed

.utility/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_1.5" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_1.5.1" ]; then
44
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
55
mvn deploy --settings ~/settings.xml
66
fi

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77

88

99
## Demo
10-
* [1.5.0 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
11-
* [1.5.1 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/)
10+
* [1.5.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
11+
* [1.6.0 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/)
1212

1313
## Documentation
1414
Support documentation can be found [here](https://github.com/GwtMaterialDesign/gwt-material/wiki) <br/>
1515
We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs" > Java Docs </a> for developers
1616

1717

1818
## Maven
19-
### Current Version 1.5.0
19+
### Current Version 1.5.1
2020
```xml
2121
<dependency>
2222
<groupId>com.github.gwtmaterialdesign</groupId>
2323
<artifactId>gwt-material</artifactId>
24-
<version>1.5.0</version>
24+
<version>1.5.1</version>
2525
</dependency>
2626
```
27-
### Snapshot Version 1.5.1-SNAPSHOT
27+
### Snapshot Version 1.6.0-SNAPSHOT
2828
```xml
2929
<dependency>
3030
<groupId>com.github.gwtmaterialdesign</groupId>
3131
<artifactId>gwt-material</artifactId>
32-
<version>1.5.1-SNAPSHOT</version>
32+
<version>1.6.0-SNAPSHOT</version>
3333
</dependency>
3434
```
3535

gwt-material/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>gwt-material-parent</artifactId>
55
<groupId>com.github.gwtmaterialdesign</groupId>
6-
<version>1.5.0</version>
6+
<version>1.5.1</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

gwt-material/src/main/java/gwt/material/design/client/MaterialDesignBase.java

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,90 @@
2121
*/
2222

2323
import com.google.gwt.core.client.ScriptInjector;
24+
import com.google.gwt.dom.client.StyleInjector;
2425
import com.google.gwt.resources.client.TextResource;
2526
import gwt.material.design.client.resources.MaterialResources;
2627

28+
import java.util.ArrayList;
29+
import java.util.List;
30+
2731
public class MaterialDesignBase {
2832

29-
public void load() {
30-
inject(MaterialResources.INSTANCE.materializeJs());
31-
inject(MaterialResources.INSTANCE.animationJs());
32-
inject(MaterialResources.INSTANCE.shrinkJs());
33+
static class FutureResource {
34+
TextResource resource;
35+
boolean removeTag, sourceUrl;
36+
37+
public FutureResource(TextResource resource, boolean removeTag, boolean sourceUrl) {
38+
this.resource = resource;
39+
this.removeTag = removeTag;
40+
this.sourceUrl = sourceUrl;
41+
}
42+
}
43+
44+
static TextResource jqueryResource;
45+
static List<FutureResource> futureResources;
46+
47+
protected void load() {
48+
checkJQuery(false);
49+
injectJs(MaterialResources.INSTANCE.materializeJs());
50+
injectJs(MaterialResources.INSTANCE.animationJs());
51+
injectJs(MaterialResources.INSTANCE.shrinkJs());
52+
onModuleLoaded();
3353
}
3454

35-
protected void inject(TextResource resource) {
36-
inject(resource, true, false);
55+
protected void onModuleLoaded() {
56+
if(futureResources != null) {
57+
for (FutureResource res : futureResources) {
58+
injectJs(res.resource, res.removeTag, res.sourceUrl);
59+
}
60+
}
3761
}
3862

39-
protected void injectDebug(TextResource resource) {
40-
inject(resource, false, true);
63+
public static void injectJs(TextResource resource) {
64+
injectJs(resource, true, false);
4165
}
4266

43-
protected void inject(TextResource resource, boolean removeTag, boolean sourceUrl) {
67+
public static void injectDebugJs(TextResource resource) {
68+
injectJs(resource, false, true);
69+
}
70+
71+
public static void injectJs(TextResource resource, boolean removeTag, boolean sourceUrl) {
72+
if(!resource.getName().contains("jQuery")) {
73+
if(!checkJQuery(sourceUrl)) {
74+
// We need to wait for jQuery to load
75+
if(futureResources == null) {
76+
futureResources = new ArrayList<>();
77+
}
78+
futureResources.add(new FutureResource(resource, removeTag, sourceUrl));
79+
}
80+
}
4481
String text = resource.getText() +
45-
(sourceUrl ? "//# sourceURL="+resource.getName()+".js" : "");
82+
(sourceUrl ? "//# sourceURL=" + resource.getName() + ".js" : "");
4683

4784
// Inject the script resource
4885
ScriptInjector.fromString(text)
49-
.setWindow(ScriptInjector.TOP_WINDOW)
50-
.setRemoveTag(removeTag)
51-
.inject();
86+
.setWindow(ScriptInjector.TOP_WINDOW)
87+
.setRemoveTag(removeTag)
88+
.inject();
89+
}
90+
91+
public static void injectCss(TextResource resource) {
92+
StyleInjector.inject(resource.getText());
93+
}
94+
95+
protected static boolean checkJQuery(boolean debug) {
96+
if(!isjQueryLoaded()) {
97+
if(jqueryResource != null) {
98+
if(debug) {
99+
injectDebugJs(jqueryResource);
100+
} else {
101+
injectJs(jqueryResource);
102+
}
103+
} else {
104+
return false;
105+
}
106+
}
107+
return true;
52108
}
53109

54110
/**

gwt-material/src/main/java/gwt/material/design/client/MaterialDesignDebugBase.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
*/
2222

2323
import gwt.material.design.client.resources.MaterialDebugResources;
24-
import gwt.material.design.client.resources.MaterialResources;
2524

2625
public class MaterialDesignDebugBase extends MaterialDesignBase {
2726

2827
@Override
2928
public void load() {
30-
injectDebug(MaterialDebugResources.INSTANCE.materializeJsDebug());
31-
injectDebug(MaterialDebugResources.INSTANCE.animationJsDebug());
32-
injectDebug(MaterialDebugResources.INSTANCE.shrinkJsDebug());
29+
checkJQuery(true);
30+
injectDebugJs(MaterialDebugResources.INSTANCE.materializeJsDebug());
31+
injectDebugJs(MaterialDebugResources.INSTANCE.animationJsDebug());
32+
injectDebugJs(MaterialDebugResources.INSTANCE.shrinkJsDebug());
33+
onModuleLoaded();
3334
}
3435
}

gwt-material/src/main/java/gwt/material/design/client/MaterialWithJQuery.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,7 @@ public class MaterialWithJQuery extends MaterialDesignBase implements EntryPoint
2727

2828
@Override
2929
public void onModuleLoad() {
30+
jqueryResource = WithJQueryResources.INSTANCE.jQuery();
3031
load();
3132
}
32-
33-
@Override
34-
public void load() {
35-
if(!isjQueryLoaded()) {
36-
inject(WithJQueryResources.INSTANCE.jQuery());
37-
}
38-
super.load();
39-
}
4033
}

gwt-material/src/main/java/gwt/material/design/client/MaterialWithJQueryDebug.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ public class MaterialWithJQueryDebug extends MaterialDesignDebugBase implements
3030

3131
@Override
3232
public void onModuleLoad() {
33+
jqueryResource = WithJQueryDebugResources.INSTANCE.jQueryDebug();
3334
load();
3435
}
35-
36-
@Override
37-
public void load() {
38-
if(!isjQueryLoaded()) {
39-
injectDebug(WithJQueryDebugResources.INSTANCE.jQueryDebug());
40-
}
41-
super.load();
42-
}
4336
}

gwt-material/src/main/java/gwt/material/design/client/base/AbstractButton.java

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ protected AbstractButton() {
7373
getElement().getStyle().setCursor(Style.Cursor.POINTER);
7474
}
7575

76+
protected AbstractButton(String... initialClass) {
77+
this();
78+
setInitialClasses(initialClass);
79+
}
80+
7681
protected AbstractButton(String text, String bgColor, WavesType waves) {
7782
this(null, text, bgColor);
7883
setWaves(waves);
@@ -191,42 +196,98 @@ public String getTargetHistoryToken() {
191196
}
192197

193198
@Override
194-
public HandlerRegistration addClickHandler(ClickHandler handler) {
195-
return addDomHandler(handler, ClickEvent.getType());
199+
public HandlerRegistration addClickHandler(final ClickHandler handler) {
200+
return addDomHandler(new ClickHandler() {
201+
@Override
202+
public void onClick(ClickEvent event) {
203+
if(isEnabled()){
204+
handler.onClick(event);
205+
}
206+
}
207+
}, ClickEvent.getType());
196208
}
197209

198210
@Override
199211
public HandlerRegistration addMouseDownHandler(final MouseDownHandler handler) {
200-
return addDomHandler(handler, MouseDownEvent.getType());
212+
return addDomHandler(new MouseDownHandler() {
213+
@Override
214+
public void onMouseDown(MouseDownEvent event) {
215+
if(isEnabled()){
216+
handler.onMouseDown(event);
217+
}
218+
}
219+
}, MouseDownEvent.getType());
201220
}
202221

203222
@Override
204223
public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
205-
return addDomHandler(handler, MouseMoveEvent.getType());
224+
return addDomHandler(new MouseMoveHandler() {
225+
@Override
226+
public void onMouseMove(MouseMoveEvent event) {
227+
if(isEnabled()){
228+
handler.onMouseMove(event);
229+
}
230+
}
231+
}, MouseMoveEvent.getType());
206232
}
207233

208234
@Override
209235
public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) {
210-
return addDomHandler(handler, MouseOutEvent.getType());
236+
return addDomHandler(new MouseOutHandler() {
237+
@Override
238+
public void onMouseOut(MouseOutEvent event) {
239+
if(isEnabled()) {
240+
handler.onMouseOut(event);
241+
}
242+
}
243+
}, MouseOutEvent.getType());
211244
}
212245

213246
@Override
214247
public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
215-
return addDomHandler(handler, MouseOverEvent.getType());
248+
return addDomHandler(new MouseOverHandler() {
249+
@Override
250+
public void onMouseOver(MouseOverEvent event) {
251+
if(isEnabled()) {
252+
handler.onMouseOver(event);
253+
}
254+
}
255+
}, MouseOverEvent.getType());
216256
}
217257

218258
@Override
219259
public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
220-
return addDomHandler(handler, MouseUpEvent.getType());
260+
return addDomHandler(new MouseUpHandler() {
261+
@Override
262+
public void onMouseUp(MouseUpEvent event) {
263+
if(isEnabled()) {
264+
handler.onMouseUp(event);
265+
}
266+
}
267+
}, MouseUpEvent.getType());
221268
}
222269

223270
@Override
224271
public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
225-
return addDomHandler(handler, MouseWheelEvent.getType());
272+
return addDomHandler(new MouseWheelHandler() {
273+
@Override
274+
public void onMouseWheel(MouseWheelEvent event) {
275+
if(isEnabled()) {
276+
handler.onMouseWheel(event);
277+
}
278+
}
279+
}, MouseWheelEvent.getType());
226280
}
227281

228282
@Override
229-
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
230-
return addDomHandler(handler, DoubleClickEvent.getType());
283+
public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) {
284+
return addDomHandler(new DoubleClickHandler() {
285+
@Override
286+
public void onDoubleClick(DoubleClickEvent event) {
287+
if(isEnabled()) {
288+
handler.onDoubleClick(event);
289+
}
290+
}
291+
}, DoubleClickEvent.getType());
231292
}
232293
}

gwt-material/src/main/java/gwt/material/design/client/base/AbstractIconButton.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public AbstractIconButton() {
6161
setIconPosition(IconPosition.LEFT);
6262
}
6363

64+
public AbstractIconButton(String... initialClass) {
65+
super();
66+
setInitialClasses(initialClass);
67+
}
68+
6469
@Override
6570
public MaterialIcon getIcon() {
6671
return icon;

0 commit comments

Comments
 (0)