|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sciapp.filter.FilterHeaderModel
com.sciapp.filter.PopupFilterHeaderModel
public class PopupFilterHeaderModel
PopupFilterHeaderModel uses an arrow button in order to provide real-time row filtering. The arrow appears on the right of the column's normal header and, once pressed, a popup is shown that contains available filter expression values regarding the column.
PopupFilterHeaderModel is easily installed on a JTable:
PopupFilterHeaderModel popup = new PopupFilterHeaderModel();
popup.attachToTable(table);
Field Summary | |
---|---|
protected String |
allString
The string to display for the "ALL" option |
protected ArrowButton |
arrow
Deprecated. |
protected String |
BLANK_STRING
a string for the 'blanks' filter selection |
protected JComboBox |
box
The combo box whose popup menu is displayed. |
protected Cursor |
defaultHeaderCursor
the header's default cursor |
protected FilterRenderer |
filterRenderer
the filter renderer displaying the filterable header component |
protected boolean |
hidePopupOnSelection
flag indicating whether the popup menu will be hidden after a filter value is selected |
protected String |
NON_BLANK_STRING
a string for the 'non blanks' filter selection |
Fields inherited from class com.sciapp.filter.FilterHeaderModel |
---|
ALL_VALUES_MODE, autoCreateAllFilters, columnShowing, defaultFiltersByColumnClass, filterHeader, filterMode, filterModel, ORDERED_MODE, PROGRESSIVE_MODE, removeOnInvisible, tableModel |
Constructor Summary | |
---|---|
PopupFilterHeaderModel()
Constructs a PopupFilterHeaderModel. |
Method Summary | |
---|---|
void |
attachToTable(JTable table,
FilterListModel ftm)
Installs this FilterHeaderModel instance to a table, by explicitly specifying the FilterListModel object that will process filter events. |
protected boolean |
checkForFilter(MouseEvent e)
Deprecated. |
protected FilterRenderer |
createDefaultFilterRenderer()
Creates and returns the default filter renderer that will be used to display the filterable header component. |
protected void |
filterSelected(JList list,
int c)
Called as soon as the user has selected a value from the popup menu. |
String |
getALL_String()
Returns the string used for the 'ALL' filter selection. |
ArrowButton |
getArrowButton()
Deprecated. |
String |
getBLANKS_String()
Returns the string used for the 'BLANKS' filter selection. |
protected Collection |
getCollectionForClass(Class columnClass)
Returns an empty collection that will be used to fill with available filter expression values. |
protected Collection |
getCollectionForColumn(int c)
Returns an empty collection that will be used to fill with available filter expression values. |
JComboBox |
getComboBox()
Returns the combo box whose popup menu is displayed when the arrow button is pressed. |
Cursor |
getDefaultHeaderCursor()
Retrieves the default header's cursor. |
FilterRenderer |
getFilterRenderer()
Retrieves the filter renderer that will be used to display the filterable header component. |
boolean |
getHidePopupOnSelection()
Determines whether the popup menu will be hidden after a selection is made. |
String |
getNON_BLANKS_String()
Returns the string used for the 'NON BLANKS' filter selection. |
void |
installFilter(Object listValue,
Object filterValue,
int c)
Assigns a new table filter to the column c . |
void |
installFilter(TableFilter tableFilter,
Object listValue,
Object filterValue,
int c)
Assigns a new table filter to the column c . |
protected void |
populatePopup(int c)
Populates the popup menu with values that will be used as filter expressions. |
protected void |
popupWillShow(int c)
This method is called just before the popup is shown on screen. |
protected void |
preparePopup(int c)
Makes final preparations before the popup is shown on screen. |
protected void |
prepareRenderer(int c)
Deprecated. |
void |
removeFromTable()
Removes this FilterHeaderModel instance from the table to which it was previously assigned. |
void |
removeRenderer(TableColumn column)
Remove the renderer for aColumn . |
void |
setDefaultHeaderCursor(Cursor cursor)
Assigns the default headers' cursor. |
void |
setFilterRenderer(FilterRenderer filterRenderer)
Assigns the filter renderer that will be used to display the filterable header component. |
void |
setHidePopupOnSelection(boolean hidePopupOnSelection)
Determines whether the popup menu will be hidden after a selection is made. |
void |
setRenderer(TableColumn column)
Assigns a renderer for aColumn . |
void |
setTableHeader(FilterTableHeader header)
Associates a header that will be used for displaying a visual representation of a filter on columns. |
boolean |
shouldProcessEvent(MouseEvent e)
Determines whether the mouse event generated on the table's header should be propagated. |
void |
showPopup(Point p,
int column,
int width)
Shows the filter popup for column at the specified location. |
void |
updateUI()
Calls to this method should update all components that are used to display the filter on the header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean hidePopupOnSelection
protected String BLANK_STRING
protected String NON_BLANK_STRING
protected String allString
protected transient JComboBox box
protected transient ArrowButton arrow
NOTE: this variable is now deprecated and will be removed in future versions It exists for backward compatibility.
getArrowButton
protected Cursor defaultHeaderCursor
protected transient FilterRenderer filterRenderer
Constructor Detail |
---|
public PopupFilterHeaderModel()
Method Detail |
---|
public void attachToTable(JTable table, FilterListModel ftm)
attachToTable
in class FilterHeaderModel
table
- the table on which the FilterHeaderModel is installed.ftm
- the FilterListModel that will be used to process filter events on behalf of the table.protected boolean checkForFilter(MouseEvent e)
NOTE: This method is now deprecated and will be removed in future versions.
This method has moved to DefaultFilterRenderer
, which you can get by calling
getFilterRenderer
and casting appropriately.
e
- the mouse event generated on the table's header.
protected FilterRenderer createDefaultFilterRenderer()
protected void filterSelected(JList list, int c)
e.g. Object selectedValue = list.getSelectedValue();
list
- the list of the popup menu.public String getALL_String()
public ArrowButton getArrowButton()
NOTE: This method is now deprecated and will be removed in future versions.
This method has moved to DefaultFilterRenderer
, which you can get by calling
getFilterRenderer
and casting appropriately.
public String getBLANKS_String()
protected Collection getCollectionForClass(Class columnClass)
columnClass
- the class
protected Collection getCollectionForColumn(int c)
c
- the view index of the column.
public JComboBox getComboBox()
public Cursor getDefaultHeaderCursor()
public FilterRenderer getFilterRenderer()
public boolean getHidePopupOnSelection()
public String getNON_BLANKS_String()
public void installFilter(TableFilter tableFilter, Object listValue, Object filterValue, int c)
c
.
installFilter
in class FilterHeaderModel
tableFilter
- the new table filter to assign.listValue
- the label of the filter.filterValue
- the value of the filter.c
- the view index of the column.public void installFilter(Object listValue, Object filterValue, int c)
c
.
The table filter will be retrieved by calling getTableFilterForObject(filterValue, c).
installFilter
in class FilterHeaderModel
listValue
- the label of the filter.filterValue
- the value of the filter.c
- the view index of the column.protected void populatePopup(int c)
c
- the column that contains the values.protected void popupWillShow(int c)
The location and size of the popup can be specified at this point. For example:
Rectangle rec = filterHeader.getHeaderRect(c);
Point p = new Point(rec.x-50, rec.y + filterHeader.getHeight());
box.setLocation(p);
box.setSize(rec.width+50, 0);
c
- the column for which a popup filter will be displayed.protected void preparePopup(int c)
c
- the column for which the popup filter will be displayed.protected void prepareRenderer(int c)
c
for columns that have a filter installed.
This implementation pushes the arrow button down and paints it with the filtered
or unfiltered color, depending whether a filter expression is present on the column.
NOTE: This method is now deprecated and will be removed in future versions.
It does not nothing, and it is still there for backward compatibility.
c
- the column the renderer is paintingpublic void removeFromTable()
removeFromTable
in class FilterHeaderModel
public void removeRenderer(TableColumn column)
aColumn
.
removeRenderer
in class FilterHeaderModel
column
- the column which renderer we want to remove.public void setDefaultHeaderCursor(Cursor cursor)
cursor
- the default header cursor to assignpublic void setFilterRenderer(FilterRenderer filterRenderer)
filterRenderer
- the filter renderer to assignpublic void setHidePopupOnSelection(boolean hidePopupOnSelection)
hidePopupOnSelection
- true if the popup menu is hidden after a selection, false otherwisepublic void setRenderer(TableColumn column)
aColumn
.
setRenderer
in class FilterHeaderModel
column
- the column to which a renderer we want to assign.public void setTableHeader(FilterTableHeader header)
setTableHeader
in class FilterHeaderModel
header
- the new header to assignpublic boolean shouldProcessEvent(MouseEvent e)
e
- the mouse event.
public void showPopup(Point p, int column, int width)
p
- the location at which the filter popup is showncolumn
- the column to show the filter forwidth
- the width of the filter popuppublic void updateUI()
updateUI
in class FilterHeaderModel
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |