//# 0 errors, 413 messages
//#
/*
    //#OptionalColourChooser.java:1:1: class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#OptionalColourChooser.java:1:1: method: com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init
 * 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.ui_swing.components;

import com.dmdirc.ui.messages.ColourManager;
import com.dmdirc.util.ListenerList;
import com.dmdirc.addons.ui_swing.UIUtilities;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;

import net.miginfocom.swing.MigLayout;

/**
 * Colour chooser widget.
 */
public final class OptionalColourChooser extends JPanel implements ActionListener {

    /**
     * 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 = 1;
    /** Enabled checkbox. */
    private JCheckBox enabled;
    /** Edit button. */
    private JButton editButton;
    /** Panel to show the colour preview. */
    private JPanel previewPanel;
    /** Colours picking dialog. */
    private ColourPickerDialog cpd;
    /** show irc colours. */
    private boolean showIRC;
    /** show hex colours. */
    private boolean showHex;
    /** The value of this component. */
    private String value;
    /** Our listeners. */
    private final ListenerList listeners = new ListenerList();
    //#OptionalColourChooser.java:69: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.ListenerList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void com.dmdirc.util.ListenerList()
    /** Parent window. */
    private Window window;

    /** Creates a new instance of ColourChooser. */
    public OptionalColourChooser() {
        this("", false, true, true);
    //#OptionalColourChooser.java:75: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser()
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): java.awt.Color.DARK_GRAY
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JButton(OptionalColourChooser#2) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JCheckBox(OptionalColourChooser#7) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JPanel(OptionalColourChooser#5) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new ListenerList(OptionalColourChooser#1) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.editButton
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.enabled
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.listeners
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.previewPanel
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.showHex
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.showIRC
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.value
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.window
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JButton(OptionalColourChooser#2)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JCheckBox(OptionalColourChooser#7)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JPanel(OptionalColourChooser#5)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.editButton == &new JButton(OptionalColourChooser#2)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.enabled == &new JCheckBox(OptionalColourChooser#7)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.listeners == &new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.previewPanel == &new JPanel(OptionalColourChooser#5)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.showHex == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.showIRC == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JButton(OptionalColourChooser#2) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JCheckBox(OptionalColourChooser#7) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new JPanel(OptionalColourChooser#5) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): new ListenerList(OptionalColourChooser#1) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.value == &""
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): this.window == null
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JPanel:setToolTipText
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:parseColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:com.dmdirc.util.ListenerList
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JButton
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:isWindowsUI
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.awt.Insets
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JButton:setMargin
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JButton:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JButton:setEnabled
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.awt.Dimension
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JPanel:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.BorderFactory:createLineBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JPanel:setBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JCheckBox
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JCheckBox:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JCheckBox:setSelected
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.JCheckBox:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:setLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:javax.swing.UIManager:getLookAndFeel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.lang.Class:getName
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser()): Effects-of-calling:java.lang.String:equals
    }
    //#OptionalColourChooser.java:76: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser()
    
    /** 
     * Creates a new instance of ColourChooser.
     * 
     * @param window Parent window
     * 
     * @since 0.6
     */
    public OptionalColourChooser(final Window window) {
        this("", false, true, true, window);
    //#OptionalColourChooser.java:86: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): java.awt.Color.DARK_GRAY
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): window
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JButton(OptionalColourChooser#2) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JCheckBox(OptionalColourChooser#7) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JPanel(OptionalColourChooser#5) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new ListenerList(OptionalColourChooser#1) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.editButton
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.enabled
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.listeners
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.previewPanel
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.showHex
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.showIRC
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.value
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.window
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JButton(OptionalColourChooser#2)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JCheckBox(OptionalColourChooser#7)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JPanel(OptionalColourChooser#5)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.editButton == &new JButton(OptionalColourChooser#2)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.enabled == &new JCheckBox(OptionalColourChooser#7)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.listeners == &new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.previewPanel == &new JPanel(OptionalColourChooser#5)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.showHex == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.showIRC == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JButton(OptionalColourChooser#2) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JCheckBox(OptionalColourChooser#7) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new JPanel(OptionalColourChooser#5) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): new ListenerList(OptionalColourChooser#1) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.value == &""
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): this.window == window
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): init'ed(this.window)
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JPanel:setToolTipText
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:parseColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:com.dmdirc.util.ListenerList
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JButton
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:isWindowsUI
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.awt.Insets
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JButton:setMargin
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JButton:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JButton:setEnabled
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.awt.Dimension
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JPanel:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.BorderFactory:createLineBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JPanel:setBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JCheckBox
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JCheckBox:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JCheckBox:setSelected
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.JCheckBox:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:setLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:javax.swing.UIManager:getLookAndFeel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.lang.Class:getName
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)): Effects-of-calling:java.lang.String:equals
    }
    //#OptionalColourChooser.java:87: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(Window)
    
    /**
     * Creates a new instance of ColourChooser.
     * 
     * @param initialColour Snitial colour
     * @param initialState Initial state
     * @param ircColours Show irc colours
     * @param hexColours Show hex colours
     */
    public OptionalColourChooser(final String initialColour,
            final boolean initialState, final boolean ircColours,
            final boolean hexColours) {
        this(initialColour, initialState, ircColours, hexColours, null);
    //#OptionalColourChooser.java:100: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): hexColours
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): initialColour
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): initialState
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): ircColours
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): java.awt.Color.DARK_GRAY
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JButton(OptionalColourChooser#2) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JCheckBox(OptionalColourChooser#7) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JPanel(OptionalColourChooser#5) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new ListenerList(OptionalColourChooser#1) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.editButton
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.enabled
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.listeners
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.previewPanel
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.showHex
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.showIRC
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.value
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.window
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JButton(OptionalColourChooser#2)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JCheckBox(OptionalColourChooser#7)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JPanel(OptionalColourChooser#5)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new ListenerList(OptionalColourChooser#1)
    //#pre[2] (void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): initialColour != null
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.editButton == &new JButton(OptionalColourChooser#2)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.enabled == &new JCheckBox(OptionalColourChooser#7)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.listeners == &new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.previewPanel == &new JPanel(OptionalColourChooser#5)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.showHex == hexColours
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): init'ed(this.showHex)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.showIRC == ircColours
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): init'ed(this.showIRC)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.value == initialColour
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.value != null
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): this.window == null
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JButton(OptionalColourChooser#2) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JCheckBox(OptionalColourChooser#7) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new JPanel(OptionalColourChooser#5) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): new ListenerList(OptionalColourChooser#1) num objects == 1
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JPanel:setToolTipText
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:parseColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:com.dmdirc.util.ListenerList
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JButton
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:isWindowsUI
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.awt.Insets
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JButton:setMargin
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JButton:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JButton:setEnabled
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.awt.Dimension
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JPanel:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.BorderFactory:createLineBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JPanel:setBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JCheckBox
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JCheckBox:setPreferredSize
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JCheckBox:setSelected
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.JCheckBox:addActionListener
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:setLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:javax.swing.UIManager:getLookAndFeel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.lang.Class:getName
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)): Effects-of-calling:java.lang.String:equals
    }
    //#OptionalColourChooser.java:101: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool)

    /**
     * Creates a new instance of ColourChooser.
     * 
     * @param initialColour Snitial colour
     * @param initialState Initial state
     * @param ircColours Show irc colours
     * @param hexColours Show hex colours
     * @param window Parent window
     * 
     * @since 0.6
     */
    public OptionalColourChooser(final String initialColour,
            final boolean initialState, final boolean ircColours,
            final boolean hexColours, final Window window) {
        super();
    //#OptionalColourChooser.java:117: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): hexColours
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): initialColour
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): initialState
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): ircColours
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): java.awt.Color.DARK_GRAY
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this
    //#input(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): window
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JButton(OptionalColourChooser#2) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JCheckBox(OptionalColourChooser#7) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JPanel(OptionalColourChooser#5) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new ListenerList(OptionalColourChooser#1) num objects
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.editButton
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.enabled
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.listeners
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.previewPanel
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.showHex
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.showIRC
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.value
    //#output(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.window
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JButton(OptionalColourChooser#2)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JCheckBox(OptionalColourChooser#7)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JPanel(OptionalColourChooser#5)
    //#new obj(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new ListenerList(OptionalColourChooser#1)
    //#pre[2] (void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): initialColour != null
    //#presumption(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): init'ed(java.awt.Color.DARK_GRAY)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.editButton == &new JButton(OptionalColourChooser#2)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.enabled == &new JCheckBox(OptionalColourChooser#7)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.listeners == &new ListenerList(OptionalColourChooser#1)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.previewPanel == &new JPanel(OptionalColourChooser#5)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.showHex == hexColours
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): init'ed(this.showHex)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.showIRC == ircColours
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): init'ed(this.showIRC)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.value == initialColour
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.value != null
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): this.window == window
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): init'ed(this.window)
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JButton(OptionalColourChooser#2) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JCheckBox(OptionalColourChooser#7) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new JPanel(OptionalColourChooser#5) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): new ListenerList(OptionalColourChooser#1) num objects == 1
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:javax.swing.JPanel:setToolTipText
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:parseColour
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:javax.swing.UIManager:getLookAndFeel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:java.lang.Class:getName
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): Effects-of-calling:java.lang.String:equals
    //#test_vector(void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)): initialState: {1}, {0}

        this.window = window;
        showIRC = ircColours;
        showHex = hexColours;
        value = initialColour;

        editButton = new JButton("Edit");
        if (UIUtilities.isWindowsUI()) {
            editButton.setMargin(new Insets(2, 4, 2, 4));
        } else {
            editButton.setMargin(new Insets(0, 2, 0, 2));
        }
        editButton.addActionListener(this);
        if (!initialState) {
            editButton.setEnabled(false);
        }

        previewPanel = new JPanel();
        previewPanel.setPreferredSize(new Dimension(40, 10));
        previewPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));

        enabled = new JCheckBox();
        enabled.setPreferredSize(new Dimension(40, 40));
        enabled.setSelected(initialState);
        enabled.addActionListener(this);

        setLayout(new MigLayout("fill, ins 0"));
    //#OptionalColourChooser.java:144: Warning: method not available - call not analyzed
    //#    call on void net.miginfocom.swing.MigLayout(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void net.miginfocom.swing.MigLayout(String)
    //#OptionalColourChooser.java:144: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:setLayout(LayoutManager)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:setLayout(LayoutManager)

        add(enabled, "sgy all");
    //#OptionalColourChooser.java:146: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)
        add(previewPanel, "growx, pushx, sgy all");
    //#OptionalColourChooser.java:147: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)
        add(editButton, "sgy all");
    //#OptionalColourChooser.java:148: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser:add(Component, Object)

        updateColour(initialColour);
    }
    //#OptionalColourChooser.java:151: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser(String, bool, bool, bool, Window)

    /** Sets the colour back to white. */
    public void clearColour() {
        value = "ffffff";
    //#OptionalColourChooser.java:155: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.clearColour()
    //#input(void clearColour()): this
    //#input(void clearColour()): this.previewPanel
    //#output(void clearColour()): this.value
    //#pre[2] (void clearColour()): this.previewPanel != null
    //#post(void clearColour()): this.value == &"ffffff"
        previewPanel.setBackground(ColourManager.getColour("ffffff"));
    //#OptionalColourChooser.java:156: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.ui.messages.ColourManager:getColour(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void clearColour()
    //#    unanalyzed callee: Color com.dmdirc.ui.messages.ColourManager:getColour(String)
        previewPanel.setToolTipText("");
    }
    //#OptionalColourChooser.java:158: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.clearColour()

    /** {@inheritDoc} */
    @Override
    public boolean isEnabled() {
        return enabled.isSelected();
    //#OptionalColourChooser.java:163: method: bool com.dmdirc.addons.ui_swing.components.OptionalColourChooser.isEnabled()
    //#input(bool isEnabled()): this
    //#input(bool isEnabled()): this.enabled
    //#output(bool isEnabled()): return_value
    //#pre[2] (bool isEnabled()): this.enabled != null
    //#post(bool isEnabled()): init'ed(return_value)
    //#OptionalColourChooser.java:163: end of method: bool com.dmdirc.addons.ui_swing.components.OptionalColourChooser.isEnabled()
    }

    /**
     * Returns the selected colour from this component.
     *
     * @return This components colour, as a string
     */
    public String getColour() {
        return value;
    //#OptionalColourChooser.java:172: method: String com.dmdirc.addons.ui_swing.components.OptionalColourChooser.getColour()
    //#input(String getColour()): this
    //#input(String getColour()): this.value
    //#output(String getColour()): return_value
    //#pre[2] (String getColour()): init'ed(this.value)
    //#post(String getColour()): return_value == this.value
    //#post(String getColour()): init'ed(return_value)
    //#OptionalColourChooser.java:172: end of method: String com.dmdirc.addons.ui_swing.components.OptionalColourChooser.getColour()
    }

    /**
     * Updates the colour panel.
     * @param newColour The new colour to use.
     */
    private void updateColour(final String newColour) {
        if (newColour.isEmpty()) {
    //#OptionalColourChooser.java:180: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.updateColour(String)
    //#input(void updateColour(String)): newColour
    //#input(void updateColour(String)): this
    //#input(void updateColour(String)): this.previewPanel
    //#pre[1] (void updateColour(String)): newColour != null
    //#pre[3] (void updateColour(String)): this.previewPanel != null
    //#test_vector(void updateColour(String)): java.lang.String:isEmpty(...)@180: {0}, {1}
            previewPanel.setBackground(ColourManager.getColour("ffffff"));
    //#OptionalColourChooser.java:181: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.ui.messages.ColourManager:getColour(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void updateColour(String)
    //#    unanalyzed callee: Color com.dmdirc.ui.messages.ColourManager:getColour(String)
            previewPanel.setToolTipText("");
        } else {
            previewPanel.setBackground(ColourManager.parseColour(newColour));
    //#OptionalColourChooser.java:184: Warning: method not available - call not analyzed
    //#    call on Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void updateColour(String)
    //#    unanalyzed callee: Color com.dmdirc.ui.messages.ColourManager:parseColour(String)
            previewPanel.setToolTipText(newColour);
        }
    }
    //#OptionalColourChooser.java:187: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.updateColour(String)

    /** 
     * {@inheritDoc}.
     * 
     * @param e Action event
     */
    @Override
    public void actionPerformed(final ActionEvent e) {
        if (e.getSource() == editButton) {
    //#OptionalColourChooser.java:196: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.actionPerformed(ActionEvent)
    //#input(void actionPerformed(ActionEvent)): com/dmdirc/addons/ui_swing/components/ColourPickerDialog.java.awt.Dialog$ModalityType.MODELESS
    //#input(void actionPerformed(ActionEvent)): e
    //#input(void actionPerformed(ActionEvent)): this
    //#input(void actionPerformed(ActionEvent)): this.cpd
    //#input(void actionPerformed(ActionEvent)): this.cpd.colourChooser.listeners
    //#input(void actionPerformed(ActionEvent)): this.editButton
    //#input(void actionPerformed(ActionEvent)): this.enabled
    //#input(void actionPerformed(ActionEvent)): this.listeners
    //#input(void actionPerformed(ActionEvent)): this.previewPanel
    //#input(void actionPerformed(ActionEvent)): this.showHex
    //#input(void actionPerformed(ActionEvent)): this.showIRC
    //#input(void actionPerformed(ActionEvent)): this.window
    //#output(void actionPerformed(ActionEvent)): new ArrayList(ColourPickerPanel#1) num objects
    //#output(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1) num objects
    //#output(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1).__Tag
    //#output(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1).colourChooser
    //#output(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1).window
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1) num objects
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1).__Tag
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1).listeners
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1).saturation
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1).showHex
    //#output(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1).showIrc
    //#output(void actionPerformed(ActionEvent)): this.cpd
    //#output(void actionPerformed(ActionEvent)): this.value
    //#new obj(void actionPerformed(ActionEvent)): new ArrayList(ColourPickerPanel#1)
    //#new obj(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1)
    //#new obj(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1)
    //#pre[1] (void actionPerformed(ActionEvent)): e != null
    //#pre[2] (void actionPerformed(ActionEvent)): (soft) this.cpd != null
    //#pre[7] (void actionPerformed(ActionEvent)): (soft) this.editButton != null
    //#pre[8] (void actionPerformed(ActionEvent)): (soft) this.enabled != null
    //#pre[9] (void actionPerformed(ActionEvent)): (soft) this.listeners != null
    //#pre[10] (void actionPerformed(ActionEvent)): (soft) this.previewPanel != null
    //#pre[11] (void actionPerformed(ActionEvent)): (soft) init'ed(this.showHex)
    //#pre[12] (void actionPerformed(ActionEvent)): (soft) init'ed(this.showIRC)
    //#pre[13] (void actionPerformed(ActionEvent)): (soft) init'ed(this.window)
    //#presumption(void actionPerformed(ActionEvent)): java.awt.event.ActionEvent:getActionCommand(...)@206 != null
    //#post(void actionPerformed(ActionEvent)): this.cpd == One-of{&new ColourPickerDialog(actionPerformed#1), old this.cpd}
    //#post(void actionPerformed(ActionEvent)): this.cpd != null
    //#post(void actionPerformed(ActionEvent)): possibly_updated(this.value)
    //#post(void actionPerformed(ActionEvent)): new ArrayList(ColourPickerPanel#1) num objects <= 1
    //#post(void actionPerformed(ActionEvent)): new ColourPickerDialog(actionPerformed#1) num objects <= 1
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerDialog(actionPerformed#1).__Tag)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerDialog(actionPerformed#1).colourChooser)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerDialog(actionPerformed#1).window)
    //#post(void actionPerformed(ActionEvent)): new ColourPickerPanel(ColourPickerDialog#1) num objects <= 1
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerPanel(ColourPickerDialog#1).__Tag)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerPanel(ColourPickerDialog#1).listeners)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerPanel(ColourPickerDialog#1).saturation)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerPanel(ColourPickerDialog#1).showHex)
    //#post(void actionPerformed(ActionEvent)): init'ed(new ColourPickerPanel(ColourPickerDialog#1).showIrc)
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:getColour
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JPanel:setBackground
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JPanel:setToolTipText
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.ui.messages.ColourManager:parseColour
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.util.ListenerList:get
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.event.ActionEvent
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.event.ActionListener:actionPerformed
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.event.WindowAdapter
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.Window:addWindowListener
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.StandardDialog:setIconImages
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JDialog
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.Window:getIconImages
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.awt.Dimension
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerPanel:setPreferredSize
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerPanel:addMouseListener
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerPanel:addMouseMotionListener
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerPanel:addMouseWheelListener
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setDefaultCloseOperation
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerDialog:add
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerDialog:pack
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setResizable
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setFocusableWindowState
    //#unanalyzed(void actionPerformed(ActionEvent)): Effects-of-calling:java.util.List:add
            cpd = new ColourPickerDialog(showIRC, showHex, window);
            cpd.setLocationRelativeTo(editButton);
    //#OptionalColourChooser.java:198: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setLocationRelativeTo(Component)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void actionPerformed(ActionEvent)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setLocationRelativeTo(Component)
            cpd.addActionListener(this);
            cpd.setVisible(true);
    //#OptionalColourChooser.java:200: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setVisible(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void actionPerformed(ActionEvent)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:setVisible(bool)
        } else if (e.getSource() == enabled) {
            editButton.setEnabled(enabled.isSelected());
            fireActionEvent();
        } else {
            value = e.getActionCommand();
            updateColour(e.getActionCommand());
            fireActionEvent();
            cpd.dispose();
    //#OptionalColourChooser.java:208: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:dispose()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void actionPerformed(ActionEvent)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.ColourPickerDialog:dispose()
        }
    }
    //#OptionalColourChooser.java:210: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.actionPerformed(ActionEvent)

    /**
     * Adds an action listener to this optional colour chooser. Action
     * listeners are notified whenever the state changes in some way.
     * 
     * @param l The listener to be added
     */
    public void addActionListener(final ActionListener l) {
        listeners.add(ActionListener.class, l);
    //#OptionalColourChooser.java:219: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.addActionListener(ActionListener)
    //#OptionalColourChooser.java:219: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.ListenerList:add(Class, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void addActionListener(ActionListener)
    //#    unanalyzed callee: void com.dmdirc.util.ListenerList:add(Class, Object)
    //#input(void addActionListener(ActionListener)): l
    //#input(void addActionListener(ActionListener)): this
    //#input(void addActionListener(ActionListener)): this.listeners
    //#pre[3] (void addActionListener(ActionListener)): this.listeners != null
    }
    //#OptionalColourChooser.java:220: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.addActionListener(ActionListener)

    /**
     * Informs all action listeners that an action has occured.
     */
    protected void fireActionEvent() {
        for (ActionListener listener : listeners.get(ActionListener.class)) {
    //#OptionalColourChooser.java:226: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.fireActionEvent()
    //#OptionalColourChooser.java:226: Warning: method not available - call not analyzed
    //#    call on List com.dmdirc.util.ListenerList:get(Class)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
    //#    method: void fireActionEvent()
    //#    unanalyzed callee: List com.dmdirc.util.ListenerList:get(Class)
    //#input(void fireActionEvent()): this
    //#input(void fireActionEvent()): this.listeners
    //#pre[2] (void fireActionEvent()): this.listeners != null
    //#presumption(void fireActionEvent()): com.dmdirc.util.ListenerList:get(...)@226 != null
    //#presumption(void fireActionEvent()): java.util.Iterator:next(...)@226 != null
    //#test_vector(void fireActionEvent()): java.util.Iterator:hasNext(...)@226: {0}, {1}
            listener.actionPerformed(new ActionEvent(this, 1, "stuffChanged"));
        }
    }
    //#OptionalColourChooser.java:229: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.fireActionEvent()
    
    /**
     * Sets the Parent window.
     * 
     * @param window Parent window
     */
    public void setWindow(final Window window) {
        this.window = window;
    //#OptionalColourChooser.java:237: method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.setWindow(Window)
    //#input(void setWindow(Window)): this
    //#input(void setWindow(Window)): window
    //#output(void setWindow(Window)): this.window
    //#post(void setWindow(Window)): this.window == window
    //#post(void setWindow(Window)): init'ed(this.window)
    }
    //#OptionalColourChooser.java:238: end of method: void com.dmdirc.addons.ui_swing.components.OptionalColourChooser.setWindow(Window)
}
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/OptionalColourChooser]
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.addActionListener(Ljava/awt/event/ActionListener;)V
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.clearColour()V
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.fireActionEvent()V
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.getColour()Ljava/lang/String;
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.isEnabled()Z
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.setWindow(Ljava/awt/Window;)V
    //#output(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.updateColour(Ljava/lang/String;)V
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/OptionalColourChooser] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.actionPerformed(Ljava/awt/event/ActionEvent;)V == &actionPerformed
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.addActionListener(Ljava/awt/event/ActionListener;)V == &addActionListener
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.clearColour()V == &clearColour
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.fireActionEvent()V == &fireActionEvent
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.getColour()Ljava/lang/String; == &getColour
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.isEnabled()Z == &isEnabled
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.setWindow(Ljava/awt/Window;)V == &setWindow
    //#post(com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init): __Dispatch_Table.updateColour(Ljava/lang/String;)V == &updateColour
    //#OptionalColourChooser.java:: end of method: com.dmdirc.addons.ui_swing.components.OptionalColourChooser.com.dmdirc.addons.ui_swing.components.OptionalColourChooser__static_init
    //#OptionalColourChooser.java:: end of class: com.dmdirc.addons.ui_swing.components.OptionalColourChooser
