| 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.table.JTableHeader
com.jidesoft.grid.DraggingTableHeader
com.jidesoft.grid.CellStyleTableHeader
com.jidesoft.grid.SortableTableHeader
com.jidesoft.grid.EditableTableHeader
com.jidesoft.grid.AutoFilterTableHeader
public class AutoFilterTableHeader
AutoFilterTableHeader implements auto-filter feature. Each column header has a combobox-like control to
 allow user selecting certain values to be filtered from the list. The list contains the possible values for that
 column as well as other customized items. Each item represents a Filter class that will be added to
 FilterableTableModel when selected.
 
AutoFilterTableHeader works with any FilterableTableModel. If the table passed to the
 constructor of AutoFilterTableHeader already defined a FilterableTableModel, it will use that FilterableTableModel.
 Otherwise, it will create a new FilterableTableModel, wrapping the current table's table model and reset the table's
 table model to the newly created FilterableTableModel.
 
 There are three kinds of Filters AutoFilterTableHeader will use. They are SingleValueFilter, MultipleValuesFilter and DynamicTableFilter. When isAllowMultipleValues() returns false and user selects a value
 from AutoFilterTableHeader's drop down value list, SingleValueFilter will be created and added to that column as the
 filter. DynamicTableFilter could also be used in this case when you call AutoFilterBox.addDynamicTableFilter(DynamicTableFilter). This method call will add new custom
 filter to the header which will appear as a new item under "All" item in the drop down value list. If isAllowMultipleValues() returns true, MultipleValuesFilter will be the only filter that is used to allow multiple
 values as the filter values.
 
 AutoFilterTableHeader also detects filters added outside AutoFilterTableHeader. For example, if
 isAllowMultipleValues returns false, you can add a SingleValueFilter to the column, or if isAllowMultipleValues
 returns true, you can add a MultipleValuesFilter. After you did it, AutoFilterTableHeader will automatically update
 the display to show a filter name or filter name to indicate the column has a filter.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class javax.swing.table.JTableHeader | 
|---|
JTableHeader.AccessibleJTableHeader | 
| 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  boolean | 
_autoFilterEnabled
 | 
protected  IFilterableTableModel | 
_filterableTableModel
 | 
static String | 
CLIENT_PROPERTY_CUSTOM_FILTER_EDITOR_TYPE
Set this client property to choose a specific editor.  | 
static String | 
CUSTOM_FILTER_EDITOR_TYPE_TABLE_CUSTOM_FILTER_EDITOR
 | 
static String | 
PROPERTY_ACCEPT_TEXT_INPUT
 | 
static String | 
PROPERTY_AUTO_FILTER_ENABLED
 | 
static String | 
PROPERTY_USE_NATIVE_CELL_RENDERER
 | 
| Fields inherited from class com.jidesoft.grid.EditableTableHeader | 
|---|
_cellEditor, _defaultEditor, _editingColumn, _editorComp, HEADER_ROW | 
| Fields inherited from class com.jidesoft.grid.SortableTableHeader | 
|---|
PROPERTY_SHOW_SORT_ARROW | 
| Fields inherited from class com.jidesoft.grid.CellStyleTableHeader | 
|---|
_cellStyleList | 
| Fields inherited from class com.jidesoft.grid.DraggingTableHeader | 
|---|
PROPERTY_DRAGGED_COLUMN, PROPERTY_DRAGGED_DISTANCE, PROPERTY_RESIZING_COLUMN | 
| Fields inherited from class javax.swing.table.JTableHeader | 
|---|
columnModel, draggedColumn, draggedDistance, reorderingAllowed, resizingAllowed, resizingColumn, table, updateTableInRealTime | 
| 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 | |
|---|---|
  | 
AutoFilterTableHeader(JTable table)
Creates AutoFilterTableHeader. | 
protected  | 
AutoFilterTableHeader(TableColumnModel columnModel)
The constructor.  | 
| Method Summary | |
|---|---|
 void | 
clearFilters()
Clears all filters created by the AutoFilterTableHeader. | 
 void | 
columnMarginChanged(ChangeEvent e)
 | 
protected  TableCellEditor | 
createDefaultEditor()
Overrides to create an AutoFilterTableHeaderEditor. | 
protected  IFilterableTableModel | 
createDefaultFilterableTableModel(TableModel model)
Creates the FilterableTableModel. | 
protected  TableCellRenderer | 
createDefaultRenderer()
Overrides to create an AutoFilterTableHeaderRenderer. | 
protected  TableHeaderCellDecorator | 
createFilterableTableHeaderCellDecorator()
Creates a TableHeaderCellDecorator instance to paint the filter button and icon.  | 
protected  IFilterableTableModel | 
createFilterableTableModel(TableModel model)
Creates the FilterableTableModel to be used by AutoFilterTableHeader. | 
protected  void | 
customizeAutoFilterBox(AutoFilterBox autoFilterBox)
Customizes the AutoFilterBox. | 
 void | 
editingStopped(ChangeEvent e)
 | 
 void | 
filterableTableModelChanged(FilterableTableModelEvent event)
Called whenever the FilterableTableModel's filtered is changed.  | 
protected  String | 
formatColumnTitle(int modelIndex,
                  String columnName,
                  Filter[] filters)
Formats the string when the filter name is displayed.  | 
 String | 
getActualUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.  | 
 TableCellRenderer | 
getAutoFilterTableHeaderRenderer()
Gets the header renderer for auto filter feature.  | 
 TableHeaderCellDecorator | 
getFilterableTableHeaderCellDecorator()
Gets the TableHeaderCellDecorator instance to paint the filter button and icon.  | 
 IFilterableTableModel | 
getFilterableTableModel()
Gets the FilterableTableModel used by this AutoFilterTableHeader. | 
protected  IFilterableTableModel | 
getFilterableTableModel(AutoFilterBox box)
Gets the FilterableTableModel used by the AutoFilterBox.  | 
protected  ImageIcon | 
getFilterIcon(int columnIndex,
              boolean mouseOverPaintArea,
              boolean hasFilter)
Gets the filter icon to be painted in the AutoFilterTableHeader if isUseNativeHeaderRenderer() returns true. | 
 String | 
getFormattedColumnName(int columnIndex)
Get formatted column name based on current filters for header and tooltip text.  | 
 String | 
getToolTipText(MouseEvent event)
Gets the tool tip text from ToolTipSupport | 
 String | 
getUIDelegateClassID()
Returns a string that specifies the name of the UIDelegate class that paints this component.  | 
protected  void | 
initTable(JTable table)
Initializes the table.  | 
 boolean | 
isAcceptTextInput()
Gets the flag indicating if this header accepts text input.  | 
 boolean | 
isAllowMultipleValues()
Checks if the AutoFilterTableHeader allows multiple values as the filter. | 
 boolean | 
isAllowMultipleValues(int columnIndex)
Checks if the AutoFilterTableHeader allows multiple values as the filter. | 
 boolean | 
isAutoFilterEnabled()
Gets the flag indicating if auto filter feature is enabled for the entire header.  | 
protected  boolean | 
isAutoRequestFocus()
If the editor requests focus when starts editing.  | 
 boolean | 
isCellEditable(int columnIndex)
Returns true if the header cell at index is editable. | 
 boolean | 
isPreferSelectedValues()
Get the flag indicating if selected possible values will be used or filtered possible values.  | 
 boolean | 
isRolloverEnabled()
Checks if rollover is enabled.  | 
 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 on the table header.  | 
 boolean | 
isUseNativeHeaderRenderer()
Gets the flag indicating if the native header renderer will be used.  | 
 void | 
propertyChange(PropertyChangeEvent evt)
 | 
 void | 
setAcceptTextInput(boolean acceptTextInput)
Sets the flag indicating if the header accepts text input.  | 
 void | 
setAllowMultipleValues(boolean allowMultipleValues)
Set the flag if the AutoFilterTableHeader allows multiple values as the filter. | 
 void | 
setAutoFilterEnabled(boolean autoFilterEnabled)
Sets the flag indicating if auto filter feature is enabled for the entire header.  | 
 void | 
setPreferSelectedValues(boolean preferSelectedPossibleValues)
Set the flag indicating if selected possible values will be used or filtered possible values.  | 
 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 table header.  | 
 void | 
setShowSortArrow(boolean showSortArrow)
Sets the flag if the sort arrow is shown on the header.  | 
 void | 
setTable(JTable table)
 | 
 void | 
setUseNativeHeaderRenderer(boolean useNativeHeaderRenderer)
Sets the flag indicating if the native header renderer will be used.  | 
protected  void | 
tableModelChanged(JTable table)
This method will be called when TableModel on JTable is changed.  | 
| Methods inherited from class com.jidesoft.grid.EditableTableHeader | 
|---|
cancelEditing, customizeEditorComponent, editCellAt, editCellAt, editingCanceled, getCellEditor, getCellEditor, getDefaultEditor, getEditingColumn, getEditorComponent, isClickToStartEditing, isEditing, prepareEditor, removeEditor, removeNotify, resizeAndRepaint, setCellEditor, setClickToStartEditing, setDefaultEditor, setDraggedColumn, setEditingColumn, setRolloverEnabled, stopEditing | 
| Methods inherited from class com.jidesoft.grid.SortableTableHeader | 
|---|
createSortableTableHeaderCellDecorator, createSortIcon, getSortableTableHeaderCellDecorator, isShowSortArrow, paintComponent, paintSortArrow, paintSortArrows | 
| Methods inherited from class com.jidesoft.grid.DraggingTableHeader | 
|---|
getPreferredSize, setDraggedDistance, setResizingColumn | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected IFilterableTableModel _filterableTableModel
protected boolean _autoFilterEnabled
public static final String PROPERTY_ACCEPT_TEXT_INPUT
public static final String PROPERTY_USE_NATIVE_CELL_RENDERER
public static final String PROPERTY_AUTO_FILTER_ENABLED
public static final String CLIENT_PROPERTY_CUSTOM_FILTER_EDITOR_TYPE
CUSTOM_FILTER_EDITOR_TYPE_TABLE_CUSTOM_FILTER_EDITOR, TableCustomFIlterEditor will be used.
 Otherwise, CustomFilterEditor will be used
public static final String CUSTOM_FILTER_EDITOR_TYPE_TABLE_CUSTOM_FILTER_EDITOR
| Constructor Detail | 
|---|
protected AutoFilterTableHeader(TableColumnModel columnModel)
columnModel - the column modelpublic AutoFilterTableHeader(JTable table)
AutoFilterTableHeader. By default, rollover is enabled.
table - the table to install this AutoFilterTableHeader. The table model of this table could be
              FilterableTableModel or if it is a TableModelWrapper, it could have a nested
              FilterableTableModel. In either case, we will use the FilterableTableModel
              and add filters to it. If there is no FilterableTableModel, we will create one and wrap
              it around the table model returned from table.getModel(). If so, after creating the
              AutoFilterTableHeader, table.getModel() will return a
              FilterableTableModel. FilterableTableModel's getActualModel()
              will be the old tableModel.| Method Detail | 
|---|
protected TableHeaderCellDecorator createFilterableTableHeaderCellDecorator()
public TableHeaderCellDecorator getFilterableTableHeaderCellDecorator()
public void setTable(JTable table)
setTable in class JTableHeaderpublic String getUIDelegateClassID()
getUIDelegateClassID in class EditableTableHeaderpublic String getActualUIClassID()
SortableTableHeader
getActualUIClassID in class EditableTableHeaderpublic TableCellRenderer getAutoFilterTableHeaderRenderer()
isUseNativeHeaderRenderer() returns true. Otherwise returns AutoFilterTableHeaderRendererprotected TableCellRenderer createDefaultRenderer()
AutoFilterTableHeaderRenderer. Below is the default code in case you need to
 override it to you create your own renderer.
 
 if (isAutoFilterEnabled() && !isUseNativeHeaderRenderer()) {
     return new AutoFilterTableHeaderRenderer(){
         protected void customizeAutoFilterBox(AutoFilterBox autoFilterBox) {
             super.customizeAutoFilterBox(autoFilterBox);
             AutoFilterTableHeader.this.customizeAutoFilterBox(autoFilterBox);
             autoFilterBox.applyComponentOrientation(AutoFilterTableHeader.this.getComponentOrientation());
         }
     };
 }
 else {
     return super.createDefaultRenderer();
 }
 
createDefaultRenderer in class JTableHeaderAutoFilterTableHeaderRenderer.protected TableCellEditor createDefaultEditor()
AutoFilterTableHeaderEditor. Below is the default code in case you need to
 override it to you create your own editor.
 
 if (isAutoFilterEnabled()) {
    return new AutoFilterTableHeaderEditor() {
        protected void customizeAutoFilterBox(AutoFilterBox autoFilterBox) {
            autoFilterBox.applyComponentOrientation(AutoFilterTableHeader.this.getComponentOrientation());
            super.customizeAutoFilterBox(autoFilterBox);
            AutoFilterTableHeader.this.customizeAutoFilterBox(autoFilterBox);
        }
     };
 }
 else {
     return null;
 }
 
createDefaultEditor in class EditableTableHeaderAutoFilterTableHeaderEditor.public boolean isCellEditable(int columnIndex)
EditableTableHeaderindex is editable.
 
 Note: The column is specified in the table view's display order, and not in the TableModel's
 column order.  This is an important distinction because as the user rearranges the columns in the table, the
 column at a given index in the view will change. Meanwhile the user's actions never affect the model's column
 ordering.
isCellEditable in class EditableTableHeadercolumnIndex - the column whose value is to be queried
public void editingStopped(ChangeEvent e)
editingStopped in interface CellEditorListenereditingStopped in class EditableTableHeaderprotected void customizeAutoFilterBox(AutoFilterBox autoFilterBox)
AutoFilterBox.
 
 Please be noted that this method will only be invoked if isUseNativeHeaderRenderer() returns false.
autoFilterBox - the AutoFilterBox created by AutoFilterTableHeaderRenderer or AutoFilterTableHeaderEditor.protected void initTable(JTable table)
table - the table which is passed in as parameter of the constructor AutoFilterTableHeader(javax.swing.JTable).public void columnMarginChanged(ChangeEvent e)
columnMarginChanged in interface TableColumnModelListenercolumnMarginChanged in class JTableHeaderprotected void tableModelChanged(JTable table)
table - the tablepublic void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic void filterableTableModelChanged(FilterableTableModelEvent event)
FilterableTableModelListener
filterableTableModelChanged in interface FilterableTableModelListenerevent - FilterableTableModelEvent.protected IFilterableTableModel createFilterableTableModel(TableModel model)
FilterableTableModel to be used by AutoFilterTableHeader. It returns null by
 default. You can override it to create your own FilterableTableModel.
model - the table model.
FilterableTableModel.protected IFilterableTableModel createDefaultFilterableTableModel(TableModel model)
FilterableTableModel.
model - the table model.
FilterableTableModel.public IFilterableTableModel getFilterableTableModel()
FilterableTableModel used by this AutoFilterTableHeader.
 
 Please be noted that, this method could return null since 3.1.0 when isAutoFilterEnabled() returns false.
FilterableTableModel.public void clearFilters()
AutoFilterTableHeader. Please note, this method only clears all the
 filters created by AutoFilterTableHeader but does NOT refresh the data. It will NOT clear any filter that is NOT
 created by AutoFilterTableHeader. You still need to call AutoFilterTableHeader#getFilterableTableModel().refresh()
 after this call to refresh the table.
public boolean isAutoFilterEnabled()
public void setAutoFilterEnabled(boolean autoFilterEnabled)
autoFilterEnabled - the flagpublic boolean isShowFilterName()
public void setShowFilterName(boolean showFilterName)
showFilterName - true to show the filter name. False to not show it.public boolean isShowFilterNameAsToolTip()
public void setShowFilterNameAsToolTip(boolean showFilterNameAsToolTip)
showFilterNameAsToolTip - true to show the filter name as tooltip. False to not show it.public boolean isShowFilterIcon()
setShowFilterIcon(boolean)public void setShowFilterIcon(boolean showFilterIcon)
isUseNativeHeaderRenderer() returns true, it means that the filter icon will
 always be painted on the header. If isUseNativeHeaderRenderer() returns false, it means that if there is
 a filter, if a filter icon should be painted on the header.
 
 Right now, we support show the icon directly while the header value is an instance of Icon. If you set the header
 value to icon and isUseNativeHeaderRenderer() returns false, this flag will not be respected.
showFilterIcon - true to show the filter icon. False to not show it.public void setShowSortArrow(boolean showSortArrow)
setShowSortArrow in class SortableTableHeadershowSortArrow - true to show the sort arrow. False to not show it.public boolean isAllowMultipleValues(int columnIndex)
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.
 
 Please be noted that the column index is in view level since the interface is provided in AutoFilterTableHeader.
 Make sure you will convert it to model level while overriding this method.
columnIndex - the visual column index.
public boolean isAllowMultipleValues()
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.
public void setAllowMultipleValues(boolean allowMultipleValues)
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.
 
 Please note, call this method will clear all filters that were added before.
allowMultipleValues - true to allow multiple value filters. False to disallow it. Default is false.public boolean isPreferSelectedValues()
isAllowMultipleValues() return true.
 
 The default value is false which is different from the behavior before 2.9.0. In this way, if you input a new
 record to the target table, the new record will stay. If you want the new record to be filtered away, please try
 to set this flag to true.
isAllowMultipleValues()public void setPreferSelectedValues(boolean preferSelectedPossibleValues)
preferSelectedPossibleValues - the flagisPreferSelectedValues()protected boolean isAutoRequestFocus()
EditableTableHeader
isAutoRequestFocus in class EditableTableHeaderprotected IFilterableTableModel getFilterableTableModel(AutoFilterBox box)
getFilterableTableModel() which means all AutoFilterBoxes will use the same filter table model. If for whatever
 reason you need to use different instances for different AutoFilterBox, you can create a new FilterableTableModel
 and return.
box - the AutoFilterBox who will use the IFilterableTableModel returned from this method.
public boolean isAcceptTextInput()
isUseNativeHeaderRenderer() returns true.
setAcceptTextInput(boolean)public void setAcceptTextInput(boolean acceptTextInput)
isUseNativeHeaderRenderer() returns false.
 
 By default, the value is false to minimize the height of the header. You could set it to true if you want to let
 your customer to input text in this header. However, the height of the header would be bigger.
acceptTextInput - the flagpublic boolean isUseNativeHeaderRenderer()
setUseNativeHeaderRenderer(boolean)public void setUseNativeHeaderRenderer(boolean useNativeHeaderRenderer)
useNativeHeaderRenderer - the flagpublic boolean isRolloverEnabled()
EditableTableHeader
isRolloverEnabled in class EditableTableHeaderpublic String getToolTipText(MouseEvent event)
DraggingTableHeaderToolTipSupport
getToolTipText in class DraggingTableHeaderevent - the mouse event
public String getFormattedColumnName(int columnIndex)
columnIndex - the view column index in the header
protected String formatColumnTitle(int modelIndex,
                                   String columnName,
                                   Filter[] filters)
modelIndex - the model column indexcolumnName - the name for the column.filters - the filters on the column
protected ImageIcon getFilterIcon(int columnIndex,
                                  boolean mouseOverPaintArea,
                                  boolean hasFilter)
isUseNativeHeaderRenderer() returns true.
columnIndex - the column indexmouseOverPaintArea - if the mouse is currently over this columnhasFilter - if the column currently has filter
  | 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||