protected void dialogInit()

in commons-transfer/commons-transfer-interactive/src/main/java/org/apache/archiva/commons/transfer/interactive/NetworkProxyDialog.java [308:384]


    protected void dialogInit()
    {
        super.dialogInit();
        setModal( true );

        /* .\ Init \._________________________________________ */

        sectionProxied = new ArrayList<JComponent>();
        sectionProxiedAuth = new ArrayList<JComponent>();

        radioDirectConnection = new JRadioButton();
        radioDirectConnection.setAction( getActionMapper() );
        radioDirectConnection.setActionCommand( USE_DIRECT_CONNECTION );
        radioDirectConnection.setText( "Use a Direct Connection" );

        // Init Section 1
        radioProxiedConnection = new JRadioButton();
        radioProxiedConnection.setAction( getActionMapper() );
        radioProxiedConnection.setActionCommand( USE_PROXIED_CONNECTION );
        radioProxiedConnection.setText( "Use a Proxied Connection" );

        ButtonGroup connectionTypeGroup = new ButtonGroup();
        connectionTypeGroup.add( radioDirectConnection );
        connectionTypeGroup.add( radioProxiedConnection );

        radioDirectConnection.setSelected( true );

        txtProxyHost = new JTextField( "[host]" );
        txtProxyPort = new JTextField( "[port]" );
        txtProxyPort.setColumns( 6 );

        // Init Section 2
        noProxyListModel = new NoProxyListModel();
        lstNoProxy = new JList( noProxyListModel );
        btnAddNoProxyHost = createJButton( "Add ...", ADD_NOPROXY_HOST );
        btnEditNoProxyHost = createJButton( "Edit ...", EDIT_NOPROXY_HOST );
        btnRemoveNoProxyHost = createJButton( "Remove", REMOVE_NOPROXY_HOST );

        // Init Section 3
        boxEnableProxyAuth = new JCheckBox();
        boxEnableProxyAuth.setAction( getActionMapper() );
        boxEnableProxyAuth.setActionCommand( PROXY_AUTH_STATE );
        boxEnableProxyAuth.setText( "Enable Proxy Auth" );
        txtProxyUsername = new JTextField( "[username]" );
        txtProxyPassword = new JPasswordField( "[password]" );

        // Init Button Bar
        btnOk = createJButton( "OK", OK );
        btnCancel = createJButton( "Cancel", CANCEL );

        /* .\ Layout \._______________________________________ */

        Container pane = getContentPane();
        pane.setLayout( new GridBagLayout() );

        GBCStyles styles = CommonStyles.baseline();
        styles.define( "left_spacer" ).marginLeft( 20 ).fillTall();
        styles.define( "radio_button" ).margin( 5, 5, 0, 5 ).spanCol( 2 ).fillWide();
        styles.define( "checkbox" ).margin( 5, 5, 0, 5 ).spanCol( 2 ).fillWide();
        styles.define( "hr" ).margin( 5, 5, 0, 5 ).spanCol( 2 ).fillWide().endRow();
        styles.define( "noproxy_button" ).margin( 0, 5, 5, 5 ).x( 1 ).stretch( GBC.WIDE ).endRow();

        // Layout top of dialog.
        pane.add( radioDirectConnection, styles.use( "radio_button" ).endRow() );
        pane.add( radioProxiedConnection, styles.use( "radio_button" ).endRow() );
        pane.add( new JPanel(), styles.base().marginLeft( 20 ) );
        pane.add( getProxiedPanel( styles ), styles.base().margin( 5, 5, 5, 5 ).fillBoth().endRow() );
        pane.add( layoutButtonBar( styles ), styles.use( "button_bar" ).fillWide().endRow() );

        /* .\ Properties \.___________________________________ */

        setTitle( "Network Proxy Setup" );
        setResizable( false );
        pack();

        setDefaultCloseOperation( DISPOSE_ON_CLOSE );
    }