Example usage for java.awt KeyboardFocusManager downFocusCycle

List of usage examples for java.awt KeyboardFocusManager downFocusCycle

Introduction

In this page you can find the example usage for java.awt KeyboardFocusManager downFocusCycle.

Prototype

public final void downFocusCycle() 

Source Link

Document

Moves the focus down one focus traversal cycle from the current focus owner, if and only if the current focus owner is a Container that is a focus cycle root.

Usage

From source file:org.kepler.gui.KeplerGraphFrame.java

/**
 * Override the dispose method to unattach any listeners that may keep this
 * model from getting garbage collected. Also remove KARManager's mapping of
 * this JFrame to KARfile if necessary./*from w  w  w . ja  v  a  2  s .  c o m*/
 */
@Override
public void dispose() {

    if (_topPack instanceof KeplerMenuHandler) {
        KeplerMenuHandler topPack = (KeplerMenuHandler) _topPack;
        MenuMapper mm = topPack.menuMapper;
        mm.clear();
        /*
         * mm.printDebugInfo(); Map<String,Action> m =
         * mm.getPTIIMenuActionsMap(); m.clear(); KeplerMenuHandler kmh =
         * (KeplerMenuHandler) _topPack; kmh.clear(); _topPack = null;
         */
    }

    JMenuBar keplerMenuBar = getJMenuBar();
    /* int removed = */MemoryCleaner.removeActionListeners(keplerMenuBar);
    // System.out.println("KeplerGraphFrame menubar action listeners removed: "
    // + removed);

    CanvasDropTargetListener listener = CanvasDropTargetListener.getInstance();
    if (listener != null && _dropTarget != null) {
        _dropTarget.deRegisterAdditionalListener(listener);
    }

    if (_horizontalScrollBarListener != null && _horizontalScrollBar != null) {
        _horizontalScrollBar.removeAdjustmentListener(_horizontalScrollBarListener);
        _horizontalScrollBarListener = null;
    }
    if (_verticalScrollBarListener != null && _verticalScrollBarListener != null) {
        _verticalScrollBar.removeAdjustmentListener(_verticalScrollBarListener);
        _verticalScrollBarListener = null;
    }

    // remove JFrame => KARFile mapping from KARManager
    KARManager karManager = KARManager.getInstance();
    karManager.remove(this);

    TabManager tabManager = TabManager.getInstance();
    tabManager.removeAllFrameTabs(this);

    // this isn't safe. see:
    // http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5095#c14
    // it is safe now after changes in r26444.
    ObjectManager.getInstance().removeNamedObjs(this.getModel());
    ViewManager.getInstance().removeOpenFrame(this);
    LibraryManager.getInstance().removeAllFrameTabs(this);

    // now call dispose on updaters in order
    synchronized (_updaterSet) {
        Iterator<KeplerGraphFrameUpdater> itr = _updaterSet.iterator();
        while (itr.hasNext()) {
            KeplerGraphFrameUpdater updater = itr.next();
            updater.dispose(this);
        }
    }

    ModelToFrameManager m2fm = ModelToFrameManager.getInstance();
    m2fm.remove(this);

    // see if this was the last window
    if (m2fm.numberOfOpenFrames() == 0) {
        ShutdownNotifier.shutdown();
    }

    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.clearGlobalFocusOwner();
    focusManager.downFocusCycle();

    super.dispose();
}