Skip to content

Commit

Permalink
Merge pull request #437 from GwtMaterialDesign/release_2.7.0
Browse files Browse the repository at this point in the history
Release 2.7.0
  • Loading branch information
kevzlou7979 authored May 8, 2023
2 parents 8e71181 + 6ae4fd0 commit 0d6ae49
Show file tree
Hide file tree
Showing 22 changed files with 351 additions and 137 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery library before we build the demo
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- cd gwt-material-jquery
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material library before we build the demo
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material.git
- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material.git
- cd gwt-material
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material-table library before we build the demo
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-table.git
- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material-table.git
- cd gwt-material-table
- mvn install -DskipTests=true -DdryRun=true
- cd ..
Expand Down
2 changes: 1 addition & 1 deletion .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.1" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.8.0" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy -DskipTests --settings ~/settings.xml
fi
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gwt-material <br>

## Current Version 2.6.1
## Current Version 2.7.0
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.6.1</version>
<version>2.7.0</version>
</dependency>
```

## Snapshot Version 2.6.1
## Snapshot Version 2.8.0
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.6.1-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
</dependency>
```

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 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.6.1</version>
<version>2.7.0</version>
</parent>

<artifactId>gwt-material-addins</artifactId>
Expand All @@ -24,7 +24,7 @@
<connection>scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git</connection>
<developerConnection>scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
<tag>v2.6.1</tag>
<tag>v2.7.0</tag>
</scm>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.DomEvent;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
Expand Down Expand Up @@ -59,12 +60,14 @@
import gwt.material.design.client.events.ClosingEvent;
import gwt.material.design.client.events.OpeningEvent;
import gwt.material.design.client.ui.MaterialLabel;
import gwt.material.design.client.ui.MaterialToast;
import gwt.material.design.client.ui.html.Label;
import gwt.material.design.client.ui.html.OptGroup;
import gwt.material.design.client.ui.html.Option;
import gwt.material.design.jquery.client.api.Event;
import gwt.material.design.jquery.client.api.Functions;
import gwt.material.design.jquery.client.api.JQueryElement;
import gwt.material.design.jquery.client.api.KeyEvent;

import java.util.*;

Expand Down Expand Up @@ -115,6 +118,7 @@ public class MaterialComboBox<T> extends AbstractValueWidget<List<T>> implements
private int selectedIndex;
private boolean open;
private boolean suppressChangeEvent;
private boolean enableFocus;
protected List<T> values = new ArrayList<>();
private Label label = new Label();
private MaterialLabel errorLabel = new MaterialLabel();
Expand Down Expand Up @@ -221,11 +225,19 @@ public void load() {
return true;
});

body().on(ComboBoxEvents.FOCUS, getSelectContainerSelector(), (e, param1) -> {
if (!e.getCurrentTarget().getClassName().contains("select2-container--focus")) {
DomEvent.fireNativeEvent(Document.get().createFocusEvent(), this, getElement());
}
return false;
if (enableFocus) {
body().on(ComboBoxEvents.FOCUS, getSelectContainerSelector(), (e, param1) -> {
if (!e.getCurrentTarget().getClassName().contains("select2-container--focus")) {
DomEvent.fireNativeEvent(Document.get().createFocusEvent(), this, getElement());
}
return false;
});
}

body().on(ComboBoxEvents.KEYUP, getSearchFieldElement(), e -> {
KeyEvent keyEvent = (KeyEvent) e;
DomEvent.fireNativeEvent(Document.get().createKeyUpEvent(keyEvent.ctrlKey, keyEvent.altKey, keyEvent.shiftKey, Boolean.parseBoolean(keyEvent.metaKey), keyEvent.keyCode), this, getElement());
return true;
});

displayArrowForAllowClearOption(false);
Expand Down Expand Up @@ -256,10 +268,14 @@ public void unload() {
jsComboBox.off(ComboBoxEvents.CHANGE);
jsComboBox.off(ComboBoxEvents.SELECT);
jsComboBox.off(ComboBoxEvents.UNSELECT);
jsComboBox.off(ComboBoxEvents.OPENING);
jsComboBox.off(ComboBoxEvents.OPEN);
jsComboBox.off(ComboBoxEvents.CLOSING);
jsComboBox.off(ComboBoxEvents.CLOSE);
jsComboBox.off(ComboBoxEvents.CLEAR);
jsComboBox.off(ComboBoxEvents.CLEARING);
jsComboBox.off(ComboBoxEvents.FOCUS);
jsComboBox.off(ComboBoxEvents.KEYUP);
body().off("focus");
jsComboBox.select2("destroy");
}
Expand Down Expand Up @@ -1243,6 +1259,26 @@ public List<T> getOptions() {
return values;
}

public void focusSearchInput() {
$(getSearchFieldElement()).focus();
}

public void setSearchInputPlaceholder(String placeholder) {
$(getSearchFieldElement()).attr("placeholder", placeholder);
}

public void setSearchInputValue(String value) {
$(getSearchFieldElement()).val(value);
}

public boolean isEnableFocus() {
return enableFocus;
}

public void setEnableFocus(boolean enableFocus) {
this.enableFocus = enableFocus;
}

@Override
public void setAsyncDisplayLoader(AsyncDisplayLoader displayLoader) {
getAsyncWidgetMixin().setAsyncDisplayLoader(displayLoader);
Expand All @@ -1256,6 +1292,10 @@ public String getSelectContainerSelector() {
return "#" + getId() + " .select2.select2-container";
}

public String getSearchFieldElement() {
return "#" + getId() + " .select2-search__field";
}

@Override
public AsyncDisplayLoader getAsyncDisplayLoader() {
return getAsyncWidgetMixin().getAsyncDisplayLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
package gwt.material.design.addins.client.combobox.events;

import gwt.material.design.jquery.client.api.Event;

/**
* Events for Combobox
*
Expand All @@ -36,4 +38,5 @@ public interface ComboBoxEvents {
String CLEAR = "select2:clear";
String CLEARING = "select2:clearing";
String FOCUS = "focus";
String KEYUP = "keyup";
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.addins.client.base.constants.AddinsCssName;
import gwt.material.design.client.MaterialDesignBase;
import gwt.material.design.client.base.HasIcon;
import gwt.material.design.client.base.HasTitle;
import gwt.material.design.client.base.MaterialWidget;
import gwt.material.design.client.constants.*;
import gwt.material.design.client.ui.MaterialIcon;
import gwt.material.design.client.ui.MaterialLoader;
import gwt.material.design.client.ui.MaterialTitle;
import gwt.material.design.client.ui.*;
import gwt.material.design.client.ui.html.Div;

//@formatter:off
Expand Down Expand Up @@ -65,6 +64,7 @@ public class MaterialEmptyState extends MaterialWidget implements HasIcon, HasTi
private boolean loading;
private MaterialIcon icon = new MaterialIcon();
private MaterialTitle title = new MaterialTitle();
private MaterialPanel actions = new MaterialPanel();
private Div container = new Div();

public MaterialEmptyState() {
Expand All @@ -91,6 +91,8 @@ protected void onLoad() {
container.setWidth("100%");
container.setStyleName(CssName.VALIGN + " " + CssName.CENTER);
container.add(title);
actions.addStyleName("actions");
container.add(actions);
title.insert(icon, 0);
}

Expand Down Expand Up @@ -178,6 +180,12 @@ public Div getContainer() {
return container;
}

public void addAction(Widget widget) {
if (widget != null) {
actions.add(widget);
}
}

public boolean isLoading() {
return loading;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ protected void onLoad() {

@Override
public void load() {
if (mask == null || mask.isEmpty()) {
GWT.log("You must provide a mask pattern in order to mask your field");
} else {
if (mask != null && !mask.isEmpty()) {
load(mask);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
*/
package gwt.material.design.addins.client.livestamp;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import gwt.material.design.addins.client.MaterialAddins;
import gwt.material.design.addins.client.livestamp.js.JsLiveStamp;
import gwt.material.design.addins.client.moment.resources.MomentClientBundle;
import gwt.material.design.addins.client.moment.resources.MomentClientDebugBundle;
import gwt.material.design.client.MaterialDesignBase;
import gwt.material.design.client.base.AbstractValueWidget;
import gwt.material.design.client.base.JsLoader;

import java.util.Date;

Expand Down Expand Up @@ -56,9 +54,9 @@
* @see <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/#livestamp">Material Live Stamp</a>
* @see <a href="https://github.com/mattbradley/livestampjs">LiveStamp 1.1.2</a>
*/
public class MaterialLiveStamp extends AbstractValueWidget<Date> implements JsLoader {
public class MaterialLiveStamp extends AbstractValueWidget<Date> {

private Date date = new Date();
private Date value = new Date();

static {
if (MaterialAddins.isDebug()) {
Expand All @@ -75,45 +73,31 @@ public MaterialLiveStamp() {
}

@Override
protected void onLoad() {
super.onLoad();
protected void onUnload() {
super.onUnload();

load();
destroy();
}

@Override
public void load() {
if (date != null) {
setValue(date);
public void setValue(Date value, boolean fireEvents) {
super.setValue(value, fireEvents);
this.value = value;

if (value != null) {
getElement().setAttribute("data-livestamp", value.toString());
} else {
GWT.log("You must specify the date value.", new IllegalStateException());
destroy();
}
}

@Override
public void unload() {
getElement().removeAttribute("data-livestamp");
}

@Override
public void reload() {
unload();
load();
}

@Override
public void setValue(Date date, boolean fireEvents) {
this.date = date;

if (date != null) {
getElement().setAttribute("data-livestamp", date.toString());

super.setValue(date, fireEvents);
}
public void destroy() {
JsLiveStamp.$(getElement()).livestamp("destroy");
getElement().setInnerText("-");
}

@Override
public Date getValue() {
return date;
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class JsLiveStamp extends JQueryElement {
public static native JsLiveStamp $(String selector);

@JsMethod
public native JsLiveStamp livestamp(int currentMillis);
public native JsLiveStamp livestamp(String method);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package gwt.material.design.addins.client.popupmenu;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.logical.shared.*;
import com.google.gwt.event.shared.HandlerRegistration;
Expand Down Expand Up @@ -72,8 +73,10 @@ protected void onLoad() {
@Override
public void load() {
$(this).attr("tabindex", "0");
$(this).on("blur", e -> {
if (autoClose) {

$(this).off("mouseup").on("mouseup", e -> {
boolean closest = $(e.target).closest("#" + id).length() == 0;
if (autoClose && closest) {
close();
}
return true;
Expand Down Expand Up @@ -189,7 +192,7 @@ public HandlerRegistration addSelectionHandler(SelectionHandler<Element> selecti
@Override
public void open() {
setVisible(true);
/*Scheduler.get().scheduleDeferred(() -> setFocus(true));*/
Scheduler.get().scheduleDeferred(() -> setFocus(true));

// Check if dropdown is out of the container (Left)
if ($(this).width() + $(this).offset().left > body().width()) {
Expand Down
Loading

0 comments on commit 0d6ae49

Please sign in to comment.