Skip to content

Commit 1c016ad

Browse files
authored
Merge pull request #1014 from GwtMaterialDesign/release_2.5.0
Release 2.5.0
2 parents db9e131 + 0f813d9 commit 1c016ad

34 files changed

+687
-273
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs
2828
<version>2.5.0-rc1</version>
2929
</dependency>
3030
```
31-
### Snapshot Version 2.5.0-SNAPSHOT
31+
### Snapshot Version 2.5.0
3232
```xml
3333
<dependency>
3434
<groupId>com.github.gwtmaterialdesign</groupId>
3535
<artifactId>gwt-material</artifactId>
36-
<version>2.5.0-SNAPSHOT</version>
36+
<version>2.5.0</version>
3737
</dependency>
3838
```
3939

gwt-material/pom.xml

Lines changed: 1 addition & 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.5.0-rc1</version>
7+
<version>2.5.0</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

@@ -137,7 +137,6 @@
137137
<exclude>**/ui/**.java</exclude>
138138
</excludes>
139139
<includes>
140-
<!--<include>**/MixinTestSuite.java</include>-->
141140
<include>**/MaterialWidgetTestSuite.java</include>
142141
</includes>
143142
<!-- disable JVM asserts, but enable JS asserts for tests -->

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
public abstract class AbstractValueWidget<V> extends MaterialWidget implements HasValue<V>, LeafValueEditor<V>,
4848
HasEditorErrors<V>, HasErrorHandler, HasStatusText, HasValidators<V>, HasRequiredField, HasClearOnKeyUp, HasCopyCommand {
4949

50+
private V initialValue;
5051
private boolean allowBlank = true;
5152
private boolean autoValidate;
5253
private BlankValidator<V> blankValidator;
@@ -69,6 +70,10 @@ public AbstractValueWidget(Element element, String... initialClass) {
6970
@Override
7071
public void setValue(V value) {
7172
setValue(value, false);
73+
74+
if (initialValue == null) {
75+
initialValue = value;
76+
}
7277
}
7378

7479
@Override
@@ -88,6 +93,14 @@ public void setValue(V value, boolean fireEvents, boolean reload) {
8893
}
8994
}
9095

96+
public V getInitialValue() {
97+
return initialValue;
98+
}
99+
100+
public void setInitialValue(V initialValue) {
101+
this.initialValue = initialValue;
102+
}
103+
91104
@Override
92105
public void setErrorText(String errorText) {
93106
getStatusTextMixin().setErrorText(errorText);

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
*/
2020
package gwt.material.design.client.base;
2121

22-
import gwt.material.design.client.ui.MaterialLink;
23-
2422
public interface DropdownItemRenderer<T> {
2523

26-
MaterialLink render(T object);
24+
MaterialWidget render(T object);
2725
}
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 - 2021 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;
21+
22+
public enum ToastPosition {
23+
DEFAULT(""),
24+
TOP_LEFT("top-left"),
25+
TOP_RIGHT("top-right"),
26+
BOTTOM_LEFT("bottom-left"),
27+
BOTTOM_RIGHT("bottom-right");
28+
29+
private String name;
30+
31+
ToastPosition(String name) {
32+
this.name = name;
33+
}
34+
35+
public String getName() {
36+
return name;
37+
}
38+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 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+
import static gwt.material.design.jquery.client.api.JQuery.$;
23+
24+
public class UiSortHelper {
25+
26+
/**
27+
* Calls a Jquery sort api
28+
*
29+
* @param containerSelector - The container Id i.e UnorderedList - (ul)
30+
* @param childSelector - The child element selector (i.e List - li)
31+
* @param dataAttribute - The data attribute that indicate the order of each children (i.e order -> data-attribute='order')
32+
*/
33+
public static void sort(String containerSelector, String childSelector, String dataAttribute) {
34+
if (containerSelector != null && !containerSelector.isEmpty() && childSelector != null && !childSelector.isEmpty() && dataAttribute != null && !dataAttribute.isEmpty()) {
35+
$(containerSelector + " " + childSelector + "[data-order]").sort((elem1, elem2) -> {
36+
Object elem1Order = $(elem1).data(dataAttribute);
37+
Object elem2Order = $(elem2).data(dataAttribute);
38+
if (elem1Order != null && elem2Order != null) {
39+
return Integer.parseInt(elem2Order.toString()) < Integer.parseInt(elem1Order.toString()) ? 1 : -1;
40+
}
41+
return -1;
42+
}).appendTo(containerSelector);
43+
}
44+
}
45+
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public ToggleStyleMixin(final H widget, String style) {
3838
}
3939

4040
public void setOn(boolean on) {
41-
uiObject.removeStyleName(style);
42-
if (on) {
43-
uiObject.addStyleName(style);
41+
if (uiObject != null) {
42+
uiObject.removeStyleName(style);
43+
if (on) {
44+
uiObject.addStyleName(style);
45+
}
4446
}
4547
}
4648

4749
public boolean isOn() {
48-
return StyleHelper.containsStyle(uiObject.getStyleName(), style);
50+
return uiObject != null && StyleHelper.containsStyle(uiObject.getStyleName(), style);
4951
}
5052
}

gwt-material/src/main/java/gwt/material/design/client/base/validator/DefaultDirtyValidator.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
import java.util.ArrayList;
2929
import java.util.List;
3030

31-
/**
32-
* //TODO: Leaving/Abandoning validator (Name)
33-
34-
*/
3531
public class DefaultDirtyValidator<C extends Widget> implements DirtyValidator, IsPropagateToChildren {
3632

3733
private List<HandlerRegistration> registrations;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2021 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.validator;
21+
22+
public interface DirtyCheck {
23+
24+
/**
25+
* Will check whether there are dirty fields found
26+
*/
27+
boolean isDirty();
28+
29+
/**
30+
* Sets the widget dirty value
31+
*/
32+
void setDirty(boolean dirty);
33+
}

gwt-material/src/main/java/gwt/material/design/client/base/validator/DirtyValidator.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
package gwt.material.design.client.base.validator;
2121

22-
public interface DirtyValidator {
22+
public interface DirtyValidator extends DirtyCheck {
2323

2424
/**
2525
* Detect whether we support dirty field checking
@@ -31,15 +31,5 @@ public interface DirtyValidator {
3131
*/
3232
void setAllowDirtyValidation(boolean allowDirty);
3333

34-
/**
35-
* Will check whether there are dirty fields found
36-
*/
37-
boolean isDirty();
38-
39-
/**
40-
* Sets the widget dirty value
41-
*/
42-
void setDirty(boolean dirty);
43-
4434
String getDirtyMessage();
4535
}

0 commit comments

Comments
 (0)