JIDE 3.5.15

com.jidesoft.grid
Class AutoFilterBox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JButton
                      extended by com.jidesoft.swing.JideButton
                          extended by com.jidesoft.swing.HeaderBox
                              extended by com.jidesoft.grid.AutoFilterBox
All Implemented Interfaces:
FilterableTableModelListener, SortListener, Alignable, AlignmentSupport, ButtonStyle, ComponentStateSupport, MouseListener, MouseMotionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, SwingConstants
Direct Known Subclasses:
AutoFilterTableHeaderRenderer

public class AutoFilterBox
extends HeaderBox
implements SortListener, FilterableTableModelListener, MouseListener, MouseMotionListener

AutoFilterBox is used as the cell editor component for AutoFilterTableHeader.

See Also:
Serialized Form

Nested Class Summary
 class AutoFilterBox.ArrowIcon
           
protected  class AutoFilterBox.AutoFilterBoxFilterField
          The QuickTableFilterField used by AutoFilterBox.
static interface AutoFilterBox.FilterTitleFormatter
          An interface which is used to format the filter title.
 
Nested classes/interfaces inherited from class javax.swing.JButton
JButton.AccessibleJButton
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  int _filterableTableModelColumnIndex
           
protected  AbstractButton _filterButton
           
protected  JComponent _filterField
           
protected  JPanel _filterPanel
           
protected  JLabel _label
           
protected  JPanel _labelPanel
           
protected  StyledLabel _sortArrow
           
protected  Object HIDE_POPUP_KEY
           
static String PROPERTY_ASCENDING
           
static String PROPERTY_FILTER_BUTTON_VISIBLE
           
static String PROPERTY_FILTER_INDICATOR_VISIBLE
           
static String PROPERTY_ICON
           
static String PROPERTY_POSSIBLE_VALUES
           
static String PROPERTY_SORT_ARROW_VISIBLE
           
static String PROPERTY_SORTED
           
static String PROPERTY_TITLE
           
 
Fields inherited from class com.jidesoft.swing.HeaderBox
CLIENT_PROPERTY_TABLE_CELL_EDITOR
 
Fields inherited from class com.jidesoft.swing.JideButton
CLIENT_PROPERTY_HIDE_POPUPMENU, PROPERTY_ALWAYS_SHOW_HYPERLINK
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 com.jidesoft.swing.Alignable
PROPERTY_ORIENTATION
 
Fields inherited from interface com.jidesoft.swing.ButtonStyle
BUTTON_STYLE_PROPERTY, CLIENT_PROPERTY_SEGMENT_POSITION, FLAT_STYLE, HYPERLINK_STYLE, SEGMENT_POSITION_FIRST, SEGMENT_POSITION_LAST, SEGMENT_POSITION_MIDDLE, SEGMENT_POSITION_ONLY, TOOLBAR_STYLE, TOOLBOX_STYLE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AutoFilterBox()
          Creates a button with no set text or icon.
 
Method Summary
 void addDynamicTableFilter(DynamicTableFilter filter)
          Add a DynamicTableFilter.
protected  void applyFilter(Filter filter, int columnIndex)
          Applies the filter to the specified column index of the FilterableTableModel.
protected  void applyFilter(Filter filter, int columnIndex, boolean clearFirst)
           
protected  void applyFilters(Filter[] filters, int columnIndex)
          Applies the filters to the specified column index of the FilterableTableModel.
protected  void applyFilters(Filter[] filters, int columnIndex, boolean clearFirst)
          Applies the filters to the specified column index of the FilterableTableModel.
protected  Point calculatePopupLocation()
          calculate the popup location.
protected  String convertElementToString(Object item)
          Converts the element from object to string.
protected  String convertElementToString(Object item, boolean isArray, ObjectGrouper grouper)
           
protected  String convertElementToString(Object item, ConverterContext context)
          Converts the element from object to string.
protected  PopupPanel createCheckBoxListChooserPanel(TableModel tableModel, int columnIndex, Object[] possibleValues, ObjectGrouper objectGrouper, DefaultComboBoxModel comboBoxModel)
          Create a multiple selection popup panel (check box list chooser panel).
protected  FilterEditor createCustomFilterEditor(FilterFactoryManager filterFactoryManager, Class<?> type, ConverterContext converterContext, Object[] possibleValues)
          Creates the CustomFilterEditor used in the FieldBox's custom filter drop down list.
protected  StandardDialog createCustomFilterEditorDialog(Container container, String title, JComponent filterEditor)
          Creates the CustomFilterEditorDialog when the "(Custom...)" is clicked in the drop down list of the AutoFilterBox.
protected  AbstractButton createDefaultButton()
          Creates the default combobox button.
protected  JComponent createFilterField()
          Creates the filter field instance.
protected  PopupPanel createListChooserPanel(TableModel tableModel, int columnIndex, Object[] possibleValues, ObjectGrouper objectGrouper, DefaultComboBoxModel comboBoxModel)
          Create a single selection popup panel (list chooser panel).
protected  PopupPanel createPopupPanel(TableModel tableModel, int columnIndex, Object[] possibleValues)
          Create the popup panel while the customer clicks the filter icon.
protected  JidePopup createPopupWindow()
          Creates the popup window.
protected  void customizeFilterField(JComponent filterField)
          Customizes the filter field.
protected  void customizeList(JList list)
          Create Searchable instance for drop down list in AutoFilterBox.
 void filterableTableModelChanged(FilterableTableModelEvent event)
          Called whenever the FilterableTableModel's filtered is changed.
protected  String formatColumnTitle(String columnName, Filter[] filters)
          Formats the string when the filter name is displayed.
 Icon getAscendingIcon()
          Gets the ascending icon.
protected  Filter[] getCurrentFilters()
          Gets the current filters in the FilterableTableModel for the column this AutoFilterBox is working on.
 Icon getDescendingIcon()
           
 DynamicTableFilter[] getDynamicTableFilters()
          Gets all the DynamicTableFilters.
 JComponent getFilterField()
          Gets the QuickTableFilterField instance.
 AutoFilterBox.FilterTitleFormatter getFilterTitleFormatter()
          Gets the formatter that will format the title for the AutoFilterBox.
 ListCellRenderer getListCellRenderer()
          Gets the list cell renderer for the drop down filter list.
 int getModelColumnIndex()
          Gets the table column index of this AutoFilterBox.
 Object[] getPossibleValues()
           
 Object[] getPossibleValues(ObjectGrouper objectGrouper, Object[] values, Comparator comparator)
           
 Dimension getPreferredSize()
           
 int getSearchingDelay()
          Gets the searching delay for the filter field
 int getTableColumnIndex()
          Gets the table column index of this AutoFilterBox.
 Component getTarget()
           
 String getText()
           
 StringConverter getTitleConverter()
           
 void hidePopup()
          Causes the combo box to close its popup window.
protected  void initComponents(String text, Icon icon, boolean sortArrowVisible, boolean filterButtonVisible, boolean isCellEditor)
           
protected  void installListeners()
           
 boolean isAllowCustomFilter()
          Checks the flag if the AutoFilterTableHeader allows custom filter.
 boolean isAllowMultipleValues()
          Checks if the AutoFilterTableHeader allows multiple values as the filter.
 boolean isAscending()
           
 boolean isCellEditor()
           
 boolean isFilterButtonVisible()
          Gets the visibility of the filter button.
protected  boolean isFiltered()
           
 boolean isFilterIconVisible()
          Gets if the filter icon currently is visible or not.
 boolean isFilterIndicatorVisible()
          Deprecated. replaced by isShowFilterIcon()
 boolean isMultiLineMode()
           
 boolean isPopupVisible()
          Determines the visibility of the popup.
 boolean isPreferSelectedValues()
          Get the flag indicating if selected possible values will be used or filtered possible values.
protected  boolean isRequestFocusForTextField()
          Check if the text field should request focus automatically when mouse is over the AutoFilterBox.
 boolean isShowFilterIcon()
          Checks if the filter icon is visible on the box as part of the title.
 boolean isShowFilterName()
          Checks if the filter name is visible on the box as part of the title.
 boolean isShowFilterNameAsToolTip()
          Checks if the filter name is displayed as tooltip of the box.
 boolean isShowSortArrow()
          Checks if the filter icon is visible on the box as part of the title.
 boolean isSortArrowVisible()
           
 boolean isSorted()
           
 boolean isUseTableCellRenderer()
          Gets the flag indicating if table cell renderer will be used for the list.
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
protected  void paintComponent(Graphics g)
           
protected  void paintFilterIndicator(Graphics g)
          Paints the filter indicator.
 void removeDynamicTableFilter(DynamicTableFilter filter)
          Removes a DynamicTableFilter which was added earlier.
 void setAllowCustomFilter(boolean allowCustomFilter)
          Set the flag if the AutoFilterTableHeader allows custom filter.
 void setAllowMultipleValues(boolean allowMultipleValues)
          Set the flag if the AutoFilterTableHeader allows multiple values as the filter.
 void setAscending(boolean ascending)
           
 void setAscendingIcon(Icon ascendingIcon)
           
 void setCellEditor(boolean cellEditor)
           
 void setDescendingIcon(Icon descendingIcon)
           
 void setFilterButtonVisible(boolean filterButtonVisible)
          Sets the visibility of the filter button.
 void setFilterIndicatorVisible(boolean filterIndicatorVisible)
          Deprecated. replaced by setShowFilterIcon(boolean)
 void setFilterTitleFormatter(AutoFilterBox.FilterTitleFormatter filterTitleFormatter)
          Sets the formatter that will format the title for the AutoFilterBox.
 void setFont(Font font)
           
 void setForeground(Color fg)
           
 void setHorizontalAlignment(int alignment)
          Sets the horizontal alignment of the content.
 void setIcon(Icon icon)
           
 void setListCellRenderer(ListCellRenderer listCellRenderer)
          Sets the list cell renderer for the drop down filter list.
 void setMultiLineMode(boolean multiLineMode)
           
 void setPossibleValues(Object[] possibleValues)
           
 void setPreferSelectedValues(boolean preferSelectedPossibleValues)
          Set the flag indicating if selected possible values will be used or filtered possible values.
 void setSearchingDelay(int searchingDelay)
          Sets the searching delay for the filter field

By default, the value is 0, which means each key type will trigger a filter.

 void setShowFilterIcon(boolean showFilterIcon)
          Sets the flag if the filter icon is shown on the title.
 void setShowFilterName(boolean showFilterName)
          Sets the flag if the filter name is shown on the title.
 void setShowFilterNameAsToolTip(boolean showFilterNameAsToolTip)
          Sets the flag if the filter name is displayed as tooltip on the box.
 void setShowSortArrow(boolean showSortArrow)
          Sets the flag if the filter icon is shown on the title.
 void setSortArrowVisible(boolean sortArrowVisible)
           
 void setSorted(boolean sorted)
           
 void setTableModel(TableModel tableModel, int columnIndex, boolean isCellEditor)
          Sets the table model onto AutoFilterBox.
 void setTableModel(TableModel tableModel, int columnIndex, boolean isCellEditor, boolean isModelIndex)
          Sets the table model onto AutoFilterBox.
 void setTarget(Component target)
           
 void setText(String title)
           
 void setTitleConverter(StringConverter titleConverter)
           
 void setToolTipText(String tooltipText)
           
 void setUseTableCellRenderer(boolean useTableCellRenderer)
          Sets the flag indicating if table cell renderer will be used for the list.
 void setVerticalAlignment(int alignment)
          Sets the vertical alignment of the content.
protected  void showCustomFilterEditor(IFilterableTableModel filterableTableModel, int columnIndex, Object[] possibleValues)
          Shows CustomFilterEditor when "(Custom...) is selected in the drop down list.
 void sortChanged(SortEvent event)
          Called whenever the sorting index of SortableTableModel changed.
 void sortChanging(SortEvent event)
          Called whenever the sorting index of SortableTableModel is about to change.
 void toggleSortOrder()
           
 void toggleSortOrder(boolean extend)
           
protected  void updateFilterField(JComponent filterField)
          Updates filter field.
protected  void updateFilterIndicator(IFilterableTableModel filterableTableModel)
          Updates the filter indicator.
 
Methods inherited from class com.jidesoft.swing.HeaderBox
getUIClassID, updateUI
 
Methods inherited from class com.jidesoft.swing.JideButton
getBackgroundOfState, getButtonStyle, getDefaultForeground, getForegroundOfState, getOrientation, isAlwaysShowHyperlink, setAlwaysShowHyperlink, setBackgroundOfState, setButtonStyle, setDefaultForeground, setForegroundOfState, setOrientation, setRolloverEnabled, supportHorizontalOrientation, supportVerticalOrientation
 
Methods inherited from class javax.swing.JButton
getAccessibleContext, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable
 
Methods inherited from class javax.swing.AbstractButton
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalTextPosition, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setUI, setVerticalTextPosition
 
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, 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, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, 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, 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, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jidesoft.swing.AlignmentSupport
getHorizontalAlignment, getVerticalAlignment
 

Field Detail

PROPERTY_TITLE

public static final String PROPERTY_TITLE
See Also:
Constant Field Values

PROPERTY_ICON

public static final String PROPERTY_ICON
See Also:
Constant Field Values

PROPERTY_SORT_ARROW_VISIBLE

public static final String PROPERTY_SORT_ARROW_VISIBLE
See Also:
Constant Field Values

PROPERTY_FILTER_INDICATOR_VISIBLE

public static final String PROPERTY_FILTER_INDICATOR_VISIBLE
See Also:
Constant Field Values

PROPERTY_FILTER_BUTTON_VISIBLE

public static final String PROPERTY_FILTER_BUTTON_VISIBLE
See Also:
Constant Field Values

PROPERTY_ASCENDING

public static final String PROPERTY_ASCENDING
See Also:
Constant Field Values

PROPERTY_SORTED

public static final String PROPERTY_SORTED
See Also:
Constant Field Values

PROPERTY_POSSIBLE_VALUES

public static final String PROPERTY_POSSIBLE_VALUES
See Also:
Constant Field Values

_label

protected JLabel _label

_sortArrow

protected StyledLabel _sortArrow

_filterButton

protected AbstractButton _filterButton

_filterableTableModelColumnIndex

protected int _filterableTableModelColumnIndex

_filterField

protected JComponent _filterField

_labelPanel

protected JPanel _labelPanel

_filterPanel

protected JPanel _filterPanel

HIDE_POPUP_KEY

protected Object HIDE_POPUP_KEY
Constructor Detail

AutoFilterBox

public AutoFilterBox()
Creates a button with no set text or icon.

Method Detail

setTableModel

public void setTableModel(TableModel tableModel,
                          int columnIndex,
                          boolean isCellEditor)
Sets the table model onto AutoFilterBox.

Parameters:
tableModel - the table model.
columnIndex - the column index for this auto filter, this is the view column index.
isCellEditor - whether this is used as cell editor. The opposite is to be used as cell renderer.

setTableModel

public void setTableModel(TableModel tableModel,
                          int columnIndex,
                          boolean isCellEditor,
                          boolean isModelIndex)
Sets the table model onto AutoFilterBox.

Parameters:
tableModel - the table model.
columnIndex - the column index for this auto filter, this is the view column index.
isCellEditor - whether this is used as cell editor. The opposite is to be used as cell renderer.
isModelIndex - the flag to indicate if the columnIndex is a view index or model index

sortChanging

public void sortChanging(SortEvent event)
Description copied from interface: SortListener
Called whenever the sorting index of SortableTableModel is about to change.

Specified by:
sortChanging in interface SortListener
Parameters:
event - the SortEvent

sortChanged

public void sortChanged(SortEvent event)
Description copied from interface: SortListener
Called whenever the sorting index of SortableTableModel changed.

Specified by:
sortChanged in interface SortListener
Parameters:
event - the SortEvent

filterableTableModelChanged

public void filterableTableModelChanged(FilterableTableModelEvent event)
Description copied from interface: FilterableTableModelListener
Called whenever the FilterableTableModel's filtered is changed.

Specified by:
filterableTableModelChanged in interface FilterableTableModelListener
Parameters:
event - FilterableTableModelEvent.

getTableColumnIndex

public int getTableColumnIndex()
Gets the table column index of this AutoFilterBox.

Returns:
the table column index.

getModelColumnIndex

public int getModelColumnIndex()
Gets the table column index of this AutoFilterBox.

Returns:
the table column index.

updateFilterIndicator

protected void updateFilterIndicator(IFilterableTableModel filterableTableModel)
Updates the filter indicator. By default, we will set the text and set a filter icon if isShowFilterName returns true and isShowFilterIcon returns true respectively.

Parameters:
filterableTableModel - the FilterableTableModel. You can use it to find out if the column is filtered and what the filters are. The column index can be got from getTabelColumnIndex method.

formatColumnTitle

protected String formatColumnTitle(String columnName,
                                   Filter[] filters)
Formats the string when the filter name is displayed. By default, we will display the column name first, followed by ": " then the filter name.

Parameters:
columnName - the name for the column.
filters - the filters on the column
Returns:
the string after formatted.

getFilterTitleFormatter

public AutoFilterBox.FilterTitleFormatter getFilterTitleFormatter()
Gets the formatter that will format the title for the AutoFilterBox. This formatter will be used, when isShowFilterName is true, to format the title including column name and filter names.

Returns:
the formatted title.

setFilterTitleFormatter

public void setFilterTitleFormatter(AutoFilterBox.FilterTitleFormatter filterTitleFormatter)
Sets the formatter that will format the title for the AutoFilterBox.

Parameters:
filterTitleFormatter - the new FilterTitleFormatter.

isMultiLineMode

public boolean isMultiLineMode()

setMultiLineMode

public void setMultiLineMode(boolean multiLineMode)

isUseTableCellRenderer

public boolean isUseTableCellRenderer()
Gets the flag indicating if table cell renderer will be used for the list.

Returns:
true if table cell renderer will be used. Otherwise false.
See Also:
setUseTableCellRenderer(boolean)

setUseTableCellRenderer

public void setUseTableCellRenderer(boolean useTableCellRenderer)
Sets the flag indicating if table cell renderer will be used for the list.

By default, the value is false to keep current behavior. However, if you have a column with a special renderer which can be retrieved from CellRendererManager, you may need set this flag to true. In this way, the popup list will try to borrow the renderer component from the table cell renderer to paint its entries.

Parameters:
useTableCellRenderer - the flag

isFiltered

protected boolean isFiltered()

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent

initComponents

protected void initComponents(String text,
                              Icon icon,
                              boolean sortArrowVisible,
                              boolean filterButtonVisible,
                              boolean isCellEditor)

createFilterField

protected JComponent createFilterField()
Creates the filter field instance.

By default, it returns an AutoFilterBox.AutoFilterBoxFilterField instance.

Returns:
the filter field.

customizeFilterField

protected void customizeFilterField(JComponent filterField)
Customizes the filter field.

Parameters:
filterField - the filter field

updateFilterField

protected void updateFilterField(JComponent filterField)
Updates filter field. This method will be invoked each time AutoFilterBox is created and refreshed.

Parameters:
filterField - the filter field to be updated

getCurrentFilters

protected Filter[] getCurrentFilters()
Gets the current filters in the FilterableTableModel for the column this AutoFilterBox is working on.

Returns:
the Filter array.

installListeners

protected void installListeners()

isFilterIconVisible

public boolean isFilterIconVisible()
Gets if the filter icon currently is visible or not.

Returns:
true if the filter icon is displayed in UI. Otherwise false.

isSortArrowVisible

public boolean isSortArrowVisible()

setSortArrowVisible

public void setSortArrowVisible(boolean sortArrowVisible)

isFilterIndicatorVisible

@Deprecated
public boolean isFilterIndicatorVisible()
Deprecated. replaced by isShowFilterIcon()

Returns:
the flag

setFilterIndicatorVisible

@Deprecated
public void setFilterIndicatorVisible(boolean filterIndicatorVisible)
Deprecated. replaced by setShowFilterIcon(boolean)

Parameters:
filterIndicatorVisible - the flag

isFilterButtonVisible

public boolean isFilterButtonVisible()
Gets the visibility of the filter button.

Returns:
the flag

setFilterButtonVisible

public void setFilterButtonVisible(boolean filterButtonVisible)
Sets the visibility of the filter button.

Parameters:
filterButtonVisible - the flag

setText

public void setText(String title)
Overrides:
setText in class JideButton

setFont

public void setFont(Font font)
Overrides:
setFont in class JComponent

setToolTipText

public void setToolTipText(String tooltipText)
Overrides:
setToolTipText in class JComponent

getText

public String getText()
Overrides:
getText in class AbstractButton

setIcon

public void setIcon(Icon icon)
Overrides:
setIcon in class JideButton

isAscending

public boolean isAscending()

toggleSortOrder

public void toggleSortOrder()

toggleSortOrder

public void toggleSortOrder(boolean extend)

setAscending

public void setAscending(boolean ascending)

isSorted

public boolean isSorted()

setSorted

public void setSorted(boolean sorted)

getPossibleValues

public Object[] getPossibleValues()

setPossibleValues

public void setPossibleValues(Object[] possibleValues)

applyFilters

protected void applyFilters(Filter[] filters,
                            int columnIndex)
Applies the filters to the specified column index of the FilterableTableModel.

Parameters:
filters - the filters.
columnIndex - the column index.
Since:
3.4.1

applyFilters

protected void applyFilters(Filter[] filters,
                            int columnIndex,
                            boolean clearFirst)
Applies the filters to the specified column index of the FilterableTableModel.

Parameters:
filters - the filters.
columnIndex - the column index.
clearFirst - the flag indicating if it should clear current filters inside FilterableTableModel or not.
Since:
3.4.1

applyFilter

protected void applyFilter(Filter filter,
                           int columnIndex)
Applies the filter to the specified column index of the FilterableTableModel.

Parameters:
filter - the filter.
columnIndex - the column index.

applyFilter

protected void applyFilter(Filter filter,
                           int columnIndex,
                           boolean clearFirst)

createDefaultButton

protected AbstractButton createDefaultButton()
Creates the default combobox button. This method is used only if createButtonComponent() returns null. The idea is each combobox can implement createButtonComponent() to provide its own button. However the default implementation should still be the button created by this method.

Returns:
the default combobox button.

createPopupWindow

protected JidePopup createPopupWindow()
Creates the popup window. By default it will create a JidePopup which is not detached and not resizable. Subclass can override it to create your own JidePopup or customize the default one.

Returns:
the popup window.

getPossibleValues

public Object[] getPossibleValues(ObjectGrouper objectGrouper,
                                  Object[] values,
                                  Comparator comparator)

createPopupPanel

protected PopupPanel createPopupPanel(TableModel tableModel,
                                      int columnIndex,
                                      Object[] possibleValues)
Create the popup panel while the customer clicks the filter icon.

Basically, we will try to use the converterContext defined in the table model to render the popup list in AutoFilterTableHeader. With this attempt, the customer will be able to see a consistent display in table cells and the popup list. You could also override AutoFilterBox#customizeList() to set your desired renderer.

Parameters:
tableModel - the table model
columnIndex - the column index to create the popup panel
possibleValues - possible values to be displayed
Returns:
the popup panel to be displayed.

createListChooserPanel

protected PopupPanel createListChooserPanel(TableModel tableModel,
                                            int columnIndex,
                                            Object[] possibleValues,
                                            ObjectGrouper objectGrouper,
                                            DefaultComboBoxModel comboBoxModel)
Create a single selection popup panel (list chooser panel).

Parameters:
tableModel - the table model
columnIndex - the column index
possibleValues - possible values to be displayed in the list
objectGrouper - the grouper which contains the information how we should display those values if the values are groupers.
comboBoxModel - the combo box model of the list.
Returns:
the popup panel.

showCustomFilterEditor

protected void showCustomFilterEditor(IFilterableTableModel filterableTableModel,
                                      int columnIndex,
                                      Object[] possibleValues)
Shows CustomFilterEditor when "(Custom...) is selected in the drop down list.

Parameters:
filterableTableModel - the FilterableTableModel
columnIndex - the column index of the AutoFilterBox relative to the filterableTableModel.
possibleValues - the possible values of the column in the table model.

createCustomFilterEditorDialog

protected StandardDialog createCustomFilterEditorDialog(Container container,
                                                        String title,
                                                        JComponent filterEditor)
Creates the CustomFilterEditorDialog when the "(Custom...)" is clicked in the drop down list of the AutoFilterBox.

Parameters:
container - the top level ancestor of the AutoFilterBox.
title - the title of the dialog.
filterEditor - the CustomFilterEditor.
Returns:
a CustomFilterEditorDialog.

createCustomFilterEditor

protected FilterEditor createCustomFilterEditor(FilterFactoryManager filterFactoryManager,
                                                Class<?> type,
                                                ConverterContext converterContext,
                                                Object[] possibleValues)
Creates the CustomFilterEditor used in the FieldBox's custom filter drop down list.

Parameters:
filterFactoryManager - the FilterFactoryManager.
type - the type.
converterContext - the ConverterContext.
possibleValues - the possible values.
Returns:
a new instance of FilterEditor.

createCheckBoxListChooserPanel

protected PopupPanel createCheckBoxListChooserPanel(TableModel tableModel,
                                                    int columnIndex,
                                                    Object[] possibleValues,
                                                    ObjectGrouper objectGrouper,
                                                    DefaultComboBoxModel comboBoxModel)
Create a multiple selection popup panel (check box list chooser panel).

Parameters:
tableModel - the table model
columnIndex - the column index
possibleValues - possible values to be displayed in the check box list
objectGrouper - the grouper which contains the information how we should display those values if the values are groupers.
comboBoxModel - the combo box model of the check box list.
Returns:
the popup panel.

customizeList

protected void customizeList(JList list)
Create Searchable instance for drop down list in AutoFilterBox. You can override this method to create your own searchable. The default implementation is to utilize the converter from the cell renderer as below.
 new ListSearchable(list) {
     protected String convertElementToString(Object object) {
         return cellRenderer.convertElementToString(list.getLocale(), object);
     }
 };
 

Parameters:
list - the list generated by possible values

convertElementToString

protected String convertElementToString(Object item,
                                        boolean isArray,
                                        ObjectGrouper grouper)

convertElementToString

protected String convertElementToString(Object item)
Converts the element from object to string.

Parameters:
item - the item
Returns:
the string.

convertElementToString

protected String convertElementToString(Object item,
                                        ConverterContext context)
Converts the element from object to string.

Parameters:
item - the item
context - the converter context
Returns:
the string.

calculatePopupLocation

protected Point calculatePopupLocation()
calculate the popup location.

Returns:
the location of popup.

hidePopup

public void hidePopup()
Causes the combo box to close its popup window.


isPopupVisible

public boolean isPopupVisible()
Determines the visibility of the popup.

Returns:
true if the popup is visible, otherwise returns false

addDynamicTableFilter

public void addDynamicTableFilter(DynamicTableFilter filter)
Add a DynamicTableFilter. DynamicTableFilter allows to add your own customize filter to the drop down filter list. Any DynamicTableFilter will become an entry in the list. If user clicks on that entry, the filter will be used to filter the column. What's special about DynamicTableFilter is it allows to to create a filter on fly. For example, in initializeFilter method of DynamicTableFilter, you can pop up a dialog to allow user to select certain information and you return a filter based on user selection. If returning null, no filter will be added. If not null, the filter you just created will be added to the FilterableTableModel.

Parameters:
filter - a DynamicTableFilter.

removeDynamicTableFilter

public void removeDynamicTableFilter(DynamicTableFilter filter)
Removes a DynamicTableFilter which was added earlier.

Parameters:
filter - a DynamicTableFilter.

getDynamicTableFilters

public DynamicTableFilter[] getDynamicTableFilters()
Gets all the DynamicTableFilters.

Returns:
an array of DynamicTableFilters.

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

paintFilterIndicator

protected void paintFilterIndicator(Graphics g)
Paints the filter indicator. By default, we will paint a line above the filter list button to indicate there is filter on this column.

Parameters:
g - the Graphics object

isShowFilterName

public boolean isShowFilterName()
Checks if the filter name is visible on the box as part of the title.

Returns:
true or false.

setShowFilterName

public void setShowFilterName(boolean showFilterName)
Sets the flag if the filter name is shown on the title.

Parameters:
showFilterName - true to show the filter name. False to not show it.

isShowFilterNameAsToolTip

public boolean isShowFilterNameAsToolTip()
Checks if the filter name is displayed as tooltip of the box.

Returns:
true or false.

setShowFilterNameAsToolTip

public void setShowFilterNameAsToolTip(boolean showFilterNameAsToolTip)
Sets the flag if the filter name is displayed as tooltip on the box.

Parameters:
showFilterNameAsToolTip - true to show the filter name as tooltip. False to not show it.

isShowFilterIcon

public boolean isShowFilterIcon()
Checks if the filter icon is visible on the box as part of the title.

Returns:
true or false.

setShowFilterIcon

public void setShowFilterIcon(boolean showFilterIcon)
Sets the flag if the filter icon is shown on the title.

Parameters:
showFilterIcon - true to show the filter icon. False to not show it.

isShowSortArrow

public boolean isShowSortArrow()
Checks if the filter icon is visible on the box as part of the title.

Returns:
true or false.

setShowSortArrow

public void setShowSortArrow(boolean showSortArrow)
Sets the flag if the filter icon is shown on the title.

Parameters:
showSortArrow - true to show the filter icon. False to not show it.

getTarget

public Component getTarget()

setTarget

public void setTarget(Component target)

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

isAllowMultipleValues

public boolean isAllowMultipleValues()
Checks if the AutoFilterTableHeader allows multiple values as the filter. The difference will be to use a CheckBoxList or a regular JList as the popup panel when clicking on the filter button.

Returns:
true or false.

setAllowMultipleValues

public void setAllowMultipleValues(boolean allowMultipleValues)
Set the flag if the AutoFilterTableHeader allows multiple values as the filter. The difference will be to use a CheckBoxList or a regular JList as the popup panel when clicking on the filter button.

Parameters:
allowMultipleValues - true to allow multiple value filters. False to disallow it. Default is false.

isAllowCustomFilter

public boolean isAllowCustomFilter()
Checks the flag if the AutoFilterTableHeader allows custom filter. The difference is there will be a (Custom...) item in the drop down list.when clicking on the filter button.

Returns:
true or false.

setAllowCustomFilter

public void setAllowCustomFilter(boolean allowCustomFilter)
Set the flag if the AutoFilterTableHeader allows custom filter. The difference is there will be a (Custom...) item in the drop down list.when clicking on the filter button. The value is only considered when isAllowMultipleValues() returns false.

Parameters:
allowCustomFilter - true to allow custom filter. False to disallow it. Default is true.

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Description copied from interface: AlignmentSupport
Sets the vertical alignment of the content.

Specified by:
setVerticalAlignment in interface AlignmentSupport
Overrides:
setVerticalAlignment in class AbstractButton
Parameters:
alignment - one of the following values:
  • SwingConstants.CENTER (the default)
  • SwingConstants.TOP
  • SwingConstants.BOTTOM

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Description copied from interface: AlignmentSupport
Sets the horizontal alignment of the content. AbstractButton's default is SwingConstants.CENTER, but subclasses such as JCheckBox may use a different default.

Specified by:
setHorizontalAlignment in interface AlignmentSupport
Overrides:
setHorizontalAlignment in class AbstractButton
Parameters:
alignment - the alignment value, one of the following values:
  • SwingConstants.RIGHT
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING

getDescendingIcon

public Icon getDescendingIcon()

setDescendingIcon

public void setDescendingIcon(Icon descendingIcon)

getAscendingIcon

public Icon getAscendingIcon()
Gets the ascending icon.

Returns:
the ascending icon.

setAscendingIcon

public void setAscendingIcon(Icon ascendingIcon)
Parameters:
ascendingIcon - the new ascending icon

getListCellRenderer

public ListCellRenderer getListCellRenderer()
Gets the list cell renderer for the drop down filter list.

Returns:
the list cell renderer for the drop down filter list.

setListCellRenderer

public void setListCellRenderer(ListCellRenderer listCellRenderer)
Sets the list cell renderer for the drop down filter list.

Parameters:
listCellRenderer - the new list cell renderer for the drop down filter list.

isCellEditor

public boolean isCellEditor()

setCellEditor

public void setCellEditor(boolean cellEditor)

getTitleConverter

public StringConverter getTitleConverter()

setTitleConverter

public void setTitleConverter(StringConverter titleConverter)

isPreferSelectedValues

public boolean isPreferSelectedValues()
Get the flag indicating if selected possible values will be used or filtered possible values.

Returns:
true if the selected possible values will be used. Otherwise false.
See Also:
AutoFilterTableHeader.isPreferSelectedValues()

setPreferSelectedValues

public void setPreferSelectedValues(boolean preferSelectedPossibleValues)
Set the flag indicating if selected possible values will be used or filtered possible values.

Parameters:
preferSelectedPossibleValues - the flag
See Also:
isPreferSelectedValues()

getFilterField

public JComponent getFilterField()
Gets the QuickTableFilterField instance.

Returns:
the QuickTableFilterField instance.

getSearchingDelay

public int getSearchingDelay()
Gets the searching delay for the filter field

Returns:
the searching delay.
See Also:
setSearchingDelay(int)

setSearchingDelay

public void setSearchingDelay(int searchingDelay)
Sets the searching delay for the filter field

By default, the value is 0, which means each key type will trigger a filter. You could set it to a negative value to trigger filter until pressing ENTER or a positive value to start a timer to trigger filter.

Parameters:
searchingDelay - the searching delay
See Also:
QuickFilterField.setSearchingDelay(int)

setForeground

public void setForeground(Color fg)
Overrides:
setForeground in class JComponent

isRequestFocusForTextField

protected boolean isRequestFocusForTextField()
Check if the text field should request focus automatically when mouse is over the AutoFilterBox.

Returns:
true by default.
Since:
3.4.6

JIDE 3.5.15