|
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.tree.TreeFilterHeaderModel
com.sciapp.filter.tree.PopupTreeFilterHeaderModel
public class PopupTreeFilterHeaderModel
PopupTreeFilterHeaderModel 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.
PopupTreeFilterHeaderModel is easily installed on a TreeTable:
TreeTable treeTable = new TreeTable();
PopupTreeFilterHeaderModel popup = new PopupTreeFilterHeaderModel();
popup.attachToTable(treeTable);
NOTE: PopupTreeFilterHeaderModel will create and install its own FilterTableHeader on the table when the attachToTable method is called. If you made changes to the header, or want to use TreeTable's header, you should call TreeFilterHeaderModel.setTableHeader prior to the attachToTable method. For example:
popup.setTableHeader((FilterTableHeader) treeTable.getTableHeader());
Field Summary | |
---|---|
protected ArrowButton |
arrow
The button that is showing on the header. |
static int |
ARROW_LEFT
integer identifying that the arrow button should appear on the left of the column |
static int |
ARROW_RIGHT
integer identifying that the arrow button should appear on the right of the column |
protected int |
arrowMode
the current positioning mode of the arrow (left or right) |
protected JComboBox |
box
The combo box whose popup menu is displayed. |
protected Cursor |
defaultHeaderCursor
the header's default cursor |
protected Color |
filteredColor
the color of the arrow for a column that has filters |
protected Color |
unfilteredColor
the color of the arrow for a column that has no filters |
Fields inherited from class com.sciapp.filter.tree.TreeFilterHeaderModel |
---|
ALL_VALUES_MODE, autoCreateAllFilters, columnShowing, defaultFiltersByColumnClass, dynamicFilterTreeTableModel, filterHeader, filterMode, filterTreeTableModel, mapper, PROGRESSIVE_MODE, removeOnInvisible |
Constructor Summary | |
---|---|
PopupTreeFilterHeaderModel()
Constructs a PopupTreeFilterHeaderModel. |
Method Summary | |
---|---|
protected boolean |
checkForFilter(MouseEvent e)
Determines if the user clicked on any of the arrow buttons on the table's header. |
protected ColumnFilterMapper |
createFilterMapper()
This will return a DefaultColumnFilterMapper. |
ArrowButton |
getArrowButton()
Returns the arrow button that is showing when a filter is installed on the column. |
int |
getArrowMode()
Determines the positioning mode of the arrow. |
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. |
Color |
getFilteredColor()
Determines the color of the arrow button for columns that have filters. |
Color |
getUnfilteredColor()
Determines the color of the arrow button for columns that do not have filters. |
protected void |
popupWillShow(int c)
This method is called just before the popup is shown on screen. |
protected void |
prepareRenderer(int c)
This method is called just before the renderer paints the column at c
for columns that have a filter installed. |
void |
removeFromTable()
Removes this TreeFilterHeaderModel instance from the table to which it was previously installed. |
protected void |
removeRenderer(TableColumn column)
Remove the renderer for aColumn . |
void |
setArrowMode(int arrowMode)
Determines the positioning mode of the arrow. |
void |
setDefaultHeaderCursor(Cursor cursor)
Assigns the default headers' cursor. |
void |
setFilteredColor(Color filteredColor)
Assigns the color of the arrow button for columns that have filters. |
protected 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. |
void |
setUnfilteredColor(Color unfilteredColor)
Assigns the color of the arrow button for columns that do not have filters. |
boolean |
shouldProcessEvent(MouseEvent e)
Determines whether the mouse event generated on the table's header should be propagated. |
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 |
---|
public static final int ARROW_LEFT
public static final int ARROW_RIGHT
protected int arrowMode
protected Color unfilteredColor
protected Color filteredColor
protected JComboBox box
protected ArrowButton arrow
protected Cursor defaultHeaderCursor
Constructor Detail |
---|
public PopupTreeFilterHeaderModel()
Method Detail |
---|
protected boolean checkForFilter(MouseEvent e)
e
- the mouse event generated on the table's header.
protected ColumnFilterMapper createFilterMapper()
Creates a new instance of the column filter mapper that will be used to install and uninstall the filters.
createFilterMapper
in class TreeFilterHeaderModel
public ArrowButton getArrowButton()
public int getArrowMode()
public JComboBox getComboBox()
public Cursor getDefaultHeaderCursor()
public Color getFilteredColor()
public Color getUnfilteredColor()
protected void popupWillShow(int c)
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 prepareRenderer(int c)
c
for columns that have a filter installed.
This implementation pushes the arrow button down and paints it with a blue color
if a filter expression is present on the column.
c
- the column the renderer is painting.public void removeFromTable()
removeFromTable
in class TreeFilterHeaderModel
protected void removeRenderer(TableColumn column)
aColumn
.
removeRenderer
in class TreeFilterHeaderModel
column
- the column which renderer we want to remove.public void setArrowMode(int arrowMode)
arrowMode
- integer indicating where the arrow is positionedpublic void setDefaultHeaderCursor(Cursor cursor)
cursor
- the default header cursor to assignpublic void setFilteredColor(Color filteredColor)
filteredColor
- the arrow button's color for filtered columnsprotected void setRenderer(TableColumn column)
aColumn
.
setRenderer
in class TreeFilterHeaderModel
column
- the column to which a renderer we want to assign.public void setTableHeader(FilterTableHeader header)
setTableHeader
in class TreeFilterHeaderModel
header
- the new header to assignpublic void setUnfilteredColor(Color unfilteredColor)
unfilteredColor
- the arrow button's color for non-filtered columnspublic boolean shouldProcessEvent(MouseEvent e)
e
- the mouse event.
public void updateUI()
updateUI
in class TreeFilterHeaderModel
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |