public SymbolTablePopupW(AppW app, AutoCompleteW autoCompleteTextField, Widget invoker) { super(true, app.getPanel()); this.app = app; this.textField = autoCompleteTextField; createSymbolTable(); this.addDomHandler( new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { // used because autoCompleteTextField should not loose focus event.preventDefault(); } }, MouseDownEvent.getType()); // prevent autohide when clicking on the popup button addAutoHidePartner(invoker.getElement()); addStyleName("SymbolTablePopup"); }
/** creates a new {@link ButtonPopupMenu} */ private void createPopup() { myPopup = new ButtonPopupMenu(app.getPanel()) { @Override public void setVisible(boolean visible) { super.setVisible(visible); // if another button is pressed only the visibility is changed, // by firing the event we can react as if it was closed CloseEvent.fire(this, this, false); } @Override public void hide() { super.hide(); if (EuclidianStyleBarW.CURRENT_POP_UP.equals(this)) { EuclidianStyleBarW.CURRENT_POP_UP = null; } } }; myPopup.setAutoHideEnabled(true); }