//# 0 errors, 105 messages
//#
/*
    //#ActionsPanel.java:1:1: class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#ActionsPanel.java:1:1: method: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__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.dialogs.sslcertificate;

import com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import net.miginfocom.swing.MigLayout;

/**
 * SSL certificate actions.
 */
public class ActionsPanel extends JPanel {

    /**
     * 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;
    /** Radio button for temporarily accept. */
    private JRadioButton tempAccept;
    /** Radio button for permanently accept. */
    private JRadioButton permAccept;
    /** Radio button for do not connect. */
    private JRadioButton disconnect;
    /** Radio button group. */
    private ButtonGroup group;

    public ActionsPanel() {
    //#ActionsPanel.java:52: method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()
    //#input(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new ButtonGroup(initComponents#4) num objects
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#1) num objects
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#2) num objects
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#3) num objects
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.disconnect
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.group
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.permAccept
    //#output(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.tempAccept
    //#new obj(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new ButtonGroup(initComponents#4)
    //#new obj(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#1)
    //#new obj(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#2)
    //#new obj(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#3)
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.disconnect == &new JRadioButton(initComponents#3)
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.group == &new ButtonGroup(initComponents#4)
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.permAccept == &new JRadioButton(initComponents#2)
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): this.tempAccept == &new JRadioButton(initComponents#1)
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new ButtonGroup(initComponents#4) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#1) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#2) num objects == 1
    //#post(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): new JRadioButton(initComponents#3) num objects == 1
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.JRadioButton
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.ButtonGroup
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.ButtonGroup:add
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.JRadioButton:getModel
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.ButtonGroup:setSelected
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:javax.swing.BorderFactory:createTitledBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setBorder
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:net.miginfocom.swing.MigLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setLayout
    //#unanalyzed(void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()): Effects-of-calling:com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add
        initComponents();
        layoutComponents();
    }
    //#ActionsPanel.java:55: end of method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel()

    private void initComponents() {
        tempAccept = new JRadioButton("Temporarily accept the problems with " +
    //#ActionsPanel.java:58: method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.initComponents()
    //#input(void initComponents()): this
    //#output(void initComponents()): new ButtonGroup(initComponents#4) num objects
    //#output(void initComponents()): new JRadioButton(initComponents#1) num objects
    //#output(void initComponents()): new JRadioButton(initComponents#2) num objects
    //#output(void initComponents()): new JRadioButton(initComponents#3) num objects
    //#output(void initComponents()): this.disconnect
    //#output(void initComponents()): this.group
    //#output(void initComponents()): this.permAccept
    //#output(void initComponents()): this.tempAccept
    //#new obj(void initComponents()): new ButtonGroup(initComponents#4)
    //#new obj(void initComponents()): new JRadioButton(initComponents#1)
    //#new obj(void initComponents()): new JRadioButton(initComponents#2)
    //#new obj(void initComponents()): new JRadioButton(initComponents#3)
    //#post(void initComponents()): this.disconnect == &new JRadioButton(initComponents#3)
    //#post(void initComponents()): this.group == &new ButtonGroup(initComponents#4)
    //#post(void initComponents()): this.permAccept == &new JRadioButton(initComponents#2)
    //#post(void initComponents()): this.tempAccept == &new JRadioButton(initComponents#1)
    //#post(void initComponents()): new ButtonGroup(initComponents#4) num objects == 1
    //#post(void initComponents()): new JRadioButton(initComponents#1) num objects == 1
    //#post(void initComponents()): new JRadioButton(initComponents#2) num objects == 1
    //#post(void initComponents()): new JRadioButton(initComponents#3) num objects == 1
                "this certificate and connect.");
        permAccept = new JRadioButton("Permanently accept the problems with " +
                "this certificate and connect.");
        disconnect = new JRadioButton("Do not connect.");
        group = new ButtonGroup();
        group.add(tempAccept);
        group.add(permAccept);
        group.add(disconnect);
        group.setSelected(tempAccept.getModel(), true);
    }
    //#ActionsPanel.java:68: end of method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.initComponents()

    private void layoutComponents() {
        setBorder(BorderFactory.createTitledBorder("Actions"));
    //#ActionsPanel.java:71: method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.layoutComponents()
    //#ActionsPanel.java:71: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setBorder(Border)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setBorder(Border)
    //#input(void layoutComponents()): this
    //#input(void layoutComponents()): this.disconnect
    //#input(void layoutComponents()): this.permAccept
    //#input(void layoutComponents()): this.tempAccept
    //#pre[2] (void layoutComponents()): init'ed(this.disconnect)
    //#pre[3] (void layoutComponents()): init'ed(this.permAccept)
    //#pre[4] (void layoutComponents()): init'ed(this.tempAccept)
        setLayout(new MigLayout("fill, wrap 1"));
    //#ActionsPanel.java:72: Warning: method not available - call not analyzed
    //#    call on void net.miginfocom.swing.MigLayout(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void net.miginfocom.swing.MigLayout(String)
    //#ActionsPanel.java:72: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setLayout(LayoutManager)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:setLayout(LayoutManager)

        add(tempAccept, "growx, pushx");
    //#ActionsPanel.java:74: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
        add(permAccept, "growx, pushx");
    //#ActionsPanel.java:75: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
        add(disconnect, "growx, pushx");
    //#ActionsPanel.java:76: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
    //#    method: void layoutComponents()
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel:add(Component, Object)
    }
    //#ActionsPanel.java:77: end of method: void com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.layoutComponents()

    public CertificateAction getAction() {
        if (group.getSelection().equals(tempAccept.getModel())) {
    //#ActionsPanel.java:80: method: CertificateAction com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.getAction()
    //#input(CertificateAction getAction()): com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.DISCONNECT
    //#input(CertificateAction getAction()): com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_PERMANENTY
    //#input(CertificateAction getAction()): com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_TEMPORARILY
    //#input(CertificateAction getAction()): this
    //#input(CertificateAction getAction()): this.group
    //#input(CertificateAction getAction()): this.permAccept
    //#input(CertificateAction getAction()): this.tempAccept
    //#output(CertificateAction getAction()): return_value
    //#pre[2] (CertificateAction getAction()): this.group != null
    //#pre[4] (CertificateAction getAction()): this.tempAccept != null
    //#pre[3] (CertificateAction getAction()): (soft) this.permAccept != null
    //#presumption(CertificateAction getAction()): init'ed(com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.DISCONNECT)
    //#presumption(CertificateAction getAction()): init'ed(com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_PERMANENTY)
    //#presumption(CertificateAction getAction()): init'ed(com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_TEMPORARILY)
    //#presumption(CertificateAction getAction()): javax.swing.ButtonGroup:getSelection(...)@80 != null
    //#presumption(CertificateAction getAction()): javax.swing.ButtonGroup:getSelection(...)@82 != null
    //#post(CertificateAction getAction()): return_value == One-of{com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_TEMPORARILY, com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.IGNORE_PERMANENTY, com.dmdirc.ui.core.dialogs.sslcertificate.CertificateAction.DISCONNECT}
    //#post(CertificateAction getAction()): init'ed(return_value)
    //#test_vector(CertificateAction getAction()): java.lang.Object:equals(...)@80: {0}, {1}
    //#test_vector(CertificateAction getAction()): java.lang.Object:equals(...)@82: {0}, {1}
            return CertificateAction.IGNORE_TEMPORARILY;
        } else if (group.getSelection().equals(permAccept.getModel())) {
            return CertificateAction.IGNORE_PERMANENTY;
        } else {
            return CertificateAction.DISCONNECT;
    //#ActionsPanel.java:85: end of method: CertificateAction com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.getAction()
        }
    }
}
    //#output(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/dialogs/sslcertificate/ActionsPanel]
    //#output(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.getAction()Lcom/dmdirc/ui/core/dialogs/sslcertificate/CertificateAction;
    //#output(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.initComponents()V
    //#output(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.layoutComponents()V
    //#post(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/dialogs/sslcertificate/ActionsPanel] == &__Dispatch_Table
    //#post(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.getAction()Lcom/dmdirc/ui/core/dialogs/sslcertificate/CertificateAction; == &getAction
    //#post(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.initComponents()V == &initComponents
    //#post(com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init): __Dispatch_Table.layoutComponents()V == &layoutComponents
    //#ActionsPanel.java:: end of method: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel.com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel__static_init
    //#ActionsPanel.java:: end of class: com.dmdirc.addons.ui_swing.dialogs.sslcertificate.ActionsPanel
