Skip to content

Commit 7b2676d

Browse files
authored
Merge pull request #364 from GwtMaterialDesign/release_2.1.1
Release 2.1.1
2 parents adee37d + efedc01 commit 7b2676d

38 files changed

+1209
-689
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ cache:
77
- $HOME/.m2
88
before_install:
99
# install the gwt-material-jquery library before we build the demo
10-
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material-jquery.git
10+
- git clone -b release_2.1.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
1111
- cd gwt-material-jquery
1212
- mvn install -DskipTests=true -DdryRun=true
1313
- cd ..
1414
# install the gwt-material library before we build the demo
15-
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material.git
15+
- git clone -b release_2.1.1 https://github.com/GwtMaterialDesign/gwt-material.git
1616
- cd gwt-material
1717
- mvn install -DskipTests=true -DdryRun=true
1818
- cd ..

.utility/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.1.1" ]; then
44
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
55
mvn deploy --settings ~/settings.xml
66
fi

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66

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

9-
## Current Version 2.1
9+
## Current Version 2.1.1
1010
```xml
1111
<dependency>
1212
<groupId>com.github.gwtmaterialdesign</groupId>
1313
<artifactId>gwt-material-addins</artifactId>
14-
<version>2.1</version>
14+
<version>2.1.1</version>
1515
</dependency>
1616
```
1717

18-
## Snapshot Version 2.1.1-SNAPSHOT
18+
## Snapshot Version 2.2-SNAPSHOT
1919
```xml
2020
<dependency>
2121
<groupId>com.github.gwtmaterialdesign</groupId>
2222
<artifactId>gwt-material-addins</artifactId>
23-
<version>2.1.1-SNAPSHOT</version>
23+
<version>2.2-SNAPSHOT</version>
2424
</dependency>
2525
```
2626

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
<parent>
66
<artifactId>gwt-material-parent</artifactId>
77
<groupId>com.github.gwtmaterialdesign</groupId>
8-
<version>2.1</version>
8+
<version>2.1.1</version>
99
</parent>
1010

1111
<artifactId>gwt-material-addins</artifactId>
1212
<packaging>gwt-lib</packaging>
1313

1414
<name>Gwt Material Addins</name>
15-
<version>2.1</version>
15+
<version>2.1.1</version>
1616
<description>Extra Components of GWT Material Framework</description>
1717

1818
<properties>
19-
<gwt-material.version>2.1</gwt-material.version>
19+
<gwt-material.version>2.1.1</gwt-material.version>
2020
</properties>
2121

2222
<scm>
2323
<connection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</connection>
2424
<developerConnection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
2525
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
26-
<tag>v2.1</tag>
26+
<tag>v2.1.1</tag>
2727
</scm>
2828

2929
<licenses>

src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -232,59 +232,65 @@ protected void onLoad() {
232232

233233
protected void loadHandlers() {
234234

235-
itemBoxBlurHandler = itemBox.addBlurHandler(blurEvent -> {
236-
if (getValue().size() > 0) {
237-
label.addStyleName(CssName.ACTIVE);
238-
}
239-
});
235+
if (itemBoxBlurHandler == null) {
236+
itemBoxBlurHandler = itemBox.addBlurHandler(blurEvent -> {
237+
if (getValue().size() > 0) {
238+
label.addStyleName(CssName.ACTIVE);
239+
}
240+
});
241+
}
240242

241-
itemBoxKeyDownHandler = itemBox.addKeyDownHandler(event -> {
242-
switch (event.getNativeKeyCode()) {
243-
case KeyCodes.KEY_ENTER:
244-
if (directInputAllowed) {
245-
String value = itemBox.getValue();
246-
if (value != null && !(value = value.trim()).isEmpty()) {
247-
gwt.material.design.client.base.Suggestion directInput = new gwt.material.design.client.base.Suggestion();
248-
directInput.setDisplay(value);
249-
directInput.setSuggestion(value);
250-
addItem(directInput);
251-
if (getType() == AutocompleteType.TEXT) {
252-
itemBox.setText(value);
253-
} else {
254-
itemBox.setValue("");
243+
if (itemBoxKeyDownHandler == null) {
244+
itemBoxKeyDownHandler = itemBox.addKeyDownHandler(event -> {
245+
switch (event.getNativeKeyCode()) {
246+
case KeyCodes.KEY_ENTER:
247+
if (directInputAllowed) {
248+
String value = itemBox.getValue();
249+
if (value != null && !(value = value.trim()).isEmpty()) {
250+
gwt.material.design.client.base.Suggestion directInput = new gwt.material.design.client.base.Suggestion();
251+
directInput.setDisplay(value);
252+
directInput.setSuggestion(value);
253+
addItem(directInput);
254+
if (getType() == AutocompleteType.TEXT) {
255+
itemBox.setText(value);
256+
} else {
257+
itemBox.setValue("");
258+
}
259+
itemBox.setFocus(true);
255260
}
256-
itemBox.setFocus(true);
257261
}
258-
}
259-
break;
260-
case KeyCodes.KEY_BACKSPACE:
261-
if (itemBox.getValue().trim().isEmpty()) {
262-
if (itemsHighlighted.isEmpty()) {
263-
if (suggestionMap.size() > 0) {
264-
ListItem li = (ListItem) list.getWidget(list.getWidgetCount() - 2);
265-
266-
if (tryRemoveSuggestion(li.getWidget(0))) {
267-
li.removeFromParent();
262+
break;
263+
case KeyCodes.KEY_BACKSPACE:
264+
if (itemBox.getValue().trim().isEmpty()) {
265+
if (itemsHighlighted.isEmpty()) {
266+
if (suggestionMap.size() > 0) {
267+
ListItem li = (ListItem) list.getWidget(list.getWidgetCount() - 2);
268+
269+
if (tryRemoveSuggestion(li.getWidget(0))) {
270+
li.removeFromParent();
271+
}
268272
}
269273
}
270274
}
271-
}
272-
break;
273-
case KeyCodes.KEY_DELETE:
274-
if (itemBox.getValue().trim().isEmpty()) {
275-
for (ListItem li : itemsHighlighted) {
276-
if (tryRemoveSuggestion(li.getWidget(0))) {
277-
li.removeFromParent();
275+
break;
276+
case KeyCodes.KEY_DELETE:
277+
if (itemBox.getValue().trim().isEmpty()) {
278+
for (ListItem li : itemsHighlighted) {
279+
if (tryRemoveSuggestion(li.getWidget(0))) {
280+
li.removeFromParent();
281+
}
278282
}
283+
itemsHighlighted.clear();
279284
}
280-
itemsHighlighted.clear();
281-
}
282-
itemBox.setFocus(true);
283-
break;
284-
}
285-
});
285+
itemBox.setFocus(true);
286+
break;
287+
}
288+
});
289+
}
286290

287-
itemBoxClickHandler = itemBox.addClickHandler(event -> suggestBox.showSuggestionList());
291+
if (itemBoxClickHandler == null) {
292+
itemBoxClickHandler = itemBox.addClickHandler(event -> suggestBox.showSuggestionList());
293+
}
288294
}
289295

290296
@Override

src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,11 @@ public void setValue(List<T> values, boolean fireEvents) {
532532
*/
533533
public void setSingleValue(T value, boolean fireEvents) {
534534
int index = this.values.indexOf(value);
535-
if (index >= 0) {
535+
if (index < 0 && value instanceof String) {
536+
index = getIndexByString((String) value);
537+
}
538+
539+
if (index > -1) {
536540
List<T> before = getValue();
537541
setSelectedIndex(index);
538542

@@ -542,6 +546,29 @@ public void setSingleValue(T value, boolean fireEvents) {
542546
}
543547
}
544548

549+
// TODO: Optimize performance (maybe use a map)
550+
public T getValueByString(String key) {
551+
for (T value : values) {
552+
if (keyFactory.generateKey(value).equals(key)) {
553+
return value;
554+
}
555+
}
556+
return null;
557+
}
558+
559+
// TODO: Optimize performance (maybe use a map)
560+
public int getIndexByString(String key) {
561+
int index = -1;
562+
563+
for (T value : values) {
564+
++index;
565+
if (keyFactory.generateKey(value).equals(key)) {
566+
return index;
567+
}
568+
}
569+
return index;
570+
}
571+
545572
/**
546573
* Set directly all the values that will be stored into
547574
* combobox and build options into it.

src/main/java/gwt/material/design/addins/client/emptystate/MaterialEmptyState.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class MaterialEmptyState extends MaterialWidget implements HasIcon, HasTi
6969

7070
public MaterialEmptyState() {
7171
super(Document.get().createDivElement(), CssName.VALIGN_WRAPPER, AddinsCssName.EMPTY_STATE);
72+
73+
setIconSize(IconSize.LARGE);
7274
}
7375

7476
public MaterialEmptyState(Color bgColor, Color textColor, IconType iconType, String title, String description) {
@@ -89,7 +91,6 @@ protected void onLoad() {
8991
container.setWidth("100%");
9092
container.setStyleName(CssName.VALIGN + " " + CssName.CENTER);
9193
container.add(title);
92-
icon.setIconSize(IconSize.LARGE);
9394
title.insert(icon, 0);
9495
}
9596

src/main/java/gwt/material/design/addins/client/richeditor/MaterialRichEditor.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ protected void onLoad() {
118118

119119
@Override
120120
public void load() {
121-
122121
JsRichEditor jsRichEditor = $(getElement());
123122

124123
options.toolbar = manager.getToolbars();
@@ -264,11 +263,7 @@ protected void adjustNestedDialog(MaterialDialog dialog) {
264263
protected void adjustFullScreen(MaterialDialog dialog) {
265264
getEditor().find("div[data-event='fullscreen']").off("click").on("click", (e, param1) -> {
266265
dialog.setFullscreen(toggleFullScreen);
267-
if (toggleFullScreen) {
268-
toggleFullScreen = false;
269-
} else {
270-
toggleFullScreen = true;
271-
}
266+
toggleFullScreen = !toggleFullScreen;
272267
return true;
273268
});
274269
}

0 commit comments

Comments
 (0)