Search in sources :

Example 1 with AnchorableFrame

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

the class PresentationPane method zoom.

@Override
public void zoom(String title, String url, final Command onClosed) {
    // create the titlebar (no title for now)
    HorizontalPanel titlePanel = new HorizontalPanel();
    ThemeStyles styles = ThemeResources.INSTANCE.themeStyles();
    Label titleLabel = new Label(title);
    titleLabel.addStyleName(styles.fullscreenCaptionLabel());
    titlePanel.add(titleLabel);
    // create the frame
    AnchorableFrame frame = new PresentationFrame(true);
    frame.setSize("100%", "100%");
    // create the popup panel & add close handler 
    activeZoomPanel_ = new FullscreenPopupPanel(titlePanel, frame, false);
    activeZoomPanel_.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            activeZoomPanel_ = null;
            onClosed.execute();
        }
    });
    // load the frame and show the zoom panel
    frame.navigate(url);
    activeZoomPanel_.center();
}
Also used : FullscreenPopupPanel(org.rstudio.core.client.widget.FullscreenPopupPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ThemeStyles(org.rstudio.core.client.theme.res.ThemeStyles) Label(com.google.gwt.user.client.ui.Label) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) FullscreenPopupPanel(org.rstudio.core.client.widget.FullscreenPopupPanel) AnchorableFrame(org.rstudio.core.client.widget.AnchorableFrame)

Example 2 with AnchorableFrame

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

the class RmdOutputPanel method createFrame.

@Override
protected AnchorableFrame createFrame(String url) {
    AnchorableFrame frame = new AnchorableFrame();
    // allow full screen
    Element el = frame.getElement();
    el.setAttribute("webkitallowfullscreen", "");
    el.setAttribute("mozallowfullscreen", "");
    el.setAttribute("allowfullscreen", "");
    frame.navigate(url);
    final Operation initSlides = new Operation() {

        @Override
        public void execute() {
            if (getNavigationMenu().isVisible()) {
                fireSlideIndexChanged();
                slideChangeMonitor_.scheduleRepeating(100);
            }
        }
    };
    if (isShiny_) {
        shinyFrame_.initialize(url, new Operation() {

            @Override
            public void execute() {
                shinyFrame_.setScrollPosition(scrollPosition_);
                initSlides.execute();
            }
        });
    } else {
        // poll for document availability then perform initialization
        // tasks once it's available (addLoadHandler wasn't always 
        // getting called at least under Cocoa WebKit)
        Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

            @Override
            public boolean execute() {
                // see if the document is ready
                AnchorableFrame frame = getFrame();
                if (frame == null)
                    return true;
                IFrameElementEx iframe = frame.getIFrame();
                if (iframe == null)
                    return true;
                Document doc = iframe.getContentDocument();
                if (doc == null)
                    return true;
                initSlides.execute();
                // Even though the document exists, it may not have rendered all
                // its content yet
                ScrollUtil.setScrollPositionOnLoad(frame, scrollPosition_);
                return false;
            }
        }, 50);
    }
    return frame;
}
Also used : Element(com.google.gwt.dom.client.Element) RepeatingCommand(com.google.gwt.core.client.Scheduler.RepeatingCommand) IFrameElementEx(org.rstudio.core.client.dom.IFrameElementEx) Operation(org.rstudio.core.client.widget.Operation) AnchorableFrame(org.rstudio.core.client.widget.AnchorableFrame) Document(com.google.gwt.dom.client.Document)

Aggregations

AnchorableFrame (org.rstudio.core.client.widget.AnchorableFrame)2 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)1 Document (com.google.gwt.dom.client.Document)1 Element (com.google.gwt.dom.client.Element)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Label (com.google.gwt.user.client.ui.Label)1 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)1 IFrameElementEx (org.rstudio.core.client.dom.IFrameElementEx)1 ThemeStyles (org.rstudio.core.client.theme.res.ThemeStyles)1 FullscreenPopupPanel (org.rstudio.core.client.widget.FullscreenPopupPanel)1 Operation (org.rstudio.core.client.widget.Operation)1