|
JIDE 2.9.5 | ||||||||
| 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.AbstractButton
javax.swing.JButton
com.jidesoft.swing.JideButton
com.jidesoft.swing.HeaderBox
com.jidesoft.grid.AutoFilterBox
public class AutoFilterBox
AutoFilterBox is used as the cell editor component for AutoFilterTableHeader.
| Nested Class Summary | |
|---|---|
class |
AutoFilterBox.ArrowIcon
|
static interface |
AutoFilterBox.FilterTitleFormatter
An interface which is used to format the filter title. |
| Nested classes/interfaces inherited from class javax.swing.JButton |
|---|
JButton.AccessibleJButton |
| Nested classes/interfaces inherited from class javax.swing.AbstractButton |
|---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
| 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 | |
|---|---|
protected Object |
HIDE_POPUP_KEY
|
static String |
PROPERTY_ASCENDING
|
static String |
PROPERTY_FILTER_BUTTON_VISIBLE
|
static String |
PROPERTY_FILTER_INDICATOR_VISIBLE
|
static String |
PROPERTY_ICON
|
static String |
PROPERTY_POSSIBLE_VALUES
|
static String |
PROPERTY_SORT_ARROW_VISIBLE
|
static String |
PROPERTY_SORTED
|
static String |
PROPERTY_TITLE
|
| Fields inherited from class com.jidesoft.swing.HeaderBox |
|---|
CLIENT_PROPERTY_TABLE_CELL_EDITOR |
| Fields inherited from class com.jidesoft.swing.JideButton |
|---|
CLIENT_PROPERTY_HIDE_POPUPMENU, PROPERTY_ALWAYS_SHOW_HYPERLINK |
| 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 com.jidesoft.swing.Alignable |
|---|
PROPERTY_ORIENTATION |
| Fields inherited from interface com.jidesoft.swing.ButtonStyle |
|---|
BUTTON_STYLE_PROPERTY, CLIENT_PROPERTY_SEGMENT_POSITION, FLAT_STYLE, HYPERLINK_STYLE, SEGMENT_POSITION_FIRST, SEGMENT_POSITION_LAST, SEGMENT_POSITION_MIDDLE, SEGMENT_POSITION_ONLY, TOOLBAR_STYLE, TOOLBOX_STYLE |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
AutoFilterBox()
Creates a button with no set text or icon. |
|
| Method Summary | |
|---|---|
void |
addDynamicTableFilter(DynamicTableFilter filter)
Add a DynamicTableFilter. |
protected void |
applyFilter(Filter filter,
int columnIndex)
Applies the filter to the specified column index of the FilterableTableModel. |
protected void |
applyFilter(Filter filter,
int columnIndex,
boolean clearFirst)
|
protected Point |
calculatePopupLocation()
calculate the popup location. |
protected String |
convertElementToString(Object item)
Converts the element from object to string. |
protected String |
convertElementToString(Object item,
boolean isArray,
ObjectGrouper grouper)
|
protected String |
convertElementToString(Object item,
ConverterContext context)
Converts the element from object to string. |
protected CustomFilterEditor |
createCustomFilterEditor(FilterFactoryManager filterFactoryManager,
Class<?> type,
ConverterContext converterContext,
Object[] possibleValues)
Creates the CustomFilterEditor used in the FieldBox's custom filter drop down list. |
protected StandardDialog |
createCustomFilterEditorDialog(Container container,
String title,
CustomFilterEditor filterEditor)
Creates the CustomFilterEditorDialog when the "(Custom...)" is clicked in the drop down list of the AutoFilterBox. |
protected AbstractButton |
createDefaultButton()
Creates the default combobox button. |
protected PopupPanel |
createPopupPanel(TableModel tableModel,
int columnIndex,
Object[] possibleValues)
Create the popup panel while the customer clicks the filter icon. |
protected JidePopup |
createPopupWindow()
Creates the popup window. |
protected void |
customizeList(JList list)
Create Searchable instance for drop down list in AutoFilterBox. |
void |
filterableTableModelChanged(FilterableTableModelEvent event)
Called whenever the FilterableTableModel's filtered is changed. |
protected String |
formatColumnTitle(String columnName,
Filter[] filters)
Formats the string when the filter name is displayed. |
Icon |
getAscendingIcon()
Gets the ascending icon. |
Icon |
getDescendingIcon()
|
DynamicTableFilter[] |
getDynamicTableFilters()
Gets all the DynamicTableFilters. |
AutoFilterBox.FilterTitleFormatter |
getFilterTitleFormatter()
Gets the formatter that will format the title for the AutoFilterBox. |
ListCellRenderer |
getListCellRenderer()
Gets the list cell renderer for the drop down filter list. |
int |
getModelColumnIndex()
Gets the table column index of this AutoFilterBox. |
Object[] |
getPossibleValues()
|
Object[] |
getPossibleValues(ObjectGrouper objectGrouper,
Object[] values,
Comparator comparator)
|
int |
getTableColumnIndex()
Gets the table column index of this AutoFilterBox. |
Component |
getTarget()
|
String |
getText()
|
StringConverter |
getTitleConverter()
|
void |
hidePopup()
Causes the combo box to close its popup window. |
protected void |
initComponents(String text,
Icon icon,
boolean sortArrowVisible,
boolean filterButtonVisible,
boolean isCellEditor)
|
protected void |
installListeners()
|
boolean |
isAllowCustomFilter()
Checks the flag if the AutoFilterTableHeader allows custom filter. |
boolean |
isAllowMultipleValues()
Checks if the AutoFilterTableHeader allows multiple values as the filter. |
boolean |
isAscending()
|
boolean |
isCellEditor()
|
boolean |
isFilterButtonVisible()
|
protected boolean |
isFiltered()
|
boolean |
isFilterIndicatorVisible()
|
boolean |
isMultiLineMode()
|
boolean |
isPopupVisible()
Determines the visibility of the popup. |
boolean |
isPreferSelectedValues()
Get the flag indicating if selected possible values will be used or filtered possible values. |
boolean |
isShowFilterIcon()
Checks if the filter icon is visible on the box as part of the title. |
boolean |
isShowFilterName()
Checks if the filter name is visible on the box as part of the title. |
boolean |
isShowFilterNameAsToolTip()
Checks if the filter name is displayed as tooltip of the box. |
boolean |
isShowSortArrow()
Checks if the filter icon is visible on the box as part of the title. |
boolean |
isSortArrowVisible()
|
boolean |
isSorted()
|
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
protected void |
paintComponent(Graphics g)
|
protected void |
paintFilterIndicator(Graphics g)
Paints the filter indicator. |
void |
removeDynamicTableFilter(DynamicTableFilter filter)
Removes a DynamicTableFilter which was added earlier. |
void |
setAllowCustomFilter(boolean allowCustomFilter)
Set the flag if the AutoFilterTableHeader allows custom filter. |
void |
setAllowMultipleValues(boolean allowMultipleValues)
Set the flag if the AutoFilterTableHeader allows multiple values as the filter. |
void |
setAscending(boolean ascending)
|
void |
setAscendingIcon(Icon ascendingIcon)
|
void |
setCellEditor(boolean cellEditor)
|
void |
setDescendingIcon(Icon descendingIcon)
|
void |
setFilterButtonVisible(boolean filterButtonVisible)
|
void |
setFilterIndicatorVisible(boolean filterIndicatorVisible)
|
void |
setFilterTitleFormatter(AutoFilterBox.FilterTitleFormatter filterTitleFormatter)
Sets the formatter that will format the title for the AutoFilterBox. |
void |
setHorizontalAlignment(int alignment)
Sets the horizontal alignment of the content. |
void |
setIcon(Icon icon)
|
void |
setListCellRenderer(ListCellRenderer listCellRenderer)
Sets the list cell renderer for the drop down filter list. |
void |
setMultiLineMode(boolean multiLineMode)
|
void |
setPossibleValues(Object[] possibleValues)
|
void |
setPreferSelectedValues(boolean preferSelectedPossibleValues)
Set the flag indicating if selected possible values will be used or filtered possible values. |
void |
setShowFilterIcon(boolean showFilterIcon)
Sets the flag if the filter icon is shown on the title. |
void |
setShowFilterName(boolean showFilterName)
Sets the flag if the filter name is shown on the title. |
void |
setShowFilterNameAsToolTip(boolean showFilterNameAsToolTip)
Sets the flag if the filter name is displayed as tooltip on the box. |
void |
setShowSortArrow(boolean showSortArrow)
Sets the flag if the filter icon is shown on the title. |
void |
setSortArrowVisible(boolean sortArrowVisible)
|
void |
setSorted(boolean sorted)
|
void |
setTableModel(TableModel tableModel,
int columnIndex,
boolean isCellEditor)
Sets the table model onto AutoFilterBox. |
void |
setTarget(Component target)
|
void |
setText(String title)
|
void |
setTitleConverter(StringConverter titleConverter)
|
void |
setToolTipText(String tooltipText)
|
void |
setVerticalAlignment(int alignment)
Sets the vertical alignment of the content. |
protected void |
showCustomFilterEditor(IFilterableTableModel filterableTableModel,
int columnIndex,
Object[] possibleValues)
Shows CustomFilterEditor when "(Custom...) is selected in the drop down list. |
void |
sortChanged(SortEvent event)
Called whenever the sorting index of SortableTableModel changed. |
void |
sortChanging(SortEvent event)
Called whenever the sorting index of SortableTableModel is about to change. |
void |
toggleSortOrder()
|
void |
toggleSortOrder(boolean extend)
|
protected void |
updateFilterIndicator(IFilterableTableModel filterableTableModel)
Updates the filter indicator. |
| Methods inherited from class com.jidesoft.swing.HeaderBox |
|---|
getUIClassID, updateUI |
| Methods inherited from class com.jidesoft.swing.JideButton |
|---|
getBackgroundOfState, getButtonStyle, getCursor, getDefaultForeground, getForegroundOfState, getOrientation, isAlwaysShowHyperlink, setAlwaysShowHyperlink, setBackgroundOfState, setButtonStyle, setDefaultForeground, setForegroundOfState, setOrientation, supportHorizontalOrientation, supportVerticalOrientation |
| Methods inherited from class javax.swing.JButton |
|---|
getAccessibleContext, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jidesoft.swing.AlignmentSupport |
|---|
getHorizontalAlignment, getVerticalAlignment |
| Field Detail |
|---|
public static final String PROPERTY_TITLE
public static final String PROPERTY_ICON
public static final String PROPERTY_SORT_ARROW_VISIBLE
public static final String PROPERTY_FILTER_INDICATOR_VISIBLE
public static final String PROPERTY_FILTER_BUTTON_VISIBLE
public static final String PROPERTY_ASCENDING
public static final String PROPERTY_SORTED
public static final String PROPERTY_POSSIBLE_VALUES
protected Object HIDE_POPUP_KEY
| Constructor Detail |
|---|
public AutoFilterBox()
| Method Detail |
|---|
public void setTableModel(TableModel tableModel,
int columnIndex,
boolean isCellEditor)
AutoFilterBox.
tableModel - the table model.columnIndex - the column index for this auto filter, this is the view column index.isCellEditor - whether this is used as cell editor. The opposite is to be used as cell renderer.public void sortChanging(SortEvent event)
SortListener
sortChanging in interface SortListenerevent - the SortEventpublic void sortChanged(SortEvent event)
SortListener
sortChanged in interface SortListenerevent - the SortEventpublic void filterableTableModelChanged(FilterableTableModelEvent event)
FilterableTableModelListener
filterableTableModelChanged in interface FilterableTableModelListenerevent - FilterableTableModelEvent.public int getTableColumnIndex()
public int getModelColumnIndex()
protected void updateFilterIndicator(IFilterableTableModel filterableTableModel)
filterableTableModel - the FilterableTableModel. You can use it to find out if the column is filtered and what the filters are. The column index can be got from getTabelColumnIndex method.
protected String formatColumnTitle(String columnName,
Filter[] filters)
columnName - the name for the column.filters - the filters on the column
public AutoFilterBox.FilterTitleFormatter getFilterTitleFormatter()
public void setFilterTitleFormatter(AutoFilterBox.FilterTitleFormatter filterTitleFormatter)
filterTitleFormatter - the new FilterTitleFormatter.public boolean isMultiLineMode()
public void setMultiLineMode(boolean multiLineMode)
protected boolean isFiltered()
protected void initComponents(String text,
Icon icon,
boolean sortArrowVisible,
boolean filterButtonVisible,
boolean isCellEditor)
protected void installListeners()
public boolean isSortArrowVisible()
public void setSortArrowVisible(boolean sortArrowVisible)
public boolean isFilterIndicatorVisible()
public void setFilterIndicatorVisible(boolean filterIndicatorVisible)
public boolean isFilterButtonVisible()
public void setFilterButtonVisible(boolean filterButtonVisible)
public void setText(String title)
setText in class AbstractButtonpublic void setToolTipText(String tooltipText)
setToolTipText in class JComponentpublic String getText()
getText in class AbstractButtonpublic void setIcon(Icon icon)
setIcon in class AbstractButtonpublic boolean isAscending()
public void toggleSortOrder()
public void toggleSortOrder(boolean extend)
public void setAscending(boolean ascending)
public boolean isSorted()
public void setSorted(boolean sorted)
public Object[] getPossibleValues()
public void setPossibleValues(Object[] possibleValues)
protected void applyFilter(Filter filter,
int columnIndex)
FilterableTableModel.
filter - the filter.columnIndex - the column index.
protected void applyFilter(Filter filter,
int columnIndex,
boolean clearFirst)
protected AbstractButton createDefaultButton()
protected JidePopup createPopupWindow()
public Object[] getPossibleValues(ObjectGrouper objectGrouper,
Object[] values,
Comparator comparator)
protected PopupPanel createPopupPanel(TableModel tableModel,
int columnIndex,
Object[] possibleValues)
tableModel - the table modelcolumnIndex - the column index to create the popup panelpossibleValues - possible values to be displayed
protected void showCustomFilterEditor(IFilterableTableModel filterableTableModel,
int columnIndex,
Object[] possibleValues)
filterableTableModel - the FilterableTableModelcolumnIndex - the column index of the AutoFilterBox relative to the filterableTableModel.possibleValues - the possible values of the column in the table model.
protected StandardDialog createCustomFilterEditorDialog(Container container,
String title,
CustomFilterEditor filterEditor)
container - the top level ancestor of the AutoFilterBox.title - the title of the dialog.filterEditor - the CustomFilterEditor.
protected CustomFilterEditor createCustomFilterEditor(FilterFactoryManager filterFactoryManager,
Class<?> type,
ConverterContext converterContext,
Object[] possibleValues)
filterFactoryManager - the FilterFactoryManager.type - the type.converterContext - the ConverterContext.possibleValues - the possible values.
protected void customizeList(JList list)
new ListSearchable(list) {
protected String convertElementToString(Object object) {
return cellRenderer.convertElementToString(list.getLocale(), object);
}
};
list - the list generated by possible values
protected String convertElementToString(Object item,
boolean isArray,
ObjectGrouper grouper)
protected String convertElementToString(Object item)
item - the item
protected String convertElementToString(Object item,
ConverterContext context)
item - the itemcontext - the converter context
protected Point calculatePopupLocation()
public void hidePopup()
public boolean isPopupVisible()
public void addDynamicTableFilter(DynamicTableFilter filter)
DynamicTableFilter. DynamicTableFilter allows to add your own customize filter to the drop down filter list. Any DynamicTableFilter will become an entry in the list. If user clicks on that entry, the filter will be used to filter the column. What's special about DynamicTableFilter is it allows to to create a filter on fly. For example, in initializeFilter method of DynamicTableFilter, you can pop up a dialog to allow user to select certain information and you return a filter based on user selection. If returning null, no filter will be added. If not null, the filter you just created will be added to the FilterableTableModel.
filter - a DynamicTableFilter.public void removeDynamicTableFilter(DynamicTableFilter filter)
DynamicTableFilter which was added earlier.
filter - a DynamicTableFilter.public DynamicTableFilter[] getDynamicTableFilters()
DynamicTableFilters.
DynamicTableFilters.protected void paintComponent(Graphics g)
paintComponent in class JComponentprotected void paintFilterIndicator(Graphics g)
g - the Graphics objectpublic boolean isShowFilterName()
public void setShowFilterName(boolean showFilterName)
showFilterName - true to show the filter name. False to not show it.public boolean isShowFilterNameAsToolTip()
public void setShowFilterNameAsToolTip(boolean showFilterNameAsToolTip)
showFilterNameAsToolTip - true to show the filter name as tooltip. False to not show it.public boolean isShowFilterIcon()
public void setShowFilterIcon(boolean showFilterIcon)
showFilterIcon - true to show the filter icon. False to not show it.public boolean isShowSortArrow()
public void setShowSortArrow(boolean showSortArrow)
showSortArrow - true to show the filter icon. False to not show it.public Component getTarget()
public void setTarget(Component target)
public void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic boolean isAllowMultipleValues()
AutoFilterTableHeader allows multiple values as the filter. The difference will be to use a CheckBoxList or a regular JList as the popup panel when clicking on the filter button.
public void setAllowMultipleValues(boolean allowMultipleValues)
AutoFilterTableHeader allows multiple values as the filter. The difference will be to use a CheckBoxList or a regular JList as the popup panel when clicking on the filter button.
allowMultipleValues - true to allow multiple value filters. False to disallow it. Default is false.public boolean isAllowCustomFilter()
AutoFilterTableHeader allows custom filter. The difference is there will be a (Custom...) item in the drop down list.when clicking on the filter button. The value is only considered when isAllowMultipleValues() returns false.
public void setAllowCustomFilter(boolean allowCustomFilter)
AutoFilterTableHeader allows custom filter. The difference is there will be a (Custom...) item in the drop down list.when clicking on the filter button. The value is only considered when isAllowMultipleValues() returns false.
allowCustomFilter - true to allow custom filter. False to disallow it. Default is true.public void setVerticalAlignment(int alignment)
AlignmentSupport
setVerticalAlignment in interface AlignmentSupportsetVerticalAlignment in class AbstractButtonalignment - one of the following values:
SwingConstants.CENTER (the default)
SwingConstants.TOP
SwingConstants.BOTTOM
public void setHorizontalAlignment(int alignment)
AlignmentSupportAbstractButton's default is SwingConstants.CENTER,
but subclasses such as JCheckBox may use a different default.
setHorizontalAlignment in interface AlignmentSupportsetHorizontalAlignment in class AbstractButtonalignment - the alignment value, one of the following values:
SwingConstants.RIGHT
SwingConstants.LEFT
SwingConstants.CENTER
SwingConstants.LEADING
SwingConstants.TRAILING
public Icon getDescendingIcon()
public void setDescendingIcon(Icon descendingIcon)
public Icon getAscendingIcon()
public void setAscendingIcon(Icon ascendingIcon)
ascendingIcon - the new ascending iconpublic ListCellRenderer getListCellRenderer()
public void setListCellRenderer(ListCellRenderer listCellRenderer)
listCellRenderer - the new list cell renderer for the drop down filter list.public boolean isCellEditor()
public void setCellEditor(boolean cellEditor)
public StringConverter getTitleConverter()
public void setTitleConverter(StringConverter titleConverter)
public boolean isPreferSelectedValues()
AutoFilterTableHeader.isPreferSelectedValues()public void setPreferSelectedValues(boolean preferSelectedPossibleValues)
preferSelectedPossibleValues - the flagisPreferSelectedValues()
|
JIDE 2.9.5 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||