@Override public void onClose(CloseEvent<PopupPanel> event) { debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")"); if (event.isAutoClosed()) { this.lastAutoClosed = new Date().getTime(); } }
protected void showContextMenuPopup(int left, int top) { if (customContextMenu instanceof HasWidgets) { if (!((HasWidgets) customContextMenu).iterator().hasNext()) { // there are no actions to show return; } } customContextMenuPopup = Tools.createCubaTableContextMenu(); customContextMenuPopup.setOwner(this); customContextMenuPopup.setWidget(customContextMenu); customContextMenuPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { customContextMenuPopup = null; } }); Tools.showPopup(customContextMenuPopup, left, top); }
/** * The constructor that has to be used when we send * a message to a particular user * @param parentDialog the parent dialog, i.e. the one we open this dialog from * @param toUserID the ID of the user we send the message to * @param toUserLoginName the login name of the user we send the message to * @param replyMsgData if not null then this is the message we reply to */ public SendMessageDialogUI( final DialogBox parentDialog, final int toUserID, final String toUserLoginName, final PrivateMessageData replyMsgData) { super( true, false, true, parentDialog ); //Store the local value of the message we reply to this.replyMsgData = replyMsgData; //Increment the number of opened send message dialogs openSendMessageDialogCounter++; this.addCloseHandler( new CloseHandler<PopupPanel>(){ public void onClose( CloseEvent<PopupPanel> e ) { if( e.getTarget() == thisDialog ) { //The send message is closed, decrement the number of //opened send message dialogs if( openSendMessageDialogCounter > 0 ) { openSendMessageDialogCounter--; } } } } ); //Set the message recepient setMessageRecepient(toUserID, toUserLoginName); //Set title and style this.setText(titlesI18N.sendPersonalMessageDialogTitle() ); this.setStyleName( CommonResourcesContainer.USER_DIALOG_STYLE_NAME ); //Fill dialog with data populateDialog(); }
@Inject public QuickDocViewImpl() { super(true, true); addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (delegate != null) { delegate.onCloseView(); } } }); setSize("400px", "200px"); Style style = getElement().getStyle(); style.setProperty("resize", "both"); style.setPaddingBottom(0, Style.Unit.PX); style.setPaddingTop(3, Style.Unit.PX); style.setPaddingLeft(3, Style.Unit.PX); style.setPaddingRight(3, Style.Unit.PX); createFrame(); add(frame); }
public PopupPane getPopup() { if (popup==null) { popup = new PopupPane("Alerts", main); popup.setDefaultSize(600, 150); popup.setHideOnResizeWidget(view); popup.setDoRegionChangeHide(false); popup.hide(); final Widget flyer = makeAniIcon(); popup.addCloseHandler(new CloseHandler<PopupPane>(){ public void onClose(CloseEvent<PopupPane> popupPanelCloseEvent) { int x = popup.getPopupPanel().getAbsoluteLeft() + view.getOffsetWidth() / 2; int y = popup.getPopupPanel().getAbsoluteTop() + view.getOffsetHeight() / 2; FlyByAnimation ani = new FlyByAnimation(flyer, x, y, message.getAbsoluteTop(), message.getAbsoluteLeft()); ani.setStartSize(100); ani.run(1000); } }); } return popup; }
void show() { final PopupPanel p = new PopupPanel(true); p.setStyleName(Resources.I.style().popup()); p.addAutoHidePartner(activatingButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { activatingButton.unlink(); if (popup == p) { popup = null; } } }); p.add(panel); p.showRelativeTo(activatingButton); GlobalKey.dialog(p); popup = p; }
void show() { if (popup != null) { popup.hide(); popup = null; return; } final PopupPanel p = new PopupPanel(true); p.setStyleName(style.popup()); p.addAutoHidePartner(activatingButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(this); p.showRelativeTo(activatingButton); GlobalKey.dialog(p); message.setFocus(true); popup = p; }
RenameFileBox(Project.NameKey project, Change.Id changeId, RevisionInfo revision) { this.project = project; this.changeId = changeId; path = new RemoteSuggestBox(new PathSuggestOracle(project, changeId, revision)); path.addCloseHandler( new CloseHandler<RemoteSuggestBox>() { @Override public void onClose(CloseEvent<RemoteSuggestBox> event) { hide(); } }); initWidget(uiBinder.createAndBindUi(this)); }
@Override public void forceShow() { final IsWidget widget = getWidget(); splash.setContent(widget, getBodyHeight()); splash.setTitle(getTitle()); splash.show(); splash.addCloseHandler(new CloseHandler<SplashView>() { @Override public void onClose(final CloseEvent<SplashView> event) { JSSplashScreenActivity.this.onClose(); } }); }
public Button createToggleButton() { final Button button = GWT.create(Button.class); button.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerButton()); button.setDataToggle(Toggle.BUTTON); button.setIcon(IconType.LIST_UL); button.setTitle(CommonConstants.INSTANCE.ColumnPickerButtonTooltip()); popup.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerPopup()); popup.addAutoHidePartner(button.getElement()); popup.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) { if (popupPanelCloseEvent.isAutoClosed()) { button.setActive(false); } } }); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!button.isActive()) { showColumnPickerPopup(button.getAbsoluteLeft() + button.getOffsetWidth(), button.getAbsoluteTop() + button.getOffsetHeight()); } else { popup.hide(false); } } }); return button; }
@Override public void show() { modal.show(); modal.addHiddenHandler(new ModalHiddenHandler() { @Override public void onHidden(final ModalHiddenEvent hiddenEvent) { CloseEvent.fire(PopupViewImpl.this, PopupViewImpl.this, false); } }); modal.addHideHandler(new ModalHideHandler() { @Override public void onHide(ModalHideEvent evt) { CloseEvent.fire(PopupViewImpl.this, PopupViewImpl.this, false); } }); }
@Override public void onOpen() { super.onOpen(); popup.addCloseHandler(new CloseHandler<PopupView>() { @Override public void onClose(CloseEvent<PopupView> event) { if (!placeManagerIsClosingUs) { try { popupAlreadyHiding = true; placeManager.closePlace(place); } finally { popupAlreadyHiding = false; } } } }); final IsWidget widget = getWidget(); popup.setContent(widget); popup.setSize(getSize()); popup.setTitle(getTitle()); popup.show(); }
/** * Test to ensure we don't start an infinite loop when someone clicks the "X" in the popup header. * See also the complementary test, {@link #shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager()}. */ @SuppressWarnings("unchecked") @Test public void shouldNotCallHideOnViewWhenCloseOperationTriggeredByView() throws Exception { doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PlaceManager will do in response to the close hook popupActivity.onClose(); return null; } }).when(placeManager).closePlace(popupPlace); popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); // we shouldn't call hide() on the popup, because this sequence of events // was triggered by the fact that it was already hiding itself verify(popupView, never()).hide(); }
/** * Test to ensure we don't start an infinite loop when the PlaceManager closes the activity. * See also the complementary case, {@link #shouldNotCallHideOnViewWhenCloseOperationTriggeredByView()}. */ @SuppressWarnings("unchecked") @Test public void shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager() throws Exception { doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PopupView will do in response to hide() registeredCloseHandler.onClose(mock(CloseEvent.class)); return null; } }).when(popupView).hide(); popupActivity.onStartup(popupPlace); popupActivity.onOpen(); popupActivity.onClose(); verify(popupView).hide(); // PlaceManager initiated this operation, so we mustn't call back into it verify(placeManager, never()).closePlace(popupPlace); }
public AuthView(AuthManager authManager, ApiService service, AnalyticsManager analytics) { initWidget(uiBinder.createAndBindUi(this)); this.presenter = new AuthPresenter(service, authManager, analytics, this); serviceName.setText(service.displayTitle()); // Unless you show then hide popup windows they do not initialize properly. scopePopup.show(); scopePopup.hide(); scopeInfoPopup.show(); scopeInfoPopup.hide(); scopeInfoPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { GWT.log("Handler for closing popup."); clickedToDiscloseScopeInfo = false; } }); }
public DIHDialog(final DIHManager dihManager) { super(true, false); this.dihManager = dihManager; main = new VerticalPanel(); setText("Data Import Result"); statusTimer = new Timer() { public void run() { dihManager.getStatus(new Callback<DIHResult>() { public void onSuccess(DIHResult result) { reset(result); } }); } }; addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) { statusTimer.cancel(); } }); setWidget(main); }
@Override public void onClose(CloseEvent<DisclosurePanel> event) { for (Iterator panelIt = xPanels.iterator(); panelIt.hasNext();) { OutputPanel panel = (OutputPanel) panelIt.next(); panel.setAnnotationsOpen(false); } }
/** * Creates a popup. * * @param reference reference element for the positioner * @param positioner strategy for positioning the popup */ public Popup(Element reference, RelativePopupPositioner positioner) { this.reference = reference; this.positioner = positioner; popupPanel.addStyleName("editor-popup"); popupPanel.setAnimationEnabled(true); popupPanel.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { Popup.this.hide(); } }); }
/** * A constructor creates a send chat message dialog with the preset recipient. * @param roomID the id of the room we will be sending the message from * @param recepientID the recepient's ID * @param recepientLoginName the recipient's login name * @param roomsManager the instane of the rooms manager */ SendChatMessageDialogUI( final int roomID, final ClickHandler smileyActionLinkClickHandler, final RoomsManagerUI roomsManager ) { super( true, false, false, null ); //Store the parameters this.commonWidgets = new SendChatMessageWidgets( roomID, smileyActionLinkClickHandler, this, false, roomsManager ); this.roomsManager = roomsManager; //Add style this.addStyleName( CommonResourcesContainer.SEND_CHAT_MESSAGE_DIALOG_EXTRA_STYLE ); //Update the dialog's title updateDialogTitle(); //Call the onClose method to clean up data this.addCloseHandler( new CloseHandler<PopupPanel>(){ public void onClose(CloseEvent<PopupPanel> e) { if( e.getTarget() == thisDialog ) { //Save the current dialog data SendChatMessageManager.getInstance().saveChatMessageDataFromCurrentUI(); } } } ); //Initialize the common components commonWidgets.initialize(); //Fill dialog with data populateDialog(); //Update the list of recipients for the case of no recipients set updateMessageRecipientsPanel( ); }
@Inject public QuickOpenViewImpl( Resources resources, AutoCompleteResources autoCompleteResources, QuickOpenViewImplUiBinder uiBinder, LanguageServerResources languageServerResources) { this.resources = resources; this.languageServerResources = languageServerResources; css = autoCompleteResources.autocompleteComponentCss(); css.ensureInjected(); DockLayoutPanel rootElement = uiBinder.createAndBindUi(this); setWidget(rootElement); setAutoHideEnabled(true); setAnimationEnabled(true); layoutPanel.setWidgetHidden(actionsPanel, true); addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { delegate.onClose(event.isAutoClosed()); } }); }
void _fireExpandOrCollapseEvent(final boolean expand) { if (_tree != null) { if (expand) { OpenEvent.fire(_tree,this); TreeViewItemExpandEvent.fire(_tree,this); } else { CloseEvent.fire(_tree,this); TreeViewItemCollapseEvent.fire(_tree,this); } } }
public void onClose(CloseEvent<PopupPanel> ev) { if (this.popup.isAccepted()) { textBox.setText(colorChooserPanel.getColor()); colorPanel.getElement().setAttribute("style", "background-color: #"+colorChooserPanel.getColor()); } }
private static void initDialog() { if (restoreGlobal == null) { restoreGlobal = new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { active = global; } }; } }
static void call(Button b, String project) { // TODO Replace CreateChangeDialog with a nicer looking display. b.setEnabled(false); new CreateChangeDialog(new Project.NameKey(project)) { { sendButton.setText(AdminConstants.I.buttonCreate()); message.setText(AdminConstants.I.buttonCreateDescription()); } @Override public void onSend() { ChangeApi.createChange( project, getDestinationBranch(), getDestinationTopic(), message.getText(), null, new GerritCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { sent = true; hide(); Gerrit.display(PageLinks.toChange(result.projectNameKey(), result.legacyId())); } @Override public void onFailure(Throwable caught) { enableButtons(true); super.onFailure(caught); } }); } @Override public void onClose(CloseEvent<PopupPanel> event) { super.onClose(event); b.setEnabled(true); } }.center(); }
@Override public void onClose(CloseEvent<PopupPanel> event) { if (!buttonClicked) { // the dialog was closed without one of the buttons being pressed // e.g. the user pressed ESC to close the dialog Gerrit.deleteSessionCookie(); } }
void onRename() { if (popup != null) { popup.hide(); return; } if (renameBox == null) { renameBox = new RenameFileBox(project, changeId, revision); } renameBox.clearPath(); final PopupPanel p = new PopupPanel(true); p.setStyleName(style.replyBox()); p.addAutoHidePartner(renameButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(renameBox); p.showRelativeTo(renameButton); GlobalKey.dialog(p); renameBox.setFocus(true); popup = p; }
static void call( final Button b, final Project.NameKey project, final String branch, final Change.Id id, final String revision, final boolean enabled) { b.setEnabled(false); new RebaseDialog(project, branch, id, enabled) { @Override public void onSend() { ChangeApi.rebase( project.get(), id.get(), revision, getBase(), new GerritCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { sent = true; hide(); Gerrit.display(PageLinks.toChange(project, id)); } @Override public void onFailure(Throwable caught) { enableButtons(true); super.onFailure(caught); } }); } @Override public void onClose(CloseEvent<PopupPanel> event) { super.onClose(event); b.setEnabled(true); } }.center(); }
public void onEdit() { if (popup != null) { popup.hide(); return; } files.unregisterKeys(); if (addBox == null) { addBox = new AddFileBox(project, changeId, revision, files); } addBox.clearPath(); final PopupPanel p = new PopupPanel(true); p.setStyleName(style.replyBox()); p.addAutoHidePartner(addButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(addBox); p.showRelativeTo(addButton); GlobalKey.dialog(p); addBox.setFocus(true); popup = p; }
void onReply(MessageInfo msg) { if (popup != null) { popup.hide(); return; } if (replyBox == null) { replyBox = new ReplyBox(clp, project, psId, revision, allLabels, permittedLabels); allLabels = null; permittedLabels = null; } if (msg != null) { replyBox.replyTo(msg); } final PopupPanel p = new PopupPanel(true, false); p.setStyleName(style.replyBox()); p.addAutoHidePartner(replyButton.getElement()); p.addAutoHidePartner(quickApproveButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; if (hasDraftComments || replyBox.hasMessage()) { replyButton.setStyleName(style.highlight()); } } } }); p.add(replyBox); Window.scrollTo(0, 0); replyButton.removeStyleName(style.highlight()); p.showRelativeTo(replyButton); GlobalKey.dialog(p); popup = p; }
void onDelete() { if (popup != null) { popup.hide(); return; } if (deleteBox == null) { deleteBox = new DeleteFileBox(project, changeId, revision); } deleteBox.clearPath(); final PopupPanel p = new PopupPanel(true); p.setStyleName(style.replyBox()); p.addAutoHidePartner(deleteButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(deleteBox); p.showRelativeTo(deleteButton); GlobalKey.dialog(p); deleteBox.setFocus(true); popup = p; }
static void call(Button b, ChangeInfo info, Project.NameKey project) { b.setEnabled(false); new MoveDialog(project) { { sendButton.setText(Util.C.moveChangeSend()); } @Override public void onSend() { ChangeApi.move( info.project(), info.legacyId().get(), getDestinationBranch(), getMessageText(), new GerritCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { sent = true; hide(); Gerrit.display(PageLinks.toChange(project, result.legacyId())); } @Override public void onFailure(Throwable caught) { enableButtons(true); super.onFailure(caught); } }); } @Override public void onClose(CloseEvent<PopupPanel> event) { super.onClose(event); b.setEnabled(true); } }.center(); }
@Override protected PopupPanel createPopup() { PopupPanel p = super.createPopup(); p.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { popupHideTimer.schedule(400); } }); return p; }
void fireStateChanged(final T item, final T.State state) { if (state.equals(T.State.OPEN)) { OpenEvent.fire(this, item); } else { CloseEvent.fire(this, item); } onSelection(item, true); }
private void onTitleClicked() { if (expanded) { CloseEvent.fire(this, this); } else { OpenEvent.fire(this, this); } }
@Override public void show() { modal.show(Commands.DO_NOTHING, new Command() { @Override public void execute() { showAgain = footer.getShowAgain(); CloseEvent.fire(SplashViewImpl.this, SplashViewImpl.this, false); } }); }
@PostConstruct private void initialize() { this.splashFilter = getFilter(); splash.addCloseHandler(new CloseHandler<SplashView>() { @Override public void onClose(final CloseEvent<SplashView> event) { AbstractSplashScreenActivity.this.onClose(); } }); }
@SuppressWarnings("unchecked") @Test public void shouldUsePlaceManagerToCloseSelfOnViewClosedCallback() throws Exception { popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); }
protected final void initPopup() { setGlassEnabled(isModal()); // clearPopupDecorations getElement().getStyle().setBorderWidth(0, Style.Unit.PX); getElement().getStyle().setMargin(0, Style.Unit.PX); getElement().getStyle().setPadding(0, Style.Unit.PX); // close event re-fire addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { ClosedEvent.<WindowUI>fire(window, window); } }); }
public void close() { if (nativePreviewHandlerRegistration != null) { nativePreviewHandlerRegistration.removeHandler(); nativePreviewHandlerRegistration = null; } if (historyHandlerRegistration != null) { historyHandlerRegistration.removeHandler(); historyHandlerRegistration = null; } removeFromParent(); CloseEvent.fire(this, this); }