Search in sources :

Example 1 with WindowStateChangeEvent

use of org.rstudio.core.client.events.WindowStateChangeEvent in project rstudio by rstudio.

the class DualWindowLayoutPanel method replaceWindows.

public void replaceWindows(LogicalWindow windowA, LogicalWindow windowB) {
    unhookEvents();
    windowA_ = windowA;
    windowB_ = windowB;
    hookEvents();
    layout_.setWidgets(new Widget[] { windowA_.getNormal(), windowA_.getMinimized(), windowB_.getNormal(), windowB_.getMinimized() });
    Scheduler.get().scheduleFinally(new ScheduledCommand() {

        public void execute() {
            windowA_.onWindowStateChange(new WindowStateChangeEvent(NORMAL));
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Example 2 with WindowStateChangeEvent

use of org.rstudio.core.client.events.WindowStateChangeEvent in project rstudio by rstudio.

the class LogicalWindow method onWindowStateChange.

public void onWindowStateChange(WindowStateChangeEvent event) {
    WindowState newState = event.getNewState();
    if (state_ == EXCLUSIVE && newState == MAXIMIZE)
        newState = NORMAL;
    if (newState == state_)
        newState = NORMAL;
    events_.fireEvent(new WindowStateChangeEvent(newState, event.skipFocusChange()));
}
Also used : WindowState(org.rstudio.core.client.layout.WindowState) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Example 3 with WindowStateChangeEvent

use of org.rstudio.core.client.events.WindowStateChangeEvent in project rstudio by rstudio.

the class PaneManager method activateTab.

public void activateTab(Tab tab) {
    lastSelectedTab_ = tab;
    WorkbenchTabPanel panel = getOwnerTabPanel(tab);
    // Ensure that the pane is visible (otherwise tab selection will fail)
    LogicalWindow parent = panel.getParentWindow();
    if (parent.getState() == WindowState.MINIMIZE || parent.getState() == WindowState.HIDE) {
        parent.onWindowStateChange(new WindowStateChangeEvent(WindowState.NORMAL));
    }
    if (tabToIndex_.containsKey(tab)) {
        int index = tabToIndex_.get(tab);
        panel.selectTab(index);
    } else {
        // unexpected; why are we trying to activate a suppressed tab?
        Debug.logWarning("Attempt to activate suppressed or unavailable " + "tab '" + tab.name() + "')");
    }
}
Also used : LogicalWindow(org.rstudio.core.client.layout.LogicalWindow) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Example 4 with WindowStateChangeEvent

use of org.rstudio.core.client.events.WindowStateChangeEvent in project rstudio by rstudio.

the class PaneManager method restoreSavedLayout.

private void restoreSavedLayout() {
    // hidden windows to display themselves, and so on.
    for (LogicalWindow window : panes_) window.onWindowStateChange(new WindowStateChangeEvent(WindowState.NORMAL, true));
    maximizedWindow_.onWindowStateChange(new WindowStateChangeEvent(WindowState.NORMAL, true));
    resizeHorizontally(panel_.getWidgetSize(right_), widgetSizePriorToZoom_);
    invalidateSavedLayoutState(true);
}
Also used : LogicalWindow(org.rstudio.core.client.layout.LogicalWindow) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Example 5 with WindowStateChangeEvent

use of org.rstudio.core.client.events.WindowStateChangeEvent in project rstudio by rstudio.

the class PaneManager method fullyMaximizeWindow.

private void fullyMaximizeWindow(final LogicalWindow window, final Tab tab) {
    if (window.equals(getSourceLogicalWindow()))
        maximizedTab_ = Tab.Source;
    else if (window.equals(getConsoleLogicalWindow()))
        maximizedTab_ = Tab.Console;
    else
        maximizedTab_ = tab;
    maximizedWindow_ = window;
    manageLayoutCommands();
    panel_.setSplitterEnabled(false);
    if (widgetSizePriorToZoom_ < 0)
        widgetSizePriorToZoom_ = panel_.getWidgetSize(right_);
    // transfers don't always propagate as expected)
    for (LogicalWindow pane : panes_) pane.onWindowStateChange(new WindowStateChangeEvent(WindowState.NORMAL));
    boolean isLeftWidget = DomUtils.contains(left_.getElement(), window.getActiveWidget().getElement());
    window.onWindowStateChange(new WindowStateChangeEvent(WindowState.EXCLUSIVE));
    final double initialSize = panel_.getWidgetSize(right_);
    double targetSize = isLeftWidget ? 0 : panel_.getOffsetWidth();
    if (targetSize < 0)
        targetSize = 0;
    // Ensure focus is sent to Help iframe on activation.
    Command onActivation = null;
    if (maximizedTab_.equals(Tab.Help)) {
        onActivation = new Command() {

            @Override
            public void execute() {
                commands_.activateHelp().execute();
            }
        };
    }
    resizeHorizontally(initialSize, targetSize, onActivation);
}
Also used : LogicalWindow(org.rstudio.core.client.layout.LogicalWindow) Command(com.google.gwt.user.client.Command) AppCommand(org.rstudio.core.client.command.AppCommand) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Aggregations

WindowStateChangeEvent (org.rstudio.core.client.events.WindowStateChangeEvent)7 LogicalWindow (org.rstudio.core.client.layout.LogicalWindow)5 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 SelectionHandler (com.google.gwt.event.logical.shared.SelectionHandler)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 Command (com.google.gwt.user.client.Command)1 AppCommand (org.rstudio.core.client.command.AppCommand)1 Handler (org.rstudio.core.client.command.Handler)1 WindowState (org.rstudio.core.client.layout.WindowState)1