123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /*
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
- package com.dmdirc.ui.swing;
-
- import com.dmdirc.Query;
- import com.dmdirc.commandparser.parsers.CommandParser;
- import com.dmdirc.commandparser.parsers.QueryCommandParser;
- import com.dmdirc.ui.input.InputHandler;
- import com.dmdirc.ui.interfaces.QueryWindow;
- import com.dmdirc.ui.swing.components.InputFrame;
- import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
-
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Insets;
-
- /**
- * The QueryFrame is the MDI window that shows query messages to the user.
- */
- public final class QueryFrame extends InputFrame implements QueryWindow {
-
- /**
- * A version number for this class. It should be changed whenever the class
- * structure is changed (or anything else that would prevent serialized
- * objects being unserialized with the new class).
- */
- private static final long serialVersionUID = 8;
-
- /** This channel's command parser. */
- private final QueryCommandParser commandParser;
-
- /** This frame's parent. */
- private final Query parent;
-
- /**
- * Creates a new QueryFrame.
- * @param owner Parent Frame container
- */
- public QueryFrame(final Query owner) {
- super(owner);
-
- parent = owner;
-
- initComponents();
-
- commandParser = new QueryCommandParser(((Query) getContainer()).
- getServer(), (Query) getContainer());
-
- setInputHandler(new InputHandler(getInputField(), commandParser, this));
- }
-
- /**
- * Retrieves the command Parser for this command window.
- * @return This window's command Parser
- */
- public CommandParser getCommandParser() {
- return commandParser;
- }
-
- /**
- * Initialises components in this frame.
- */
- private void initComponents() {
- final GridBagConstraints constraints = new GridBagConstraints();
-
- setTitle("Query Frame");
-
- getContentPane().setLayout(new GridBagLayout());
- constraints.weightx = 1.0;
- constraints.weighty = 1.0;
- constraints.fill = GridBagConstraints.BOTH;
- constraints.insets = new Insets(0, 0, SMALL_BORDER, 0);
- getContentPane().add(getTextPane(), constraints);
-
-
- constraints.weighty = 0.0;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- constraints.gridy = 1;
- constraints.insets = new Insets(0, 0, 0, 0);
- getContentPane().add(getSearchBar(), constraints);
-
- constraints.gridy = 2;
- getContentPane().add(inputPanel, constraints);
-
- pack();
- }
-
- }
|