Search in sources :

Example 1 with SimplePanelWithProgress

use of org.rstudio.core.client.widget.SimplePanelWithProgress in project rstudio by rstudio.

the class DataEditingTarget method createDisplay.

@Override
protected Display createDisplay() {
    progressPanel_ = new SimplePanelWithProgress();
    progressPanel_.setSize("100%", "100%");
    reloadDisplay();
    return new Display() {

        public void print() {
            ((Display) progressPanel_.getWidget()).print();
        }

        public Widget asWidget() {
            return progressPanel_;
        }
    };
}
Also used : SimplePanelWithProgress(org.rstudio.core.client.widget.SimplePanelWithProgress) GlobalDisplay(org.rstudio.studio.client.common.GlobalDisplay)

Example 2 with SimplePanelWithProgress

use of org.rstudio.core.client.widget.SimplePanelWithProgress in project rstudio by rstudio.

the class ChooseMirrorDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // create progress container
    final SimplePanelWithProgress panel = new SimplePanelWithProgress(ProgressImages.createLargeGray());
    panel.setStylePrimaryName(RESOURCES.styles().mainWidget());
    // show progress (with delay)
    panel.showProgress(200);
    // query data source for packages
    mirrorSource_.requestData(new SimpleRequestCallback<JsArray<T>>() {

        @Override
        public void onResponseReceived(JsArray<T> mirrors) {
            // keep internal list of mirrors 
            boolean haveInsecureMirror = false;
            mirrors_ = new ArrayList<T>(mirrors.length());
            // create list box and select default item
            listBox_ = new ListBox();
            listBox_.setMultipleSelect(false);
            // all
            listBox_.setVisibleItemCount(18);
            listBox_.setWidth("100%");
            if (mirrors.length() > 0) {
                for (int i = 0; i < mirrors.length(); i++) {
                    T mirror = mirrors.get(i);
                    if (mirrorSource_.getLabel(mirror).startsWith("0-Cloud"))
                        continue;
                    mirrors_.add(mirror);
                    String item = mirrorSource_.getLabel(mirror);
                    String value = mirrorSource_.getURL(mirror);
                    if (!value.startsWith("https"))
                        haveInsecureMirror = true;
                    listBox_.addItem(item, value);
                }
                listBox_.setSelectedIndex(0);
                enableOkButton(true);
            }
            // set it into the panel
            panel.setWidget(listBox_);
            // set caption
            String protocolQualifer = !haveInsecureMirror ? " HTTPS" : "";
            setText("Choose" + protocolQualifer + " CRAN Mirror");
            // update ok button on changed
            listBox_.addDoubleClickHandler(new DoubleClickHandler() {

                @Override
                public void onDoubleClick(DoubleClickEvent event) {
                    clickOkButton();
                }
            });
            // if the list box is larger than the space we initially allocated
            // then increase the panel height
            final int kDefaultPanelHeight = 285;
            if (listBox_.getOffsetHeight() > kDefaultPanelHeight)
                panel.setHeight(listBox_.getOffsetHeight() + "px");
            // set focus   
            FocusHelper.setFocusDeferred(listBox_);
        }

        @Override
        public void onError(ServerError error) {
            closeDialog();
            super.onError(error);
        }
    });
    return panel;
}
Also used : SimplePanelWithProgress(org.rstudio.core.client.widget.SimplePanelWithProgress) JsArray(com.google.gwt.core.client.JsArray) GWT(com.google.gwt.core.client.GWT) ServerError(org.rstudio.studio.client.server.ServerError) DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) ArrayList(java.util.ArrayList) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 3 with SimplePanelWithProgress

use of org.rstudio.core.client.widget.SimplePanelWithProgress in project rstudio by rstudio.

the class ToolbarPane method createWidget.

@Override
protected Widget createWidget() {
    dockPanel_ = new DockLayoutPanel(Style.Unit.PX);
    dockPanel_.setSize("100%", "100%");
    mainToolbar_ = createMainToolbar();
    if (mainToolbar_ != null)
        addToolbar(mainToolbar_);
    secondaryToolbar_ = createSecondaryToolbar();
    if (secondaryToolbar_ != null)
        addToolbar(secondaryToolbar_);
    mainWidget_ = createMainWidget();
    mainWidget_.setSize("100%", "100%");
    progressPanel_ = new SimplePanelWithProgress();
    progressPanel_.setSize("100%", "100%");
    progressPanel_.setWidget(mainWidget_);
    dockPanel_.add(progressPanel_);
    AutoGlassPanel glassPanel = new AutoGlassPanel(dockPanel_);
    glassPanel.setSize("100%", "100%");
    return glassPanel;
}
Also used : SimplePanelWithProgress(org.rstudio.core.client.widget.SimplePanelWithProgress) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) AutoGlassPanel(org.rstudio.studio.client.common.AutoGlassPanel)

Aggregations

SimplePanelWithProgress (org.rstudio.core.client.widget.SimplePanelWithProgress)3 GWT (com.google.gwt.core.client.GWT)1 JsArray (com.google.gwt.core.client.JsArray)1 DoubleClickEvent (com.google.gwt.event.dom.client.DoubleClickEvent)1 DoubleClickHandler (com.google.gwt.event.dom.client.DoubleClickHandler)1 DockLayoutPanel (com.google.gwt.user.client.ui.DockLayoutPanel)1 ListBox (com.google.gwt.user.client.ui.ListBox)1 ArrayList (java.util.ArrayList)1 AutoGlassPanel (org.rstudio.studio.client.common.AutoGlassPanel)1 GlobalDisplay (org.rstudio.studio.client.common.GlobalDisplay)1 ServerError (org.rstudio.studio.client.server.ServerError)1