Example usage for com.google.gwt.user.client.ui PopupPanel setModal

List of usage examples for com.google.gwt.user.client.ui PopupPanel setModal

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui PopupPanel setModal.

Prototype

public void setModal(boolean modal) 

Source Link

Document

When the popup is modal, keyboard or mouse events that do not target the PopupPanel or its children will be ignored.

Usage

From source file:com.ponysdk.ui.terminal.ui.PTPopupPanel.java

License:Apache License

@Override
public void update(final PTInstruction update, final UIService uiService) {
    final PopupPanel popup = cast();

    if (update.containsKey(PROPERTY.ANIMATION)) {
        popup.setAnimationEnabled(update.getBoolean(PROPERTY.ANIMATION));
    } else if (update.containsKey(PROPERTY.POPUP_CENTER)) {
        popup.center();/*from   w  w  w.  j av a 2  s  . c o m*/
    } else if (update.containsKey(PROPERTY.POPUP_SHOW)) {
        popup.show();
    } else if (update.containsKey(PROPERTY.POPUP_HIDE)) {
        popup.hide();
    } else if (update.containsKey(PROPERTY.POPUP_GLASS_ENABLED)) {
        popup.setGlassEnabled(update.getBoolean(PROPERTY.POPUP_GLASS_ENABLED));
    } else if (update.containsKey(PROPERTY.POPUP_MODAL)) {
        popup.setModal(update.getBoolean(PROPERTY.POPUP_MODAL));
    } else if (update.containsKey(PROPERTY.POPUP_POSITION)) {
        final int left = update.getInt(PROPERTY.POPUP_POSITION_LEFT);
        final int top = update.getInt(PROPERTY.POPUP_POSITION_TOP);
        popup.setPopupPosition(left, top);
    } else if (update.containsKey(PROPERTY.POPUP_DRAGGABLE)) {
        final boolean draggable = update.containsKey(PROPERTY.POPUP_DRAGGABLE);
        if (draggable) {
            popup.addDomHandler(this, MouseDownEvent.getType());
            popup.addDomHandler(this, MouseUpEvent.getType());
            popup.addDomHandler(this, MouseMoveEvent.getType());
        }
    } else {
        super.update(update, uiService);
    }
}

From source file:com.smartgwt.mobile.client.data.DataSource.java

License:Open Source License

public PopupPanel showPrompt() {
    PopupPanel prompt = new PopupPanel();
    prompt.setModal(true);
    prompt.setWidget(new Label("Contacting server..."));
    prompt.center();/*from w  w w .  j a v a 2s.  c  om*/
    prompt.show();
    return prompt;
}

From source file:org.iplantc.phyloviewer.viewer.client.Phyloviewer.java

License:Creative Commons License

private void displayTrees() {
    final PopupPanel displayTreePanel = new PopupPanel();
    displayTreePanel.setModal(true);

    displayTreePanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
            int left = (Window.getClientWidth() - offsetWidth) / 2;
            int top = (Window.getClientHeight() - offsetHeight) / 2 - 100;
            displayTreePanel.setPopupPosition(left, top);
        }//www. jav  a2s  . c  om
    });

    final VerticalPanel vPanel = new VerticalPanel();
    displayTreePanel.add(vPanel);

    Label messageLabel = new Label("Select a tree to load:");
    vPanel.add(messageLabel);

    final Label label = new Label("Retrieving tree list...");
    vPanel.add(label);

    final ListBox lb = new ListBox();
    lb.setVisible(false);
    vPanel.add(lb);

    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(new Button("OK", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {

            label.setText("Loading...");
            label.setVisible(true);
            lb.setVisible(false);
            hPanel.setVisible(false);

            int index = lb.getSelectedIndex();
            if (index >= 0 && trees != null) {
                final ITree data = trees.get(index);
                if (data != null) {
                    loadTree(displayTreePanel, ((RemoteTree) data), layoutType);
                }
            }
        }

    }));

    hPanel.add(new Button("Cancel", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            displayTreePanel.hide();
        }
    }));

    vPanel.add(hPanel);

    displayTreePanel.show();

    treeList.getTreeList(new AsyncCallback<List<ITree>>() {

        @Override
        public void onFailure(Throwable arg0) {
            Window.alert(arg0.getMessage());
        }

        @Override
        public void onSuccess(List<ITree> trees) {
            Phyloviewer.this.trees = new ArrayList<ITree>();
            for (ITree tree : trees) {
                if (((RemoteTree) tree).isPublic()) {
                    lb.addItem(tree.getName());
                    Phyloviewer.this.trees.add(tree);
                }
            }

            label.setVisible(false);
            lb.setVisible(true);
        }
    });
}

From source file:org.openelis.modules.pws.client.PWSScreen.java

License:Open Source License

/**
 * creates a popup that shows the progress of parsing the PWS files
 *///from  www  .j  av  a2s  .co  m
private void parse() {
    final PopupPanel statusPanel;

    if (statusScreen == null)
        statusScreen = new StatusBarPopupScreenUI() {
            @Override
            public boolean isStopVisible() {
                return false;
            }

            @Override
            public void stop() {
                // ignore           
            }
        };

    /*
     * initialize and show the popup screen
     */
    statusPanel = new PopupPanel();
    statusPanel.setSize("450px", "125px");
    statusPanel.setWidget(statusScreen);
    statusPanel.setPopupPosition(this.getAbsoluteLeft(), this.getAbsoluteTop());
    statusPanel.setModal(true);
    statusPanel.show();
    statusScreen.setStatus(null);

    /*
     * Read pws files and update database. Hide popup when database is
     * updated successfully or error is thrown.
     */
    PWSService.get().importFiles(new AsyncCallback<Void>() {
        public void onSuccess(Void result) {
            statusPanel.hide();
            statusScreen.setStatus(null);
        }

        public void onFailure(Throwable e) {
            statusPanel.hide();
            statusScreen.setStatus(null);
            Window.alert(e.getMessage());
            logger.log(Level.SEVERE, e.getMessage(), e);
        }
    });

    /*
     * refresh the status of reading the files and updating the database
     * every second, until the process successfully completes or is aborted
     * because of an error
     */
    Timer timer = new Timer() {
        public void run() {
            ReportStatus status;
            try {
                status = PWSService.get().getStatus();
                /*
                 * the status only needs to be refreshed while the status
                 * panel is showing because once the job is finished, the
                 * panel is closed
                 */
                if (statusPanel.isShowing()) {
                    statusScreen.setStatus(status);
                    this.schedule(1000);
                }
            } catch (Exception e) {
                Window.alert(e.getMessage());
                logger.log(Level.SEVERE, e.getMessage(), e);
            }
        }
    };
    timer.schedule(1000);
}

From source file:org.openelis.portal.modules.dataView.client.DataViewScreen.java

License:Open Source License

/**
 * creates a popup that shows the progress of creating data view report
 *//*w w  w  .j a va  2s. c  o  m*/
private void popup(DataView1VO data) {
    final PopupPanel statusPanel;

    if (statusScreen == null)
        statusScreen = new StatusBarPopupScreenUI();
    statusScreen.setStatus(null);

    /*
     * initialize and show the popup screen
     */
    statusPanel = new PopupPanel();
    statusPanel.setSize("450px", "125px");
    statusScreen.setSize("450px", "125px");
    statusPanel.setWidget(statusScreen);
    statusPanel.setPopupPosition(this.getAbsoluteLeft() + 50, this.getAbsoluteTop() + 50);
    statusPanel.setModal(true);
    statusPanel.show();

    /*
     * Create final reports. Hide popup when database is updated
     * successfully or error is thrown.
     */
    DataViewService.get().runReportForPortal(data, new AsyncCallback<ReportStatus>() {

        @Override
        public void onSuccess(ReportStatus result) {
            if (result.getStatus() == ReportStatus.Status.SAVED) {
                String url = "/openelisweb/openelisweb/report?file=" + result.getMessage();
                Window.open(URL.encode(url), "DataView", "resizable=yes");
            }
            window.clearStatus();
            statusPanel.hide();
            statusScreen.setStatus(null);
        }

        @Override
        public void onFailure(Throwable caught) {
            window.clearStatus();
            statusPanel.hide();
            statusScreen.setStatus(null);
            if (caught instanceof NotFoundException)
                window.setError(Messages.get().dataView_error_noResults());
            else
                Window.alert(caught.getMessage());
        }

    });

    /*
     * refresh the status of creating the reports every second, until the
     * process successfully completes or is aborted because of an error
     */
    Timer timer = new Timer() {
        public void run() {
            ReportStatus status;
            try {
                status = DataViewService.get().getStatus();
                /*
                 * the status only needs to be refreshed while the status
                 * panel is showing because once the job is finished, the
                 * panel is closed
                 */
                if (statusPanel.isShowing()) {
                    statusScreen.setStatus(status);
                    this.schedule(50);
                }
            } catch (Exception e) {
                Window.alert(e.getMessage());
                remote.log(Level.SEVERE, e.getMessage(), e);
            }
        }
    };
    timer.schedule(50);
}

From source file:org.pepstock.jem.gwt.client.panels.jobs.commons.JobsBaseActions.java

License:Open Source License

protected static void openSubmitter(boolean legacy) {
    PopupPanel submitter;
    if (legacy) {
        submitter = new LegacySubmitter();
        ((LegacySubmitter) submitter).setWidth(600);
        ((LegacySubmitter) submitter).setHeight(240);
    } else {//w ww.  j  a  v  a2 s. com
        submitter = new MultiDragAndDropSubmitter();
        ((MultiDragAndDropSubmitter) submitter).setWidth(700);
        ((MultiDragAndDropSubmitter) submitter).setHeight(340);
    }
    // be carefully about the HEIGHT and WIDTH calculation
    submitter.setModal(true);
    submitter.center();
}

From source file:stroom.widget.popup.client.view.PopupSupportImpl.java

License:Apache License

@Override
public void show(final PopupType popupType, final PopupPosition popupPosition, final PopupSize popupSize,
        final PopupUiHandlers popupUiHandlers) {
    this.popupUiHandlers = popupUiHandlers;

    if (popup == null) {
        popup = createPopup(popupType, popupSize, popupUiHandlers);
    }// ww w .jav a  2  s.  co m
    final PopupPanel popupPanel = (PopupPanel) popup;
    // Hide the popup because we are going to position it before making it
    // visible.
    popupPanel.setVisible(false);
    // Way to set popups to be non modal for now.
    if (modal != null) {
        popupPanel.setModal(modal);
    }

    // Set the popup size.
    if (popupSize != null) {
        popupPanel.setWidth(popupSize.getWidth() + "px");
        popupPanel.setHeight(popupSize.getHeight() + "px");
    }

    // Add auto hide partners.
    if (autoHidePartners != null && autoHidePartners.size() > 0) {
        for (final Element element : autoHidePartners) {
            popupPanel.addAutoHidePartner(element);
        }
    }

    // Attach the popup to the DOM.
    popupPanel.show();
    // Defer the command to position and make visible because we need the
    // popup to size first.
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            if (popup != null) {
                // Now get the popup size.
                final int w = popupPanel.getOffsetWidth();
                final int h = popupPanel.getOffsetHeight();

                if (popupPosition == null) {
                    // Center the popup in the client window.
                    centerPopup(popup, w, h);
                } else {
                    // Position the popup so it is as close as possible to
                    // the required location but is all on screen.
                    positionPopup(popup, popupType, popupPosition, w, h);
                }

                // Make the popup visible.
                popupPanel.setVisible(true);
                popupPanel.getElement().getStyle().setOpacity(1);

                // Tell the view that the popup is visible if necessary.
                onShow();
            }
        }
    });
}