org.columba.mail.gui.config.account.ImapAttributPanel.java Source code

Java tutorial

Introduction

Here is the source code for org.columba.mail.gui.config.account.ImapAttributPanel.java

Source

//The contents of this file are subject to the Mozilla Public License Version 1.1
//(the "License"); you may not use this file except in compliance with the 
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
//
//Software distributed under the License is distributed on an "AS IS" basis,
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
//for the specific language governing rights and
//limitations under the License.
//
//The Original Code is "The Columba Project"
//
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003. 
//
//All Rights Reserved.
package org.columba.mail.gui.config.account;

import javax.swing.JCheckBox;
import javax.swing.JPanel;

import org.columba.core.gui.base.CheckBoxWithMnemonic;
import org.columba.mail.config.ImapItem;
import org.columba.mail.util.MailResourceLoader;

import com.jgoodies.forms.builder.DefaultFormBuilder;

/**
 * 
 * @author freddy
 * @version
 */
public class ImapAttributPanel extends JPanel {
    private ImapItem item;

    private JCheckBox automaticallyApplyFilterCheckBox;

    private JCheckBox cleanupCheckBox;

    public ImapAttributPanel(ImapItem item) {
        this.item = item;
        initComponents();
    }

    public void updateComponents(boolean b) {
        if (b) {

            automaticallyApplyFilterCheckBox.setSelected(item.getBoolean(ImapItem.AUTOMATICALLY_APPLY_FILTER));
        } else {

            item.setBoolean(ImapItem.AUTOMATICALLY_APPLY_FILTER, automaticallyApplyFilterCheckBox.isSelected());
        }
    }

    public void createPanel(DefaultFormBuilder builder) {
        builder.appendSeparator(MailResourceLoader.getString("dialog", "account", "options"));

        builder.append(automaticallyApplyFilterCheckBox, 4);
        builder.nextLine();

    }

    protected void initComponents() {
        cleanupCheckBox = new JCheckBox();
        cleanupCheckBox.setEnabled(false);
        cleanupCheckBox.setText(MailResourceLoader.getString("dialog", "account", "Expunge_Inbox_on_Exit"));

        automaticallyApplyFilterCheckBox = new CheckBoxWithMnemonic(
                MailResourceLoader.getString("dialog", "account", "apply_filter"));
    }

}