File Source: FakeInputWindow.java
/*
P/P * Method: com.dmdirc.addons.redirect.FakeInputWindow__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
23 package com.dmdirc.addons.redirect;
24
25 import com.dmdirc.MessageTarget;
26 import com.dmdirc.WritableFrameContainer;
27 import com.dmdirc.commandparser.parsers.CommandParser;
28 import com.dmdirc.config.ConfigManager;
29 import com.dmdirc.ui.input.InputHandler;
30 import com.dmdirc.ui.interfaces.InputWindow;
31 import com.dmdirc.ui.messages.Formatter;
32 import com.dmdirc.util.StringTranscoder;
33
34 import java.beans.PropertyVetoException;
35 import java.nio.charset.Charset;
36
37 /**
38 * Implements a fake input window, which sends echoed text to the specified
39 * chat window instead.
40 *
41 * @author Chris
42 */
/*
P/P * Method: FrameContainer getContainer()
*
* Postconditions:
* return_value == this.target
* init'ed(return_value)
*/
43 public class FakeInputWindow implements InputWindow {
44
45 /** The target for this window. */
46 private final MessageTarget target;
47
48 /**
49 * Creates a new instance of FakeInputWindow.
50 *
51 * @param target The message target that output gets sent to
52 */
/*
P/P * Method: void com.dmdirc.addons.redirect.FakeInputWindow(MessageTarget)
*
* Postconditions:
* this.target == target
* init'ed(this.target)
*/
53 public FakeInputWindow(final MessageTarget target) {
54 this.target = target;
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public CommandParser getCommandParser() {
/*
P/P * Method: CommandParser getCommandParser()
*
* Preconditions:
* this.target != null
*
* Presumptions:
* com.dmdirc.MessageTarget:getFrame(...)@60 != null
*
* Postconditions:
* init'ed(return_value)
*/
60 return target.getFrame().getCommandParser();
61 }
62
63 /** {@inheritDoc} */
64 @Override
65 public InputHandler getInputHandler() {
/*
P/P * Method: InputHandler getInputHandler()
*
* Preconditions:
* this.target != null
*
* Presumptions:
* com.dmdirc.MessageTarget:getFrame(...)@66 != null
*
* Postconditions:
* init'ed(return_value)
*/
66 return target.getFrame().getInputHandler();
67 }
68
69 /** {@inheritDoc} */
70 @Override
71 public void setAwayIndicator(final boolean isAway) {
72 // Do nothing
/*
P/P * Method: void setAwayIndicator(bool)
*/
73 }
74
75 /** {@inheritDoc} */
76 @Override
77 public void addLine(final String messageType, final Object... args) {
/*
P/P * Method: void addLine(String, Object[])
*
* Preconditions:
* this.target != null
*/
78 target.sendLine(Formatter.formatMessage(getConfigManager(), messageType, args));
79 }
80
81 /** {@inheritDoc} */
82 @Override
83 public void addLine(final StringBuffer messageType, final Object... args) {
/*
P/P * Method: void addLine(StringBuffer, Object[])
*
* Preconditions:
* messageType != null
* this.target != null
*/
84 addLine(messageType.toString(), args);
85 }
86
87 /** {@inheritDoc} */
88 @Override
89 public void addLine(final String line, final boolean timestamp) {
/*
P/P * Method: void addLine(String, bool)
*
* Preconditions:
* this.target != null
*/
90 target.sendLine(line);
91 }
92
93 /** {@inheritDoc} */
94 @Override
95 public void clear() {
96 // Do nothing
/*
P/P * Method: void clear()
*/
97 }
98
99 /** {@inheritDoc} */
100 @Override
101 public ConfigManager getConfigManager() {
/*
P/P * Method: ConfigManager getConfigManager()
*
* Preconditions:
* this.target != null
*
* Presumptions:
* com.dmdirc.MessageTarget:getFrame(...)@102 != null
*
* Postconditions:
* init'ed(return_value)
*/
102 return target.getFrame().getConfigManager();
103 }
104
105 /** {@inheritDoc} */
106 @Override
107 public WritableFrameContainer getContainer() {
/*
P/P * Method: WritableFrameContainer getContainer()
*
* Postconditions:
* return_value == this.target
* init'ed(return_value)
*/
108 return target;
109 }
110
111 /** {@inheritDoc} */
112 @Override
113 public boolean isVisible() {
/*
P/P * Method: bool isVisible()
*
* Postconditions:
* return_value == 0
*/
114 return false;
115 }
116
117 /** {@inheritDoc} */
118 @Override
119 public void setVisible(final boolean isVisible) {
120 // Do nothing
/*
P/P * Method: void setVisible(bool)
*/
121 }
122
123 /** {@inheritDoc} */
124 @Override
125 public String getTitle() {
/*
P/P * Method: String getTitle()
*
* Postconditions:
* return_value == &"Fake window"
*/
126 return "Fake window";
127 }
128
129 /** {@inheritDoc} */
130 @Override
131 public boolean isMaximum() {
/*
P/P * Method: bool isMaximum()
*
* Postconditions:
* return_value == 0
*/
132 return false;
133 }
134
135 /** {@inheritDoc} */
136 @Override
137 public void setTitle(final String title) {
138 // Do nothing
/*
P/P * Method: void setTitle(String)
*/
139 }
140
141 /** {@inheritDoc} */
142 @Override
143 public void open() {
144 // Do nothing
/*
P/P * Method: void open()
*/
145 }
146
147 /** {@inheritDoc} */
148 @Override
149 public StringTranscoder getTranscoder() {
/*
P/P * Method: StringTranscoder getTranscoder()
*
* Postconditions:
* return_value == &new StringTranscoder(getTranscoder#1)
* new StringTranscoder(getTranscoder#1) num objects == 1
*/
150 return new StringTranscoder(Charset.defaultCharset());
151 }
152
153 /** {@inheritDoc} */
154 @Override
155 public void close() {
156 /// Do nothing
/*
P/P * Method: void close()
*/
157 }
158
159 /** {@inheritDoc} */
160 @Override
161 public void restore() {
162 // Do nothing
/*
P/P * Method: void restore()
*/
163 }
164
165 /** {@inheritDoc} */
166 @Override
167 public void maximise() {
168 // Do nothing
/*
P/P * Method: void maximise()
*/
169 }
170
171 /** {@inheritDoc} */
172 @Override
173 public void toggleMaximise() {
174 // Do nothing
/*
P/P * Method: void toggleMaximise()
*/
175 }
176
177 /** {@inheritDoc} */
178 @Override
179 public void minimise() {
180 // Do nothing
/*
P/P * Method: void minimise()
*/
181 }
182
183 /** {@inheritDoc} */
184 @Override
185 public void activateFrame() {
186 // Do nothing
/*
P/P * Method: void activateFrame()
*/
187 }
188
189 }
SofCheck Inspector Build Version : 2.17854
| FakeInputWindow.java |
2009-Jun-25 01:54:24 |
| FakeInputWindow.class |
2009-Sep-02 17:04:15 |