org.netbeans.swing.outline 1.7

org.netbeans.swing.etable
Class ETable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by org.netbeans.swing.etable.ETable
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
Outline

public class ETable
extends JTable

Note: This API is still under development and may change even in incompatible way during its stabilization phase. The API will be finalized in NetBeans version 6.5.

See Also:
Serialized Form

Nested Class Summary
static class ETable.RowMapping
          Item to the collection when doing the sorting of table rows.
 
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.PrintMode
 
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  int[] inverseSortingPermutation
          Inverse of the above
protected  int[] sortingPermutation
          Array with size exactly same as the number of rows in the data model or null.
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
ETable()
          Constructs a default JTable that is initialized with a default data model, a default column model, and a default selection model.
ETable(int numRows, int numColumns)
          Constructs a JTable with numRows and numColumns of empty cells using DefaultTableModel.
ETable(Object[][] rowData, Object[] columnNames)
          Constructs a JTable to display the values in the two dimensional array, rowData, with column names, columnNames.
ETable(TableModel dm)
          Constructs a JTable that is initialized with dm as the data model, a default column model, and a default selection model.
ETable(TableModel dm, TableColumnModel cm)
          Constructs a JTable that is initialized with dm as the data model, cm as the column model, and a default selection model.
ETable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
          Constructs a JTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model.
ETable(Vector rowData, Vector columnNames)
          Constructs a JTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.
 
Method Summary
protected  boolean acceptByQuickFilter(TableModel model, int row)
          Determines whether the given row should be displayed or not.
protected  void configureEnclosingScrollPane()
          Overriden to install special button into the upper right hand corner.
 int convertRowIndexToModel(int row)
          Helper method converting the row index according to the active sorting columns.
 int convertRowIndexToView(int row)
          Helper method converting the row index according to the active sorting columns.
 String convertValueToString(Object value)
          Used when copying into clipboard.
protected  TableColumn createColumn(int modelIndex)
          Allow to plug own TableColumn implementation.
protected  TableColumnModel createDefaultColumnModel()
          Overriden to use ETableColumnModel as TableColumnModel.
 void createDefaultColumnsFromModel()
          Overriden to use ETableColumns instead of the original TableColumns.
 void displaySearchField()
          Shows the search field.
 void doLayout()
          Overriden to place the search text field.
 boolean editCellAt(int row, int column, EventObject e)
          Overriden to force requesting the focus after the user starts editing.
 String getColumnDisplayName(String columnName)
          Allows subclasses to localize the column headers.
 TableColumnSelector getColumnSelector()
          Allows to supply alternative implementation of the column selection functionality in ETable.
static TableColumnSelector getDefaultColumnSelector()
          Default column selector is used when columnSelector is null.
 int getQuickFilterColumn()
          Get the column which is currently filtered by "quick-filter" object.
 JMenuItem getQuickFilterCompareItem(int column, Object value, String columnName, String text, boolean greater, boolean equalsCounts)
          Creates the menu item for setting the quick filter that filters the objects using Comparable interface.
 JMenuItem getQuickFilterEqualsItem(int column, Object value, String columnName, String text, boolean equals)
          Creates the menu item for setting the quick filter that filters the objects using equality (or non-equality).
 String[] getQuickFilterFormatStrings()
          Returns the quickFilterFormatStrings array.
 JMenuItem getQuickFilterNoFilterItem(String label)
          Creates the menu item for resetting the quick filter (to no filter).
 Object getQuickFilterObject()
          Get the "quick-filter" object that is currently active.
 JMenuItem getQuickFilterPopup(int column, Object value, String label)
          Creates a menu item usable in a popup that will trigger QuickFilter functionality for given column and value of the cell it was invoked on (returned from transformValue(getValueAt(column, row))).
 int getRowCount()
          If the quick-filter is applied the number of rows do not match the number of rows in the model.
 String getToolTipText(MouseEvent event)
          Overriden to make a speed optimization.
 String getTransferDelimiter(boolean line)
          Returns string used to delimit entries when copying into clipboard.
 Object getValueAt(int row, int column)
          Overriden to call convertRowIndexToModel(...).
protected  void initializeLocalVars()
          Overriden to do additional initialization.
 boolean isCellEditable(int row, int column)
          Returns true if the cell at row and column is editable.
 boolean isColumnHidingAllowed()
           
 boolean isFullyEditable()
          Returns true if ETable is fully editable.
 boolean isFullyNonEditable()
          Returns true if ETable is fully non-editable.
 boolean isPopupUsedFromTheCorner()
          The column selection corner can use either dialog or popup menu.
protected  boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
          Overriden to implement CTRL-+ for resizing of all columns, CTRL-- for clearing the quick filter and CTRL-* for invoking the column selection dialog.
 void readSettings(Properties p, String propertyPrefix)
          Method allowing to read stored values.
 void removeEditor()
          Overriden to track whether the remove request is in progress.
 void setCellBackground(Component renderer, boolean isSelected, int row, int column)
          Sets the table cell background colors accodring to NET UI guidelines.
 void setColumnHidingAllowed(boolean allowColumnHiding)
          Turn column hiding on/off
 void setColumnSelector(TableColumnSelector columnSelector)
          Allows to supply alternative implementation of the column selection functionality in ETable.
 void setColumnSorted(int columnIndex, boolean ascending, int rank)
          Make the column sorted.
static void setDefaultColumnSelector(TableColumnSelector aDefaultColumnSelector)
          Allows to supply the deafult column selector for all instances of ETable.
 void setFullyEditable(boolean fullyEditable)
          Sets all the cells in the ETable to be editable if fullyEditable is true.
 void setFullyNonEditable(boolean fullyNonEditable)
          Sets all the cells in the ETable to be non-editable if fullyNonEditable is true.
 void setModel(TableModel dataModel)
          Overriden to update the header listeners and also to adjust the preferred width of the collumns.
 void setPopupUsedFromTheCorner(boolean popupUsedFromTheCorner)
          The column selection corner can use either dialog or popup menu.
 void setQuickFilter(int column, Object filterObject)
          Makes the table disply only the rows that match the given "quick-filter".
 void setQuickFilterFormatStrings(String[] newFormats)
          Replaces the quickFilterFormatStrings by the given array.
 void setSelectVisibleColumnsLabel(String localizedLabel)
          Allows customization of the text appearing in the column customization dialog.
 void setValueAt(Object aValue, int row, int column)
          Overriden to call convertRowIndexToModel(...).
protected  void sortAndFilter()
          Sorts the rows of the table.
 void tableChanged(TableModelEvent e)
          If the table data model is changed we reset (and then recompute) the sorting permutation and the row count.
 Object transformValue(Object value)
          Allows subclasses to transform the value (usually obtained by calling getValueAt(...)) to another object that is used for sorting, comparison via quick filters etc.
 void unsetQuickFilter()
          Makes the table show all the rows, resetting the filter state (to no filter).
 void writeSettings(Properties p, String propertyPrefix)
          Method allowing to store customization values.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, sizeColumnsToFit, sizeColumnsToFit, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sortingPermutation

protected transient int[] sortingPermutation
Array with size exactly same as the number of rows in the data model or null. If it is not null the row originally at index i will be displayed on index sortingPermutation[i].


inverseSortingPermutation

protected transient int[] inverseSortingPermutation
Inverse of the above

Constructor Detail

ETable

public ETable()
Constructs a default JTable that is initialized with a default data model, a default column model, and a default selection model.

See Also:
JTable.createDefaultDataModel(), createDefaultColumnModel(), JTable.createDefaultSelectionModel()

ETable

public ETable(TableModel dm)
Constructs a JTable that is initialized with dm as the data model, a default column model, and a default selection model.

Parameters:
dm - the data model for the table
See Also:
createDefaultColumnModel(), JTable.createDefaultSelectionModel()

ETable

public ETable(TableModel dm,
              TableColumnModel cm)
Constructs a JTable that is initialized with dm as the data model, cm as the column model, and a default selection model.

Parameters:
dm - the data model for the table
cm - the column model for the table
See Also:
JTable.createDefaultSelectionModel()

ETable

public ETable(TableModel dm,
              TableColumnModel cm,
              ListSelectionModel sm)
Constructs a JTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model. If any of the parameters are null this method will initialize the table with the corresponding default model. The autoCreateColumnsFromModel flag is set to false if cm is non-null, otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in dm.

Parameters:
dm - the data model for the table
cm - the column model for the table
sm - the row selection model for the table
See Also:
JTable.createDefaultDataModel(), createDefaultColumnModel(), JTable.createDefaultSelectionModel()

ETable

public ETable(int numRows,
              int numColumns)
Constructs a JTable with numRows and numColumns of empty cells using DefaultTableModel. The columns will have names of the form "A", "B", "C", etc.

Parameters:
numRows - the number of rows the table holds
numColumns - the number of columns the table holds
See Also:
DefaultTableModel

ETable

public ETable(Vector rowData,
              Vector columnNames)
Constructs a JTable to display the values in the Vector of Vectors, rowData, with column names, columnNames. The Vectors contained in rowData should contain the values for that row. In other words, the value of the cell at row 1, column 5 can be obtained with the following code:

((Vector)rowData.elementAt(1)).elementAt(5);

Parameters:
rowData - the data for the new table
columnNames - names of each column

ETable

public ETable(Object[][] rowData,
              Object[] columnNames)
Constructs a JTable to display the values in the two dimensional array, rowData, with column names, columnNames. rowData is an array of rows, so the value of the cell at row 1, column 5 can be obtained with the following code:

 rowData[1][5]; 

All rows must be of the same length as columnNames.

Parameters:
rowData - the data for the new table
columnNames - names of each column
Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns true if the cell at row and column is editable. Otherwise, invoking setValueAt on the cell will have no effect.

Returns true always if the ETable is fully editable.

Returns false always if the ETable is fully non-editable.

Overrides:
isCellEditable in class JTable
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
true if the cell is editable
See Also:
setValueAt(java.lang.Object, int, int), setFullyEditable(boolean), setFullyNonEditable(boolean)

setFullyEditable

public void setFullyEditable(boolean fullyEditable)
Sets all the cells in the ETable to be editable if fullyEditable is true. if fullyEditable is false, sets the table cells into their default state as in JTable.

Parameters:
fullyEditable - true if the table is meant to be fully editable. false if the table is meant to take the defalut state for editing.
See Also:
isFullyEditable()

setFullyNonEditable

public void setFullyNonEditable(boolean fullyNonEditable)
Sets all the cells in the ETable to be non-editable if fullyNonEditable is true. If fullyNonEditable is false, sets the table cells into their default state as in JTable.

Parameters:
fullyNonEditable - true if the table is meant to be fully non-editable. false if the table is meant to take the defalut state for editing.
See Also:
isFullyNonEditable()

isFullyEditable

public boolean isFullyEditable()
Returns true if ETable is fully editable.

Returns:
true if the the table is fully editable.
See Also:
setFullyEditable(boolean)

isFullyNonEditable

public boolean isFullyNonEditable()
Returns true if ETable is fully non-editable.

Returns:
true if the the table is fully non-editable.
See Also:
setFullyNonEditable(boolean)

setCellBackground

public void setCellBackground(Component renderer,
                              boolean isSelected,
                              int row,
                              int column)
Sets the table cell background colors accodring to NET UI guidelines.

This is needed in case where the user does not use the NET Look and Feel, but still wants to paint the cell background colors accoring to NET L&F.

This needs to be called also in case where the user has custom table cell renderer (that is not a DefaultTableCellRenderer or a sub-class of it) for a cell even though NET L&F package is used, if the cell background colors need to be consistent for the custom renderer.

Parameters:
renderer - the custom cell renderer to be painted
isSelected - true if the custom cell is selected
row - the row, the custom cell corresponds to
column - the column, the custom cell corresponds to

createDefaultColumnsFromModel

public void createDefaultColumnsFromModel()
Overriden to use ETableColumns instead of the original TableColumns.

Overrides:
createDefaultColumnsFromModel in class JTable
See Also:
JTable.createDefaultColumnModel()

getTransferDelimiter

public String getTransferDelimiter(boolean line)
Returns string used to delimit entries when copying into clipboard. The default implementation returns new line character ("\n") if the line argument is true. If it is false the tab character ("\t") is returned.


convertValueToString

public String convertValueToString(Object value)
Used when copying into clipboard. The value passed to this method is obtained by calling getValueAt(...). The resulting string is put into clipboard. The default implementation returns an empty string ("") if the value is null and value.toString() otherwise. The method transformValue(value) is called prior to the string conversion.


createColumn

protected TableColumn createColumn(int modelIndex)
Allow to plug own TableColumn implementation. This implementation returns ETableColumn. Called from createDefaultColumnsFromModel().


createDefaultColumnModel

protected TableColumnModel createDefaultColumnModel()
Overriden to use ETableColumnModel as TableColumnModel.

Overrides:
createDefaultColumnModel in class JTable
See Also:
JTable.createDefaultColumnModel()

getValueAt

public Object getValueAt(int row,
                         int column)
Overriden to call convertRowIndexToModel(...).

Overrides:
getValueAt in class JTable
See Also:
JTable.getValueAt(int, int)

setValueAt

public void setValueAt(Object aValue,
                       int row,
                       int column)
Overriden to call convertRowIndexToModel(...).

Overrides:
setValueAt in class JTable
See Also:
JTable.setValueAt(Object, int, int)

getRowCount

public int getRowCount()
If the quick-filter is applied the number of rows do not match the number of rows in the model.

Overrides:
getRowCount in class JTable

setQuickFilter

public void setQuickFilter(int column,
                           Object filterObject)
Makes the table disply only the rows that match the given "quick-filter". Filtering is done according to values from column with index column and according to filterObject. There are 2 possibilities for the filterObject paramterer
  1. filterObject implements QuickFilter interface: the method accept(Object) of the QuickFilter is called to determine whether the row will be shown
  2. if filterObject does not implement the interface the value is compared using method equals(Object) with the filterObject. If they are equal the row will be shown.


getQuickFilterObject

public Object getQuickFilterObject()
Get the "quick-filter" object that is currently active.

Returns:
the filter object or null
See Also:
setQuickFilter(int, java.lang.Object)

getQuickFilterColumn

public int getQuickFilterColumn()
Get the column which is currently filtered by "quick-filter" object.

Returns:
the filtered column or -1
See Also:
setQuickFilter(int, java.lang.Object)

unsetQuickFilter

public void unsetQuickFilter()
Makes the table show all the rows, resetting the filter state (to no filter).


setModel

public void setModel(TableModel dataModel)
Overriden to update the header listeners and also to adjust the preferred width of the collumns.

Overrides:
setModel in class JTable
See Also:
JTable.setModel(TableModel)

getToolTipText

public String getToolTipText(MouseEvent event)
Overriden to make a speed optimization.

Overrides:
getToolTipText in class JTable

isColumnHidingAllowed

public boolean isColumnHidingAllowed()
Returns:
True if column hiding is allowed.

setColumnHidingAllowed

public void setColumnHidingAllowed(boolean allowColumnHiding)
Turn column hiding on/off

Parameters:
allowColumnHiding - false to turn column hiding off

initializeLocalVars

protected void initializeLocalVars()
Overriden to do additional initialization.

Overrides:
initializeLocalVars in class JTable
See Also:
JTable.initializeLocalVars()

processKeyBinding

protected boolean processKeyBinding(KeyStroke ks,
                                    KeyEvent e,
                                    int condition,
                                    boolean pressed)
Overriden to implement CTRL-+ for resizing of all columns, CTRL-- for clearing the quick filter and CTRL-* for invoking the column selection dialog.

Overrides:
processKeyBinding in class JTable
See Also:
JTable.processKeyBinding(KeyStroke, KeyEvent, int, boolean)

setColumnSorted

public void setColumnSorted(int columnIndex,
                            boolean ascending,
                            int rank)
Make the column sorted. Value of columnIndex is in the model coordinates. Be carefull with the columnIndes parameter: again, it is in the model coordinates.


configureEnclosingScrollPane

protected void configureEnclosingScrollPane()
Overriden to install special button into the upper right hand corner.

Overrides:
configureEnclosingScrollPane in class JTable
See Also:
JTable.configureEnclosingScrollPane()

tableChanged

public void tableChanged(TableModelEvent e)
If the table data model is changed we reset (and then recompute) the sorting permutation and the row count. The selection is restored when needed.

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class JTable

convertRowIndexToModel

public int convertRowIndexToModel(int row)
Helper method converting the row index according to the active sorting columns.


convertRowIndexToView

public int convertRowIndexToView(int row)
Helper method converting the row index according to the active sorting columns.


setSelectVisibleColumnsLabel

public void setSelectVisibleColumnsLabel(String localizedLabel)
Allows customization of the text appearing in the column customization dialog.


setQuickFilterFormatStrings

public void setQuickFilterFormatStrings(String[] newFormats)
Replaces the quickFilterFormatStrings by the given array. The new array must have the same length as the old one.


getQuickFilterFormatStrings

public String[] getQuickFilterFormatStrings()
Returns the quickFilterFormatStrings array.


getColumnDisplayName

public String getColumnDisplayName(String columnName)
Allows subclasses to localize the column headers. This method is called by the header renderer. The default implementation just returns passed in columnName.


transformValue

public Object transformValue(Object value)
Allows subclasses to transform the value (usually obtained by calling getValueAt(...)) to another object that is used for sorting, comparison via quick filters etc. The default implementation just returns the original value.


getQuickFilterPopup

public JMenuItem getQuickFilterPopup(int column,
                                     Object value,
                                     String label)
Creates a menu item usable in a popup that will trigger QuickFilter functionality for given column and value of the cell it was invoked on (returned from transformValue(getValueAt(column, row))).

Note: do not forget to call transformValue before passing the value to this method otherwise the quickfilters will not work.

The label should be localized version of the string the user will see in the popup menu, e.g. "Filter Column".


getQuickFilterEqualsItem

public JMenuItem getQuickFilterEqualsItem(int column,
                                          Object value,
                                          String columnName,
                                          String text,
                                          boolean equals)
Creates the menu item for setting the quick filter that filters the objects using equality (or non-equality).


getQuickFilterNoFilterItem

public JMenuItem getQuickFilterNoFilterItem(String label)
Creates the menu item for resetting the quick filter (to no filter).


getQuickFilterCompareItem

public JMenuItem getQuickFilterCompareItem(int column,
                                           Object value,
                                           String columnName,
                                           String text,
                                           boolean greater,
                                           boolean equalsCounts)
Creates the menu item for setting the quick filter that filters the objects using Comparable interface.


sortAndFilter

protected void sortAndFilter()
Sorts the rows of the table.


acceptByQuickFilter

protected boolean acceptByQuickFilter(TableModel model,
                                      int row)
Determines whether the given row should be displayed or not.


readSettings

public void readSettings(Properties p,
                         String propertyPrefix)
Method allowing to read stored values. The stored values should be only those that the user has customized, it does not make sense to store the values that were set using the initialization code because the initialization code can be run in the same way after restart.


writeSettings

public void writeSettings(Properties p,
                          String propertyPrefix)
Method allowing to store customization values. The stored values should be only those that the user has customized, it does not make sense to store the values that were set using the initialization code because the initialization code can be run in the same way after restart.


displaySearchField

public void displaySearchField()
Shows the search field.


doLayout

public void doLayout()
Overriden to place the search text field.

Overrides:
doLayout in class JTable
See Also:
JTable.doLayout()

editCellAt

public boolean editCellAt(int row,
                          int column,
                          EventObject e)
Overriden to force requesting the focus after the user starts editing.

Overrides:
editCellAt in class JTable
See Also:
JTable.editCellAt(int, int, EventObject)

removeEditor

public void removeEditor()
Overriden to track whether the remove request is in progress.

Overrides:
removeEditor in class JTable
See Also:
JTable.removeEditor()

getColumnSelector

public TableColumnSelector getColumnSelector()
Allows to supply alternative implementation of the column selection functionality in ETable. If columnSelector is null the defaultColumnSelector is returned by this method.


setColumnSelector

public void setColumnSelector(TableColumnSelector columnSelector)
Allows to supply alternative implementation of the column selection functionality in ETable.


isPopupUsedFromTheCorner

public boolean isPopupUsedFromTheCorner()
The column selection corner can use either dialog or popup menu.


setPopupUsedFromTheCorner

public void setPopupUsedFromTheCorner(boolean popupUsedFromTheCorner)
The column selection corner can use either dialog or popup menu.


getDefaultColumnSelector

public static TableColumnSelector getDefaultColumnSelector()
Default column selector is used when columnSelector is null.


setDefaultColumnSelector

public static void setDefaultColumnSelector(TableColumnSelector aDefaultColumnSelector)
Allows to supply the deafult column selector for all instances of ETable.


org.netbeans.swing.outline 1.7

Built on November 7 2009.  |  Portions Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.