|
||||||||||
| 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.JPanel
net.coderazzi.filters.gui.TableFilterHeader
public class TableFilterHeader
Implementation of a table filter that displays a set of editors associated to each table's column. This is the main Gui component in this library.
These editors are moved and resized as the table's columns are resized, so
this Swing component is better suited to be displayed atop, inline the JTable, or just below, using the same size -and resizing- as the table
itself. The position can be automatically handled by the header itself -that
is the default behaviour-
The editor associated to each column has the type IFilterEditor,
and can be manipulated separately.
The implementation relies on the FiltersHandler class, please read its
documentation to understand the requirements on the table and its model, and
how it is affected by this filter
The default settings can be modified by using system properties or by
setting values on the singleton FilterSettings instance
Providing a filter header to an existing table is as easy as doing:
TableFilterHeader filter = new TableFilterHeader(table);
| Nested Class Summary | |
|---|---|
static class |
TableFilterHeader.Position
Location of the header in relation to the table |
| 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 | |
|---|---|
TableFilterHeader()
Basic constructor, requires an attached table. |
|
TableFilterHeader(JTable table)
Basic constructor, using default IParserModel. |
|
TableFilterHeader(JTable table,
IParserModel parserModel)
Full constructor. |
|
| Method Summary | |
|---|---|
void |
addFilter(IFilter... filter)
Adds a filter -user specified- to the filter header. |
void |
addHeaderObserver(IFilterHeaderObserver observer)
Adds a new observer to the header. |
void |
addNotify()
Method automatically invoked when the class ancestor changes. |
AutoChoices |
getAutoChoices()
Returns the auto choices flag. |
CustomChoiceDecorator |
getCustomChoiceDecorator()
Returns the CustomChoiceDecorator instance. |
Color |
getDisabledBackground()
Returns the background color used for disabled editors. |
Color |
getDisabledForeground()
Returns the color used for disabled editors. |
Color |
getErrorForeground()
Returns the color set by default as foreground on each text editor when the user commits any error on the filter expression. |
IFilterEditor |
getFilterEditor(int modelColumn)
Returns the filter editor for the given column in the table model. |
Color |
getGridColor()
Returns the color set by default for the header's grid. |
int |
getMaxHistory()
Returns the maximum history size. |
int |
getMaxVisibleRows()
Returns the maximum number of visible rows in the popup menu. |
IParserModel |
getParserModel()
Retrieves the current IParserModel; The returned reference is
required to update properties like Format or Comparator
instances associated to each class, or whether to ignore case. |
TableFilterHeader.Position |
getPosition()
Returns the mode currently associated to the TableHeader. |
int |
getRowHeightDelta()
Returns the filter row's height delta. |
Color |
getSelectionBackground()
Returns the background color on focused editors. |
Color |
getSelectionForeground()
Returns the foreground color on focused editors. |
JTable |
getTable()
Returns the table currently attached. |
Color |
getTextSelectionColor()
Returns the color set by default as text selection on filters. |
Color |
getWarningForeground()
Returns the color set by default as foreground on each text editor when the filter would produce no visible rows |
boolean |
isAdaptiveChoices()
Returns the adaptive choices mode. |
boolean |
isAutoCompletion()
Returns true if instant filtering is enabled. |
boolean |
isEnabled()
Returns the current enable status. |
boolean |
isFilterOnUpdates()
Returns true if the filter is reapplied on updates. |
boolean |
isInstantFiltering()
Returns true if instant filtering is enabled. |
void |
removeFilter(IFilter... filter)
Adds a filter -user specified- to the filter header. |
void |
removeHeaderObserver(IFilterHeaderObserver observer)
Removes an existing observer from the header. |
void |
resetFilter()
Invokes resetFilter on all the editor filters. |
void |
setAdaptiveChoices(boolean enable)
Sets the adaptive choices mode. |
void |
setAutoChoices(AutoChoices set)
Sets the auto choices flag. |
void |
setAutoCompletion(boolean enable)
Enables instant filtering, as the user edits the filter's text. |
void |
setBackground(Color bg)
Sets the background color used by the parsed-based editors. |
void |
setCustomChoiceDecorator(CustomChoiceDecorator decorator)
Sets the CustomChoiceDecorator instance. |
void |
setDisabledBackground(Color dbg)
Sets the background color used for disabled editors. |
void |
setDisabledForeground(Color dfg)
Sets the color used for disabled fields. |
void |
setEnabled(boolean enabled)
Enables/Disables the filters. |
void |
setErrorForeground(Color fg)
Sets the foreground color used by the parsing text editors when there are errors on the filter expressions. |
void |
setFilterOnUpdates(boolean enable)
Sets the filter on updates flag. It sets the sortOnUpdates flag on the underlying DefaultRowSorter
it is, in fact, just a helper to set this flag without accessing directly
the row sorter. |
void |
setFont(Font font)
Sets the font used on all the editors. |
void |
setForeground(Color fg)
Sets the foreground color used by the editors. |
void |
setGridColor(Color c)
Sets the color used to draw the header's grid. |
void |
setInstantFiltering(boolean enable)
Enables instant filtering, as the user edits the filter's text The exact way the instant filtering works depends on the associated. |
void |
setMaxHistory(int maxHistory)
Sets the maximum history size, always lower than the max number of visible rows. |
void |
setMaxVisibleRows(int maxVisibleRows)
Sets the maximum number of visible rows in the popup menu (a minimum is always enforced). |
void |
setParserModel(IParserModel parserModel)
Sets the IParserModel, used to define the parsing of text on the
filter editors. |
void |
setPosition(TableFilterHeader.Position location)
Sets the position of the header related to the table. |
void |
setRowHeightDelta(int filterRowHeightDelta)
Setting to add / decrease height to the filter row. |
void |
setSelectionBackground(Color bg)
Sets the background color used to represent selected state. |
void |
setSelectionForeground(Color fg)
Sets the foreground color used to represent selected state. |
void |
setTable(JTable table)
Attaches the table where the filtering will be applied. |
void |
setTextSelectionColor(Color c)
Sets the color set by default as text selection on filters. |
void |
setVisible(boolean flag)
Hides / makes visible the header. |
void |
setWarningForeground(Color fg)
Sets the foreground color used by the parsing text editors when the associated filter would produce no visible rows. |
void |
updateUI()
|
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TableFilterHeader()
public TableFilterHeader(JTable table)
IParserModel.
public TableFilterHeader(JTable table,
IParserModel parserModel)
| Method Detail |
|---|
public IFilterEditor getFilterEditor(int modelColumn)
public void setTable(JTable table)
Attaches the table where the filtering will be applied.
It will be created a row of editors, that follow the size and position of each of the columns in the table.
public JTable getTable()
public void setParserModel(IParserModel parserModel)
IParserModel, used to define the parsing of text on the
filter editors.
public IParserModel getParserModel()
IParserModel; The returned reference is
required to update properties like Format or Comparator
instances associated to each class, or whether to ignore case.
public void setAutoChoices(AutoChoices set)
public AutoChoices getAutoChoices()
public void setAdaptiveChoices(boolean enable)
public boolean isAdaptiveChoices()
public void setInstantFiltering(boolean enable)
IParser#parseInstantText(String)public boolean isInstantFiltering()
public void setAutoCompletion(boolean enable)
public boolean isAutoCompletion()
public void setFilterOnUpdates(boolean enable)
DefaultRowSorter
it is, in fact, just a helper to set this flag without accessing directly
the row sorter.
DefaultRowSorter.setSortsOnUpdates(boolean)public boolean isFilterOnUpdates()
public void setVisible(boolean flag)
setVisible in class JComponentpublic void setEnabled(boolean enabled)
setEnabled in class JComponentpublic boolean isEnabled()
isEnabled in class Componentpublic void setPosition(TableFilterHeader.Position location)
public TableFilterHeader.Position getPosition()
public void setMaxVisibleRows(int maxVisibleRows)
public int getMaxVisibleRows()
public void setMaxHistory(int maxHistory)
public int getMaxHistory()
public void addFilter(IFilter... filter)
public void removeFilter(IFilter... filter)
public void addHeaderObserver(IFilterHeaderObserver observer)
public void removeHeaderObserver(IFilterHeaderObserver observer)
public void resetFilter()
Invokes resetFilter on all the editor filters.
IFilterEditor.resetFilter()public void setBackground(Color bg)
setBackground in class JComponentpublic void setForeground(Color fg)
setForeground in class JComponentpublic void setDisabledForeground(Color dfg)
public Color getDisabledForeground()
public void setDisabledBackground(Color dbg)
public Color getDisabledBackground()
public void setSelectionForeground(Color fg)
public Color getSelectionForeground()
public void setSelectionBackground(Color bg)
public Color getSelectionBackground()
public void setTextSelectionColor(Color c)
public Color getTextSelectionColor()
public void setErrorForeground(Color fg)
public Color getErrorForeground()
public void setWarningForeground(Color fg)
public Color getWarningForeground()
Returns the color set by default as foreground on each text editor when the filter would produce no visible rows
public void setGridColor(Color c)
public Color getGridColor()
public void setFont(Font font)
setFont in class JComponentpublic void setRowHeightDelta(int filterRowHeightDelta)
public int getRowHeightDelta()
public void setCustomChoiceDecorator(CustomChoiceDecorator decorator)
CustomChoiceDecorator instance.
public CustomChoiceDecorator getCustomChoiceDecorator()
CustomChoiceDecorator instance.
public void addNotify()
addNotify in class JComponentpublic void updateUI()
updateUI in class JPanel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||