File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed
gwt-material/src/main/java/gwt/material/design/client/ui Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 2828import gwt .material .design .client .base .JsLoader ;
2929import gwt .material .design .client .base .helper .EventHelper ;
3030import gwt .material .design .client .constants .Position ;
31- import gwt .material .design .client .events .DefaultHandlerRegistry ;
3231import gwt .material .design .client .js .JsTooltipOptions ;
3332
3433import 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
You can’t perform that action at this time.
0 commit comments