gwt - Vaadin extension: MouseOverHandler -
in simple extension add vhorizontallayout
vlabel
. layout add mouseoverhandler
, method never invoked. wrong?
(everything else works - i.e. label displayed below extended field)
connector:
@connect(myextension.class) public class myextensionconnector extends abstractextensionconnector { private static final logger log = logger.getlogger(myextensionconnector.class.getname()); private final vhorizontallayout layout = new vhorizontallayout(); @override protected void extend(serverconnector target) { log.info("-->extend"); vlabel label = new vlabel(); label.settext("some text"); layout.add(label); final widget field = ((componentconnector) target).getwidget(); field.addattachhandler(new attachevent.handler() { @override public void onattachordetach(attachevent event) { log.info("-->onattachordetach: " + event.todebugstring()); if (event.isattached()) { field.getelement().getparentelement().insertafter(layout.getelement(), field.getelement()); layout.addhandler(new mouseoverhandler() { @override public void onmouseover(mouseoverevent event) { log.info("-->onmouseover: " + event); } }, mouseoverevent.gettype()); } else { element parentelement = layout.getelement().getparentelement(); if (parentelement != null) { parentelement.removechild(layout.getelement()); } } } }); } }
one should use adddomhandler
instead of addhandler
!
Comments
Post a Comment