jgnash.ui.register
Class RegisterFactory

java.lang.Object
  extended by jgnash.ui.register.RegisterFactory

public class RegisterFactory
extends java.lang.Object

Factory class for constructing register tables and controlling global options for registers.

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private static java.lang.String[] ACCOUNTING_NAMES
           
private static java.lang.String ACCOUNTINGTERMS
           
private static java.lang.String[] BANK_NAMES
           
private static java.lang.String[] CASH_NAMES
           
private static java.lang.String CONFIRMDELETE
           
private static boolean confirmTransactionDelete
           
private static java.lang.String[] CREDIT_NAMES
           
private static java.lang.String[] EQUITY_NAMES
           
private static java.lang.String EVENCOLOR
           
private static java.lang.String[] EXPENSE_NAMES
           
private static java.lang.String[] GENERIC_NAMES
           
private static java.lang.String[] INCOME_NAMES
           
private static java.lang.String[] LIABILITY_NAMES
           
private static java.lang.String ODDCOLOR
           
private static Resource rb
           
private static boolean sortable
           
private static java.lang.String SORTABLE
           
private static java.lang.String[] SPLIT_ACCOUNTING_NAMES
           
private static java.lang.String[] SPLIT_BANK_NAMES
           
private static java.lang.String[] SPLIT_CASH_NAMES
           
private static java.lang.String[] SPLIT_CREDIT_NAMES
           
private static java.lang.String[] SPLIT_EQUITY_NAMES
           
private static java.lang.String[] SPLIT_EXPENSE_NAMES
           
private static java.lang.String[] SPLIT_GAINLOSS_NAMES
           
private static java.lang.String[] SPLIT_GENERIC_NAMES
           
private static java.lang.String[] SPLIT_INCOME_NAMES
           
private static java.lang.String[] SPLIT_LIABILITY_NAMES
           
private static boolean useAccountingTerms
           
 
Constructor Summary
private RegisterFactory()
           
 
Method Summary
protected static AbstractRegisterPanel createRegisterPanel(Account account)
          Creates the appropriate register panel given an account
static RegisterTable generateInvestmentFeesTable(Account account, java.util.List<TransactionEntry> splits)
          Creates and returns a RegisterTable for investment transaction fees
static RegisterTable generateInvestmentGainsLossTable(Account account, java.util.List<TransactionEntry> splits)
          Creates and returns a RegisterTable for investment transaction fees
protected static RegisterTable generateSplitsTable(Account account, java.util.List<TransactionEntry> splits)
          Creates and returns a GenericRegisterTable of the appropriate type
static RegisterTable generateTable(Account account)
          Creates and returns a GenericRegisterTable of the appropriate type
static ClippingModel getClippingTableModel(Account account, boolean detailSplits)
           
private static java.lang.String[] getColumnNames(Account account)
           
static java.lang.String[] getCreditDebitTabNames(Account account)
          Generates tab names for transaction forms
static java.awt.Color getEvenColor()
           
static FilterModel getFilterTableModel(Account account, boolean detailSplits)
           
static java.lang.String[] getGainLossTabNames()
          Generates tab names for investment gains and loss
static java.awt.Color getOddColor()
           
private static AbstractRegisterTableModel getTableModel(Account account)
           
private static AbstractRegisterTableModel getTableModel(boolean sort, Account account, boolean detailSplits)
           
static boolean isAccountingTermsEnabled()
           
static boolean isConfirmTransactionDeleteEnabled()
          Returns the availability of sortable registers
static boolean isSortingEnabled()
          Returns the availability of sortable registers
static void setAccountingTermsEnabled(boolean enabled)
           
static void setConfirmTransactionDeleteEnabled(boolean enabled)
          Sets if confirm on transaction delete is enabled
static void setEvenColor(java.awt.Color color)
           
static void setOddColor(java.awt.Color color)
           
static void setSortingEnabled(boolean enabled)
          Sets the availability of sortable registers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCOUNTINGTERMS

private static final java.lang.String ACCOUNTINGTERMS
See Also:
Constant Field Values

EVENCOLOR

private static final java.lang.String EVENCOLOR
See Also:
Constant Field Values

ODDCOLOR

private static final java.lang.String ODDCOLOR
See Also:
Constant Field Values

rb

private static final Resource rb

sortable

private static boolean sortable

useAccountingTerms

private static boolean useAccountingTerms

confirmTransactionDelete

private static boolean confirmTransactionDelete

SORTABLE

private static final java.lang.String SORTABLE
See Also:
Constant Field Values

CONFIRMDELETE

private static final java.lang.String CONFIRMDELETE
See Also:
Constant Field Values

BANK_NAMES

private static java.lang.String[] BANK_NAMES

GENERIC_NAMES

private static java.lang.String[] GENERIC_NAMES

CASH_NAMES

private static java.lang.String[] CASH_NAMES

EXPENSE_NAMES

private static java.lang.String[] EXPENSE_NAMES

INCOME_NAMES

private static java.lang.String[] INCOME_NAMES

CREDIT_NAMES

private static java.lang.String[] CREDIT_NAMES

EQUITY_NAMES

private static java.lang.String[] EQUITY_NAMES

LIABILITY_NAMES

private static java.lang.String[] LIABILITY_NAMES

ACCOUNTING_NAMES

private static java.lang.String[] ACCOUNTING_NAMES

SPLIT_ACCOUNTING_NAMES

private static java.lang.String[] SPLIT_ACCOUNTING_NAMES

SPLIT_CREDIT_NAMES

private static java.lang.String[] SPLIT_CREDIT_NAMES

SPLIT_EXPENSE_NAMES

private static java.lang.String[] SPLIT_EXPENSE_NAMES

SPLIT_INCOME_NAMES

private static java.lang.String[] SPLIT_INCOME_NAMES

SPLIT_CASH_NAMES

private static java.lang.String[] SPLIT_CASH_NAMES

SPLIT_EQUITY_NAMES

private static java.lang.String[] SPLIT_EQUITY_NAMES

SPLIT_LIABILITY_NAMES

private static java.lang.String[] SPLIT_LIABILITY_NAMES

SPLIT_BANK_NAMES

private static java.lang.String[] SPLIT_BANK_NAMES

SPLIT_GAINLOSS_NAMES

private static java.lang.String[] SPLIT_GAINLOSS_NAMES

SPLIT_GENERIC_NAMES

private static java.lang.String[] SPLIT_GENERIC_NAMES
Constructor Detail

RegisterFactory

private RegisterFactory()
Method Detail

setOddColor

public static void setOddColor(java.awt.Color color)

getOddColor

public static java.awt.Color getOddColor()

getEvenColor

public static java.awt.Color getEvenColor()

setEvenColor

public static void setEvenColor(java.awt.Color color)

setSortingEnabled

public static void setSortingEnabled(boolean enabled)
Sets the availability of sortable registers

Parameters:
enabled - true if sorting it enabled

isSortingEnabled

public static boolean isSortingEnabled()
Returns the availability of sortable registers

Returns:
true if auto completion is enabled, false otherwise

setConfirmTransactionDeleteEnabled

public static void setConfirmTransactionDeleteEnabled(boolean enabled)
Sets if confirm on transaction delete is enabled

Parameters:
enabled - true if deletion confirmation is required

isConfirmTransactionDeleteEnabled

public static boolean isConfirmTransactionDeleteEnabled()
Returns the availability of sortable registers

Returns:
true if confirm on transaction delete is enabled, false otherwise

setAccountingTermsEnabled

public static void setAccountingTermsEnabled(boolean enabled)

isAccountingTermsEnabled

public static boolean isAccountingTermsEnabled()

generateTable

public static RegisterTable generateTable(Account account)
Creates and returns a GenericRegisterTable of the appropriate type

Parameters:
account - the account to create a new table for
Returns:
returns a GenericRegisterTable of the appropriate type

getTableModel

private static AbstractRegisterTableModel getTableModel(Account account)

getClippingTableModel

public static ClippingModel getClippingTableModel(Account account,
                                                  boolean detailSplits)

getFilterTableModel

public static FilterModel getFilterTableModel(Account account,
                                              boolean detailSplits)

getColumnNames

private static java.lang.String[] getColumnNames(Account account)

getTableModel

private static AbstractRegisterTableModel getTableModel(boolean sort,
                                                        Account account,
                                                        boolean detailSplits)

generateSplitsTable

protected static RegisterTable generateSplitsTable(Account account,
                                                   java.util.List<TransactionEntry> splits)
Creates and returns a GenericRegisterTable of the appropriate type

Parameters:
account - the account to create a new table for
splits - transaction entries to display
Returns:
returns a GenericRegisterTable of the appropriate type

generateInvestmentFeesTable

public static RegisterTable generateInvestmentFeesTable(Account account,
                                                        java.util.List<TransactionEntry> splits)
Creates and returns a RegisterTable for investment transaction fees

Parameters:
account - the account to create a new table for
splits - transaction entries to display
Returns:
returns a GenericRegisterTable of the appropriate type

generateInvestmentGainsLossTable

public static RegisterTable generateInvestmentGainsLossTable(Account account,
                                                             java.util.List<TransactionEntry> splits)
Creates and returns a RegisterTable for investment transaction fees

Parameters:
account - the account to create a new table for
splits - transaction entries to display
Returns:
returns a GenericRegisterTable of the appropriate type

createRegisterPanel

protected static AbstractRegisterPanel createRegisterPanel(Account account)
Creates the appropriate register panel given an account

Parameters:
account - the account to create a register panel for
Returns:
the register panel

getCreditDebitTabNames

public static java.lang.String[] getCreditDebitTabNames(Account account)
Generates tab names for transaction forms

Parameters:
account - account to generate tab names for
Returns:
tab names with increase name at 0 and decrease name at 1

getGainLossTabNames

public static java.lang.String[] getGainLossTabNames()
Generates tab names for investment gains and loss

Returns:
tab names with increase name at 0 and decrease name at 1