Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.filter.tree
Class DefaultFilterTreeRenderer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.CellRendererPane
              extended by com.citra.table.WrapperCellRendererPane
                  extended by com.citra.filter.tree.DefaultFilterTreeRenderer
All Implemented Interfaces:
FilterTreeRenderer, ImageObserver, MenuContainer, Serializable, Accessible

public class DefaultFilterTreeRenderer
extends WrapperCellRendererPane
implements FilterTreeRenderer

DefaultFilterTreeRenderer is the default FilterTreeRenderer implementation that uses an arrow button to present users with filter options for a column.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.CellRendererPane
CellRendererPane.AccessibleCellRendererPane
 
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  ArrowButton arrow
          The button that is showing on the header
protected  int arrowMode
          the current positioning mode of the arrow (left or right)
 
Fields inherited from class com.citra.table.WrapperCellRendererPane
opaqueFalse
 
Fields inherited from class javax.swing.CellRendererPane
accessibleContext
 
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
DefaultFilterTreeRenderer()
          Constructs a DefaultFilterTreeRenderer.
 
Method Summary
 boolean checkForFilter(MouseEvent e, PopupTreeFilterHeaderModel model)
          Determines whether the mouse event triggered the start of a filter action on the column.
 ArrowButton getArrowButton()
          Returns the arrow button that is showing when a filter is installed on the column.
 Component getFilterableTreeComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, PopupTreeFilterHeaderModel model, TableCellRenderer cellRenderer)
          Returns the component used for drawing the filterable header column.
 Component getMainComponent()
          Returns the main wrapped component.
 Dimension getPreferredSize()
          Returns the preferred size of this container.
 String getToolTipText(MouseEvent event)
          Returns the string to be used as the tooltip for event.
protected  void prepareRenderer(PopupTreeFilterHeaderModel model, int modelIndex)
          This method is called just before the renderer paints the column with the supplied model index for columns that have a filter installed.
 void setBounds(int x, int y, int w, int h)
          Moves and resizes this component.
 
Methods inherited from class com.citra.table.WrapperCellRendererPane
getMainComponent, paint, paintComponent
 
Methods inherited from class javax.swing.CellRendererPane
addImpl, getAccessibleContext, invalidate, paintComponent, paintComponent, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, 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

arrow

protected ArrowButton arrow
The button that is showing on the header


arrowMode

protected int arrowMode
the current positioning mode of the arrow (left or right)

Constructor Detail

DefaultFilterTreeRenderer

public DefaultFilterTreeRenderer()
Constructs a DefaultFilterTreeRenderer.

Method Detail

checkForFilter

public boolean checkForFilter(MouseEvent e,
                              PopupTreeFilterHeaderModel model)
Determines whether the mouse event triggered the start of a filter action on the column. If so, a popup menu containing available filter expression values is displayed for the column.

Specified by:
checkForFilter in interface FilterTreeRenderer
Parameters:
e - the mouse event generated on the table's header
model - the tree filter header model containing information about installed filters
Returns:
true if the arrow button was pressed

getArrowButton

public ArrowButton getArrowButton()
Returns the arrow button that is showing when a filter is installed on the column.

Returns:
the arrow button

getFilterableTreeComponent

public Component getFilterableTreeComponent(JTable table,
                                            Object value,
                                            boolean isSelected,
                                            boolean hasFocus,
                                            int row,
                                            int column,
                                            PopupTreeFilterHeaderModel model,
                                            TableCellRenderer cellRenderer)
Returns the component used for drawing the filterable header column. This method is used to configure the renderer appropriately before drawing.

Specified by:
getFilterableTreeComponent in interface FilterTreeRenderer
Parameters:
table - the table that is asking the renderer to draw
value - the value of the column to be rendered
isSelected - true if the column is to be rendered with the selection highlighted, false otherwise
hasFocus - if true, render appropriately
row - the row index of the column being drawn. usually -1
column - the column index of the column being drawn
model - the tree filter header model that contains information about installed filters
cellRenderer - the renderer of the 'unfiltered' component
Returns:
the component used for drawing the filterable tree header column

getMainComponent

public Component getMainComponent()
Returns the main wrapped component. By default, this is returned.

Overrides:
getMainComponent in class WrapperCellRendererPane
Returns:
the wrapped component

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of this container.

Overrides:
getPreferredSize in class Container
Returns:
an instance of Dimension that represents the preferred size of this container.
See Also:
Container.getMinimumSize(), Container.getLayout(), LayoutManager.preferredLayoutSize(Container), Component.getPreferredSize()

getToolTipText

public String getToolTipText(MouseEvent event)
Returns the string to be used as the tooltip for event.

Overrides:
getToolTipText in class WrapperCellRendererPane
Parameters:
event - the mouse event producing the tooltip
Returns:
the tooltip's text

prepareRenderer

protected void prepareRenderer(PopupTreeFilterHeaderModel model,
                               int modelIndex)
This method is called just before the renderer paints the column with the supplied model index for columns that have a filter installed. This implementation pushes the arrow button down and paints it with a specified color, taken by the model, if a filter expression is present on the column.

Parameters:
model - the tree filter header model that contains information about installed filters
modelIndex - the column's index in the model

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

Overrides:
setBounds in class Component
Parameters:
x - the new x-coordinate of this component
y - the new y-coordinate of this component
w - the new width of this component
h - the new height of this component
See Also:
Component.getBounds(), Component.setLocation(int, int), Component.setLocation(Point), Component.setSize(int, int), Component.setSize(Dimension)

Copyright © 2011 Citra Technologies. All Rights Reserved.