Skip to content

Commit 0377fc9

Browse files
authored
Merge pull request #982 from Medo42/patch-1
Fix #981: DOM breakage in MaterialListValueBox
2 parents 09401f0 + 1d9cd6b commit 0377fc9

File tree

10 files changed

+68
-20
lines changed

10 files changed

+68
-20
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs
2020

2121

2222
## Maven
23-
### Current Version 2.4.0-rc2
23+
### Current Version 2.4.0
2424
```xml
2525
<dependency>
2626
<groupId>com.github.gwtmaterialdesign</groupId>
2727
<artifactId>gwt-material</artifactId>
28-
<version>2.4.0-rc2</version>
28+
<version>2.4.0</version>
2929
</dependency>
3030
```
31-
### Snapshot Version 2.4.0-SNAPSHOT
31+
### Snapshot Version 2.5.0-SNAPSHOT
3232
```xml
3333
<dependency>
3434
<groupId>com.github.gwtmaterialdesign</groupId>
3535
<artifactId>gwt-material</artifactId>
36-
<version>2.4.0-SNAPSHOT</version>
36+
<version>2.5.0-SNAPSHOT</version>
3737
</dependency>
3838
```
3939

@@ -52,9 +52,6 @@ Contributions are welcomed by all! If you would like to submit changes be sure t
5252

5353
Please follow the [contribution document](https://github.com/GwtMaterialDesign/gwt-material/wiki/Contributing) on the projects code style standards.
5454

55-
## Follow Us
56-
<a href="https://plus.google.com/u/0/communities/108005250093449814286"> Google Plus</a>
57-
5855
## Related Projects
5956
<ul>
6057
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-addins" >Addins</a></li>

gwt-material/pom.xml

Lines changed: 1 addition & 1 deletion
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.4.0-SNAPSHOT</version>
7+
<version>2.4.0</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
*/
5757
//@formatter:on
5858
public abstract class AbstractSideNav extends MaterialWidget
59-
implements JsLoader, HasSelectables, HasInOutDurationTransition, HasSideNavHandlers, HasOverlayStyle, HasDensity {
59+
implements JsLoader, HasSelectables, HasInOutDurationTransition, HasSideNavHandlers, HasOverlayStyle, HasOpenClose, HasDensity {
6060

6161
protected int width = 240;
6262
protected int inDuration = 400;
@@ -482,6 +482,7 @@ public void show() {
482482
/**
483483
* Show the sidenav using the activator element
484484
*/
485+
@Override
485486
public void open() {
486487
$("#sidenav-overlay").remove();
487488
$(activator).sideNav("show");
@@ -498,10 +499,12 @@ public void hide() {
498499
/**
499500
* Hide the sidenav using the activator element
500501
*/
502+
@Override
501503
public void close() {
502504
$(activator).sideNav("hide");
503505
}
504506

507+
@Override
505508
public boolean isOpen() {
506509
return open;
507510
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* #%L
3+
* GwtMaterial
4+
* %%
5+
* Copyright (C) 2015 - 2020 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 interface HasOpenClose {
23+
24+
void open();
25+
26+
void close();
27+
28+
boolean isOpen();
29+
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
//@formatter:on
6868
public class MaterialDatePicker extends AbstractValueWidget<Date> implements JsLoader, HasPlaceholder,
6969
HasOpenHandlers<MaterialDatePicker>, HasCloseHandlers<MaterialDatePicker>, HasIcon, HasReadOnly,
70-
HasFieldTypes, HasLabel {
70+
HasFieldTypes, HasLabel, HasOpenClose {
7171

7272
/**
7373
* Enum for identifying various selection types for the picker.
@@ -636,17 +636,20 @@ public MaterialLabel getErrorLabel() {
636636
/**
637637
* Programmatically close the date picker component
638638
*/
639+
@Override
639640
public void close() {
640641
Scheduler.get().scheduleDeferred(() -> getPicker().close());
641642
}
642643

643644
/**
644645
* Programmatically open the date picker component
645646
*/
647+
@Override
646648
public void open() {
647649
Scheduler.get().scheduleDeferred(() -> getPicker().open());
648650
}
649651

652+
@Override
650653
public boolean isOpen() {
651654
return Boolean.parseBoolean(getPicker().get("open").toString());
652655
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
*/
7878
// @formatter:on
7979
public class MaterialDialog extends MaterialWidget implements HasType<DialogType>, HasInOutDurationTransition,
80-
HasDismissible, HasCloseHandlers<MaterialDialog>, HasOpenHandlers<MaterialDialog>, HasFullscreen, HasOverlayStyle {
80+
HasDismissible, HasCloseHandlers<MaterialDialog>, HasOpenHandlers<MaterialDialog>, HasFullscreen, HasOverlayStyle,
81+
HasOpenClose {
8182

8283
private JsModalOptions options = new JsModalOptions();
8384

@@ -232,6 +233,7 @@ public boolean isFullscreen() {
232233
*
233234
* @throws IllegalStateException If the MaterialDialog is not added to the document
234235
*/
236+
@Override
235237
public void open() {
236238
open(true);
237239
}
@@ -296,6 +298,7 @@ protected void onNativeClose(boolean autoClosed, boolean fireEvent) {
296298
* are not using UiBinder. See {@link #open()}.
297299
* </p>
298300
*/
301+
@Override
299302
public void close() {
300303
close(false);
301304
}
@@ -337,6 +340,7 @@ protected void close(Element e, boolean autoClosed, boolean fireEvent) {
337340
}
338341
}
339342

343+
@Override
340344
public boolean isOpen() {
341345
return open;
342346
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.gwt.event.logical.shared.*;
2424
import com.google.gwt.event.shared.HandlerRegistration;
2525
import gwt.material.design.client.base.HasAxis;
26+
import gwt.material.design.client.base.HasOpenClose;
2627
import gwt.material.design.client.base.HasType;
2728
import gwt.material.design.client.base.MaterialWidget;
2829
import gwt.material.design.client.base.mixin.CssNameMixin;
@@ -61,7 +62,7 @@
6162
*/
6263
//@formatter:on
6364
public class MaterialFAB extends MaterialWidget implements HasType<FABType>, HasAxis, HasCloseHandlers<MaterialFAB>,
64-
HasOpenHandlers<MaterialFAB> {
65+
HasOpenHandlers<MaterialFAB>, HasOpenClose {
6566

6667
private CssTypeMixin<FABType, MaterialFAB> typeMixin;
6768
private CssNameMixin<MaterialFAB, Axis> axisMixin;
@@ -93,6 +94,7 @@ protected void onLoad() {
9394
/**
9495
* Open the FAB programmatically
9596
*/
97+
@Override
9698
public void open() {
9799
open(true);
98100
}
@@ -112,6 +114,7 @@ public void open(boolean fireEvent) {
112114
/**
113115
* Close the FAB programmatically
114116
*/
117+
@Override
115118
public void close() {
116119
close(true);
117120
}
@@ -128,6 +131,11 @@ public void close(boolean fireEvent) {
128131
$(getElement()).closeFAB();
129132
}
130133

134+
@Override
135+
public boolean isOpen() {
136+
return getElement().hasClassName(CssName.ACTIVE);
137+
}
138+
131139
@Override
132140
public void setType(FABType type) {
133141
getTypeMixin().setType(type);
@@ -148,10 +156,6 @@ public Axis getAxis() {
148156
return getAxisMixin().getCssName();
149157
}
150158

151-
public boolean isOpen() {
152-
return getElement().hasClassName(CssName.ACTIVE);
153-
}
154-
155159
@Override
156160
public HandlerRegistration addCloseHandler(CloseHandler<MaterialFAB> handler) {
157161
return addHandler(handler, CloseEvent.getType());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ public void setKeyFactory(KeyFactory<T, String> keyFactory) {
958958
@Override
959959
public void setReadOnly(boolean value) {
960960
getReadOnlyMixin().setReadOnly(value);
961-
if (!value) {
961+
if (!value && isAttached()) {
962962
$(listBox.getElement()).material_select("destroy");
963963
$(listBox.getElement()).material_select();
964964
}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.gwt.event.shared.HandlerRegistration;
2828
import com.google.gwt.user.client.ui.TextBox;
2929
import gwt.material.design.client.base.HasActive;
30+
import gwt.material.design.client.base.HasOpenClose;
3031
import gwt.material.design.client.base.HasSearchHandlers;
3132
import gwt.material.design.client.base.SearchObject;
3233
import gwt.material.design.client.constants.*;
@@ -75,7 +76,7 @@
7576
*/
7677
//@formatter:on
7778
public class MaterialSearch extends MaterialValueBox<String> implements HasOpenHandlers<String>, HasCloseHandlers<String>,
78-
HasActive, HasSearchHandlers {
79+
HasActive, HasSearchHandlers, HasOpenClose {
7980

8081
private Label label = new Label();
8182
private MaterialIcon iconSearch = new MaterialIcon(IconType.SEARCH);
@@ -255,16 +256,23 @@ protected void onUnload() {
255256
/**
256257
* Programmatically open the search input field component
257258
*/
259+
@Override
258260
public void open() {
259261
setActive(true);
260262
Scheduler.get().scheduleDeferred(() -> $(valueBoxBase.getElement()).focus());
261263
OpenEvent.fire(MaterialSearch.this, getText());
262264
}
263265

266+
@Override
264267
public void close() {
265268
close(true);
266269
}
267270

271+
@Override
272+
public boolean isOpen() {
273+
return isActive();
274+
}
275+
268276
public void close(boolean fireEvents) {
269277
setActive(false);
270278
if (fireEvents) {

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.gwtmaterialdesign</groupId>
77
<artifactId>gwt-material-parent</artifactId>
8-
<version>2.4.0-SNAPSHOT</version>
8+
<version>2.4.0</version>
99
<packaging>pom</packaging>
1010
<modules>
1111
<module>gwt-material</module>
@@ -69,7 +69,7 @@
6969
<connection>scm:git:[email protected]:GwtMaterialDesign/gwt-material.git</connection>
7070
<developerConnection>scm:git:[email protected]:GwtMaterialDesign/gwt-material.git</developerConnection>
7171
<url>http://github.com/GwtMaterialDesign/gwt-material</url>
72-
<tag>v2.4.0-SNAPSHOT</tag>
72+
<tag>v2.4.0</tag>
7373
</scm>
7474

7575
<licenses>

0 commit comments

Comments
 (0)