|
|||||||||
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
com.sciapp.filter.FilterTablePanel
public class FilterTablePanel
FilterTablePanel is a panel through which filter events are propagated to a FilterTableModel. FilterTablePanel uses a box layout with horizontal orientation to layout the different gui components. You can customize its appearance by overriding makePanel, in which you must supply code to add these gui components to the panel. FilterTablePanel provides filters for the fields passed as arguments in the constructor. Additionally, it defines two more filtering options: no filter and filter on all columns.
Nested Class Summary |
---|
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected JCheckBox |
caseSensitive
a checkbox used by stringfilters to denote case(in)sensitivity. |
protected HashMap |
defaultFiltersByColumnClass
A table of objects that filter data, indexed by class. |
protected JTextField |
expression
a textfield used to input the filter pattern. |
protected JComboBox |
fieldBox
a combobox that contains the fields that we are able to filter. |
protected JComboBox |
fieldBoxOptions
a combobox that presents the different options of the current filter to the user. |
protected JButton |
filterButton
a button that when clicked, fires the filter event. |
protected JCheckBox |
filterOn
a checkbox that shows if the filter displayed is active or not. |
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 | |
---|---|
FilterTablePanel(String[] fields)
Constructs a FilterTablePanel with fields as the fields that we are able to filter. |
|
FilterTablePanel(String[] fields,
Class[] classes)
Constructs a FilterTablePanel with fields as the fields that we are able to filter
and classes as the corresponding classes of each field. |
|
FilterTablePanel(TableModel tableModel)
Constructs a FilterTablePanel by quering tableModel for the filtering fields
and the corresponding classes. |
Method Summary | |
---|---|
void |
addTableFilterListener(TableFilterListener l)
Adds a TableFilterListener that is notified each time a filter event is generated. |
protected void |
createDefaultFilters()
Creates default filters for objects, strings, numbers and boolean values. |
Filter |
getDefaultFilter(Class columnClass)
Returns the filter to use for the class defined by columnClass. |
boolean |
getFilterOnKey()
Returns a boolean value that if true, filter events are fired whenever a key press is detected on a text field, otherwise the user must press the Enter key for this to happen. |
protected void |
makePanel()
Adds the gui components to the FilterTablePanel using a box layout with horizontal orientation. |
void |
removeTableFilterListener(TableFilterListener l)
Removes a TableFilterListener from the list of listeners that is notified each time a filter event is generated. |
void |
setDefaultFilter(Class columnClass,
Filter filter)
Sets the default filter for columnClass. |
void |
setFilterOnKey(boolean key)
Set key to true for filter events to be fired upon key detection. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected HashMap defaultFiltersByColumnClass
protected JTextField expression
protected JButton filterButton
protected JCheckBox filterOn
protected JComboBox fieldBox
protected JComboBox fieldBoxOptions
protected JCheckBox caseSensitive
Constructor Detail |
---|
public FilterTablePanel(String[] fields)
fields
as the fields that we are able to filter.
The corresponing filter for each field is initialized to a StringFilter.
fields
- the fields, which ususally are the columns of a table.public FilterTablePanel(String[] fields, Class[] classes)
fields
as the fields that we are able to filter
and classes
as the corresponding classes of each field.
An IllegalArgumentException is thrown if fields
and classes
are not of the same length.
fields
- the fields, which ususally are the columns of a table.classes
- the associated classes to fields.public FilterTablePanel(TableModel tableModel)
tableModel
for the filtering fields
and the corresponding classes. The filter columns and classes are constructed by calling
the getColumnName and getColumnClass methods of TableModel respectively. Therefore,
these methods should not return null.
tableModel
- the tablemodel to queryMethod Detail |
---|
public void addTableFilterListener(TableFilterListener l)
l
- the TableFilterListenerprotected void createDefaultFilters()
public Filter getDefaultFilter(Class columnClass)
public boolean getFilterOnKey()
protected void makePanel()
public void removeTableFilterListener(TableFilterListener l)
l
- the TableFilterListenerpublic void setDefaultFilter(Class columnClass, Filter filter)
columnClass
- the Class with which a filter we want to associatefilter
- the filter to setpublic void setFilterOnKey(boolean key)
key
to true for filter events to be fired upon key detection.
key
- true if filter events are to be fired upon key detection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |