//# 0 errors, 65 messages
//#
/*
    //#ErrorPopup.java:1:1: class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#ErrorPopup.java:1:1: method: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init
 * Copyright (c) 2006-2008 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.statusbar;

import com.dmdirc.logger.ErrorLevel;
import com.dmdirc.logger.ErrorManager;
import com.dmdirc.logger.ErrorReportStatus;
import com.dmdirc.logger.ProgramError;
import com.dmdirc.util.MapList;

import java.awt.Font;
import java.awt.Window;
import java.util.List;

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

/**
 * Shows a breakdown of errors that have occured.
 *
 * @since 0.6.3m1
 * @author chris
 */
public class ErrorPopup extends StatusbarPopupWindow {

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

    /**
     * Creates a new error popup.
     * 
     * @param parent Parent panel
     * @param parentWindow Parent window
     */
    public ErrorPopup(final JPanel parent, final Window parentWindow) {
        super(parent, parentWindow);
    //#ErrorPopup.java:61: method: void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)
    //#input(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPopupWindow.java.awt.Dialog$ModalityType.MODELESS
    //#input(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): parent
    //#input(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): parentWindow
    //#input(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): this
    //#output(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): this.parent
    //#output(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): this.parentWindow
    //#post(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): this.parent == parent
    //#post(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): init'ed(this.parent)
    //#post(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): this.parentWindow == parentWindow
    //#post(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): init'ed(this.parentWindow)
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.StandardDialog
    //#unanalyzed(void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)): Effects-of-calling:com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupWindow:setDefaultCloseOperation
    }
    //#ErrorPopup.java:62: end of method: void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup(JPanel, Window)

    /** {@inheritDoc} */
    @Override
    protected void initContent(final JPanel panel) {
        final List<ProgramError> errors = ErrorManager.getErrorManager().getErrors();
    //#ErrorPopup.java:67: method: void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.initContent(JPanel)
    //#ErrorPopup.java:67: Warning: method not available - call not analyzed
    //#    call on ErrorManager com.dmdirc.logger.ErrorManager:getErrorManager()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: ErrorManager com.dmdirc.logger.ErrorManager:getErrorManager()
    //#ErrorPopup.java:67: Warning: method not available - call not analyzed
    //#    call on List com.dmdirc.logger.ErrorManager:getErrors()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: List com.dmdirc.logger.ErrorManager:getErrors()
    //#input(void initContent(JPanel)): panel
    //#pre[1] (void initContent(JPanel)): panel != null
    //#presumption(void initContent(JPanel)): arr$.length@104 <= 4_294_967_295
    //#presumption(void initContent(JPanel)): arr$.length@85 <= 4_294_967_295
    //#presumption(void initContent(JPanel)): arr$[i$]@104 != null
    //#presumption(void initContent(JPanel)): arr$[i$]@85 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.logger.ErrorLevel:values(...)@85 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.logger.ErrorManager:getErrorManager(...)@67 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.logger.ErrorManager:getErrors(...)@67 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.logger.ErrorReportStatus:values(...)@104 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.util.MapList:values(...)@106 != null
    //#presumption(void initContent(JPanel)): com.dmdirc.util.MapList:values(...)@87 != null
    //#presumption(void initContent(JPanel)): java.util.Iterator:next(...)@72 != null
    //#presumption(void initContent(JPanel)): javax.swing.JLabel:getFont(...)@101 != null
    //#presumption(void initContent(JPanel)): javax.swing.JLabel:getFont(...)@78 != null
    //#presumption(void initContent(JPanel)): javax.swing.JLabel:getFont(...)@82 != null
    //#presumption(void initContent(JPanel)): javax.swing.JLabel:getFont(...)@97 != null
    //#test_vector(void initContent(JPanel)): com.dmdirc.util.MapList:containsKey(...)@105: {0}, {1}
    //#test_vector(void initContent(JPanel)): com.dmdirc.util.MapList:containsKey(...)@86: {0}, {1}
    //#test_vector(void initContent(JPanel)): java.util.Iterator:hasNext(...)@72: {0}, {1}
        final MapList<ErrorLevel, ProgramError> buckets = new MapList<ErrorLevel, ProgramError>();
    //#ErrorPopup.java:68: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.MapList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: void com.dmdirc.util.MapList()
        final MapList<ErrorReportStatus, ProgramError> statuses
    //#ErrorPopup.java:69: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.MapList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: void com.dmdirc.util.MapList()
                = new MapList<ErrorReportStatus, ProgramError>();

        for (ProgramError error : errors) {
            buckets.add(error.getLevel(), error);
    //#ErrorPopup.java:73: Warning: method not available - call not analyzed
    //#    call on ErrorLevel com.dmdirc.logger.ProgramError:getLevel()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: ErrorLevel com.dmdirc.logger.ProgramError:getLevel()
    //#ErrorPopup.java:73: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.MapList:add(Object, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: void com.dmdirc.util.MapList:add(Object, Object)
            statuses.add(error.getReportStatus(), error);
    //#ErrorPopup.java:74: Warning: method not available - call not analyzed
    //#    call on ErrorReportStatus com.dmdirc.logger.ProgramError:getReportStatus()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: ErrorReportStatus com.dmdirc.logger.ProgramError:getReportStatus()
    //#ErrorPopup.java:74: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.MapList:add(Object, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: void com.dmdirc.util.MapList:add(Object, Object)
        }

        JLabel header = new JLabel("Severity");
        header.setFont(header.getFont().deriveFont(Font.BOLD));
        panel.add(header);

        header = new JLabel("#", JLabel.RIGHT);
        header.setFont(header.getFont().deriveFont(Font.BOLD));
        panel.add(header, "growx, pushx, wrap");

        for (ErrorLevel level : ErrorLevel.values()) {
    //#ErrorPopup.java:85: Warning: method not available - call not analyzed
    //#    call on ErrorLevel[] com.dmdirc.logger.ErrorLevel:values()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: ErrorLevel[] com.dmdirc.logger.ErrorLevel:values()
            if (buckets.containsKey(level)) {
    //#ErrorPopup.java:86: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.util.MapList:containsKey(Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: bool com.dmdirc.util.MapList:containsKey(Object)
                final int count = buckets.values(level).size();
    //#ErrorPopup.java:87: Warning: method not available - call not analyzed
    //#    call on Collection com.dmdirc.util.MapList:values(Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: Collection com.dmdirc.util.MapList:values(Object)

                panel.add(new JLabel(level.toString(), level.getIcon(), JLabel.LEFT));
    //#ErrorPopup.java:89: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.logger.ErrorLevel:toString()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: String com.dmdirc.logger.ErrorLevel:toString()
    //#ErrorPopup.java:89: Warning: method not available - call not analyzed
    //#    call on Icon com.dmdirc.logger.ErrorLevel:getIcon()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: Icon com.dmdirc.logger.ErrorLevel:getIcon()
                panel.add(new JLabel(String.valueOf(count), JLabel.RIGHT), "growx, pushx, wrap");
            }
        }

        panel.add(new JSeparator(), "span, growx, pushx, wrap");

        header = new JLabel("Report status");
        header.setFont(header.getFont().deriveFont(Font.BOLD));
        panel.add(header);

        header = new JLabel("#", JLabel.RIGHT);
        header.setFont(header.getFont().deriveFont(Font.BOLD));
        panel.add(header, "growx, pushx, wrap");

        for (ErrorReportStatus status : ErrorReportStatus.values()) {
    //#ErrorPopup.java:104: Warning: method not available - call not analyzed
    //#    call on ErrorReportStatus[] com.dmdirc.logger.ErrorReportStatus:values()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: ErrorReportStatus[] com.dmdirc.logger.ErrorReportStatus:values()
            if (statuses.containsKey(status)) {
    //#ErrorPopup.java:105: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.util.MapList:containsKey(Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: bool com.dmdirc.util.MapList:containsKey(Object)
                final int count = statuses.values(status).size();
    //#ErrorPopup.java:106: Warning: method not available - call not analyzed
    //#    call on Collection com.dmdirc.util.MapList:values(Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: Collection com.dmdirc.util.MapList:values(Object)

                panel.add(new JLabel(status.toString(), JLabel.LEFT));
    //#ErrorPopup.java:108: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.logger.ErrorReportStatus:toString()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
    //#    method: void initContent(JPanel)
    //#    unanalyzed callee: String com.dmdirc.logger.ErrorReportStatus:toString()
                panel.add(new JLabel(String.valueOf(count), JLabel.RIGHT), "growx, pushx, wrap");
            }
        }
    }
    //#ErrorPopup.java:112: end of method: void com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.initContent(JPanel)

}
    //#output(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup]
    //#output(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Dispatch_Table.initContent(Ljavax/swing/JPanel;)V
    //#output(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Dispatch_Table.setVisible(Z)V
    //#output(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPopupWindow.__Descendant_Table[com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup]
    //#post(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPopupWindow.__Descendant_Table[com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Dispatch_Table.initContent(Ljavax/swing/JPanel;)V == &initContent
    //#post(com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init): __Dispatch_Table.setVisible(Z)V == &com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPopupWindow.setVisible
    //#ErrorPopup.java:: end of method: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup.com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup__static_init
    //#ErrorPopup.java:: end of class: com.dmdirc.addons.ui_swing.components.statusbar.ErrorPopup
