//# 0 errors, 355 messages
//#
/*
    //#OsdWindow.java:1:1: class: com.dmdirc.addons.osd.OsdWindow$1
    //#OsdWindow.java:1:1: method: com.dmdirc.addons.osd.OsdWindow$1.com.dmdirc.addons.osd.OsdWindow$1__static_init
    //#OsdWindow.java:1:1: class: com.dmdirc.addons.osd.OsdWindow
 * Copyright (c) 2006-2009 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.addons.osd;

import com.dmdirc.Main;
import com.dmdirc.addons.ui_swing.MainFrame;
import com.dmdirc.config.IdentityManager;
import com.dmdirc.ui.messages.ColourManager;

import java.awt.Color;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;

import net.miginfocom.swing.MigLayout;

/**
 * The OSD Window is an always-on-top window designed to convey information
 * about events to the user.
 * @author chris
 */
public final class OsdWindow extends JDialog implements MouseListener,
        MouseMotionListener {
    
    /**
     * 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 = 2;
    
    /** Gap between vertically stacked windows. */
    private static final int WINDOW_GAP = 5;
    
    /** A list of open OSD windows. */
    private static List<OsdWindow> windows = new ArrayList<OsdWindow>();
    //#OsdWindow.java:68: method: com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow__static_init
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow]
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.dispose()V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseClicked(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseDragged(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseEntered(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseExited(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseMoved(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mousePressed(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseReleased(Ljava/awt/event/MouseEvent;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setBackgroundColour(Ljava/lang/String;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setFontSize(I)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setForegroundColour(Ljava/lang/String;)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setVisible(Z)V
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): new ArrayList(OsdWindow__static_init#1) num objects
    //#output(com.dmdirc.addons.osd.OsdWindow__static_init): windows
    //#new obj(com.dmdirc.addons.osd.OsdWindow__static_init): new ArrayList(OsdWindow__static_init#1)
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow] == &__Dispatch_Table
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.dispose()V == &dispose
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseClicked(Ljava/awt/event/MouseEvent;)V == &mouseClicked
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseDragged(Ljava/awt/event/MouseEvent;)V == &mouseDragged
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseEntered(Ljava/awt/event/MouseEvent;)V == &mouseEntered
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseExited(Ljava/awt/event/MouseEvent;)V == &mouseExited
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseMoved(Ljava/awt/event/MouseEvent;)V == &mouseMoved
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mousePressed(Ljava/awt/event/MouseEvent;)V == &mousePressed
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.mouseReleased(Ljava/awt/event/MouseEvent;)V == &mouseReleased
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setBackgroundColour(Ljava/lang/String;)V == &setBackgroundColour
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setFontSize(I)V == &setFontSize
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setForegroundColour(Ljava/lang/String;)V == &setForegroundColour
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): __Dispatch_Table.setVisible(Z)V == &setVisible
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): windows == &new ArrayList(OsdWindow__static_init#1)
    //#post(com.dmdirc.addons.osd.OsdWindow__static_init): new ArrayList(OsdWindow__static_init#1) num objects == 1
    //#OsdWindow.java:68: end of method: com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow__static_init

    /** Plugin this window belongs to. */
    private final OsdPlugin plugin;
    
    /** OSD Label. */
    private final JLabel label;
    
    /** OSD Panel. */
    private final JPanel panel;
    
    /** Starting positions of the mouse. */
    private int startX, startY;
    
    /** Is this a config instance? */
    private final boolean config;

    /**
     * Creates a new instance of OsdWindow.
     * 
     * @param text The text to be displayed in the OSD window
     * @param config Is the window being configured (should it timeout and
     * allow itself to be moved)
     * @param plugin The plugin that owns this window
     */    
    public OsdWindow(final String text, final boolean config, final OsdPlugin plugin) {
        this(text, config, IdentityManager.getGlobalConfig()
    //#OsdWindow.java:94: method: void com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)
    //#OsdWindow.java:94: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:94: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:94: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): __Descendant_Table[others]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): com/dmdirc/addons/ui_swing/MainFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/MainFrame]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): com/dmdirc/addons/ui_swing/MainFrame.__Descendant_Table[others]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): config
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): java.awt.Color.BLACK
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): plugin
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): text
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): windows
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JLabel(OsdWindow#5) num objects
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JPanel(OsdWindow#1) num objects
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.config
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.label
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.panel
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.plugin
    //#new obj(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JLabel(OsdWindow#5)
    //#new obj(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JPanel(OsdWindow#1)
    //#pre[2] (void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): plugin != null
    //#pre[5] (void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): (soft) windows != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@94 != null
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.config == config
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): init'ed(this.config)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.label == &new JLabel(OsdWindow#5)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.panel == &new JPanel(OsdWindow#1)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.plugin == plugin
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): this.plugin != null
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JLabel(OsdWindow#5) num objects == 1
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): new JPanel(OsdWindow#1) num objects == 1
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JDialog:dispose
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.List:remove
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.ArrayList:iterator
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdPlugin:getDomain
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOption
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionInt
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:isVisible
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:getY
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:getHeight
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.lang.Math:max
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.lang.Math:min
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.Main:getUI
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.ui.interfaces.UIController:getMainWindow
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JDialog
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setFocusableWindowState
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setAlwaysOnTop
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setResizable
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setUndecorated
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setDefaultCloseOperation
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setLocation
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.border.LineBorder
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JPanel:setBorder
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionColour
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setContentPane
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:setLayout
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JLabel
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JLabel:setForeground
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JLabel:getFont
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.awt.Font:deriveFont
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JLabel:setFont
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:javax.swing.JLabel:setHorizontalAlignment
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:add
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:pack
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:addMouseMotionListener
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:addMouseListener
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.Timer
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.TimerTask
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)): Effects-of-calling:java.util.Timer:schedule
                .getOptionInt(plugin.getDomain(), "locationX"), getYPosition(plugin), plugin);
    }
    //#OsdWindow.java:96: end of method: void com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow(String, bool, OsdPlugin)

    /**
     * Creates a new instance of OsdWindow.
     *
     * @param text The text to be displayed in the OSD window
     * @param config Is the window being configured (should it timeout and
     * allow itself to be moved)
     * @param x The x-axis position for the OSD Window
     * @param y The y-axis position for the OSD window
     * @param plugin Parent OSD Plugin
     */
    public OsdWindow(final String text, final boolean config, final int x,
            final int y, final OsdPlugin plugin) {
        super((MainFrame) Main.getUI().getMainWindow(), false);
    //#OsdWindow.java:110: method: void com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#OsdWindow.java:110: Warning: method not available - call not analyzed
    //#    call on UIController com.dmdirc.Main:getUI()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: UIController com.dmdirc.Main:getUI()
    //#OsdWindow.java:110: Warning: method not available - call not analyzed
    //#    call on MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com/dmdirc/addons/ui_swing/MainFrame.__Descendant_Table[com/dmdirc/addons/ui_swing/MainFrame]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com/dmdirc/addons/ui_swing/MainFrame.__Descendant_Table[others]
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): config
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): java.awt.Color.BLACK
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): plugin
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): text
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): windows
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): x
    //#input(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): y
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JLabel(OsdWindow#5) num objects
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JPanel(OsdWindow#1) num objects
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.config
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.label
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.panel
    //#output(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.plugin
    //#new obj(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JLabel(OsdWindow#5)
    //#new obj(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JPanel(OsdWindow#1)
    //#pre[2] (void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): plugin != null
    //#pre[5] (void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): (soft) windows != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.Main:getUI(...)@110 != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@126 != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@133 != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@135 != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@149 != null
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): com.dmdirc.ui.interfaces.UIController:getMainWindow(...).__Tag@110 == com/dmdirc/addons/ui_swing/MainFrame
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): init'ed(java.awt.Color.BLACK)
    //#presumption(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): javax.swing.JLabel:getFont(...)@135 != null
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.config == config
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): init'ed(this.config)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.label == &new JLabel(OsdWindow#5)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.panel == &new JPanel(OsdWindow#1)
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.plugin == plugin
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): this.plugin != null
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JLabel(OsdWindow#5) num objects == 1
    //#post(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): new JPanel(OsdWindow#1) num objects == 1
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): Effects-of-calling:java.util.TimerTask
    //#test_vector(void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)): config: {0}, {1}

        this.plugin = plugin;
        this.config = config;

        setFocusableWindowState(false);
    //#OsdWindow.java:115: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setFocusableWindowState(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setFocusableWindowState(bool)
        setAlwaysOnTop(true);
    //#OsdWindow.java:116: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setAlwaysOnTop(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setAlwaysOnTop(bool)
        setResizable(false);
    //#OsdWindow.java:117: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setResizable(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setResizable(bool)
        setUndecorated(true);
    //#OsdWindow.java:118: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setUndecorated(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setUndecorated(bool)

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    //#OsdWindow.java:120: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setDefaultCloseOperation(int)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setDefaultCloseOperation(int)

        setLocation(x, y);
    //#OsdWindow.java:122: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setLocation(int, int)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setLocation(int, int)

        panel = new JPanel();
        panel.setBorder(new LineBorder(Color.BLACK));
        panel.setBackground(IdentityManager.getGlobalConfig().getOptionColour(plugin.getDomain(),
    //#OsdWindow.java:126: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:126: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:126: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.config.ConfigManager:getOptionColour(String, String, String[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: Color com.dmdirc.config.ConfigManager:getOptionColour(String, String, String[])
                "bgcolour"));

        setContentPane(panel);
    //#OsdWindow.java:129: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setContentPane(Container)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setContentPane(Container)
        setLayout(new MigLayout("wmin 500, wmax 500, ins rel, fill"));
    //#OsdWindow.java:130: Warning: method not available - call not analyzed
    //#    call on void net.miginfocom.swing.MigLayout(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void net.miginfocom.swing.MigLayout(String)
    //#OsdWindow.java:130: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setLayout(LayoutManager)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setLayout(LayoutManager)

        label = new JLabel(text);
        label.setForeground(IdentityManager.getGlobalConfig().getOptionColour(plugin.getDomain(),
    //#OsdWindow.java:133: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:133: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:133: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.config.ConfigManager:getOptionColour(String, String, String[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: Color com.dmdirc.config.ConfigManager:getOptionColour(String, String, String[])
                "fgcolour"));
        label.setFont(label.getFont().deriveFont(
    //#OsdWindow.java:135: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:135: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:135: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
                (float) IdentityManager.getGlobalConfig().getOptionInt(plugin.getDomain(),
                "fontSize")));
        label.setHorizontalAlignment(SwingConstants.CENTER);
            add(label, "alignx center");
    //#OsdWindow.java:139: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:add(Component, Object)

        setVisible(true);
        pack();
    //#OsdWindow.java:142: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:pack()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:pack()

        if (config) {
            this.addMouseMotionListener(this);
    //#OsdWindow.java:145: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:addMouseMotionListener(MouseMotionListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:addMouseMotionListener(MouseMotionListener)
            this.addMouseListener(this);
    //#OsdWindow.java:146: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:addMouseListener(MouseListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:addMouseListener(MouseListener)
        } else {
            addMouseListener(this);
    //#OsdWindow.java:148: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:addMouseListener(MouseListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:addMouseListener(MouseListener)
            new Timer("OSD Display Timer").schedule(new TimerTask() {
    //#OsdWindow.java:149: method: void com.dmdirc.addons.osd.OsdWindow$1.com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)
    //#input(void com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)): Param_1
    //#input(void com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)): this
    //#output(void com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)): this.this$0
    //#post(void com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)): this.this$0 == Param_1
    //#post(void com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)): init'ed(this.this$0)
    //#OsdWindow.java:149: end of method: void com.dmdirc.addons.osd.OsdWindow$1.com.dmdirc.addons.osd.OsdWindow$1(OsdWindow)
    //#OsdWindow.java:149: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:149: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:149: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
                
                /** {@inheritDoc} */
                @Override
                public void run() {
                    setVisible(false);
    //#OsdWindow.java:154: method: void com.dmdirc.addons.osd.OsdWindow$1.run()
    //#input(void run()): com/dmdirc/addons/osd/OsdWindow.windows
    //#input(void run()): this
    //#input(void run()): this.this$0
    //#pre[3] (void run()): this.this$0 != null
    //#pre[1] (void run()): (soft) com/dmdirc/addons/osd/OsdWindow.windows != null
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JDialog:dispose
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:remove
                    dispose();
                }
    //#OsdWindow.java:156: end of method: void com.dmdirc.addons.osd.OsdWindow$1.run()
            }, IdentityManager.getGlobalConfig().getOptionInt(plugin.getDomain(),
                    "timeout") * 1000);
        }
    }
    //#OsdWindow.java:160: end of method: void com.dmdirc.addons.osd.OsdWindow.com.dmdirc.addons.osd.OsdWindow(String, bool, int, int, OsdPlugin)
    
    /**
     * Retrieves the y-axis position for a new OSD window, based on the user's
     * configured policy.
     * 
     * @return The y-axis position for a new OSD window.
     */
    private static int getYPosition(final OsdPlugin plugin) {
        final String policy = IdentityManager.getGlobalConfig()
    //#OsdWindow.java:169: method: int com.dmdirc.addons.osd.OsdWindow.getYPosition(OsdPlugin)
    //#OsdWindow.java:169: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:169: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:169: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.config.ConfigManager:getOption(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.config.ConfigManager:getOption(String, String)
    //#input(int getYPosition(OsdPlugin)): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow]
    //#input(int getYPosition(OsdPlugin)): __Descendant_Table[others]
    //#input(int getYPosition(OsdPlugin)): plugin
    //#input(int getYPosition(OsdPlugin)): windows
    //#output(int getYPosition(OsdPlugin)): return_value
    //#pre[1] (int getYPosition(OsdPlugin)): plugin != null
    //#pre[2] (int getYPosition(OsdPlugin)): (soft) windows != null
    //#presumption(int getYPosition(OsdPlugin)): com.dmdirc.addons.osd.OsdWindow:getHeight(...)@185 - com.dmdirc.addons.osd.OsdWindow:getY(...)@185 in {-4_294_967_300..2_147_483_643}
    //#presumption(int getYPosition(OsdPlugin)): com.dmdirc.addons.osd.OsdWindow:getY(...)@178 + com.dmdirc.addons.osd.OsdWindow:getHeight(...)@178 in {-2_147_483_653..4_294_967_290}
    //#presumption(int getYPosition(OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@169 != null
    //#presumption(int getYPosition(OsdPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@171 != null
    //#presumption(int getYPosition(OsdPlugin)): java.util.ArrayList:iterator(...)@176 != null
    //#presumption(int getYPosition(OsdPlugin)): java.util.ArrayList:iterator(...)@183 != null
    //#presumption(int getYPosition(OsdPlugin)): java.util.Iterator:next(...).__Tag@176 == com/dmdirc/addons/osd/OsdWindow
    //#presumption(int getYPosition(OsdPlugin)): java.util.Iterator:next(...).__Tag@183 == com/dmdirc/addons/osd/OsdWindow
    //#presumption(int getYPosition(OsdPlugin)): java.util.Iterator:next(...)@176 != null
    //#presumption(int getYPosition(OsdPlugin)): java.util.Iterator:next(...)@183 != null
    //#post(int getYPosition(OsdPlugin)): init'ed(return_value)
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.List:add
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:javax.swing.JDialog:dispose
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.List:remove
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.ArrayList:iterator
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(int getYPosition(OsdPlugin)): Effects-of-calling:java.util.Iterator:next
    //#test_vector(int getYPosition(OsdPlugin)): com.dmdirc.addons.osd.OsdWindow:isVisible(...)@177: {0}, {1}
    //#test_vector(int getYPosition(OsdPlugin)): com.dmdirc.addons.osd.OsdWindow:isVisible(...)@184: {0}, {1}
    //#test_vector(int getYPosition(OsdPlugin)): java.lang.String:equals(...)@174: {0}, {1}
    //#test_vector(int getYPosition(OsdPlugin)): java.lang.String:equals(...)@181: {0}, {1}
    //#test_vector(int getYPosition(OsdPlugin)): java.lang.String:equals(...)@188: {0}, {1}
                .getOption(plugin.getDomain(), "newbehaviour");
        int y = IdentityManager.getGlobalConfig().getOptionInt(plugin.getDomain(),
    //#OsdWindow.java:171: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#OsdWindow.java:171: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.osd.OsdPlugin:getDomain()
    //#OsdWindow.java:171: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.config.ConfigManager:getOptionInt(String, String)
                "locationY");
        
        if ("down".equals(policy)) {
            // Place our new window below old windows
            for (OsdWindow window : new ArrayList<OsdWindow>(windows)) {
                if (window.isVisible()) {
    //#OsdWindow.java:177: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.osd.OsdWindow:isVisible()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: bool com.dmdirc.addons.osd.OsdWindow:isVisible()
                    y = Math.max(y, window.getY() + window.getHeight() + WINDOW_GAP);
    //#OsdWindow.java:178: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.osd.OsdWindow:getY()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.addons.osd.OsdWindow:getY()
    //#OsdWindow.java:178: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.osd.OsdWindow:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.addons.osd.OsdWindow:getHeight()
                }
            }
        } else if ("up".equals(policy)) {
            // Place our new window above old windows
            for (OsdWindow window : new ArrayList<OsdWindow>(windows)) {
                if (window.isVisible()) {
    //#OsdWindow.java:184: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.osd.OsdWindow:isVisible()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: bool com.dmdirc.addons.osd.OsdWindow:isVisible()
                    y = Math.min(y, window.getY() - window.getHeight() - WINDOW_GAP);
    //#OsdWindow.java:185: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.osd.OsdWindow:getY()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.addons.osd.OsdWindow:getY()
    //#OsdWindow.java:185: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.osd.OsdWindow:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: int getYPosition(OsdPlugin)
    //#    unanalyzed callee: int com.dmdirc.addons.osd.OsdWindow:getHeight()
                }
            }            
        } else if ("close".equals(policy)) {
            // Close existing windows and use their place
            closeAll();
        }        
        
        return y;
    //#OsdWindow.java:193: end of method: int com.dmdirc.addons.osd.OsdWindow.getYPosition(OsdPlugin)
    }
    
    /**
     * Closes all open OSD windows.
     */
    protected static void closeAll() {
        for (OsdWindow window : new ArrayList<OsdWindow>(windows)) {
    //#OsdWindow.java:200: method: void com.dmdirc.addons.osd.OsdWindow.closeAll()
    //#input(void closeAll()): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow]
    //#input(void closeAll()): __Descendant_Table[others]
    //#input(void closeAll()): windows
    //#pre[1] (void closeAll()): (soft) windows != null
    //#presumption(void closeAll()): java.util.ArrayList:iterator(...)@200 != null
    //#presumption(void closeAll()): java.util.Iterator:next(...).__Tag@200 == com/dmdirc/addons/osd/OsdWindow
    //#presumption(void closeAll()): java.util.Iterator:next(...)@200 != null
    //#unanalyzed(void closeAll()): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(void closeAll()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void closeAll()): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(void closeAll()): Effects-of-calling:javax.swing.JDialog:dispose
    //#unanalyzed(void closeAll()): Effects-of-calling:java.util.List:remove
    //#test_vector(void closeAll()): java.util.Iterator:hasNext(...)@200: {0}, {1}
            window.setVisible(false);
            window.dispose();
        }        
    }
    //#OsdWindow.java:204: end of method: void com.dmdirc.addons.osd.OsdWindow.closeAll()
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseClicked(final MouseEvent e) {
        if (!config) {
    //#OsdWindow.java:213: method: void com.dmdirc.addons.osd.OsdWindow.mouseClicked(MouseEvent)
    //#input(void mouseClicked(MouseEvent)): this
    //#input(void mouseClicked(MouseEvent)): this.config
    //#input(void mouseClicked(MouseEvent)): windows
    //#pre[3] (void mouseClicked(MouseEvent)): (soft) windows != null
    //#unanalyzed(void mouseClicked(MouseEvent)): Effects-of-calling:javax.swing.JDialog:setVisible
    //#unanalyzed(void mouseClicked(MouseEvent)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void mouseClicked(MouseEvent)): Effects-of-calling:com.dmdirc.addons.osd.OsdWindow:transferFocusBackward
    //#unanalyzed(void mouseClicked(MouseEvent)): Effects-of-calling:javax.swing.JDialog:dispose
    //#unanalyzed(void mouseClicked(MouseEvent)): Effects-of-calling:java.util.List:remove
    //#test_vector(void mouseClicked(MouseEvent)): this.config: {1}, {0}
            setVisible(false);
            dispose();
        }
    }
    //#OsdWindow.java:217: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseClicked(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mousePressed(final MouseEvent e) {
        if (config) {
    //#OsdWindow.java:226: method: void com.dmdirc.addons.osd.OsdWindow.mousePressed(MouseEvent)
    //#input(void mousePressed(MouseEvent)): e
    //#input(void mousePressed(MouseEvent)): this
    //#input(void mousePressed(MouseEvent)): this.config
    //#output(void mousePressed(MouseEvent)): this.startX
    //#output(void mousePressed(MouseEvent)): this.startY
    //#pre[1] (void mousePressed(MouseEvent)): (soft) e != null
    //#presumption(void mousePressed(MouseEvent)): java.awt.event.MouseEvent:getPoint(...)@227 != null
    //#presumption(void mousePressed(MouseEvent)): java.awt.event.MouseEvent:getPoint(...)@228 != null
    //#post(void mousePressed(MouseEvent)): possibly_updated(this.startX)
    //#post(void mousePressed(MouseEvent)): possibly_updated(this.startY)
    //#test_vector(void mousePressed(MouseEvent)): this.config: {0}, {1}
            startX = e.getPoint().x;
            startY = e.getPoint().y;
        }
    }
    //#OsdWindow.java:230: end of method: void com.dmdirc.addons.osd.OsdWindow.mousePressed(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseReleased(final MouseEvent e) {
        // Do nothing
    }
    //#OsdWindow.java:240: method: void com.dmdirc.addons.osd.OsdWindow.mouseReleased(MouseEvent)
    //#OsdWindow.java:240: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseReleased(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseEntered(final MouseEvent e) {
        // Do nothing
    }
    //#OsdWindow.java:250: method: void com.dmdirc.addons.osd.OsdWindow.mouseEntered(MouseEvent)
    //#OsdWindow.java:250: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseEntered(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseExited(final MouseEvent e) {
        // Do nothing
    }
    //#OsdWindow.java:260: method: void com.dmdirc.addons.osd.OsdWindow.mouseExited(MouseEvent)
    //#OsdWindow.java:260: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseExited(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseDragged(final MouseEvent e) {
        final Point p = e.getLocationOnScreen();
    //#OsdWindow.java:269: method: void com.dmdirc.addons.osd.OsdWindow.mouseDragged(MouseEvent)
    //#input(void mouseDragged(MouseEvent)): e
    //#input(void mouseDragged(MouseEvent)): this
    //#input(void mouseDragged(MouseEvent)): this.startX
    //#input(void mouseDragged(MouseEvent)): this.startY
    //#pre[1] (void mouseDragged(MouseEvent)): e != null
    //#pre[3] (void mouseDragged(MouseEvent)): this.startX <= 2_147_483_648
    //#pre[4] (void mouseDragged(MouseEvent)): this.startY <= 2_147_483_648
    //#presumption(void mouseDragged(MouseEvent)): java.awt.event.MouseEvent:getLocationOnScreen(...)@269 != null
        p.translate(-1 * startX, -1 * startY);
        setLocation(p);
    //#OsdWindow.java:271: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:setLocation(Point)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void mouseDragged(MouseEvent)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:setLocation(Point)
    }
    //#OsdWindow.java:272: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseDragged(MouseEvent)
    
    /** 
     * {@inheritDoc}
     * 
     * @param e Mouse event
     */
    @Override
    public void mouseMoved(final MouseEvent e) {
        // Do nothing
    }
    //#OsdWindow.java:282: method: void com.dmdirc.addons.osd.OsdWindow.mouseMoved(MouseEvent)
    //#OsdWindow.java:282: end of method: void com.dmdirc.addons.osd.OsdWindow.mouseMoved(MouseEvent)
    
    /**
     * Sets the font size that this OSD uses.
     * 
     * @param size The new size of the font
     */
    public void setFontSize(final int size) {
        label.setFont(label.getFont().deriveFont((float) size));
    //#OsdWindow.java:290: method: void com.dmdirc.addons.osd.OsdWindow.setFontSize(int)
    //#input(void setFontSize(int)): size
    //#input(void setFontSize(int)): this
    //#input(void setFontSize(int)): this.label
    //#pre[4] (void setFontSize(int)): this.label != null
    //#presumption(void setFontSize(int)): javax.swing.JLabel:getFont(...)@290 != null
    }
    //#OsdWindow.java:291: end of method: void com.dmdirc.addons.osd.OsdWindow.setFontSize(int)

    /**
     * Sets the background colour for this OSD.
     * 
     * @param colour The background colour to use
     */
    public void setBackgroundColour(final String colour) {
        panel.setBackground(ColourManager.parseColour(colour));
    //#OsdWindow.java:299: method: void com.dmdirc.addons.osd.OsdWindow.setBackgroundColour(String)
    //#OsdWindow.java:299: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void setBackgroundColour(String)
    //#    unanalyzed callee: Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
    //#input(void setBackgroundColour(String)): colour
    //#input(void setBackgroundColour(String)): this
    //#input(void setBackgroundColour(String)): this.panel
    //#pre[3] (void setBackgroundColour(String)): this.panel != null
    }
    //#OsdWindow.java:300: end of method: void com.dmdirc.addons.osd.OsdWindow.setBackgroundColour(String)

    /**
     * Sets the foreground colour for this OSD.
     * 
     * @param colour The foreground colour to use
     */
    public void setForegroundColour(final String colour) {
        label.setForeground(ColourManager.parseColour(colour));
    //#OsdWindow.java:308: method: void com.dmdirc.addons.osd.OsdWindow.setForegroundColour(String)
    //#OsdWindow.java:308: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void setForegroundColour(String)
    //#    unanalyzed callee: Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
    //#input(void setForegroundColour(String)): colour
    //#input(void setForegroundColour(String)): this
    //#input(void setForegroundColour(String)): this.label
    //#pre[3] (void setForegroundColour(String)): this.label != null
    }
    //#OsdWindow.java:309: end of method: void com.dmdirc.addons.osd.OsdWindow.setForegroundColour(String)

    /** {@inheritDoc} */
    @Override
    public void setVisible(final boolean b) {
        super.setVisible(b);
    //#OsdWindow.java:314: method: void com.dmdirc.addons.osd.OsdWindow.setVisible(bool)
    //#input(void setVisible(bool)): b
    //#input(void setVisible(bool)): this
    //#input(void setVisible(bool)): windows
    //#pre[3] (void setVisible(bool)): (soft) windows != null
    //#test_vector(void setVisible(bool)): b: {0}, {1}
        
        if (b) {
            windows.add(this);
            transferFocusBackward();
    //#OsdWindow.java:318: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.osd.OsdWindow:transferFocusBackward()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.osd.OsdWindow
    //#    method: void setVisible(bool)
    //#    unanalyzed callee: void com.dmdirc.addons.osd.OsdWindow:transferFocusBackward()
        }
    }
    //#OsdWindow.java:320: end of method: void com.dmdirc.addons.osd.OsdWindow.setVisible(bool)

    /** {@inheritDoc} */
    @Override
    public void dispose() {
        super.dispose();
    //#OsdWindow.java:325: method: void com.dmdirc.addons.osd.OsdWindow.dispose()
    //#input(void dispose()): this
    //#input(void dispose()): windows
    //#pre[2] (void dispose()): windows != null
        
        windows.remove(this);
    }
    //#OsdWindow.java:328: end of method: void com.dmdirc.addons.osd.OsdWindow.dispose()
}
    //#output(com.dmdirc.addons.osd.OsdWindow$1__static_init): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow$1]
    //#output(com.dmdirc.addons.osd.OsdWindow$1__static_init): __Dispatch_Table.run()V
    //#post(com.dmdirc.addons.osd.OsdWindow$1__static_init): __Descendant_Table[com/dmdirc/addons/osd/OsdWindow$1] == &__Dispatch_Table
    //#post(com.dmdirc.addons.osd.OsdWindow$1__static_init): __Dispatch_Table.run()V == &run
    //#OsdWindow.java:: end of method: com.dmdirc.addons.osd.OsdWindow$1.com.dmdirc.addons.osd.OsdWindow$1__static_init
    //#OsdWindow.java:: end of class: com.dmdirc.addons.osd.OsdWindow$1
    //#OsdWindow.java:: end of class: com.dmdirc.addons.osd.OsdWindow
