//# 0 errors, 141 messages
//#
/*
    //#DownloaderWindow.java:1:1: class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#DownloaderWindow.java:1:1: method: com.dmdirc.addons.addonbrowser.DownloaderWindow.com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dmdirc.addons.addonbrowser;

import com.dmdirc.Main;
import com.dmdirc.util.DownloadListener;
import com.dmdirc.util.Downloader;

import java.awt.Component;
import java.io.File;
import java.io.IOException;

import javax.swing.JDialog;
import javax.swing.JProgressBar;

import net.miginfocom.swing.MigLayout;

/**
 *
 * @author chris
 */
public class DownloaderWindow extends JDialog implements Runnable, DownloadListener {
   
    /**
     * 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;
    /** Downloader progress bar. */
    private final JProgressBar jpb = new JProgressBar(0, 100);

    /** Instantiates a new downloader window. */
    public DownloaderWindow() {
    //#DownloaderWindow.java:37: method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#input(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): com/dmdirc/Main.controller
    //#input(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): this
    //#output(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): new JProgressBar(DownloaderWindow#1) num objects
    //#output(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): this.jpb
    //#new obj(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): new JProgressBar(DownloaderWindow#1)
    //#pre[1] (void com.dmdirc.addons.addonbrowser.DownloaderWindow()): com/dmdirc/Main.controller != null
    //#presumption(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): com.dmdirc.ui.interfaces.MainWindow:getIcon(...)@44 != null
    //#presumption(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): com.dmdirc.ui.interfaces.UIController:getMainWindow(...)@44 != null
    //#post(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): this.jpb == &new JProgressBar(DownloaderWindow#1)
    //#post(void com.dmdirc.addons.addonbrowser.DownloaderWindow()): new JProgressBar(DownloaderWindow#1) num objects == 1
        setTitle("Downloading addon information...");
    //#DownloaderWindow.java:38: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setTitle(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setTitle(String)
        setLayout(new MigLayout("fill"));
    //#DownloaderWindow.java:39: Warning: method not available - call not analyzed
    //#    call on void net.miginfocom.swing.MigLayout(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void net.miginfocom.swing.MigLayout(String)
    //#DownloaderWindow.java:39: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setLayout(LayoutManager)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setLayout(LayoutManager)
        add(jpb, "grow");
    //#DownloaderWindow.java:40: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:add(Component, Object)
        pack();
    //#DownloaderWindow.java:41: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:pack()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:pack()
        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    //#DownloaderWindow.java:42: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setDefaultCloseOperation(int)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setDefaultCloseOperation(int)
        setLocationRelativeTo((Component) Main.getUI().getMainWindow());
    //#DownloaderWindow.java:43: Warning: method not available - call not analyzed
    //#    call on MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#DownloaderWindow.java:43: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setLocationRelativeTo(Component)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setLocationRelativeTo(Component)
        setIconImage(Main.getUI().getMainWindow().getIcon().getImage());
    //#DownloaderWindow.java:44: Warning: method not available - call not analyzed
    //#    call on MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: MainWindow com.dmdirc.ui.interfaces.UIController:getMainWindow()
    //#DownloaderWindow.java:44: Warning: method not available - call not analyzed
    //#    call on ImageIcon com.dmdirc.ui.interfaces.MainWindow:getIcon()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: ImageIcon com.dmdirc.ui.interfaces.MainWindow:getIcon()
    //#DownloaderWindow.java:44: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setIconImage(Image)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setIconImage(Image)
        setVisible(true);
    //#DownloaderWindow.java:45: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:setVisible(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void com.dmdirc.addons.addonbrowser.DownloaderWindow()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:setVisible(bool)
        
        new Thread(this, "Addon downloader thread").start();
    }
    //#DownloaderWindow.java:48: end of method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.com.dmdirc.addons.addonbrowser.DownloaderWindow()

    /** {@inheritDoc} */
    @Override
    public void run() {
        try {
            Downloader.downloadPage("http://addons.dmdirc.com/feed", 
    //#DownloaderWindow.java:54: method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.run()
    //#DownloaderWindow.java:54: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.util.Downloader:downloadPage(String, String, DownloadListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void run()
    //#    unanalyzed callee: void com.dmdirc.util.Downloader:downloadPage(String, String, DownloadListener)
    //#input(void run()): ".DMDirc"._tainted
    //#input(void run()): "DMDirc"._tainted
    //#input(void run()): "Library"._tainted
    //#input(void run()): "Preferences"._tainted
    //#input(void run()): "addons.feed"._tainted
    //#input(void run()): "http:..addons.dmdirc.com.addonimg."._tainted
    //#input(void run()): com/dmdirc/Main.configdir
    //#input(void run()): com/dmdirc/Main.configdir._tainted
    //#input(void run()): com/dmdirc/Main.controller
    //#input(void run()): com/dmdirc/addons/addonbrowser/AddonInfo$AddonType.TYPE_ACTION_PACK
    //#input(void run()): com/dmdirc/addons/addonbrowser/AddonInfo$AddonType.TYPE_PLUGIN
    //#input(void run()): com/dmdirc/addons/addonbrowser/AddonInfo$AddonType.TYPE_THEME
    //#input(void run()): com/dmdirc/addons/addonbrowser/BrowserWindow.java.io.File.separator
    //#input(void run()): com/dmdirc/addons/addonbrowser/BrowserWindow.java.io.File.separator._tainted
    //#input(void run()): java.io.File.separator
    //#input(void run()): java.io.File.separator._tainted
    //#input(void run()): this
    //#output(void run()): com/dmdirc/Main.configdir
    //#output(void run()): java.lang.StringBuilder:toString(...)._tainted
    //#new obj(void run()): java.lang.StringBuilder:toString(...)
    //#pre[2] (void run()): (soft) com/dmdirc/Main.controller != null
    //#pre[3] (void run()): (soft) init'ed(com/dmdirc/Main.configdir)
    //#presumption(void run()): init'ed(java.io.File.separator)
    //#post(void run()): com/dmdirc/Main.configdir == One-of{old com/dmdirc/Main.configdir, &java.lang.StringBuilder:toString(...)}
    //#post(void run()): init'ed(com/dmdirc/Main.configdir)
    //#post(void run()): java.lang.StringBuilder:toString(...)._tainted == 0
    //#unanalyzed(void run()): Effects-of-calling:java.lang.System:getProperty
    //#unanalyzed(void run()): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void run()): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void run()): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void run()): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void run()): Effects-of-calling:java.lang.System:getenv
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.ButtonGroup
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.ButtonGroup:add
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JCheckBox:addActionListener
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JRadioButton:addActionListener
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JTextField:addActionListener
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JList:getModel
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.DefaultListModel:clear
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JLabel
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JList:add
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.ui_swing.components.LoggingSwingWorker
    //#unanalyzed(void run()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow$1:execute
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.ConfigFile
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.ConfigFile:read
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.ConfigFile:getKeyDomains
    //#unanalyzed(void run()): Effects-of-calling:java.util.Map:values
    //#unanalyzed(void run()): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(void run()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void run()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void run()): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(void run()): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.util.URLBuilder:buildURL
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.ImageIcon
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.ImageIcon:getImage
    //#unanalyzed(void run()): Effects-of-calling:java.awt.Image:getScaledInstance
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.ImageIcon:setImage
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.ui.interfaces.UIController:getMainWindow
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JDialog
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JTextField
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JCheckBox
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.DefaultListModel
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JList
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JScrollPane
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JRadioButton
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.ui_swing.MainFrame:getIcon
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:setIconImage
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:setResizable
    //#unanalyzed(void run()): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:setLayout
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JScrollPane:getVerticalScrollBar
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JScrollBar:setUnitIncrement
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JPanel
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JList:setCellRenderer
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.BorderFactory:createTitledBorder
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JPanel:setBorder
    //#unanalyzed(void run()): Effects-of-calling:javax.swing.JPanel:add
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:add
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:pack
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:setLocationRelativeTo
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.addonbrowser.BrowserWindow:setVisible
                    Main.getConfigDir() + File.separator + "addons.feed", this);
            new BrowserWindow();
        } catch (IOException ex) {
            // Do nothing
        }
        
        dispose();
    //#DownloaderWindow.java:61: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.addonbrowser.DownloaderWindow:dispose()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.addonbrowser.DownloaderWindow
    //#    method: void run()
    //#    unanalyzed callee: void com.dmdirc.addons.addonbrowser.DownloaderWindow:dispose()
    }
    //#DownloaderWindow.java:62: end of method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.run()
    
    /** {@inheritDoc} */
    @Override
    public void downloadProgress(float percent) {
        System.out.println("value: " + percent);
    //#DownloaderWindow.java:67: method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.downloadProgress(float)
    //#input(void downloadProgress(float)): "value: "._tainted
    //#input(void downloadProgress(float)): java.lang.System.out
    //#input(void downloadProgress(float)): percent
    //#input(void downloadProgress(float)): this
    //#input(void downloadProgress(float)): this.jpb
    //#pre[1] (void downloadProgress(float)): (int) (percent) in {-2_147_483_648..4_294_967_295}
    //#pre[4] (void downloadProgress(float)): this.jpb != null
    //#presumption(void downloadProgress(float)): java.lang.System.out != null
        jpb.setValue((int) percent);
    }
    //#DownloaderWindow.java:69: end of method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.downloadProgress(float)

    /** {@inheritDoc} */
    @Override
    public void setIndeterminate(final boolean indeterminate) {
        jpb.setIndeterminate(indeterminate);
    //#DownloaderWindow.java:74: method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.setIndeterminate(bool)
    //#input(void setIndeterminate(bool)): indeterminate
    //#input(void setIndeterminate(bool)): this
    //#input(void setIndeterminate(bool)): this.jpb
    //#pre[3] (void setIndeterminate(bool)): this.jpb != null
    }
    //#DownloaderWindow.java:75: end of method: void com.dmdirc.addons.addonbrowser.DownloaderWindow.setIndeterminate(bool)

}
    //#output(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Descendant_Table[com/dmdirc/addons/addonbrowser/DownloaderWindow]
    //#output(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.downloadProgress(F)V
    //#output(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.run()V
    //#output(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.setIndeterminate(Z)V
    //#post(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Descendant_Table[com/dmdirc/addons/addonbrowser/DownloaderWindow] == &__Dispatch_Table
    //#post(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.downloadProgress(F)V == &downloadProgress
    //#post(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.run()V == &run
    //#post(com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init): __Dispatch_Table.setIndeterminate(Z)V == &setIndeterminate
    //#DownloaderWindow.java:: end of method: com.dmdirc.addons.addonbrowser.DownloaderWindow.com.dmdirc.addons.addonbrowser.DownloaderWindow__static_init
    //#DownloaderWindow.java:: end of class: com.dmdirc.addons.addonbrowser.DownloaderWindow
