Skip to content

Commit 2ffe5ef

Browse files
committed
More fixes to the MaterialTooltip.
1 parent b746f1f commit 2ffe5ef

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ public void setWidget(final Widget w) {
100100
attachHandler = null;
101101
}
102102

103-
// Detach new child
104-
if (w != null) {
105-
w.removeFromParent();
106-
}
107-
108103
// Remove old child
109104
if (widget != null) {
110105
remove(widget);
@@ -232,15 +227,15 @@ public void reconfigure() {
232227
}
233228

234229
protected void configure() {
235-
configure(widget.getElement(), text, position.getCssName(), delayMs);
230+
configure(text, position.getCssName(), delayMs);
236231
}
237232

238233
/**
239234
* Force the Tooltip to be destroyed
240235
*/
241236
public void remove() {
242237
if (widget != null) {
243-
command(widget.getElement(), "remove");
238+
command("remove");
244239
}
245240
}
246241

@@ -316,21 +311,16 @@ public String toString() {
316311
return asWidget().toString();
317312
}
318313

319-
protected void configure(Element e, String tooltip, String position, int delay) {
314+
protected void configure(String tooltip, String position, int delay) {
320315
JsTooltipOptions options = new JsTooltipOptions();
321316
options.tooltip = tooltip;
322317
options.position = position;
323318
options.delay = delay;
324-
$(e).tooltip(options);
325-
if (html != null && !html.isEmpty()) {
326-
String uid = "#" + $(e).attr("data-tooltip-id");
327-
JQueryElement el = $(uid);
328-
el.find("span").html(html);
329-
}
319+
$(widget.getElement()).tooltip(options);
330320
}
331321

332-
protected void command(Element e, String command) {
333-
$(e).tooltip(command);
322+
protected void command(String command) {
323+
$(widget.getElement()).tooltip(command);
334324
}
335325

336326
/**
@@ -345,5 +335,9 @@ public String getTooltipHTML() {
345335
*/
346336
public void setTooltipHTML(String html) {
347337
this.html = html;
338+
339+
if (html != null && !html.isEmpty()) {
340+
$("#" + widget.getElement().getAttribute("data-tooltip-id")).find("span").html(html);
341+
}
348342
}
349343
}

0 commit comments

Comments
 (0)