Search in sources :

Example 16 with PopupPanel

use of com.google.gwt.user.client.ui.PopupPanel in project gerrit by GerritCodeReview.

the class ShowHelpCommand method onKeyPress.

@Override
public void onKeyPress(final KeyPressEvent event) {
    if (current != null) {
        // Already open? Close the dialog.
        //
        current.hide();
        return;
    }
    final KeyHelpPopup help = new KeyHelpPopup();
    help.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(final CloseEvent<PopupPanel> event) {
            current = null;
            BUS.fireEvent(new FocusEvent() {
            });
        }
    });
    current = help;
    help.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(final int pWidth, final int pHeight) {
            final int left = (Window.getClientWidth() - pWidth) >> 1;
            final int wLeft = Window.getScrollLeft();
            final int wTop = Window.getScrollTop();
            help.setPopupPosition(wLeft + left, wTop + 50);
        }
    });
}
Also used : PositionCallback(com.google.gwt.user.client.ui.PopupPanel.PositionCallback) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) FocusEvent(com.google.gwt.event.dom.client.FocusEvent)

Example 17 with PopupPanel

use of com.google.gwt.user.client.ui.PopupPanel in project gerrit by GerritCodeReview.

the class PopupHelper method show.

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;
}
Also used : PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 18 with PopupPanel

use of com.google.gwt.user.client.ui.PopupPanel in project gerrit by GerritCodeReview.

the class ActionMessageBox method show.

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;
}
Also used : PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 19 with PopupPanel

use of com.google.gwt.user.client.ui.PopupPanel in project gerrit by GerritCodeReview.

the class RenameFileAction method onRename.

void onRename() {
    if (popup != null) {
        popup.hide();
        return;
    }
    if (renameBox == null) {
        renameBox = new RenameFileBox(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;
}
Also used : PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 20 with PopupPanel

use of com.google.gwt.user.client.ui.PopupPanel in project gerrit by GerritCodeReview.

the class RevertAction method call.

static void call(final Button b, final Change.Id id, final String revision, final String commitSubject) {
    // TODO Replace ActionDialog with a nicer looking display.
    b.setEnabled(false);
    new TextAreaActionDialog(Util.C.revertChangeTitle(), Util.C.headingRevertMessage()) {

        {
            sendButton.setText(Util.C.buttonRevertChangeSend());
            message.setText(Util.M.revertChangeDefaultMessage(commitSubject, revision));
        }

        @Override
        public void onSend() {
            ChangeApi.revert(id.get(), getMessageText(), new GerritCallback<ChangeInfo>() {

                @Override
                public void onSuccess(ChangeInfo result) {
                    sent = true;
                    hide();
                    Gerrit.display(PageLinks.toChange(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();
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) ChangeInfo(com.google.gerrit.client.info.ChangeInfo) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) TextAreaActionDialog(com.google.gerrit.client.ui.TextAreaActionDialog)

Aggregations

PopupPanel (com.google.gwt.user.client.ui.PopupPanel)28 Test (org.junit.Test)5 ChangeInfo (com.google.gerrit.client.info.ChangeInfo)4 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)4 PositionCallback (com.google.gwt.user.client.ui.PopupPanel.PositionCallback)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 Button (com.google.gwt.user.client.ui.Button)2 CherryPickDialog (com.google.gerrit.client.ui.CherryPickDialog)1 CreateChangeDialog (com.google.gerrit.client.ui.CreateChangeDialog)1 RebaseDialog (com.google.gerrit.client.ui.RebaseDialog)1 TextAreaActionDialog (com.google.gerrit.client.ui.TextAreaActionDialog)1 JsArray (com.google.gwt.core.client.JsArray)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 Style (com.google.gwt.dom.client.Style)1 FocusEvent (com.google.gwt.event.dom.client.FocusEvent)1 ResizeEvent (com.google.gwt.event.logical.shared.ResizeEvent)1 ResizeHandler (com.google.gwt.event.logical.shared.ResizeHandler)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 Request (com.google.gwt.http.client.Request)1