Skip to content

Commit e26ebe8

Browse files
committed
More updates.
1 parent bd04ddd commit e26ebe8

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ public MaterialCollapsible(final MaterialCollapsibleItem... widgets) {
123123
protected void onLoad() {
124124
super.onLoad();
125125

126-
setAccordion(accordion);
127126
if (activeIndex != -1 && activeWidget == null) {
128127
setActive(activeIndex);
129128
}

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,15 @@ public void load() {
140140
options.set = thing -> {
141141
if (thing.hasOwnProperty("clear")) {
142142
clear();
143-
} else if (thing.hasOwnProperty("select")) {
144-
select();
145143
}
146144
};
147145
}
148146

147+
getPicker().on("set", event -> {
148+
select();
149+
return true;
150+
});
151+
149152
getPicker().on(options).on("open", (e, param1) -> {
150153
onOpen();
151154
return true;
@@ -174,7 +177,9 @@ public void onUnload() {
174177
public void unload() {
175178
JsMaterialElement picker = getPicker();
176179
if (picker != null) {
177-
picker.stop();
180+
picker.off("set");
181+
picker.off("open");
182+
picker.off("close");
178183
}
179184
}
180185

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialTooltip.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import gwt.material.design.client.base.JsLoader;
2929
import gwt.material.design.client.base.helper.EventHelper;
3030
import gwt.material.design.client.constants.Position;
31-
import gwt.material.design.client.events.DefaultHandlerRegistry;
3231
import gwt.material.design.client.js.JsTooltipOptions;
3332

3433
import java.util.Iterator;
@@ -202,23 +201,19 @@ public void setWidget(final Widget widget) {
202201
setAttribute("data-tooltip", options.tooltip);
203202
}
204203

205-
if (!this.widget.isAttached()) {
206-
// When we attach it, configure the tooltip
204+
if (this.widget.isAttached()) {
205+
reload();
206+
} else {
207+
// Smart detect the attachment and detachment of widget to update the tooltip
207208
widget.addAttachHandler(event -> {
208209
if (event.isAttached()) {
210+
// If its attached - reload the tooltip
209211
reload();
210212
} else {
213+
// If it was detached - unload the tooltip
211214
unload();
212215
}
213216
});
214-
} else {
215-
// ensure the tooltip is removed on detachment
216-
widget.addAttachHandler(event -> {
217-
if (!event.isAttached()) {
218-
unload();
219-
}
220-
});
221-
reload();
222217
}
223218
}
224219

0 commit comments

Comments
 (0)