Skip to content

Commit 5973481

Browse files
authored
Merge pull request #743 from GwtMaterialDesign/release_2.0.1
Release 2.0.1
2 parents 92f8da4 + 1829bd0 commit 5973481

File tree

17 files changed

+371
-66
lines changed

17 files changed

+371
-66
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cache:
77
- $HOME/.m2
88
before_install:
99
# install the gwt-material-jquery because it will depends on built in jquery
10-
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material-jquery.git
10+
- git clone -b release_2.0.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
1111
- cd gwt-material-jquery
1212
- mvn install -DskipTests=true -DdryRun=true
1313
- cd ..

.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" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.0" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.0.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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<br/>
88

99
## Demo
10-
* [2.0 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
10+
* [2.0.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
1111
* [2.1 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/)
1212

1313
## Documentation
@@ -16,12 +16,12 @@ We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs
1616

1717

1818
## Maven
19-
### Current Version 2.0
19+
### Current Version 2.0.1
2020
```xml
2121
<dependency>
2222
<groupId>com.github.gwtmaterialdesign</groupId>
2323
<artifactId>gwt-material</artifactId>
24-
<version>2.0</version>
24+
<version>2.0.1</version>
2525
</dependency>
2626
```
2727
### Snapshot Version 2.1-SNAPSHOT

gwt-material/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>gwt-material-parent</artifactId>
66
<groupId>com.github.gwtmaterialdesign</groupId>
7-
<version>2.0</version>
7+
<version>2.0.1</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

@@ -17,7 +17,7 @@
1717
<dependency>
1818
<groupId>com.github.gwtmaterialdesign</groupId>
1919
<artifactId>gwt-material-jquery</artifactId>
20-
<version>2.0</version>
20+
<version>2.0.1</version>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.google.gwt</groupId>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static void injectDebugJs(TextResource resource) {
7272
}
7373

7474
public static void injectJs(TextResource resource, boolean removeTag, boolean sourceUrl) {
75-
if (!resource.getName().contains("jQuery") && !checkJQuery(sourceUrl)) {
75+
if (!resource.getName().equals("jQuery") && !resource.getName().equals("jQueryDebug") && !checkJQuery(sourceUrl)) {
7676
// We need to wait for jQuery to load
7777
if (futureResources == null) {
7878
futureResources = new ArrayList<>();
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2018 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.client.base.helper;
21+
22+
/**
23+
* Basic Date Format helper to support Java Based formats into <a href="http://amsul.ca/pickadate.js/date/#formats">Pickadate.js formats</a>
24+
* As of {@link gwt.material.design.client.ui.MaterialDatePicker} 2.0 we just supported the conversion of uppercase
25+
* formats to convert it to lower case for the basic support.
26+
*
27+
28+
*/
29+
public class DateFormatHelper {
30+
31+
static String DEFAULT_FORMAT = "d mmmm, yyyy";
32+
33+
/**
34+
* Will auto format the given string to provide support for pickadate.js formats.
35+
*/
36+
public static String format(String format) {
37+
38+
if (format == null) {
39+
format = DEFAULT_FORMAT;
40+
} else {
41+
if (format.contains("M")) {
42+
format = format.replace("M", "m");
43+
}
44+
45+
if (format.contains("Y")) {
46+
format = format.replace("Y", "y");
47+
}
48+
49+
if (format.contains("D")) {
50+
format = format.replace("D", "d");
51+
}
52+
}
53+
return format;
54+
}
55+
}

gwt-material/src/main/java/gwt/material/design/client/base/mixin/EnabledMixin.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ private void applyEnabled(boolean enabled, UIObject obj) {
9595
obj.addStyleName(CssName.DISABLED);
9696
obj.getElement().setAttribute(DISABLED, "");
9797
}
98+
99+
updateWaves(enabled, obj);
100+
}
101+
102+
public void updateWaves(boolean enabled, UIObject obj) {
103+
if (obj instanceof MaterialWidget) {
104+
MaterialWidget widget = (MaterialWidget) obj;
105+
if (enabled) {
106+
if (widget.getWaves() != null) {
107+
widget.getElement().addClassName(CssName.WAVES_EFFECT);
108+
}
109+
} else {
110+
widget.getElement().removeClassName(CssName.WAVES_EFFECT);
111+
}
112+
}
98113
}
99114

100115
public boolean isPropagateToChildren() {

gwt-material/src/main/java/gwt/material/design/client/constants/CssName.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,5 @@ public interface CssName {
143143
String DISPLAY_ANIMATION= "display-animation";
144144
String MATERIALIZE_CSS = "materialcss";
145145
String PREFIX = "prefix";
146+
String LISTBOX_WRAPPER = "listbox-wrapper";
146147
}

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.google.gwt.event.shared.HandlerRegistration;
3232
import com.google.gwt.user.client.DOM;
3333
import gwt.material.design.client.base.*;
34+
import gwt.material.design.client.base.helper.DateFormatHelper;
3435
import gwt.material.design.client.base.mixin.ErrorMixin;
3536
import gwt.material.design.client.base.mixin.ReadOnlyMixin;
3637
import gwt.material.design.client.constants.*;
@@ -380,21 +381,26 @@ public String getFormat() {
380381
* To call before initialization.
381382
*/
382383
public void setFormat(String format) {
383-
options.format = format;
384+
options.format = DateFormatHelper.format(format);
384385
}
385386

386387
@Override
387388
public Date getValue() {
388-
return getPickerDate();
389+
if (isAttached()) {
390+
return getPickerDate();
391+
}
392+
else {
393+
return this.date;
394+
}
389395
}
390396

391397
@Override
392398
public void setValue(Date value, boolean fireEvents) {
399+
this.date = value;
393400
if (value == null) {
394401
clear();
395402
return;
396403
}
397-
this.date = value;
398404
if (isAttached()) {
399405
suppressChangeEvent = !fireEvents;
400406
setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput);
@@ -649,6 +655,7 @@ public void stop() {
649655

650656
@Override
651657
public void clear() {
658+
this.date = null;
652659
dateInput.clear();
653660
if (getPicker() != null) {
654661
getPicker().set("select", null);

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDropDown.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ protected void registerDropdownItemHandlers() {
115115
getChildren().forEach(widget -> {
116116
if (widget instanceof ListItem) {
117117
ListItem item = (ListItem) widget;
118-
if (item.getWidget(0) instanceof MaterialWidget) {
119-
MaterialWidget child = (MaterialWidget) item.getWidget(0);
120-
registerHandler(child.addDomHandler(event -> {
121-
SelectionEvent.fire(MaterialDropDown.this, child);
122-
}, ClickEvent.getType()));
118+
if (item.getWidgetCount() > 0) {
119+
if (item.getWidget(0) instanceof MaterialWidget) {
120+
MaterialWidget child = (MaterialWidget) item.getWidget(0);
121+
registerHandler(child.addDomHandler(event -> {
122+
SelectionEvent.fire(MaterialDropDown.this, child);
123+
}, ClickEvent.getType()));
124+
}
123125
}
124126
}
125127
});

0 commit comments

Comments
 (0)