File Source: CustomInputFrame.java

         /* 
    P/P   *  Method: com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame__static_init
          */
     1  /*
     2   * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
     3   *
     4   * Permission is hereby granted, free of charge, to any person obtaining a copy
     5   * of this software and associated documentation files (the "Software"), to deal
     6   * in the Software without restriction, including without limitation the rights
     7   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     8   * copies of the Software, and to permit persons to whom the Software is
     9   * furnished to do so, subject to the following conditions:
    10   *
    11   * The above copyright notice and this permission notice shall be included in
    12   * all copies or substantial portions of the Software.
    13   *
    14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    20   * SOFTWARE.
    21   */
    22  package com.dmdirc.addons.ui_swing.components.frames;
    23  
    24  import com.dmdirc.WritableFrameContainer;
    25  import com.dmdirc.addons.ui_swing.SwingController;
    26  import com.dmdirc.commandparser.PopupType;
    27  import com.dmdirc.commandparser.parsers.CommandParser;
    28  import com.dmdirc.addons.ui_swing.components.SwingInputHandler;
    29  
    30  import javax.swing.JPopupMenu;
    31  
    32  import net.miginfocom.swing.MigLayout;
    33  
    34  /**
    35   * A custom frame that includes an input field (for use with writable
    36   * containers).
    37   * 
    38   * @author chris
    39   */
    40  public class CustomInputFrame extends InputTextFrame {
    41  
    42      /**
    43       * A version number for this class. It should be changed whenever the class
    44       * structure is changed (or anything else that would prevent serialized
    45       * objects being unserialized with the new class).
    46       */
    47      private static final long serialVersionUID = 2;
    48      /** The command parser to use. */
    49      private final CommandParser commandParser;
    50  
    51      /**
    52       * Creates a new instance of CustomInputFrame.
    53       * 
    54       * @param owner The frame container that owns this frame
    55       * @param commandParser The command parser to use for this frmae
    56       * @param controller Swing controller
    57       */
    58      public CustomInputFrame(final WritableFrameContainer owner,
    59              final CommandParser commandParser, final SwingController controller) {
                 /* 
    P/P           *  Method: void com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame(WritableFrameContainer, CommandParser, SwingController)
                  * 
                  *  Preconditions:
                  *    owner != null
                  * 
                  *  Postconditions:
                  *    this.awayLabel == &new JLabel(initComponents#3)
                  *    this.commandParser == commandParser
                  *    init'ed(this.commandParser)
                  *    this.inputField == &new SwingInputField(initComponents#1)
                  *    this.inputFieldPopup == &new JPopupMenu(initPopupMenu#1)
                  *    this.inputHandler == &new SwingInputHandler(CustomInputFrame#1)
                  *    this.inputPanel == &new JPanel(initComponents#4)
                  *    this.nickPopup == &new JPopupMenu(initComponents#2)
                  *    new JLabel(SwingInputField#3) num objects == 1
                  *    new JLabel(SwingInputField#4) num objects == 1
                  *    ...
                  */
    60          super(owner, controller);
    61  
    62          this.commandParser = commandParser;
    63  
    64          setInputHandler(new SwingInputHandler(getInputField(), commandParser, this));
    65  
    66          initComponents();
    67      }
    68  
    69      /** {@inheritDoc} */
    70      @Override
    71      public final CommandParser getCommandParser() {
                 /* 
    P/P           *  Method: CommandParser getCommandParser()
                  * 
                  *  Postconditions:
                  *    return_value == this.commandParser
                  *    init'ed(return_value)
                  */
    72          return commandParser;
    73      }
    74  
    75      /**
    76       * Initialises components in this frame.
    77       */
    78      private void initComponents() {
                 /* 
    P/P           *  Method: void initComponents()
                  * 
                  *  Preconditions:
                  *    init'ed(this.inputPanel)
                  * 
                  *  Presumptions:
                  *    com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame:getContentPane(...)@81 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame:getContentPane(...)@82 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame:getContentPane(...)@83 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame:getContentPane(...)@84 != null
                  */
    79          setTitle("Custom Input Frame");
    80  
    81          getContentPane().setLayout(new MigLayout("ins 0, fill, hidemode 3, wrap 1"));
    82          getContentPane().add(getTextPane(), "grow, push");
    83          getContentPane().add(getSearchBar(), "growx, pushx");
    84          getContentPane().add(inputPanel, "growx, pushx");
    85  
    86          pack();
    87      }
    88  
    89      /** {@inheritDoc} */
    90      @Override
    91      public PopupType getNicknamePopupType() {
                 /* 
    P/P           *  Method: PopupType getNicknamePopupType()
                  * 
                  *  Postconditions:
                  *    return_value == null
                  */
    92          return null;
    93      }
    94  
    95      /** {@inheritDoc} */
    96      @Override
    97      public PopupType getChannelPopupType() {
                 /* 
    P/P           *  Method: PopupType getChannelPopupType()
                  * 
                  *  Postconditions:
                  *    return_value == null
                  */
    98          return null;
    99      }
   100  
   101      /** {@inheritDoc} */
   102      @Override
   103      public PopupType getHyperlinkPopupType() {
                 /* 
    P/P           *  Method: PopupType getHyperlinkPopupType()
                  * 
                  *  Postconditions:
                  *    return_value == null
                  */
   104          return null;
   105      }
   106  
   107      /** {@inheritDoc} */
   108      @Override
   109      public PopupType getNormalPopupType() {
                 /* 
    P/P           *  Method: PopupType getNormalPopupType()
                  * 
                  *  Postconditions:
                  *    return_value == null
                  */
   110          return null;
   111      }
   112  
   113      /** {@inheritDoc} */
   114      @Override
   115      public void addCustomPopupItems(final JPopupMenu popupMenu) {
   116          //Add no custom popup items
             /* 
    P/P       *  Method: void addCustomPopupItems(JPopupMenu)
              */
   117      }
   118  }








SofCheck Inspector Build Version : 2.17854
CustomInputFrame.java 2009-Jun-25 01:54:24
CustomInputFrame.class 2009-Sep-02 17:04:17