File Source: QueryFrame.java

         /* 
    P/P   *  Method: com.dmdirc.addons.ui_swing.components.frames.QueryFrame__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.Query;
    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.commandparser.parsers.QueryCommandParser;
    29  import com.dmdirc.ui.interfaces.QueryWindow;
    30  import com.dmdirc.addons.ui_swing.components.SwingInputHandler;
    31  
    32  import javax.swing.JPopupMenu;
    33  
    34  import net.miginfocom.swing.MigLayout;
    35  
    36  /**
    37   * The QueryFrame is the MDI window that shows query messages to the user.
    38   */
    39  public final class QueryFrame extends InputTextFrame implements QueryWindow {
    40  
    41      /**
    42       * A version number for this class. It should be changed whenever the class
    43       * structure is changed (or anything else that would prevent serialized
    44       * objects being unserialized with the new class).
    45       */
    46      private static final long serialVersionUID = 8;
    47      /** This channel's command parser. */
    48      private final QueryCommandParser commandParser;
    49      /** This frame's parent. */
    50      private final Query parentQuery;
    51  
    52      /**
    53       * Creates a new QueryFrame.
    54       * 
    55       * @param owner Parent Frame container
    56       * @param controller Swing controller
    57       */
    58      public QueryFrame(final Query owner, final SwingController controller) {
                 /* 
    P/P           *  Method: void com.dmdirc.addons.ui_swing.components.frames.QueryFrame(Query, SwingController)
                  * 
                  *  Preconditions:
                  *    owner != null
                  * 
                  *  Presumptions:
                  *    com.dmdirc.addons.ui_swing.components.frames.TextFrame:getContainer(...)@187 != null
                  * 
                  *  Postconditions:
                  *    this.awayLabel == &new JLabel(initComponents#3)
                  *    this.commandParser == &new QueryCommandParser(QueryFrame#1)
                  *    this.inputField == &new SwingInputField(initComponents#1)
                  *    this.inputFieldPopup == &new JPopupMenu(initPopupMenu#1)
                  *    this.inputHandler == &new SwingInputHandler(QueryFrame#2)
                  *    this.inputPanel == &new JPanel(initComponents#4)
                  *    this.nickPopup == &new JPopupMenu(initComponents#2)
                  *    this.parentQuery == owner
                  *    this.parentQuery != null
                  *    new JLabel(SwingInputField#3) num objects == 1
                  *    ...
                  */
    59          super(owner, controller);
    60  
    61          parentQuery = owner;
    62  
    63          initComponents();
    64  
    65          commandParser = new QueryCommandParser(((Query) getContainer()).getServer(), (Query) getContainer());
    66  
    67          setInputHandler(new SwingInputHandler(getInputField(), commandParser, this));
    68      }
    69  
    70      /** {@inheritDoc} */
    71      @Override
    72      public CommandParser getCommandParser() {
                 /* 
    P/P           *  Method: CommandParser getCommandParser()
                  * 
                  *  Postconditions:
                  *    return_value == this.commandParser
                  *    init'ed(return_value)
                  */
    73          return commandParser;
    74      }
    75  
    76      /**
    77       * Initialises components in this frame.
    78       */
    79      private void initComponents() {
                 /* 
    P/P           *  Method: void initComponents()
                  * 
                  *  Preconditions:
                  *    init'ed(this.inputPanel)
                  * 
                  *  Presumptions:
                  *    com.dmdirc.addons.ui_swing.components.frames.QueryFrame:getContentPane(...)@82 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.QueryFrame:getContentPane(...)@83 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.QueryFrame:getContentPane(...)@84 != null
                  *    com.dmdirc.addons.ui_swing.components.frames.QueryFrame:getContentPane(...)@85 != null
                  */
    80          setTitle("Query Frame");
    81  
    82          getContentPane().setLayout(new MigLayout("ins 0, fill, hidemode 3, wrap 1"));
    83          getContentPane().add(getTextPane(), "grow, push");
    84          getContentPane().add(getSearchBar(), "growx, pushx");
    85          getContentPane().add(inputPanel, "growx, pushx");
    86  
    87          pack();
    88      }
    89  
    90      /** {@inheritDoc} */
    91      @Override
    92      public PopupType getNicknamePopupType() {
                 /* 
    P/P           *  Method: PopupType getNicknamePopupType()
                  * 
                  *  Presumptions:
                  *    init'ed(com.dmdirc.commandparser.PopupType.QUERY_NICK)
                  * 
                  *  Postconditions:
                  *    return_value == com.dmdirc.commandparser.PopupType.QUERY_NICK
                  *    init'ed(return_value)
                  */
    93          return PopupType.QUERY_NICK;
    94      }
    95  
    96      /** {@inheritDoc} */
    97      @Override
    98      public PopupType getChannelPopupType() {
                 /* 
    P/P           *  Method: PopupType getChannelPopupType()
                  * 
                  *  Presumptions:
                  *    init'ed(com.dmdirc.commandparser.PopupType.QUERY_NORMAL)
                  * 
                  *  Postconditions:
                  *    return_value == com.dmdirc.commandparser.PopupType.QUERY_NORMAL
                  *    init'ed(return_value)
                  */
    99          return PopupType.QUERY_NORMAL;
   100      }
   101  
   102      /** {@inheritDoc} */
   103      @Override
   104      public PopupType getHyperlinkPopupType() {
                 /* 
    P/P           *  Method: PopupType getHyperlinkPopupType()
                  * 
                  *  Presumptions:
                  *    init'ed(com.dmdirc.commandparser.PopupType.QUERY_HYPERLINK)
                  * 
                  *  Postconditions:
                  *    return_value == com.dmdirc.commandparser.PopupType.QUERY_HYPERLINK
                  *    init'ed(return_value)
                  */
   105          return PopupType.QUERY_HYPERLINK;
   106      }
   107  
   108      /** {@inheritDoc} */
   109      @Override
   110      public PopupType getNormalPopupType() {
                 /* 
    P/P           *  Method: PopupType getNormalPopupType()
                  * 
                  *  Presumptions:
                  *    init'ed(com.dmdirc.commandparser.PopupType.QUERY_NORMAL)
                  * 
                  *  Postconditions:
                  *    return_value == com.dmdirc.commandparser.PopupType.QUERY_NORMAL
                  *    init'ed(return_value)
                  */
   111          return PopupType.QUERY_NORMAL;
   112      }
   113  
   114      /** {@inheritDoc} */
   115      @Override
   116      public void addCustomPopupItems(final JPopupMenu popupMenu) {
   117          //Add no custom popup items
             /* 
    P/P       *  Method: void addCustomPopupItems(JPopupMenu)
              */
   118      }
   119  }








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