Skip to content

Commit 6eaf447

Browse files
authored
Merge pull request #162 from GwtMaterialDesign/release_2.0
Release 2.0-rc3
2 parents 9ed6efe + e15549d commit 6eaf447

File tree

31 files changed

+757
-377
lines changed

31 files changed

+757
-377
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gw
88
<dependency>
99
<groupId>com.github.gwtmaterialdesign</groupId>
1010
<artifactId>gwt-material-addins</artifactId>
11-
<version>2.0-rc2</version>
11+
<version>2.0-rc3</version>
1212
</dependency>
1313
```
1414

@@ -43,6 +43,7 @@ xmlns:ma="urn:import:gwt.material.design.addins.client"
4343
<li>Avatar</li>
4444
<li>Bubble</li>
4545
<li>Camera</li>
46+
<li>ComboBox</li>
4647
<li>Cutout</li>
4748
<li>Document Viewer</li>
4849
<li>Dnd</li>
@@ -52,7 +53,7 @@ xmlns:ma="urn:import:gwt.material.design.addins.client"
5253
<li>Menubar</li>
5354
<li>Overlay</li>
5455
<li>Path Animator</li>
55-
<li>Rating (NEW)</li>
56+
<li>Rating</li>
5657
<li>Rich Editor</li>
5758
<li>Scrollfire</li>
5859
<li>SplitPanel</li>

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
<parent>
55
<artifactId>gwt-material-parent</artifactId>
66
<groupId>com.github.gwtmaterialdesign</groupId>
7-
<version>2.0-rc2</version>
7+
<version>2.0-rc3</version>
88
</parent>
99

1010
<artifactId>gwt-material-addins</artifactId>
1111

1212
<name>Gwt Material Addins</name>
13-
<version>2.0-rc2</version>
13+
<version>2.0-rc3</version>
1414
<description>Extra Components of GWT Material Framework</description>
1515

1616
<properties>
17-
<gwt-material.version>2.0-rc2</gwt-material.version>
17+
<gwt-material.version>2.0-rc3</gwt-material.version>
1818
</properties>
1919

2020
<scm>
2121
<connection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</connection>
2222
<developerConnection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
2323
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
24-
<tag>v2.0-rc2</tag>
24+
<tag>v2.0-rc3</tag>
2525
</scm>
2626

2727
<licenses>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ protected boolean addItem(final Suggestion suggestion) {
393393
*/
394394
public void clear() {
395395
itemBox.setValue("");
396+
lblPlaceholder.removeStyleName(CssName.ACTIVE);
396397

397398
Collection<Widget> values = suggestionMap.values();
398399
for (Widget widget : values) {

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

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public class MaterialComboBox<T> extends AbstractValueWidget<T> implements HasPl
9696
private boolean initialized;
9797
private boolean hideSearch;
9898
private int limit;
99+
private boolean closeOnSelect = true;
99100

100101
private int selectedIndex;
101102
private String uid = DOM.createUniqueId();
@@ -108,7 +109,7 @@ public class MaterialComboBox<T> extends AbstractValueWidget<T> implements HasPl
108109
private HandlerRegistration valueChangeHandler;
109110

110111
private final ErrorMixin<AbstractValueWidget, MaterialLabel> errorMixin = new ErrorMixin<>(
111-
this, lblError, this.asWidget());
112+
this, lblError, this.asWidget());
112113
private ReadOnlyMixin<MaterialComboBox, MaterialWidget> readOnlyMixin;
113114

114115
// By default the key is generated using toString
@@ -143,6 +144,7 @@ public void initialize() {
143144
options.allowClear = allowClear;
144145
options.placeholder = placeholder;
145146
options.maximumSelectionLength = limit;
147+
options.closeOnSelect = closeOnSelect;
146148
if (isHideSearch()) {
147149
options.minimumResultsForSearch = "Infinity";
148150
}
@@ -296,7 +298,6 @@ public boolean isMultiple() {
296298
public void setAcceptableValues(Collection<T> values) {
297299
this.values.clear();
298300
clear();
299-
300301
for (T value : values) {
301302
addItem(value);
302303
}
@@ -352,14 +353,7 @@ public void setValues(List<T> values) {
352353
}
353354

354355
public Option addItem(T value) {
355-
if (!values.contains(value)) {
356-
Option opt = new Option(keyFactory.generateKey(value));
357-
add(opt);
358-
return opt;
359-
} else {
360-
GWT.log("Cannot add duplicate value: " + value);
361-
}
362-
return null;
356+
return addItem(keyFactory.generateKey(value), value);
363357
}
364358

365359
/**
@@ -400,11 +394,13 @@ public void addItem(String text, T value, OptGroup optGroup) {
400394
* @param text - The text you want to labeled on the option item
401395
* @param value - The value you want to pass through in this option
402396
*/
403-
public void addItem(String text, T value) {
397+
public Option addItem(String text, T value) {
404398
if (!values.contains(value)) {
399+
Option option = buildOption(text, value);
405400
values.add(value);
406-
listbox.add(buildOption(text, value));
401+
listbox.add(option);
407402
}
403+
return null;
408404
}
409405

410406
/**
@@ -565,6 +561,20 @@ public boolean isToggleReadOnly() {
565561
return getReadOnlyMixin().isToggleReadOnly();
566562
}
567563

564+
/**
565+
* Check whether the dropdown will be close or not when result is selected
566+
*/
567+
public boolean isCloseOnSelect() {
568+
return closeOnSelect;
569+
}
570+
571+
/**
572+
* Allow or Prevent the dropdown from closing when a result is selected (Default true)
573+
*/
574+
public void setCloseOnSelect(boolean closeOnSelect) {
575+
this.closeOnSelect = closeOnSelect;
576+
}
577+
568578
public MaterialWidget getListbox() {
569579
return listbox;
570580
}

src/main/java/gwt/material/design/addins/client/combobox/js/JsComboBoxOptions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ public class JsComboBoxOptions {
4242

4343
@JsProperty
4444
public String minimumResultsForSearch;
45-
}
45+
46+
@JsProperty
47+
public boolean closeOnSelect;
48+
}

0 commit comments

Comments
 (0)