Skip to content

Commit 543929f

Browse files
authored
Merge pull request #190 from tbenbrahim/master
Fixes #189, clear should not remove label, error label and listbox
2 parents 6eaf447 + 39c4b79 commit 543929f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
import java.util.ArrayList;
4848
import java.util.Collection;
49+
import java.util.Iterator;
4950
import java.util.List;
5051

5152
import static gwt.material.design.addins.client.combobox.js.JsComboBox.$;
@@ -211,6 +212,17 @@ public void add(Widget child) {
211212
listbox.add(child);
212213
}
213214

215+
@Override
216+
public void clear() {
217+
final Iterator<Widget> it = iterator();
218+
while (it.hasNext()) {
219+
final Widget widget = it.next();
220+
if (widget != label && widget != lblError && widget != listbox) {
221+
it.remove();
222+
}
223+
}
224+
}
225+
214226
/**
215227
* Sets multi-value select boxes.
216228
*/
@@ -582,4 +594,4 @@ public MaterialWidget getListbox() {
582594
public Label getLabel() {
583595
return label;
584596
}
585-
}
597+
}

0 commit comments

Comments
 (0)