jgnash.ui.components
Class AccountListComboBox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JComboBox
                  extended by jgnash.ui.components.AccountListComboBox
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListDataListener, MessageListener
Direct Known Subclasses:
FilteredAccountListComboBox

public class AccountListComboBox
extends javax.swing.JComboBox
implements MessageListener

ComboBox for displaying a list of accounts. Automatically refreshes itself when necessary

Version:
$Id$
Author:
Craig Cavanaugh, Vijil E C (vijilec at gmail dot com)
See Also:
Serialized Form

Nested Class Summary
protected static class AccountListComboBox.AbstractModel
           
private static class AccountListComboBox.AccountTypeModel
           
private static class AccountListComboBox.ChildrenModel
           
private static class AccountListComboBox.ChildrenTypeModel
           
private static class AccountListComboBox.DefaultModel
           
private static class AccountListComboBox.FullModel
           
private static class AccountListComboBox.ParentTypeModel
           
private  class AccountListComboBox.Renderer
          ComboBox renderer Display a specified text when the ComboBox is disabled
 
Nested classes/interfaces inherited from class javax.swing.JComboBox
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  boolean layingOut
           
 
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
  AccountListComboBox()
           
  AccountListComboBox(Account baseAccount)
           
protected AccountListComboBox(AccountListComboBox.AbstractModel model)
           
 
Method Summary
 void doLayout()
           
static AccountListComboBox getChildrenInstance(Account base, int depth)
          Static method to create an account list that shows only children of the specified account, recursing through children the specified depth.
static AccountListComboBox getChildrenTypeInstance(Account base, java.util.Set<AccountType> types, int depth)
          Static method to create an account list that shows only children of the specified account, recursing through children the specified depth.
static AccountListComboBox getFullInstance()
          Static method to create an account list that does not filter holders or locked accounts
static AccountListComboBox getInstanceByType(java.util.Set<AccountType> types)
          Static method to create an account list based on account type place holders or locked accounts are ignored
static AccountListComboBox getParentTypeInstance(Account base, java.util.Set<AccountType> types)
          Static method to create an account list that shows only parent accounts of the specified type.
 Account getSelectedAccount()
          Returns the selected account
 java.awt.Dimension getSize()
           
 void messagePosted(Message event)
           
 void setSelectedAccount(Account account)
          Sets the selected accountPath.
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, actionPropertyChanged, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

layingOut

private boolean layingOut
Constructor Detail

AccountListComboBox

public AccountListComboBox()

AccountListComboBox

public AccountListComboBox(Account baseAccount)

AccountListComboBox

protected AccountListComboBox(AccountListComboBox.AbstractModel model)
Method Detail

doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Container

getSize

public java.awt.Dimension getSize()
Overrides:
getSize in class java.awt.Component

getFullInstance

public static AccountListComboBox getFullInstance()
Static method to create an account list that does not filter holders or locked accounts

Returns:
new AccountListComboBox instance

getChildrenInstance

public static AccountListComboBox getChildrenInstance(Account base,
                                                      int depth)
Static method to create an account list that shows only children of the specified account, recursing through children the specified depth. Holders and locked accounts are not filtered.

Parameters:
base - the account to show the children of
depth - the number of times to recurse into the children. 0 means show only children of base Account
Returns:
new AccountListComboBox instance

getChildrenTypeInstance

public static AccountListComboBox getChildrenTypeInstance(Account base,
                                                          java.util.Set<AccountType> types,
                                                          int depth)
Static method to create an account list that shows only children of the specified account, recursing through children the specified depth. Holders and locked accounts are not filtered.

Parameters:
base - the account to show the children of
types - Set of AccountTypes to show
depth - the number of times to recurse into the children. 0 means show only children of base Account
Returns:
new AccountListComboBox instance

getParentTypeInstance

public static AccountListComboBox getParentTypeInstance(Account base,
                                                        java.util.Set<AccountType> types)
Static method to create an account list that shows only parent accounts of the specified type. Place holders and locked accounts are not filtered.

Parameters:
base - the account to show the children of
types - Set of AccountTypes to show
Returns:
new AccountListComboBox instance

getInstanceByType

public static AccountListComboBox getInstanceByType(java.util.Set<AccountType> types)
Static method to create an account list based on account type place holders or locked accounts are ignored

Parameters:
types - Set of account types
Returns:
new AccountListComboBox instance

getSelectedAccount

public Account getSelectedAccount()
Returns the selected account

Returns:
the account

setSelectedAccount

public void setSelectedAccount(Account account)
Sets the selected accountPath.

Parameters:
account - account to select

messagePosted

public void messagePosted(Message event)
Specified by:
messagePosted in interface MessageListener