Search in sources :

Example 1 with PopupPanel

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

the class AddFileAction method onEdit.

public void onEdit() {
    if (popup != null) {
        popup.hide();
        return;
    }
    files.unregisterKeys();
    if (addBox == null) {
        addBox = new AddFileBox(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;
}
Also used : PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 2 with PopupPanel

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

the class EditPreferencesAction method show.

void show() {
    if (popup != null) {
        hide();
        return;
    }
    current = new EditPreferencesBox(view);
    current.set(prefs);
    popup = new PopupPanel(true, false);
    popup.setStyleName(current.style.dialog());
    popup.add(current);
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            view.getEditor().focus();
            popup = null;
            current = null;
        }
    });
    popup.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            popup.setPopupPosition(300, 120);
        }
    });
}
Also used : PositionCallback(com.google.gwt.user.client.ui.PopupPanel.PositionCallback) PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 3 with PopupPanel

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

the class PreferencesAction method show.

void show() {
    if (popup != null) {
        // Already open? Close the dialog.
        hide();
        return;
    }
    current = new PreferencesBox(view);
    current.set(prefs);
    popup = new PopupPanel(true, false);
    popup.setStyleName(current.style.dialog());
    popup.add(current);
    popup.addAutoHidePartner(partner.getElement());
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            view.getCmFromSide(DisplaySide.B).focus();
            popup = null;
            current = null;
        }
    });
    popup.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            popup.setPopupPosition(300, 120);
        }
    });
    current.setFocus(true);
}
Also used : PositionCallback(com.google.gwt.user.client.ui.PopupPanel.PositionCallback) PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 4 with PopupPanel

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

the class DeleteFileAction method onDelete.

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

Example 5 with PopupPanel

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

the class ReplyAction method onReply.

void onReply(MessageInfo msg) {
    if (popup != null) {
        popup.hide();
        return;
    }
    if (replyBox == null) {
        replyBox = new ReplyBox(clp, 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;
}
Also used : PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

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