Skip to content

Commit 3cedeef

Browse files
authored
Merge pull request #520 from GwtMaterialDesign/release_2.0
Release 2.0-rc4
2 parents 694a2bb + e2ff66c commit 3cedeef

Some content is hidden

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

47 files changed

+750
-119
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can find lists of features by version <a href="https://github.com/GwtMateria
3737

3838
### Migration
3939
[Migrating from 1.3 to 1.4](https://github.com/GwtMaterialDesign/gwt-material/wiki/Migrating-from-1.3-to-1.4) <br/>
40-
[Migrating from 1.x to 2.0](https://github.com/GwtMaterialDesign/gwt-material/wiki/2.0---API-Changes)
40+
[Migrating from 1.x to 2.0](https://github.com/GwtMaterialDesign/gwt-material/wiki/2.0-API-Changes)
4141

4242
## License
4343
[Apache 2.0 License](https://github.com/GwtMaterialDesign/gwt-material/blob/master/LICENSE)

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-rc3</version>
7+
<version>2.0-SNAPSHOT</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>1.0-rc3</version>
20+
<version>1.0-SNAPSHOT</version>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.google.gwt</groupId>

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public FutureResource(TextResource resource, boolean removeTag, boolean sourceUr
4747

4848
protected void load() {
4949
checkJQuery(false);
50-
injectJs(MaterialResources.INSTANCE.materializeJs());
51-
injectJs(MaterialResources.INSTANCE.animationJs());
52-
injectJs(MaterialResources.INSTANCE.shrinkJs());
50+
if(!isMaterializeLoaded()) {
51+
injectJs(MaterialResources.INSTANCE.materializeJs());
52+
injectJs(MaterialResources.INSTANCE.animationJs());
53+
injectJs(MaterialResources.INSTANCE.shrinkJs());
54+
}
5355
onModuleLoaded();
5456
}
5557

@@ -70,23 +72,22 @@ public static void injectDebugJs(TextResource resource) {
7072
}
7173

7274
public static void injectJs(TextResource resource, boolean removeTag, boolean sourceUrl) {
73-
if (!resource.getName().contains("jQuery")) {
74-
if (!checkJQuery(sourceUrl)) {
75-
// We need to wait for jQuery to load
76-
if (futureResources == null) {
77-
futureResources = new ArrayList<>();
78-
}
79-
futureResources.add(new FutureResource(resource, removeTag, sourceUrl));
75+
if (!resource.getName().contains("jQuery") && !checkJQuery(sourceUrl)) {
76+
// We need to wait for jQuery to load
77+
if (futureResources == null) {
78+
futureResources = new ArrayList<>();
8079
}
81-
}
82-
String text = resource.getText() + (sourceUrl ?
80+
futureResources.add(new FutureResource(resource, removeTag, sourceUrl));
81+
} else {
82+
String text = resource.getText() + (sourceUrl ?
8383
"//# sourceURL=" + resource.getName() + ".js" : "");
8484

85-
// Inject the script resource
86-
ScriptInjector.fromString(text)
85+
// Inject the script resource
86+
ScriptInjector.fromString(text)
8787
.setWindow(ScriptInjector.TOP_WINDOW)
8888
.setRemoveTag(removeTag)
8989
.inject();
90+
}
9091
}
9192

9293
public static void injectCss(TextResource resource) {
@@ -101,7 +102,7 @@ protected static boolean checkJQuery(boolean debug) {
101102
injectJs(jQueryProvider.jQuery());
102103
}
103104
}
104-
return true;
105+
return isjQueryLoaded();
105106
}
106107

107108
public static boolean isProvidingJQuery() {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public class MaterialDesignDebugBase extends MaterialDesignBase {
2727
@Override
2828
public void load() {
2929
checkJQuery(true);
30-
injectDebugJs(MaterialDebugResources.INSTANCE.materializeJsDebug());
31-
injectDebugJs(MaterialDebugResources.INSTANCE.animationJsDebug());
32-
injectDebugJs(MaterialDebugResources.INSTANCE.shrinkJsDebug());
30+
if(!isMaterializeLoaded()) {
31+
injectDebugJs(MaterialDebugResources.INSTANCE.materializeJsDebug());
32+
injectDebugJs(MaterialDebugResources.INSTANCE.animationJsDebug());
33+
injectDebugJs(MaterialDebugResources.INSTANCE.shrinkJsDebug());
34+
}
3335
onModuleLoaded();
3436
}
3537
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public AbstractValueWidget(Element element, String... initialClass) {
6363

6464
@Override
6565
public void setValue(V value) {
66-
setValue(value, true);
66+
setValue(value, false);
6767
}
6868

6969
@Override

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,10 @@ public void setBottom(double value) {
10361036
getElement().getStyle().setBottom(value, Style.Unit.PX);
10371037
}
10381038

1039+
public void setLineHeight(double value) {
1040+
getElement().getStyle().setLineHeight(value, Style.Unit.PX);
1041+
}
1042+
10391043
@Override
10401044
public void setHoverable(boolean hoverable) {
10411045
getHoverableMixin().setOn(hoverable);

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,42 @@
2020
package gwt.material.design.client.base.mixin;
2121

2222
import com.google.gwt.user.client.ui.UIObject;
23+
import com.google.gwt.user.client.ui.Widget;
2324
import gwt.material.design.client.base.HasActive;
25+
import gwt.material.design.client.base.MaterialWidget;
2426
import gwt.material.design.client.constants.CssName;
2527

2628
public class ActiveMixin<T extends UIObject & HasActive> extends AbstractMixin<T> implements HasActive {
2729

30+
private boolean active;
31+
private MaterialWidget target;
32+
2833
public ActiveMixin(final T widget) {
2934
super(widget);
3035
}
3136

32-
private boolean active;
37+
public ActiveMixin(final T widget, final MaterialWidget target) {
38+
super(widget);
39+
this.target = target;
40+
}
3341

3442
@Override
3543
public void setActive(boolean active) {
3644
this.active = active;
45+
if (target != null) {
46+
applyActiveStyle(target, active);
47+
} else {
48+
applyActiveStyle((Widget) uiObject, active);
49+
}
50+
}
51+
52+
protected void applyActiveStyle(Widget widget, boolean active) {
3753
if (active) {
38-
uiObject.removeStyleName(CssName.INACTIVE);
39-
uiObject.addStyleName(CssName.ACTIVE);
54+
widget.removeStyleName(CssName.INACTIVE);
55+
widget.addStyleName(CssName.ACTIVE);
4056
} else {
41-
uiObject.removeStyleName(CssName.ACTIVE);
42-
uiObject.addStyleName(CssName.INACTIVE);
57+
widget.removeStyleName(CssName.ACTIVE);
58+
widget.addStyleName(CssName.INACTIVE);
4359
}
4460
}
4561

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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.client.constants;
21+
22+
public enum DatePickerContainer {
23+
24+
BODY, SELF
25+
}

gwt-material/src/main/java/gwt/material/design/client/js/JsDatePickerOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class JsDatePickerOptions {
3131
public String container;
3232

3333
@JsProperty
34-
public boolean selectYears;
34+
public int selectYears;
3535

3636
@JsProperty
3737
public boolean selectMonths;
@@ -41,4 +41,4 @@ public class JsDatePickerOptions {
4141

4242
@JsProperty
4343
public Functions.Func1<Thing> set;
44-
}
44+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ public MaterialColumn() {
5454

5555
public MaterialColumn(int small, int medium, int large) {
5656
this();
57-
addStyleName("s" + small + " m" + medium + " l" + large);
57+
setGrid("s" + small + " m" + medium + " l" + large);
5858
}
5959
}

0 commit comments

Comments
 (0)