<commit_before>/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package net.java.sip.communicator.impl.gui.main.configforms;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;

/**
 * The implementation of the <tt>ConfigurationManager</tt> interface.
 *
 * @author <NAME>
 */
public class ConfigurationFrame
    extends SIPCommDialog
    implements  ConfigurationWindow
{
    private Logger logger = Logger.getLogger(ConfigurationFrame.class);

    private ConfigFormList configList;

    private TitlePanel titlePanel = new TitlePanel();

    private JPanel mainPanel = new JPanel(new BorderLayout(5, 5));

    private JPanel centerPanel = new JPanel(new BorderLayout(5, 5));

    private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    private I18NString closeString = Messages.getI18NString("close");

    private JButton closeButton = new JButton(closeString.getText());

    private MainFrame mainFrame;

    /**
     * Creates an instance of <tt>ConfigurationManagerImpl</tt>.
     *
     * @param mainFrame The main application window.
     */
    public ConfigurationFrame(MainFrame mainFrame) {

        super(mainFrame);

        this.mainFrame = mainFrame;

        this.configList = new ConfigFormList(this);

        this.setTitle(Messages.getI18NString("configuration").getText());

        this.getContentPane().setLayout(new BorderLayout());

        this.addDefaultForms();

        this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        
        this.mainPanel.add(centerPanel, BorderLayout.CENTER);

        this.mainPanel.add(configList, BorderLayout.WEST);

        this.buttonsPanel.add(closeButton);

        this.closeButton.setMnemonic(closeString.getMnemonic());

        this.closeButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e)
            {
                dispose();
            }
        });

        buttonsPanel.setBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0,
                Constants.BLUE_GRAY_BORDER_COLOR));
        
        this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH);

        this.getContentPane().add(mainPanel);
    }

    /**
     * Some configuration forms constructed from the ui implementation itself
     * are added here in the configuration dialog.
     */
    public void addDefaultForms()
    {
        this.addConfigurationForm(
                new AccountsConfigurationForm(mainFrame));
    }

    /**
     * Implements the <code>ConfigurationManager.addConfigurationForm</code>
     * method. Checks if the form contained in the <tt>ConfigurationForm</tt>
     * is an instance of java.awt.Component and if so adds the form in this
     * dialog, otherwise throws a ClassCastException.
     *
     * @param configForm the form we are adding
     *
     * @see ConfigurationWindow#addConfigurationForm(ConfigurationForm)
     */<commit_msg>All Look & feel and GUI color constants are now moved to a properties file in resources folder.<commit_after>/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package net.java.sip.communicator.impl.gui.main.configforms;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;

/**
 * The implementation of the <tt>ConfigurationManager</tt> interface.
 *
 * @author <NAME>
 */
public class ConfigurationFrame
    extends SIPCommDialog
    implements  ConfigurationWindow
{
    private Logger logger = Logger.getLogger(ConfigurationFrame.class);

    private ConfigFormList configList;

    private TitlePanel titlePanel = new TitlePanel();

    private JPanel mainPanel = new JPanel(new BorderLayout(5, 5));

    private JPanel centerPanel = new JPanel(new BorderLayout(5, 5));

    private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    private I18NString closeString = Messages.getI18NString("close");

    private JButton closeButton = new JButton(closeString.getText());

    private MainFrame mainFrame;

    /**
     * Creates an instance of <tt>ConfigurationManagerImpl</tt>.
     *
     * @param mainFrame The main application window.
     */
    public ConfigurationFrame(MainFrame mainFrame) {

        super(mainFrame);

        this.mainFrame = mainFrame;

        this.configList = new ConfigFormList(this);

        this.setTitle(Messages.getI18NString("configuration").getText());

        this.getContentPane().setLayout(new BorderLayout());

        this.addDefaultForms();

        this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        
        this.mainPanel.add(centerPanel, BorderLayout.CENTER);

        this.mainPanel.add(configList, BorderLayout.WEST);

        this.buttonsPanel.add(closeButton);

        this.closeButton.setMnemonic(closeString.getMnemonic());

        this.closeButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e)
            {
                dispose();
            }
        });

        buttonsPanel.setBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0,
                Constants.BORDER_COLOR));
        
        this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH);

        this.getContentPane().add(mainPanel);
    }

    /**
     * Some configuration forms constructed from the ui implementation itself
     * are added here in the configuration dialog.
     */
    public void addDefaultForms()
    {
        this.addConfigurationForm(
                new AccountsConfigurationForm(mainFrame));
    }

    /**
     * Implements the <code>ConfigurationManager.addConfigurationForm</code>
     * method. Checks if the form contained in the <tt>ConfigurationForm</tt>
     * is an instance of java.awt.Component and if so adds the form in this
     * dialog, otherwise throws a ClassCastException.
     *
     * @param configForm the form we are adding
     *
     * @see ConfigurationWindow#addConfigurationForm(ConfigurationForm)
     */
{'fraction_non_alphanumeric': 0.10088495575221239, 'fraction_numerical': 0.0058997050147492625, 'mean_word_length': 3.0874020494273657, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1568820', 'n_tokens_mistral': 1941, 'n_tokens_neox': 1827, 'n_words': 438}