Skip to content

Commit

Permalink
Merge pull request #976 from GwtMaterialDesign/release_2.4.0
Browse files Browse the repository at this point in the history
Official 2.4.0 Release
  • Loading branch information
kevzlou7979 authored Aug 17, 2020
2 parents 9268511 + 65800dd commit 4c7b3d3
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs


## Maven
### Current Version 2.4.0-rc2
### Current Version 2.4.0
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>2.4.0-rc2</version>
<version>2.4.0</version>
</dependency>
```
### Snapshot Version 2.4.0-SNAPSHOT
### Snapshot Version 2.5.0-SNAPSHOT
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gwt-material/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.4.0-rc2</version>
<version>2.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*/
//@formatter:on
public abstract class AbstractSideNav extends MaterialWidget
implements JsLoader, HasSelectables, HasInOutDurationTransition, HasSideNavHandlers, HasOverlayStyle, HasDensity {
implements JsLoader, HasSelectables, HasInOutDurationTransition, HasSideNavHandlers, HasOverlayStyle, HasOpenClose, HasDensity {

protected int width = 240;
protected int inDuration = 400;
Expand Down Expand Up @@ -482,6 +482,7 @@ public void show() {
/**
* Show the sidenav using the activator element
*/
@Override
public void open() {
$("#sidenav-overlay").remove();
$(activator).sideNav("show");
Expand All @@ -498,10 +499,12 @@ public void hide() {
/**
* Hide the sidenav using the activator element
*/
@Override
public void close() {
$(activator).sideNav("hide");
}

@Override
public boolean isOpen() {
return open;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ protected void onEnsureDebugId(String baseID) {
*/
@Override
protected void onLoad() {
super.onLoad();
DOM.setEventListener(inputElem, this);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2020 GwtMaterialDesign
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package gwt.material.design.client.base;

public interface HasOpenClose {

void open();

void close();

boolean isOpen();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class RequiredFieldMixin <T extends AbstractValueWidget & HasRequiredField, H extends UIObject>
extends AbstractMixin<T> implements HasRequiredField {

private String REQUIRED = "required";
private final String REQUIRED = "required";
private H targetLabel;
private boolean required;
private ToggleStyleMixin<UIObject> toggleStyleMixin;
Expand All @@ -51,8 +51,8 @@ public RequiredFieldMixin(T uiObject, H targetLabel) {
public void setRequired(boolean required) {
this.required = required;

uiObject.setValidateOnBlur(true);
uiObject.setAllowBlank(false);
uiObject.setValidateOnBlur(required);
uiObject.setAllowBlank(!required);

if (targetLabel != null) {
getToggleStyleMixin().setOn(required);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
//@formatter:on
public class MaterialDatePicker extends AbstractValueWidget<Date> implements JsLoader, HasPlaceholder,
HasOpenHandlers<MaterialDatePicker>, HasCloseHandlers<MaterialDatePicker>, HasIcon, HasReadOnly,
HasFieldTypes, HasLabel {
HasFieldTypes, HasLabel, HasOpenClose {

/**
* Enum for identifying various selection types for the picker.
Expand Down Expand Up @@ -636,17 +636,20 @@ public MaterialLabel getErrorLabel() {
/**
* Programmatically close the date picker component
*/
@Override
public void close() {
Scheduler.get().scheduleDeferred(() -> getPicker().close());
}

/**
* Programmatically open the date picker component
*/
@Override
public void open() {
Scheduler.get().scheduleDeferred(() -> getPicker().open());
}

@Override
public boolean isOpen() {
return Boolean.parseBoolean(getPicker().get("open").toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
*/
// @formatter:on
public class MaterialDialog extends MaterialWidget implements HasType<DialogType>, HasInOutDurationTransition,
HasDismissible, HasCloseHandlers<MaterialDialog>, HasOpenHandlers<MaterialDialog>, HasFullscreen, HasOverlayStyle {
HasDismissible, HasCloseHandlers<MaterialDialog>, HasOpenHandlers<MaterialDialog>, HasFullscreen, HasOverlayStyle,
HasOpenClose {

private JsModalOptions options = new JsModalOptions();

Expand Down Expand Up @@ -232,6 +233,7 @@ public boolean isFullscreen() {
*
* @throws IllegalStateException If the MaterialDialog is not added to the document
*/
@Override
public void open() {
open(true);
}
Expand Down Expand Up @@ -296,6 +298,7 @@ protected void onNativeClose(boolean autoClosed, boolean fireEvent) {
* are not using UiBinder. See {@link #open()}.
* </p>
*/
@Override
public void close() {
close(false);
}
Expand Down Expand Up @@ -337,6 +340,7 @@ protected void close(Element e, boolean autoClosed, boolean fireEvent) {
}
}

@Override
public boolean isOpen() {
return open;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.event.shared.HandlerRegistration;
import gwt.material.design.client.base.HasAxis;
import gwt.material.design.client.base.HasOpenClose;
import gwt.material.design.client.base.HasType;
import gwt.material.design.client.base.MaterialWidget;
import gwt.material.design.client.base.mixin.CssNameMixin;
Expand Down Expand Up @@ -61,7 +62,7 @@
*/
//@formatter:on
public class MaterialFAB extends MaterialWidget implements HasType<FABType>, HasAxis, HasCloseHandlers<MaterialFAB>,
HasOpenHandlers<MaterialFAB> {
HasOpenHandlers<MaterialFAB>, HasOpenClose {

private CssTypeMixin<FABType, MaterialFAB> typeMixin;
private CssNameMixin<MaterialFAB, Axis> axisMixin;
Expand Down Expand Up @@ -93,6 +94,7 @@ protected void onLoad() {
/**
* Open the FAB programmatically
*/
@Override
public void open() {
open(true);
}
Expand All @@ -112,6 +114,7 @@ public void open(boolean fireEvent) {
/**
* Close the FAB programmatically
*/
@Override
public void close() {
close(true);
}
Expand All @@ -128,6 +131,11 @@ public void close(boolean fireEvent) {
$(getElement()).closeFAB();
}

@Override
public boolean isOpen() {
return getElement().hasClassName(CssName.ACTIVE);
}

@Override
public void setType(FABType type) {
getTypeMixin().setType(type);
Expand All @@ -148,10 +156,6 @@ public Axis getAxis() {
return getAxisMixin().getCssName();
}

public boolean isOpen() {
return getElement().hasClassName(CssName.ACTIVE);
}

@Override
public HandlerRegistration addCloseHandler(CloseHandler<MaterialFAB> handler) {
return addHandler(handler, CloseEvent.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.client.base.HasActivates;
import gwt.material.design.client.base.HasProgress;
Expand Down Expand Up @@ -88,8 +89,7 @@ protected void onLoad() {
navMenu.setIconPosition(IconPosition.NONE);

// Check whether the SideNav is attached or not. If not attached Hide the NavMenu
Element sideNavElement = $("\\#" + getActivatesMixin().getActivates()).asElement();

Element sideNavElement = $(DOM.getElementById(getActivatesMixin().getActivates())).asElement();
navMenu.setDisplay(sideNavElement == null ? Display.NONE : Display.INITIAL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.TextBox;
import gwt.material.design.client.base.HasActive;
import gwt.material.design.client.base.HasOpenClose;
import gwt.material.design.client.base.HasSearchHandlers;
import gwt.material.design.client.base.SearchObject;
import gwt.material.design.client.constants.*;
Expand Down Expand Up @@ -75,7 +76,7 @@
*/
//@formatter:on
public class MaterialSearch extends MaterialValueBox<String> implements HasOpenHandlers<String>, HasCloseHandlers<String>,
HasActive, HasSearchHandlers {
HasActive, HasSearchHandlers, HasOpenClose {

private Label label = new Label();
private MaterialIcon iconSearch = new MaterialIcon(IconType.SEARCH);
Expand Down Expand Up @@ -255,16 +256,23 @@ protected void onUnload() {
/**
* Programmatically open the search input field component
*/
@Override
public void open() {
setActive(true);
Scheduler.get().scheduleDeferred(() -> $(valueBoxBase.getElement()).focus());
OpenEvent.fire(MaterialSearch.this, getText());
}

@Override
public void close() {
close(true);
}

@Override
public boolean isOpen() {
return isActive();
}

public void close(boolean fireEvents) {
setActive(false);
if (fireEvents) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ protected <W extends MaterialValueBox> void checkMandatoryField(W widget) {
widget.setRequired(true);
assertTrue(widget.isRequired());
assertTrue(widget.getStatusTextMixin().getPlaceholder().getElement().hasClassName(REQUIRED));
assertTrue(widget.isValidateOnBlur());
assertFalse(widget.isAllowBlank());

widget.setRequired(false);
assertFalse(widget.isRequired());
assertFalse(widget.getStatusTextMixin().getPlaceholder().getElement().hasClassName(REQUIRED));
assertFalse(widget.isValidateOnBlur());
assertTrue(widget.isAllowBlank());
}

protected <W extends MaterialValueBox> void checkAutocomplete(W widget) {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-parent</artifactId>
<version>2.4.0-rc2</version>
<version>2.4.0</version>
<packaging>pom</packaging>
<modules>
<module>gwt-material</module>
Expand Down Expand Up @@ -69,7 +69,7 @@
<connection>scm:git:git@github.com:GwtMaterialDesign/gwt-material.git</connection>
<developerConnection>scm:git:git@github.com:GwtMaterialDesign/gwt-material.git</developerConnection>
<url>http://github.com/GwtMaterialDesign/gwt-material</url>
<tag>v2.4.0-rc2</tag>
<tag>v2.4.0</tag>
</scm>

<licenses>
Expand Down

0 comments on commit 4c7b3d3

Please sign in to comment.