File Source: ProxyDesktopPaneUI.java

         /* 
    P/P   *  Method: com.dmdirc.addons.ui_swing.components.desktopPane.ProxyDesktopPaneUI__static_init
          */
     1  /*
     2   * 
     3   * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
     4   * 
     5   * Permission is hereby granted, free of charge, to any person obtaining a copy
     6   * of this software and associated documentation files (the "Software"), to deal
     7   * in the Software without restriction, including without limitation the rights
     8   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     9   * copies of the Software, and to permit persons to whom the Software is
    10   * furnished to do so, subject to the following conditions:
    11   * 
    12   * The above copyright notice and this permission notice shall be included in
    13   * all copies or substantial portions of the Software.
    14   * 
    15   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    16   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    17   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    18   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    19   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    20   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    21   * SOFTWARE.
    22   */
    23  
    24  package com.dmdirc.addons.ui_swing.components.desktopPane;
    25  
    26  import java.awt.event.ActionEvent;
    27  
    28  import javax.swing.AbstractAction;
    29  import javax.swing.ActionMap;
    30  import javax.swing.InputMap;
    31  import javax.swing.JComponent;
    32  import javax.swing.JDesktopPane;
    33  import javax.swing.KeyStroke;
    34  import javax.swing.plaf.DesktopPaneUI;
    35  
    36  /**
    37   * Proxy desktop pane ui, proxies and adds custom key bindings.
    38   */
         /* 
    P/P   *  Method: DMDircDesktopPane access$000(ProxyDesktopPaneUI)
          * 
          *  Preconditions:
          *    x0 != null
          *    init'ed(x0.desktopPane)
          * 
          *  Postconditions:
          *    return_value == x0.desktopPane
          *    init'ed(return_value)
          */
    39  public class ProxyDesktopPaneUI extends DesktopPaneUI {
    40  
    41      private DesktopPaneUI ui;
    42      private DMDircDesktopPane desktopPane;
    43      private InputMap inputMap;
    44      private ActionMap actionMap;
    45  
    46      /**
    47       * Creates a new proxying desktop pane ui.
    48       *
    49       * @param ui UI to proxy to
    50       * @param desktopPane desktop pane to use
    51       */
    52      public ProxyDesktopPaneUI(final DesktopPaneUI ui,
                                       /* 
    P/P                                 *  Method: void com.dmdirc.addons.ui_swing.components.desktopPane.ProxyDesktopPaneUI(DesktopPaneUI, DMDircDesktopPane)
                                        * 
                                        *  Postconditions:
                                        *    this.actionMap == &new ActionMap(initInputActionMap#2)
                                        *    this.desktopPane == desktopPane
                                        *    init'ed(this.desktopPane)
                                        *    this.inputMap == &new InputMap(initInputActionMap#1)
                                        *    this.ui == ui
                                        *    init'ed(this.ui)
                                        *    new ActionMap(initInputActionMap#2) num objects == 1
                                        *    new InputMap(initInputActionMap#1) num objects == 1
                                        */
    53                                final DMDircDesktopPane desktopPane) {
    54          this.ui = ui;
    55          this.desktopPane = desktopPane;
    56          initInputActionMap();
    57      }
    58  
    59      private void initInputActionMap() {
                 /* 
    P/P           *  Method: void initInputActionMap()
                  * 
                  *  Postconditions:
                  *    this.actionMap == &new ActionMap(initInputActionMap#2)
                  *    this.inputMap == &new InputMap(initInputActionMap#1)
                  *    new ActionMap(initInputActionMap#2) num objects == 1
                  *    new InputMap(initInputActionMap#1) num objects == 1
                  */
    60          inputMap = new InputMap();
    61          actionMap = new ActionMap();
    62  
    63          inputMap.put(KeyStroke.getKeyStroke("ctrl shift pressed TAB"),
    64                       "selectPreviousFrame");
    65          inputMap.put(KeyStroke.getKeyStroke("ctrl pressed TAB"),
    66                       "selectNextFrame");
    67  
                 /* 
    P/P           *  Method: void com.dmdirc.addons.ui_swing.components.desktopPane.ProxyDesktopPaneUI$1(ProxyDesktopPaneUI, String)
                  */
    68          actionMap.put("selectNextFrame", new AbstractAction("selectNextFrame") {
    69  
    70              private static final long serialVersionUID = 1;
    71  
    72              /** {@inheritDoc} */
    73              @Override
    74              public void actionPerformed(final ActionEvent evt) {
                         /* 
    P/P                   *  Method: void actionPerformed(ActionEvent)
                          * 
                          *  Preconditions:
                          *    this.desktopPane != null
                          *    this.desktopPane.treeScroller != null
                          *    (soft) this.desktopPane.treeScroller.model != null
                          *    (soft) this.desktopPane.treeScroller.selectionModel != null
                          */
    75                  desktopPane.scrollDown();
    76              }
    77          });
                 /* 
    P/P           *  Method: void com.dmdirc.addons.ui_swing.components.desktopPane.ProxyDesktopPaneUI$2(ProxyDesktopPaneUI, String)
                  */
    78          actionMap.put("selectPreviousFrame", new AbstractAction("selectPreviousFrame") {
    79  
    80              private static final long serialVersionUID = 1;
    81  
    82              /** {@inheritDoc} */
    83              @Override
    84              public void actionPerformed(final ActionEvent evt) {
                         /* 
    P/P                   *  Method: void actionPerformed(ActionEvent)
                          * 
                          *  Preconditions:
                          *    this.desktopPane != null
                          *    this.desktopPane.treeScroller != null
                          *    (soft) this.desktopPane.treeScroller.model != null
                          *    (soft) this.desktopPane.treeScroller.selectionModel != null
                          */
    85                  desktopPane.scrollUp();
    86              }
    87          });
    88      }
    89  
    90      /** @inheritDoc} */
    91      @Override
    92      public void installUI(final JComponent c) {
                 /* 
    P/P           *  Method: void installUI(JComponent)
                  * 
                  *  Preconditions:
                  *    c != null
                  *    init'ed(this.actionMap)
                  *    init'ed(this.inputMap)
                  *    this.ui != null
                  */
    93          ui.installUI(c);
    94          c.setInputMap(JDesktopPane.WHEN_IN_FOCUSED_WINDOW, null);
    95          c.setInputMap(JDesktopPane.WHEN_FOCUSED, null);
    96          c.setInputMap(JDesktopPane.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);
    97          c.setActionMap(actionMap);
    98      }
    99  
   100      /** @inheritDoc} */
   101      @Override
   102      public void uninstallUI(final JComponent c) {
                 /* 
    P/P           *  Method: void uninstallUI(JComponent)
                  * 
                  *  Preconditions:
                  *    this.ui != null
                  */
   103          ui.uninstallUI(c);
   104      }
   105  }








SofCheck Inspector Build Version : 2.17854
ProxyDesktopPaneUI.java 2009-Jun-25 01:54:24
ProxyDesktopPaneUI.class 2009-Sep-02 17:04:15
ProxyDesktopPaneUI$1.class 2009-Sep-02 17:04:15
ProxyDesktopPaneUI$2.class 2009-Sep-02 17:04:15