Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.filter.auto
Class JAutoFilter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.citra.filter.auto.JAutoFilter
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JAutoFilter
extends JPanel

JAutoFilter provides a panel for supplying custom filter options. The visualization of the filter is implemented using the respective Object subclasses of VisualFilter, notably, BooleanVisualFilter, DateVisualFilter, NumericalVisualFilter, StringVisualFilter and GenericVisualFilter.

When the custom auto filter dialog is displayed, a new instance of a suitable AutoFilterPanel is created, using Java's reflection API. The panel's class is associated with the class of the object being filtered. This association can be retrieved and assigned with the getDefaultFilterClass and setDefaultFilterClass methods respectively.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  AbstractAutoFilterPanel currentAutoFilter
          the currently assigned auto filter panel component
protected  Map filterClasses
          a storage for associating filtered object classes versus AutoFilterPanel classes
 
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
JAutoFilter()
          Creates a new JAutoFilter object with a border layout.
 
Method Summary
protected  void createDefaultFilterClasses()
          Assigns default AutoFilterPanel classes for Booleans, Numbers, Strings and Objects.
static JDialog createDialog(Component parent, String title, boolean modal, JAutoFilter autoFilter, ActionListener okListener, ActionListener cancelListener)
          Creates and returns a new dialog containing the JAutoFilter object and buttons for controlling the dialog.
 AbstractAutoFilterPanel createNewFilterPanel(Class c)
          Returns a new instance of an auto filter panel, based on the supplying class.
 Class getDefaultFilterClass(Class columnClass)
          Returns the AutoFilterPanel class for the supplied column class.
 TableFilter getTableFilter()
          Returns the table filter object associated with the currently showing auto filter panel.
 void prepareAutoFilter(Class objectClass, String name, int modelIndex, Collection values, PopupFilterHeaderModel headerModel)
          Creates and adds the corresponding auto filter panel to the container.
 void setDefaultFilterClass(Class columnClass, Class auto)
          Assigns the AutoFilterPanel class for the supplied column class.
 void setTableFilter(TableFilter tf)
          Assigns a new tablefilter object to the currently showing auto filter panel component.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentAutoFilter

protected AbstractAutoFilterPanel currentAutoFilter
the currently assigned auto filter panel component


filterClasses

protected Map filterClasses
a storage for associating filtered object classes versus AutoFilterPanel classes

Constructor Detail

JAutoFilter

public JAutoFilter()
Creates a new JAutoFilter object with a border layout.

Method Detail

createDefaultFilterClasses

protected void createDefaultFilterClasses()
Assigns default AutoFilterPanel classes for Booleans, Numbers, Strings and Objects.


createDialog

public static JDialog createDialog(Component parent,
                                   String title,
                                   boolean modal,
                                   JAutoFilter autoFilter,
                                   ActionListener okListener,
                                   ActionListener cancelListener)
Creates and returns a new dialog containing the JAutoFilter object and buttons for controlling the dialog.

The "OK" button hides the dialog and stores the selected date.

The "Cancel" button hides the dialog without storing the selected date.

Furthermore, the user can supply his own ActionListeners that will be invoked when the "OK" or "Cancel" buttons are pressed.

Parameters:
parent - the parent component for the dialog
title - the title for the dialog
modal - boolean specifying whether the dialog is modal
autoFilter - the auto filter panel that will be placed inside the dialog
okListener - the ActionListener invoked when "OK" is pressed
cancelListener - the ActionListener invoked when "Cancel" is pressed
Returns:
a new dialog componenet

createNewFilterPanel

public AbstractAutoFilterPanel createNewFilterPanel(Class c)
Returns a new instance of an auto filter panel, based on the supplying class. i.e.

  • for Boolean objects, return a BooleanAutoFilterPanel for Date objects, return a DateAutoFilterPanel for Number objects, return a NumericAutoFilterPanel for String objects, return a StringAutoFilterPanel for all other, return a GenericAutoFilterPanel
  • Parameters:
    c - the class
    Returns:
    a new instance of an auto filter panel.

    getDefaultFilterClass

    public Class getDefaultFilterClass(Class columnClass)
    Returns the AutoFilterPanel class for the supplied column class. If there is no entry for this columnClass, this method returns the entry for the most specific superclass.

    Parameters:
    columnClass - the class for which an AutoFilterPanel class is returned
    Returns:
    the suitable AutoFilterPanel class

    getTableFilter

    public TableFilter getTableFilter()
    Returns the table filter object associated with the currently showing auto filter panel.

    Returns:
    the current auto filter panel's table filter.

    prepareAutoFilter

    public void prepareAutoFilter(Class objectClass,
                                  String name,
                                  int modelIndex,
                                  Collection values,
                                  PopupFilterHeaderModel headerModel)
    Creates and adds the corresponding auto filter panel to the container. The available filter values are supplied with the values parameter.

    Parameters:
    objectClass - the class for which a custom filter has been requested
    name - the name of the table's column
    modelIndex - the column's model index
    values - the available filter values
    headerModel - the header model populating the available filter values

    setDefaultFilterClass

    public void setDefaultFilterClass(Class columnClass,
                                      Class auto)
    Assigns the AutoFilterPanel class for the supplied column class.

    Parameters:
    columnClass - the class for which an AutoFilterPanel class is assigned
    auto - the AutoFilterPanel class to assign

    setTableFilter

    public void setTableFilter(TableFilter tf)
    Assigns a new tablefilter object to the currently showing auto filter panel component. This method modifies the visual control's values to those corresponding to the supplied table filter object.

    Parameters:
    tf - the new table filter to assign.

    Copyright © 2011 Citra Technologies. All Rights Reserved.