|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.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,
AutoChoices mode)
Advanced constructor, enabling setting the AutoChoices mode |
|
TableFilterHeader(JTable table,
IParserModel parserModel)
Advanced constructor. |
|
TableFilterHeader(JTable table,
IParserModel parserModel,
AutoChoices mode)
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()
Sets 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. |
boolean |
isAutoCompletion()
Returns true if instant filtering is enabled. |
boolean |
isEnabled()
Returns the current enable status. |
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 |
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)
Returns the color used for disabled editors. |
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 |
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 IParser.parseInstantText(String) implementation. |
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)
Defines the behaviour of the header concerning its position 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 |
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, AutoChoices mode)
AutoChoices
mode
public TableFilterHeader(JTable table, IParserModel parserModel)
public TableFilterHeader(JTable table, IParserModel parserModel, AutoChoices mode)
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.
Setting the parameter to null effectively de-associates the
TableFilterHeader from any previously associated table -which, unless
the TableFilterHeader.Position
is set to NONE, also implies removing the filter
header from the GUI-.
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 setInstantFiltering(boolean enable)
IParser.parseInstantText(String)
implementation.
public boolean isInstantFiltering()
public void setAutoCompletion(boolean enable)
public boolean isAutoCompletion()
public void setVisible(boolean flag)
setVisible
in class JComponent
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
public boolean isEnabled()
public void setPosition(TableFilterHeader.Position location)
Defines the behaviour of the header concerning its position related to the table.
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 JComponent
public void setForeground(Color fg)
setForeground
in class JComponent
public 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 setGridColor(Color c)
public Color getGridColor()
public void setFont(Font font)
setFont
in class JComponent
public 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 JComponent
public void updateUI()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |