File Source: ChannelFrame.java
/*
P/P * Method: com.dmdirc.addons.ui_swing.components.frames.ChannelFrame__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.addons.ui_swing.components.NicklistListModel;
25 import com.dmdirc.Channel;
26 import com.dmdirc.ServerState;
27 import com.dmdirc.actions.ActionManager;
28 import com.dmdirc.actions.CoreActionType;
29 import com.dmdirc.actions.interfaces.ActionType;
30 import com.dmdirc.addons.ui_swing.SwingController;
31 import com.dmdirc.addons.ui_swing.components.SnappingJSplitPane;
32 import com.dmdirc.addons.ui_swing.components.SwingInputHandler;
33 import com.dmdirc.addons.ui_swing.components.renderers.NicklistRenderer;
34 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
35 import com.dmdirc.addons.ui_swing.textpane.ClickType;
36 import com.dmdirc.commandparser.PopupType;
37 import com.dmdirc.commandparser.parsers.ChannelCommandParser;
38 import com.dmdirc.commandparser.parsers.CommandParser;
39 import com.dmdirc.config.Identity;
40 import com.dmdirc.config.IdentityManager;
41 import com.dmdirc.parser.irc.ChannelClientInfo;
42 import com.dmdirc.ui.interfaces.ChannelWindow;
43
44 import java.awt.Dimension;
45 import java.awt.Point;
46 import java.awt.event.ActionEvent;
47 import java.awt.event.ActionListener;
48 import java.awt.event.MouseEvent;
49 import java.util.List;
50
51 import javax.swing.JList;
52 import javax.swing.JMenuItem;
53 import javax.swing.JPopupMenu;
54 import javax.swing.JScrollPane;
55 import javax.swing.JSplitPane;
56 import javax.swing.ListSelectionModel;
57 import javax.swing.SwingUtilities;
58
59 import net.miginfocom.swing.MigLayout;
60
61 /**
62 * The channel frame is the GUI component that represents a channel to the user.
63 */
/*
P/P * Method: NicklistListModel access$000(ChannelFrame)
*
* Preconditions:
* x0 != null
* init'ed(x0.nicklistModel)
*
* Postconditions:
* return_value == x0.nicklistModel
* init'ed(return_value)
*/
64 public final class ChannelFrame extends InputTextFrame implements ActionListener,
65 ChannelWindow, com.dmdirc.interfaces.ActionListener {
66
67 /**
68 * A version number for this class. It should be changed whenever the class
69 * structure is changed (or anything else that would prevent serialized
70 * objects being unserialized with the new class).
71 */
72 private static final long serialVersionUID = 10;
73 /** The nick list model used for this channel's nickname list. */
74 private NicklistListModel nicklistModel;
75 /** This channel's command parser. */
76 private final ChannelCommandParser commandParser;
77 /** Nick list. */
78 private JList nickList;
79 /** split pane. */
80 private JSplitPane splitPane;
81 /** popup menu item. */
82 private JMenuItem settingsMI;
83 /** The channel object that owns this frame. */
84 private final Channel parentChannel;
85 /** Nick list scroll pane. */
86 private JScrollPane nickScrollPane;
87 /** Identity. */
88 private Identity identity;
89
90 /**
91 * Creates a new instance of ChannelFrame. Sets up callbacks and handlers,
92 * and default options for the form.
93 *
94 * @param owner The Channel object that owns this frame
95 * @param controller Swing controller
96 */
97 public ChannelFrame(final Channel owner, final SwingController controller) {
/*
P/P * Method: void com.dmdirc.addons.ui_swing.components.frames.ChannelFrame(Channel, SwingController)
*
* Preconditions:
* owner != null
*
* Presumptions:
* com.dmdirc.Channel:getChannelInfo(...)@129 != null
* com.dmdirc.Channel:getServer(...)@129 != null
* init'ed(com.dmdirc.actions.CoreActionType.CLIENT_CLOSING)
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@104 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@107 != null
* ...
*
* Postconditions:
* this.awayLabel == &new JLabel(initComponents#3)
* this.commandParser == &new ChannelCommandParser(ChannelFrame#4)
* init'ed(this.identity)
* this.inputField == &new SwingInputField(initComponents#1)
* this.inputFieldPopup == &new JPopupMenu(initPopupMenu#1)
* this.inputHandler == &new SwingInputHandler(ChannelFrame#5)
* this.inputPanel == &new JPanel(initComponents#4)
* this.nickList == &new JList(initComponents#4)
* this.nickPopup == &new JPopupMenu(initComponents#2)
* this.nickScrollPane == &new JScrollPane(initComponents#3)
* ...
*/
98 super(owner, controller);
99
100 parentChannel = owner;
101
102 initComponents();
103
104 nickList.setBackground(getConfigManager().getOptionColour(
105 "ui", "nicklistbackgroundcolour",
106 "ui", "backgroundcolour"));
107 nickList.setForeground(getConfigManager().getOptionColour(
108 "ui", "nicklistforegroundcolour",
109 "ui", "foregroundcolour"));
110
111 getConfigManager().addChangeListener("ui", "nicklistforegroundcolour",
112 this);
113 getConfigManager().addChangeListener("ui", "foregroundcolour", this);
114 getConfigManager().addChangeListener("ui", "nicklistbackgroundcolour",
115 this);
116 getConfigManager().addChangeListener("ui", "backgroundcolour", this);
117 getConfigManager().addChangeListener("ui", "nickListAltBackgroundColour",
118 this);
119 getConfigManager().addChangeListener("ui", "channelSplitPanePosition", this);
120 ActionManager.addListener(this, CoreActionType.CLIENT_CLOSING);
121
122 commandParser =
123 new ChannelCommandParser(((Channel) getContainer()).getServer(),
124 (Channel) getContainer());
125
126 setInputHandler(new SwingInputHandler(getInputField(), commandParser,
127 this));
128
129 identity = IdentityManager.getChannelConfig(getChannel().getServer().
130 getNetwork(), getChannel().getChannelInfo().getName());
131 }
132
133 /**
134 * Retrieves the command Parser for this command window.
135 * @return This window's command Parser
136 */
137 @Override
138 public CommandParser getCommandParser() {
/*
P/P * Method: CommandParser getCommandParser()
*
* Postconditions:
* return_value == this.commandParser
* init'ed(return_value)
*/
139 return commandParser;
140 }
141
142 /** {@inheritDoc} */
143 @Override
144 public void updateNames(final List<ChannelClientInfo> clients) {
/*
P/P * Method: void updateNames(List)
*/
145 SwingUtilities.invokeLater(new Runnable() {
146
147 /** {@inheritDoc} */
148 @Override
149 public void run() {
/*
P/P * Method: void run()
*
* Preconditions:
* this.nicklistModel != null
* this.nicklistModel.nicknames != null
* init'ed(this.nicklistModel.sortByCase)
* init'ed(this.nicklistModel.sortByMode)
*/
150 nicklistModel.replace(clients);
151 }
152 });
153 }
154
155 /** {@inheritDoc} */
156 @Override
157 public void updateNames() {
/*
P/P * Method: void updateNames()
*/
158 SwingUtilities.invokeLater(new Runnable() {
159
160 /** {@inheritDoc} */
161 @Override
162 public void run() {
/*
P/P * Method: void run()
*
* Preconditions:
* this.nicklistModel != null
* this.nicklistModel.nicknames != null
* init'ed(this.nicklistModel.sortByCase)
* init'ed(this.nicklistModel.sortByMode)
*/
163 nicklistModel.sort();
164 }
165 });
166 }
167
168 /** {@inheritDoc} */
169 @Override
170 public void addName(final ChannelClientInfo client) {
/*
P/P * Method: void addName(ChannelClientInfo)
*/
171 SwingUtilities.invokeLater(new Runnable() {
172
173 /** {@inheritDoc} */
174 @Override
175 public void run() {
/*
P/P * Method: void run()
*
* Preconditions:
* this.nicklistModel != null
* this.nicklistModel.nicknames != null
* init'ed(this.nicklistModel.sortByCase)
* init'ed(this.nicklistModel.sortByMode)
*/
176 nicklistModel.add(client);
177 }
178 });
179 }
180
181 /** {@inheritDoc} */
182 @Override
183 public void removeName(final ChannelClientInfo client) {
/*
P/P * Method: void removeName(ChannelClientInfo)
*/
184 SwingUtilities.invokeLater(new Runnable() {
185
186 /** {@inheritDoc} */
187 @Override
188 public void run() {
/*
P/P * Method: void run()
*
* Preconditions:
* this.nicklistModel != null
* this.nicklistModel.nicknames != null
*/
189 nicklistModel.remove(client);
190 }
191 });
192 }
193
194 /**
195 * Retrieves this channel frame's nicklist component.
196 * @return This channel's nicklist
197 */
198 public JList getNickList() {
/*
P/P * Method: JList getNickList()
*
* Preconditions:
* init'ed(this.nickList)
*
* Postconditions:
* return_value == this.nickList
* init'ed(return_value)
*/
199 return nickList;
200 }
201
202 /** {@inheritDoc} */
203 @Override
204 public Channel getChannel() {
/*
P/P * Method: Channel getChannel()
*
* Postconditions:
* return_value == this.parentChannel
* init'ed(return_value)
*/
205 return parentChannel;
206 }
207
208 /**
209 * Initialises the compoents in this frame.
210 */
211 private void initComponents() {
/*
P/P * Method: void initComponents()
*
* Preconditions:
* init'ed(this.inputPanel)
* this.parentChannel != null
*
* Presumptions:
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@232 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getContentPane(...)@237 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getContentPane(...)@239 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getContentPane(...)@240 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getContentPane(...)@241 != null
* ...
*
* Postconditions:
* this.nickList == &new JList(initComponents#4)
* this.nickScrollPane == &new JScrollPane(initComponents#3)
* this.nicklistModel == &new NicklistListModel(initComponents#6)
* this.settingsMI == &new JMenuItem(initComponents#1)
* this.splitPane == &new SnappingJSplitPane(initComponents#2)
* new JList(initComponents#4) num objects == 1
* new JMenuItem(initComponents#1) num objects == 1
* new JScrollPane(initComponents#3) num objects == 1
* new NicklistListModel(initComponents#6) num objects == 1
* new SnappingJSplitPane(initComponents#2) num objects == 1
* ...
*/
212 settingsMI = new JMenuItem("Settings");
213 settingsMI.addActionListener(this);
214
215 splitPane =
216 new SnappingJSplitPane(SnappingJSplitPane.Orientation.HORIZONTAL,
217 false);
218
219 nickScrollPane = new JScrollPane();
220 nickList = new JList();
221 nickList.setCellRenderer(new NicklistRenderer(parentChannel.getConfigManager(),
222 nickList));
223 nickList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
224
225 nickList.addMouseListener(this);
226
227 nicklistModel = new NicklistListModel();
228
229 nickList.setModel(nicklistModel);
230 nickScrollPane.setViewportView(nickList);
231
232 final int splitPanePosition = getConfigManager().getOptionInt("ui",
233 "channelSplitPanePosition");
234 nickScrollPane.setPreferredSize(new Dimension(splitPanePosition, 0));
235 nickScrollPane.setMinimumSize(new Dimension(150, 0));
236
237 getContentPane().setLayout(new MigLayout("fill, ins 0, hidemode 3, wrap 1"));
238
239 getContentPane().add(splitPane, "grow, push");
240 getContentPane().add(getSearchBar(), "growx, pushx");
241 getContentPane().add(inputPanel, "growx, pushx");
242
243 splitPane.setLeftComponent(getTextPane());
244 splitPane.setRightComponent(nickScrollPane);
245 splitPane.setResizeWeight(1);
246
247 pack();
248 }
249
250 /**
251 * {@inheritDoc}.
252 *
253 * @param actionEvent Action event
254 */
255 @Override
256 public void actionPerformed(final ActionEvent actionEvent) {
/*
P/P * Method: void actionPerformed(ActionEvent)
*
* Preconditions:
* actionEvent != null
* init'ed(this.settingsMI)
*
* Presumptions:
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getController(...)@258 != null
*/
257 if (actionEvent.getSource() == settingsMI) {
258 ChannelSettingsDialog.showChannelSettingsDialog((Channel) getContainer(), getController().getMainFrame());
259 }
260 }
261
262 /**
263 * Returns the splitpane.
264 * @return nicklist JSplitPane
265 */
266 public JSplitPane getSplitPane() {
/*
P/P * Method: JSplitPane getSplitPane()
*
* Preconditions:
* init'ed(this.splitPane)
*
* Postconditions:
* return_value == this.splitPane
* init'ed(return_value)
*/
267 return splitPane;
268 }
269
270 /**
271 * Checks for url's, channels and nicknames. {@inheritDoc}
272 */
273 @Override
274 public void mouseClicked(final MouseEvent mouseEvent) {
/*
P/P * Method: void mouseClicked(MouseEvent)
*
* Preconditions:
* mouseEvent != null
* (soft) this.inputField != null
* (soft) this.nickList != null
*
* Postconditions:
* possibly_updated(this.inputFieldPopup)
* new JPopupMenu(initPopupMenu#1) num objects <= 1
*/
275 processMouseEvent(mouseEvent);
276 super.mouseClicked(mouseEvent);
277 }
278
279 /**
280 * Not needed for this class. {@inheritDoc}
281 */
282 @Override
283 public void mousePressed(final MouseEvent mouseEvent) {
/*
P/P * Method: void mousePressed(MouseEvent)
*
* Preconditions:
* mouseEvent != null
* (soft) this.inputField != null
* (soft) this.nickList != null
*
* Postconditions:
* possibly_updated(this.inputFieldPopup)
* new JPopupMenu(initPopupMenu#1) num objects <= 1
*/
284 processMouseEvent(mouseEvent);
285 super.mousePressed(mouseEvent);
286 }
287
288 /**
289 * Not needed for this class. {@inheritDoc}
290 */
291 @Override
292 public void mouseReleased(final MouseEvent mouseEvent) {
/*
P/P * Method: void mouseReleased(MouseEvent)
*
* Preconditions:
* mouseEvent != null
* (soft) this.inputField != null
* (soft) this.nickList != null
*
* Postconditions:
* possibly_updated(this.inputFieldPopup)
* new JPopupMenu(initPopupMenu#1) num objects <= 1
*/
293 processMouseEvent(mouseEvent);
294 super.mouseReleased(mouseEvent);
295 }
296
297 /**
298 * Processes every mouse button event to check for a popup trigger.
299 *
300 * @param e mouse event
301 */
302 @Override
303 public void processMouseEvent(final MouseEvent e) {
/*
P/P * Method: void processMouseEvent(MouseEvent)
*
* Preconditions:
* e != null
* (soft) this.inputField != null
* (soft) this.nickList != null
*
* Presumptions:
* init'ed(com.dmdirc.addons.ui_swing.textpane.ClickType.NICKNAME)
* javax.swing.JList:getSelectedValue(...)@308 != null
*
* Postconditions:
* this.inputFieldPopup == One-of{old this.inputFieldPopup, &new JPopupMenu(initPopupMenu#1)}
* new JPopupMenu(initPopupMenu#1) num objects <= 1
*
* Test Vectors:
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getMousePosition(...)@304: Addr_Set{null}, Inverse{null}
* java.awt.event.MouseEvent:isPopupTrigger(...)@307: {0}, {1}
* javax.swing.JList:getMousePosition(...)@304: Addr_Set{null}, Inverse{null}
*/
304 if (e.getSource() == nickList && nickList.getMousePosition() != null
305 && getMousePosition() != null) {
306 if (checkCursorInSelectedCell() || selectNickUnderCursor()) {
307 if (e.isPopupTrigger()) {
308 showPopupMenu(ClickType.NICKNAME, getMousePosition(),
309 ((ChannelClientInfo) nickList.getSelectedValue()).getNickname());
310 }
311 } else {
312 nickList.clearSelection();
313 }
314 }
315
316 super.processMouseEvent(e);
317 }
318
319 /**
320 * Checks whether the mouse cursor is currently over a cell in the nicklist
321 * which has been previously selected.
322 *
323 * @return True if the cursor is over a selected cell, false otherwise
324 */
325 private boolean checkCursorInSelectedCell() {
/*
P/P * Method: bool checkCursorInSelectedCell()
*
* Preconditions:
* this.nickList != null
*
* Presumptions:
* javax.swing.JList:getCellBounds(...)@330 != null
* javax.swing.JList:getModel(...)@329 != null
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* java.awt.Rectangle:contains(...)@330: {0}, {1}
* javax.swing.JList:getCellBounds(...)@330: Addr_Set{null}, Inverse{null}
* javax.swing.JList:getMousePosition(...)@327: Addr_Set{null}, Inverse{null}
* javax.swing.JList:isSelectedIndex(...)@330: {0}, {1}
*/
326 boolean showMenu = false;
327 final Point mousePos = nickList.getMousePosition();
328 if (mousePos != null) {
329 for (int i = 0; i < nickList.getModel().getSize(); i++) {
330 if (nickList.getCellBounds(i, i) != null && nickList.getCellBounds(i, i).
331 contains(mousePos) && nickList.isSelectedIndex(i)) {
332 showMenu = true;
333 break;
334 }
335 }
336 }
337 return showMenu;
338 }
339
340 /**
341 * If the mouse cursor is over a nicklist cell, sets that cell to be
342 * selected and returns true. If the mouse is not over any cell, the
343 * selection is unchanged and the method returns false.
344 *
345 * @return True if an item was selected
346 */
347 private boolean selectNickUnderCursor() {
/*
P/P * Method: bool selectNickUnderCursor()
*
* Preconditions:
* this.nickList != null
*
* Presumptions:
* javax.swing.JList:getCellBounds(...)@352 != null
* javax.swing.JList:getModel(...)@351 != null
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* java.awt.Rectangle:contains(...)@352: {0}, {1}
* javax.swing.JList:getCellBounds(...)@352: Addr_Set{null}, Inverse{null}
* javax.swing.JList:getMousePosition(...)@349: Addr_Set{null}, Inverse{null}
*/
348 boolean suceeded = false;
349 final Point mousePos = nickList.getMousePosition();
350 if (mousePos != null) {
351 for (int i = 0; i < nickList.getModel().getSize(); i++) {
352 if (nickList.getCellBounds(i, i) != null && nickList.getCellBounds(i, i).
353 contains(mousePos)) {
354 nickList.setSelectedIndex(i);
355 suceeded = true;
356 break;
357 }
358 }
359 }
360 return suceeded;
361 }
362
363 /** {@inheritDoc} */
364 @Override
365 public void configChanged(final String domain, final String key) {
/*
P/P * Method: void configChanged(String, String)
*
* Preconditions:
* this.nickList != null
* (soft) init'ed(this.inputField)
* (soft) this.nickScrollPane != null
* (soft) this.splitPane != null
*
* Presumptions:
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@373 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@376 != null
* com.dmdirc.addons.ui_swing.components.frames.ChannelFrame:getConfigManager(...)@382 != null
* javax.swing.JSplitPane:getWidth(...)@385 - com.dmdirc.config.ConfigManager:getOptionInt(...)@382 in {-231..232-1}
*
* Test Vectors:
* java.lang.String:equals(...)@368: {1}, {0}
* java.lang.String:equals(...)@368: {0}, {1}
* java.lang.String:equals(...)@381: {0}, {1}
*/
366 super.configChanged(domain, key);
367
368 if ("nickListAltBackgroundColour".equals(key) ||
369 "nicklistbackgroundcolour".equals(key) ||
370 "backgroundcolour".equals(key) ||
371 "nicklistforegroundcolour".equals(key) ||
372 "foregroundcolour".equals(key)) {
373 nickList.setBackground(getConfigManager().getOptionColour(
374 "ui", "nicklistbackgroundcolour",
375 "ui", "backgroundcolour"));
376 nickList.setForeground(getConfigManager().getOptionColour(
377 "ui", "nicklistforegroundcolour",
378 "ui", "foregroundcolour"));
379 nickList.repaint();
380 }
381 if ("channelSplitPanePosition".equals(key)) {
382 final int splitPanePosition = getConfigManager().getOptionInt("ui",
383 "channelSplitPanePosition");
384 nickScrollPane.setPreferredSize(new Dimension(splitPanePosition, 0));
385 splitPane.setDividerLocation(splitPane.getWidth() - splitPanePosition);
386 }
387 nickList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
388 }
389
390 /** {@inheritDoc} */
391 @Override
392 public void processEvent(final ActionType type, final StringBuffer format,
393 final Object... arguments) {
/*
P/P * Method: void processEvent(ActionType, StringBuffer, Object[])
*
* Preconditions:
* this.identity != null
* this.nickScrollPane != null
*/
394 saveSplitPanePosition();
395 }
396
397 /** {@inheritDoc} */
398 @Override
399 public void close() {
/*
P/P * Method: void close()
*
* Preconditions:
* this.identity != null
* this.nickScrollPane != null
*/
400 saveSplitPanePosition();
401 super.close();
402 }
403
404 private void saveSplitPanePosition() {
/*
P/P * Method: void saveSplitPanePosition()
*
* Preconditions:
* this.identity != null
* this.nickScrollPane != null
*
* Presumptions:
* (int) (java.awt.Dimension:getWidth(...)@405) in {-231..232-1}
* javax.swing.JScrollPane:getSize(...)@405 != null
*/
405 identity.setOption("ui", "channelSplitPanePosition",
406 (int) nickScrollPane.getSize().getWidth());
407 }
408
409 /** {@inheritDoc} */
410 @Override
411 public PopupType getNicknamePopupType() {
/*
P/P * Method: PopupType getNicknamePopupType()
*
* Presumptions:
* init'ed(com.dmdirc.commandparser.PopupType.CHAN_NICK)
*
* Postconditions:
* return_value == com.dmdirc.commandparser.PopupType.CHAN_NICK
* init'ed(return_value)
*/
412 return PopupType.CHAN_NICK;
413 }
414
415 /** {@inheritDoc} */
416 @Override
417 public PopupType getChannelPopupType() {
/*
P/P * Method: PopupType getChannelPopupType()
*
* Presumptions:
* init'ed(com.dmdirc.commandparser.PopupType.CHAN_NORMAL)
*
* Postconditions:
* return_value == com.dmdirc.commandparser.PopupType.CHAN_NORMAL
* init'ed(return_value)
*/
418 return PopupType.CHAN_NORMAL;
419 }
420
421 /** {@inheritDoc} */
422 @Override
423 public PopupType getHyperlinkPopupType() {
/*
P/P * Method: PopupType getHyperlinkPopupType()
*
* Presumptions:
* init'ed(com.dmdirc.commandparser.PopupType.CHAN_HYPERLINK)
*
* Postconditions:
* return_value == com.dmdirc.commandparser.PopupType.CHAN_HYPERLINK
* init'ed(return_value)
*/
424 return PopupType.CHAN_HYPERLINK;
425 }
426
427 /** {@inheritDoc} */
428 @Override
429 public PopupType getNormalPopupType() {
/*
P/P * Method: PopupType getNormalPopupType()
*
* Presumptions:
* init'ed(com.dmdirc.commandparser.PopupType.CHAN_NORMAL)
*
* Postconditions:
* return_value == com.dmdirc.commandparser.PopupType.CHAN_NORMAL
* init'ed(return_value)
*/
430 return PopupType.CHAN_NORMAL;
431 }
432
433 /** {@inheritDoc} */
434 @Override
435 public void addCustomPopupItems(final JPopupMenu popupMenu) {
/*
P/P * Method: void addCustomPopupItems(JPopupMenu)
*
* Preconditions:
* popupMenu != null
* this.settingsMI != null
*
* Presumptions:
* com.dmdirc.Server:getState(...)@436 != null
* init'ed(com.dmdirc.ServerState.CONNECTED)
* com.dmdirc.WritableFrameContainer:getServer(...)@436 != null
* com.dmdirc.addons.ui_swing.components.frames.TextFrame:getContainer(...)@187 != null
*
* Test Vectors:
* com.dmdirc.ServerState:equals(...)@436: {0}, {1}
* javax.swing.JPopupMenu:getComponentCount(...)@442: {-231..0}, {1..232-1}
*/
436 if (getContainer().getServer().getState().equals(ServerState.CONNECTED)) {
437 settingsMI.setEnabled(true);
438 } else {
439 settingsMI.setEnabled(false);
440 }
441
442 if (popupMenu.getComponentCount() > 0) {
443 popupMenu.addSeparator();
444 }
445
446 popupMenu.add(settingsMI);
447 }
448
449 /** {@inheritDoc} */
450 @Override
451 public void redrawNicklist() {
/*
P/P * Method: void redrawNicklist()
*
* Preconditions:
* this.nickList != null
*/
452 getNickList().repaint();
453 }
454 }
SofCheck Inspector Build Version : 2.17854
| ChannelFrame.java |
2009-Jun-25 01:54:24 |
| ChannelFrame.class |
2009-Sep-02 17:04:17 |
| ChannelFrame$1.class |
2009-Sep-02 17:04:17 |
| ChannelFrame$2.class |
2009-Sep-02 17:04:17 |
| ChannelFrame$3.class |
2009-Sep-02 17:04:17 |
| ChannelFrame$4.class |
2009-Sep-02 17:04:17 |