|
Copyright © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.citra.filter.FilterHeaderModel
com.citra.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 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 boolean |
multipleSelection
a variable that determines whether the popup filter will allow the selection of multiple filter values |
protected Map |
multipleSelectionMap
a map of columns's indices in the table's model against boolean variables that determine whether the popup filter will allow the selection of multiple filter values for a specific column |
protected String |
NON_BLANK_STRING
a string for the 'non blanks' filter selection |
Fields inherited from class com.citra.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 FilterRenderer |
createDefaultFilterRenderer()
Creates and returns the default filter renderer that will be used to display the filterable header component. |
protected TableCellRendererWrapper |
createFilterWrapper()
Creates and returns the renderer wrapper that will be installed on the header. |
String |
getALL_String()
Returns the string used for the 'ALL' filter selection. |
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. |
boolean |
getMultipleSelection()
Determines whether the popup filter allows the selection of multiple filter values. |
boolean |
getMultipleSelection(int modelIndex)
Determines whether the popup filter allows the selection of multiple filter values for a specific column. |
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. |
void |
removeFromTable()
Removes this FilterHeaderModel instance from the table to which it was previously assigned. |
void |
removeRenderer(TableColumn column)
Remove the renderer for aColumn . |
protected boolean |
retrieveMultipleSelection(int modelIndex)
This method is called just before showing the popup filter, in order to determine whether the popup will allow the selection of multiple filter values for a specific column. |
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 |
setMultipleSelection(boolean multipleSelection)
Determines whether the popup filter allows the selection of multiple filter values. |
void |
setMultipleSelection(int modelIndex,
boolean multipleSelection)
Determines whether the popup filter allows the selection of multiple filter values for a specific column. |
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 multipleSelection
protected Map multipleSelectionMap
protected boolean hidePopupOnSelection
protected String BLANK_STRING
protected String NON_BLANK_STRING
protected String allString
protected transient JComboBox box
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 FilterRenderer createDefaultFilterRenderer()
protected TableCellRendererWrapper createFilterWrapper()
createFilterWrapper
in class FilterHeaderModel
public String getALL_String()
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 boolean getMultipleSelection()
public boolean getMultipleSelection(int modelIndex)
modelIndex
- the column's index in the table's model
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.public void removeFromTable()
removeFromTable
in class FilterHeaderModel
public void removeRenderer(TableColumn column)
aColumn
.
removeRenderer
in class FilterHeaderModel
column
- the column which renderer we want to removeprotected boolean retrieveMultipleSelection(int modelIndex)
setMultipleSelection
methods. Developers can override
it, so that to provide a custom behaviour.
modelIndex
- the column's index in the table's model
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 setMultipleSelection(int modelIndex, boolean multipleSelection)
modelIndex
- the column's index in the table's modelmultipleSelection
- true, if multiple filter values are allowed, false otherwisepublic void setMultipleSelection(boolean multipleSelection)
multipleSelection
- true, if multiple filter values are allowed, false otherwisepublic void setRenderer(TableColumn column)
aColumn
.
setRenderer
in class FilterHeaderModel
column
- the column to which a renderer we want to assignpublic 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 © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |