//# 0 errors, 74 messages
//#
/*
    //#TopicCellRenderer.java:1:1: class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#TopicCellRenderer.java:1:1: method: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__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.renderers;

import com.dmdirc.Topic;
import com.dmdirc.addons.ui_swing.components.text.TextLabel;

import java.awt.Component;
import java.awt.Dimension;
import java.util.Date;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.ListCellRenderer;

import net.miginfocom.swing.MigLayout;

/**
 * Topic list cell renderer.
 */
public class TopicCellRenderer extends JPanel implements ListCellRenderer {
    //#TopicCellRenderer.java:43: method: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer()
    //#input(void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer()): this
    //#TopicCellRenderer.java:43: end of method: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer()

    /**
     * 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;

    /** {@inheritDoc} */
    @Override
    public Component getListCellRendererComponent(final JList list,
            final Object value, final int index,
            final boolean isSelected, final boolean cellHasFocus) {
        removeAll();
    //#TopicCellRenderer.java:57: method: Component com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.getListCellRendererComponent(JList, Object, int, bool, bool)
    //#TopicCellRenderer.java:57: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:removeAll()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:removeAll()
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): "; "._tainted
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): "body { font-family: "._tainted
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): "font-size: "._tainted
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): "pt; }"._tainted
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com/dmdirc/addons/ui_swing/components/text/TextLabel.__Descendant_Table[com/dmdirc/addons/ui_swing/components/text/TextLabel]
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com/dmdirc/addons/ui_swing/components/text/TextLabel.__Descendant_Table[others]
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com/dmdirc/addons/ui_swing/components/text/TextLabel.__Dispatch_Table.getDocument()Ljavax/swing/text/StyledDocument;
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com/dmdirc/addons/ui_swing/components/text/TextLabel.__Dispatch_Table.setText(Ljava/lang/String;)V
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): isSelected
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): list
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): this
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): value
    //#input(Component getListCellRendererComponent(JList, Object, int, bool, bool)): value._tainted
    //#output(Component getListCellRendererComponent(JList, Object, int, bool, bool)): return_value
    //#pre[2] (Component getListCellRendererComponent(JList, Object, int, bool, bool)): list != null
    //#pre[4] (Component getListCellRendererComponent(JList, Object, int, bool, bool)): value != null
    //#presumption(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com.dmdirc.Topic:getTime(...)@72 in {-9_223_372_036_854_775..18_446_744_073_709_551}
    //#post(Component getListCellRendererComponent(JList, Object, int, bool, bool)): return_value == this
    //#post(Component getListCellRendererComponent(JList, Object, int, bool, bool)): return_value != null
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.JTextPane:getDocument
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.JTextPane:setText
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.lang.String:isEmpty
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.StyledDocument:setParagraphAttributes
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.DefaultStyledDocument
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.JTextPane
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.html.HTMLEditorKit
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setEditorKit
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.plaf.basic.BasicTextPaneUI
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setUI
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.UIManager:getFont
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.html.HTMLDocument:getStyleSheet
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.awt.Font:getFamily
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.awt.Font:getSize
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.html.StyleSheet:addRule
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setOpaque
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setEditable
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setHighlighter
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:java.awt.Insets
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.text.TextLabel:setMargin
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet
    //#unanalyzed(Component getListCellRendererComponent(JList, Object, int, bool, bool)): Effects-of-calling:javax.swing.text.StyleConstants:setAlignment
    //#test_vector(Component getListCellRendererComponent(JList, Object, int, bool, bool)): isSelected: {0}, {1}
    //#test_vector(Component getListCellRendererComponent(JList, Object, int, bool, bool)): com.dmdirc.Topic:instanceof(...)@66: {0}, {1}
        setLayout(new MigLayout("ins 0, wrap 1"));
    //#TopicCellRenderer.java:58: Warning: method not available - call not analyzed
    //#    call on void net.miginfocom.swing.MigLayout(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void net.miginfocom.swing.MigLayout(String)
    //#TopicCellRenderer.java:58: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setLayout(LayoutManager)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setLayout(LayoutManager)

        if (isSelected) {
            setBackground(list.getSelectionBackground());
    //#TopicCellRenderer.java:61: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setBackground(Color)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setBackground(Color)
        } else {
            setBackground(list.getBackground());
    //#TopicCellRenderer.java:63: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setBackground(Color)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:setBackground(Color)
        }

        if (value instanceof Topic) {
            final Topic topic = (Topic) value;

            final TextLabel label = new TextLabel(topic.getTopic());
    //#TopicCellRenderer.java:69: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.Topic:getTopic()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: String com.dmdirc.Topic:getTopic()
            label.setMaximumSize(new Dimension(list.getWidth(), 0));
    //#TopicCellRenderer.java:70: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.text.TextLabel:setMaximumSize(Dimension)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.text.TextLabel:setMaximumSize(Dimension)
            add(label, "growx, pushx");
    //#TopicCellRenderer.java:71: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
            add(new JLabel(new Date(topic.getTime() * 1000).toString()),
    //#TopicCellRenderer.java:72: Warning: method not available - call not analyzed
    //#    call on long com.dmdirc.Topic:getTime()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: long com.dmdirc.Topic:getTime()
    //#TopicCellRenderer.java:72: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
                    "split 2");
            add(new JLabel(topic.getClient()), "growx, pushx");
    //#TopicCellRenderer.java:74: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.Topic:getClient()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: String com.dmdirc.Topic:getClient()
    //#TopicCellRenderer.java:74: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
        } else {
            add(new JLabel(value.toString()), "grow, push");
    //#TopicCellRenderer.java:76: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
        }
        add(new JSeparator(), "growx, pushx");
    //#TopicCellRenderer.java:78: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
    //#    method: Component getListCellRendererComponent(JList, Object, int, bool, bool)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer:add(Component, Object)
        return this;
    //#TopicCellRenderer.java:79: end of method: Component com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.getListCellRendererComponent(JList, Object, int, bool, bool)
    }
}
    //#output(com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/renderers/TopicCellRenderer]
    //#output(com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__static_init): __Dispatch_Table.getListCellRendererComponent(Ljavax/swing/JList;Ljava/lang/Object;IZZ)Ljava/awt/Component;
    //#post(com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/renderers/TopicCellRenderer] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__static_init): __Dispatch_Table.getListCellRendererComponent(Ljavax/swing/JList;Ljava/lang/Object;IZZ)Ljava/awt/Component; == &getListCellRendererComponent
    //#TopicCellRenderer.java:: end of method: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer.com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer__static_init
    //#TopicCellRenderer.java:: end of class: com.dmdirc.addons.ui_swing.components.renderers.TopicCellRenderer
