Search in sources :

Example 1 with SlideOperation

use of org.netbeans.core.windows.view.ui.slides.SlideOperation in project netbeans-rcp-lite by outersky.

the class DesktopImpl method performSlideToggleMaximize.

public void performSlideToggleMaximize(TopComponent tc, String side, Rectangle editorBounds) {
    Component tabbed = findTabbed(tc);
    if (null != tabbed) {
        SlideOperation operation = SlideOperationFactory.createSlideResize(tabbed, side);
        Rectangle slideInBounds = computeSlideInBounds(operation, editorBounds);
        operation.setFinishBounds(slideInBounds);
        performSlide(operation);
    }
}
Also used : Rectangle(java.awt.Rectangle) TopComponent(org.openide.windows.TopComponent) Component(java.awt.Component) SlideOperation(org.netbeans.core.windows.view.ui.slides.SlideOperation)

Example 2 with SlideOperation

use of org.netbeans.core.windows.view.ui.slides.SlideOperation in project netbeans-rcp-lite by outersky.

the class TabbedHandler method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (e instanceof TabActionEvent) {
        TabActionEvent tae = (TabActionEvent) e;
        String cmd = tae.getActionCommand();
        if (TabbedContainer.COMMAND_SELECT.equals(cmd)) {
            return;
        }
        tae.consume();
        if (TabbedContainer.COMMAND_CLOSE == cmd) {
            // == test is safe here
            TopComponent tc = tabbed.getTopComponentAt(tae.getTabIndex());
            if (tc != null && modeView != null) {
                modeView.getController().userClosedTopComponent(modeView, tc);
            } else {
                Logger.getLogger(TabbedHandler.class.getName()).warning("TopComponent to be closed is null at index " + tae.getTabIndex());
            }
        } else if (TabbedContainer.COMMAND_POPUP_REQUEST == cmd) {
            handlePopupMenuShowing(tae.getMouseEvent(), tae.getTabIndex());
        } else if (TabbedContainer.COMMAND_MAXIMIZE == cmd) {
            handleMaximization(tae);
        } else if (TabbedContainer.COMMAND_CLOSE_ALL == cmd) {
            ActionUtils.closeAllDocuments(true);
        } else if (TabbedContainer.COMMAND_CLOSE_ALL_BUT_THIS == cmd) {
            TopComponent tc = tabbed.getTopComponentAt(tae.getTabIndex());
            ActionUtils.closeAllExcept(tc, true);
        // Pin button handling here
        } else if (TabbedContainer.COMMAND_ENABLE_AUTO_HIDE.equals(cmd)) {
            if (Switches.isTopComponentSlidingEnabled() && tabbed.getComponent().isShowing()) {
                TopComponent tc = tabbed.getTopComponentAt(tae.getTabIndex());
                // prepare slide operation
                Component tabbedComp = tabbed.getComponent();
                String side = WindowManagerImpl.getInstance().guessSlideSide(tc);
                SlideOperation operation = SlideOperationFactory.createSlideIntoEdge(tabbedComp, side, true);
                operation.setStartBounds(new Rectangle(tabbedComp.getLocationOnScreen(), tabbedComp.getSize()));
                operation.prepareEffect();
                modeView.getController().userEnabledAutoHide(modeView, tc);
                modeView.getController().userTriggeredSlideIntoEdge(modeView, operation);
            }
        } else if (TabbedContainer.COMMAND_MINIMIZE_GROUP.equals(cmd)) {
            if (Switches.isModeSlidingEnabled()) {
                TopComponent tc = tabbed.getTopComponentAt(0);
                WindowManagerImpl wm = WindowManagerImpl.getInstance();
                ModeImpl mode = (ModeImpl) wm.findMode(tc);
                if (null != mode) {
                    wm.userMinimizedMode(mode);
                }
            }
        } else if (TabbedContainer.COMMAND_RESTORE_GROUP.equals(cmd)) {
            String nameOfModeToRestore = tae.getGroupName();
            if (null != nameOfModeToRestore) {
                TopComponent tc = tabbed.getTopComponentAt(0);
                WindowManagerImpl wm = WindowManagerImpl.getInstance();
                ModeImpl slidingMode = (ModeImpl) wm.findMode(tc);
                ModeImpl modeToRestore = (ModeImpl) wm.findMode(nameOfModeToRestore);
                if (null != modeToRestore && null != slidingMode) {
                    wm.userRestoredMode(slidingMode, modeToRestore);
                }
            }
        } else if (TabbedContainer.COMMAND_CLOSE_GROUP.equals(cmd)) {
            if (Switches.isModeClosingEnabled()) {
                TopComponent tc = tabbed.getTopComponentAt(0);
                WindowManagerImpl wm = WindowManagerImpl.getInstance();
                ModeImpl mode = (ModeImpl) wm.findMode(tc);
                if (null != mode) {
                    wm.userClosedMode(mode);
                }
            }
        }
    } else if (e instanceof SlideBarActionEvent) {
        // slide bar commands
        SlideBarActionEvent sbe = (SlideBarActionEvent) e;
        String cmd = sbe.getActionCommand();
        if (SlideBar.COMMAND_POPUP_REQUEST.equals(cmd)) {
            handlePopupMenuShowing(sbe.getMouseEvent(), sbe.getTabIndex());
        } else if (SlideBar.COMMAND_SLIDE_IN.equals(cmd)) {
            modeView.getController().userTriggeredSlideIn(modeView, sbe.getSlideOperation());
        } else if (SlideBar.COMMAND_SLIDE_RESIZE.equals(cmd)) {
            modeView.getController().userResizedSlidingWindow(modeView, sbe.getSlideOperation());
        } else if (SlideBar.COMMAND_SLIDE_OUT.equals(cmd)) {
            // when the call comes from the change of tehmodel rather than user clicking,
            // ignore activation requests.
            // #48539
            SlideOperation op = new ProxySlideOperation(sbe.getSlideOperation(), ignoreChange);
            modeView.getController().userTriggeredSlideOut(modeView, op);
        } else if (SlideBar.COMMAND_DISABLE_AUTO_HIDE.equals(cmd)) {
            TopComponent tc = tabbed.getTopComponentAt(sbe.getTabIndex());
            modeView.getController().userDisabledAutoHide(modeView, tc);
        } else if (SlideBar.COMMAND_MAXIMIZE == cmd) {
            TopComponent tc = tabbed.getTopComponentAt(sbe.getTabIndex());
            MaximizeWindowAction mwa = new MaximizeWindowAction(tc);
            if (mwa.isEnabled())
                mwa.actionPerformed(e);
        }
    }
}
Also used : TabActionEvent(org.netbeans.swing.tabcontrol.event.TabActionEvent) SlideBarActionEvent(org.netbeans.core.windows.view.ui.slides.SlideBarActionEvent) WindowManagerImpl(org.netbeans.core.windows.WindowManagerImpl) ModeImpl(org.netbeans.core.windows.ModeImpl) MaximizeWindowAction(org.netbeans.core.windows.actions.MaximizeWindowAction) TopComponent(org.openide.windows.TopComponent) TopComponent(org.openide.windows.TopComponent) SlideOperation(org.netbeans.core.windows.view.ui.slides.SlideOperation)

Aggregations

SlideOperation (org.netbeans.core.windows.view.ui.slides.SlideOperation)2 TopComponent (org.openide.windows.TopComponent)2 Component (java.awt.Component)1 Rectangle (java.awt.Rectangle)1 ModeImpl (org.netbeans.core.windows.ModeImpl)1 WindowManagerImpl (org.netbeans.core.windows.WindowManagerImpl)1 MaximizeWindowAction (org.netbeans.core.windows.actions.MaximizeWindowAction)1 SlideBarActionEvent (org.netbeans.core.windows.view.ui.slides.SlideBarActionEvent)1 TabActionEvent (org.netbeans.swing.tabcontrol.event.TabActionEvent)1