/*
* :tabSize=2:indentSize=2:noTabs=true:
* :folding=explicit:collapseFolds=1:
*
* Copyright (C) 2009 Chaniel AB, Thomas Dilts This program is free
* software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version. This
* program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more
* information, surf to www.lazy8.nu or email support@lazy8.nu
*/
package lazy8ledger;
//{{{ imports
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JFrame;
import nu.lazy8.util.gen.SetupInfo;
import nu.lazy8.util.gen.Translator;
import nu.lazy8.util.help.HelpedCheckBox;
import org.gjt.sp.jedit.AbstractOptionPane;
//}}}
/**
* Description of the Class
*
* @author thomas
* @created den 2 juli 2004
*/
public class LedgerWarningsOptionPane extends AbstractOptionPane {
JCheckBox[] jWarnings;
private JFrame view;
//{{{ setupWarnings
final String[] setupWarnings =
{SetupInfo.ALLOW_TRANSACTION_CHANGES,
SetupInfo.REQUIRE_LOGIN,
SetupInfo.WARNING_GOOD_ADD,
SetupInfo.WARNING_BEFORE_DELETE,
SetupInfo.INPUT_TABSTOP_CUSTOMER, SetupInfo.WARNING_AFTER_DELETE,
SetupInfo.WARNING_CLEAR_AFTER_ADD,
SetupInfo.WARNING_CLEAR_AFTER_DELETE,
SetupInfo.SHOW_CONTEXTHELP,
SetupInfo.WARN_TO_DO_BACKUP,
SetupInfo.REQUIRE_BACKUP_PASSWORD,
SetupInfo.SHOW_ADVANCED_MENUS,
SetupInfo.DELETE_NULL_ACCOUNTS_IN_REPORTS,
SetupInfo.ALL_WINDOWS_FLOATING,
SetupInfo.ERASE_LAST_TRANS_DATE,
SetupInfo.USE_EQUITY_ACCOUNT_TYPE,
SetupInfo.WARNING_BEFORE_RE_ADDING,
SetupInfo.SHOW_PERIOD_ID,
};//}}}
//{{{ textWarnings
final String[] textWarnings =
{Translator.getTranslation("Allow changes to transactions"),
Translator.getTranslation("Require password at start"),
Translator.getTranslation("Confirm after a record is added"),
Translator.getTranslation("Confirm before deleting a record"),
Translator.getTranslation("Tab stop on customer during input"),
Translator.getTranslation("Confirm after deleting a record"),
Translator.getTranslation("Clear screen after adding a record"),
Translator.getTranslation("Clear screen after deleting a record"),
Translator.getTranslation("Show context help"),
Translator.getTranslation("Warn to backup data if changes made"),
Translator.getTranslation("Require encrypted backup files"),
Translator.getTranslation("Allow company changes in all windows"),
Translator.getTranslation("Delete from reports all accounts with zero balance"),
Translator.getTranslation("Show all windows free floating"),
Translator.getTranslation("Erase the last transaction date during input"),
Translator.getTranslation("Use the equity account type"),
Translator.getTranslation("Warn before allowing re-adding"),
Translator.getTranslation("Transaction id restart at each accounting period"),
};//}}}
//{{{ textHelp
final String[] textHelp =
{"Allow-changes-to-transactions",
"Require-password-at-start",
"Confirm-after-a-record-is-added",
"Confirm-before-deleting-a-record",
"Tab-stop-on-customer-during-input",
"Confirm-after-deleting-a-record",
"Clear-screen-after-adding-a-record",
"Clear-screen-after-deleting-a-record",
"Show-context-help",
"Warn-to-backup-data-if-changes-made",
"Require-encrypted-backup-files",
"Allow-company-changes-in-all-windows",
"Delete-from-reports-all-zero-accounts",
"Show-all-windows-free-floating",
"Erase-the-last-transaction-date-during-input",
"Use-the-equity-account-type",
"Warn-before-allowing-re-adding",
"Transaction-id-restart-at-each-accounting-period",
};//}}}
//{{{ +LedgerWarningsOptionPane(JFrame) : <init>
/**
*Constructor for the LedgerWarningsOptionPane object
*
* @param view Description of the Parameter
*/
public LedgerWarningsOptionPane(JFrame view) {
super("lazy8ledger-warnings");
this.view = view;
}//}}}
//{{{ #_init() : void
/**
* Description of the Method
*/
protected void _init() {
addComponent(new JLabel(
Translator.getTranslation("After making any changes here you must restart jEdit")));
addComponent(new JLabel(" "));
jWarnings = new JCheckBox[setupWarnings.length];
for (int i = 0; i < setupWarnings.length; i++) {
if (setupWarnings[i].compareTo("") != 0) {
jWarnings[i] = new HelpedCheckBox(textWarnings[i],
SetupInfo.getBoolProperty(setupWarnings[i]), textHelp[i], "setup", view);
addComponent(jWarnings[i]);
}
}
//the first warning is ALLOW_TRANSACTION_CHANGES which may
//never be changed, but it should be shown here anyway
jWarnings[0].setEnabled(false);
jWarnings[1].setEnabled(false);
}//}}}
//{{{ #_save() : void
/**
* Description of the Method
*/
protected void _save() {
for (int i = 0; i < setupWarnings.length; i++) {
SetupInfo.setBoolProperty(setupWarnings[i], jWarnings[i].isSelected());
}
SetupInfo.store();
}//}}}
}