com.mucommander.ui.main.table
Class FileTable

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 com.mucommander.ui.main.table.FileTable
All Implemented Interfaces:
ConfigurationListener, ActivePanelListener, ThemeListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable

public class FileTable
extends javax.swing.JTable
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, java.awt.event.FocusListener, ActivePanelListener, ConfigurationListener, ThemeListener

A heavily modified JTable which displays a folder's contents and allows file mouse and keyboard selection, marking and navigation. JTable provides the basics for file selection but its behavior has to be extended to allow file marking.

Author:
Maxence Bernard, Nicolas Rinaudo
See Also:
Serialized Form

Nested Class Summary
 class FileTable.QuickSearch
          This inner class enables quick search functionality on the FileTable, which allows to
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
FileTable(MainFrame mainFrame, FolderPanel folderPanel, FileTableConfiguration conf)
           
 
Method Summary
 void activePanelChanged(FolderPanel folderPanel)
          This method is invoked when the currently active (i.e.
 void addTableSelectionListener(TableSelectionListener listener)
          Adds the given TableSelectionListener to the list of listeners that are registered to receive notifications when the currently selected file changes.
 void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
          Overrides the changeSelection method from JTable to track the current selected row (the one that has focus) and fire a TableSelectionListener.selectedFileChanged(FileTable) event to registered listeners.
 void colorChanged(ColorChangedEvent event)
          Not used.
 void configurationChanged(ConfigurationEvent event)
          Listens to certain configuration variables.
 void doLayout()
          Overrides JTable's doLayout() method to use a custom column layout (if auto-column sizing is enabled).
 void editCurrentFilename()
          Turns on the filename editor on current row.
 void fireMarkedFilesChangedEvent()
          Notifies all registered listeners that the currently marked files have changed on this FileTable.
 void fireSelectedFileChangedEvent()
          Notifies all registered listeners that the currently selected file has changed on this FileTable.
 void focusGained(java.awt.event.FocusEvent e)
          Restores selection when focus is gained.
 void focusLost(java.awt.event.FocusEvent e)
          Hides selection when focus is lost.
 void fontChanged(FontChangedEvent event)
          Receives theme font changes notifications.
 boolean getAutoSizeColumnsEnabled()
          Returns true if auto columns sizing is currently enabled.
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
          Method overriden to return a custom TableCellRenderer.
 int getColumnPosition(int colNum)
           
 int getColumnWidth(int columnId)
           
 FileTableConfiguration getConfiguration()
           
 AbstractFile getCurrentFolder()
          Returns the folder currently displayed by this FileTable.
 FileTableColumnModel getFileTableColumnModel()
          Convenience method that returns this table's javax.swing.table.TableColumnModel cast as a FileTableColumnModel.
 FileTableModel getFileTableModel()
          Convenience method that returns this table's model (the one that JTable.getModel() returns), as a FileTableModel, to avoid having to cast it.
 FolderPanel getFolderPanel()
          Returns the FolderPanel that contains this FileTable.
 int getPageRowIncrement()
          Returns the number of rows that a page down/page up action should jump, based on this FileTable's viewport size.
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 java.awt.Dimension getPreferredSize()
           
 FileTable.QuickSearch getQuickSearch()
          Returns the FileTable.QuickSearch inner class instance used by this FileTable.
 AbstractFile getSelectedFile()
          Returns the file that is currently selected (highlighted), null if the parent folder '..' is currently selected.
 AbstractFile getSelectedFile(boolean includeParentFolder)
          Returns the file that is currently selected (highlighted).
 AbstractFile getSelectedFile(boolean includeParentFolder, boolean returnCachedFile)
          Returns the file that is currently selected (highlighted), wrapped in a CachedFile instance if the corresponding parameter is true.
 FileSet getSelectedFiles()
          Returns selected files in a FileSet.
 SortInfo getSortInfo()
          Returns a SortInfo instance that holds information about how this table is currently sorted.
 boolean isActiveTable()
          Returns true/ if this table is the active one in the MainFrame.
 boolean isAutoSizeColumnsEnabled()
          Returns true if the auto-columns sizing is currently enabled.
 boolean isColumnDisplayable(int colNum)
          Returns true if the given column can be displayed given the current folder.
 boolean isColumnEnabled(int colNum)
          Returns true if the specified column is enabled.
 boolean isColumnVisible(int colNum)
          Returns true if the specified column is currently visible.
 boolean isParentFolder(int row)
          Returns true if the given row is the parent folder '..' .
 boolean isParentFolderSelected()
          Returns true if the currently selected row/file is the parent folder '..' .
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void markSelectedFile()
          Marks or unmarks the current selected file (current row) and advance current row to the next one, with the following exceptions: if quick search is active, this method does nothing if '..' file is selected, file is not marked but current row is still advanced to the next one if the MarkSelectedFileAction key event is repeated and the last file has already been marked/unmarked since the key was last released, the file is not marked in order to avoid marked/unmarked flaps when the mark key is kept pressed.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  boolean processKeyBinding(javax.swing.KeyStroke ks, java.awt.event.KeyEvent ke, int condition, boolean pressed)
          Method overriden to consume keyboard events when quick search is active or when a row is being editing in order to prevent registered actions from being fired.
 void removeTableSelectionListener(TableSelectionListener listener)
          Removes the given TableSelectionListener from the list of listeners that are registered to receive notifications when the currently selected file changes.
 void reverseSortOrder()
          Reverses the current sort order, from ascending to descending or vice-versa.
 void selectFile(AbstractFile file)
          Selects the given file, does nothing if this table does not contain the file.
 void selectRow(int row)
          Makes the given row the currently selected one.
 void setAutoSizeColumnsEnabled(boolean enabled)
          Enables/disables auto-columns sizing, which automatically resizes columns to fit the table's width.
 void setColumnEnabled(int colNum, boolean enabled)
          Enables/disables the specified column.
 void setColumnModel(javax.swing.table.TableColumnModel columnModel)
           
 void setCurrentFolder(AbstractFile folder, AbstractFile[] children)
          Changes the current folder, preserving the current file selection if the folder hasn't changed.
 void setCurrentFolder(AbstractFile folder, AbstractFile[] children, AbstractFile select)
          Changes the current folder, selecting the specified file if it can be found in the folder.
 void setFileMarked(AbstractFile file, boolean marked)
          Sets the given file as marked/unmarked in the table model, repaints the corresponding row to reflect the change, and notifies registered TableSelectionListener that currently marked files have changed on this FileTable.
 void setFoldersFirst(boolean enabled)
          Controls whether folders are displayed first in this FileTable or mixed with regular files.
 void setRangeMarked(int startRow, int endRow, boolean marked)
          Marks or unmarks a range of rows, delimited by the provided start row index and end row index (inclusive).
 void setRowMarked(int row, boolean marked)
          Sets the given row as marked/unmarked in the table model, repaints the row to reflect the change, and notifies registered TableSelectionListener that the files currently marked on this FileTable have changed.
 void sortBy(int criterion)
          Sorts this FileTable by the given sort criterion.
 void sortBy(int criterion, boolean ascending)
          Sorts this FileTable by the given sort criterion and order.
 void sortBy(int criterion, boolean ascending, boolean foldersFirst)
          Sorts this FileTable by the given sort criterion, order and 'folders first' value.
 void sortBy(SortInfo sortInfo)
          Calls sortBy(int, boolean, boolean) with the sort information contained in the given SortInfo.
 java.lang.String toString()
          Overridden for debugging purposes.
 void updateColumnsVisibility()
          Updates the visibility of all columns based on their enabled state, and for conditional columns on the current folder.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, 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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileTable

public FileTable(MainFrame mainFrame,
                 FolderPanel folderPanel,
                 FileTableConfiguration conf)
Method Detail

getFolderPanel

public FolderPanel getFolderPanel()
Returns the FolderPanel that contains this FileTable.

Returns:
the FolderPanel that contains this FileTable

isActiveTable

public boolean isActiveTable()
Returns true/ if this table is the active one in the MainFrame. Being the active table doesn't necessarily mean that it currently has focus, the focus can be in some other component of the active FolderPanel, or nowhere in the MainFrame if the window is not in the foreground.

Use Component.hasFocus() to test if the table currently has focus.

Returns:
true if this table is the active one in the MainFrame
See Also:
MainFrame.getActiveTable()

getFileTableModel

public FileTableModel getFileTableModel()
Convenience method that returns this table's model (the one that JTable.getModel() returns), as a FileTableModel, to avoid having to cast it.

Returns:
this table's model cast as a FileTableModel

getSortInfo

public SortInfo getSortInfo()
Returns a SortInfo instance that holds information about how this table is currently sorted.

Returns:
a SortInfo instance that holds information about how this table is currently sorted

getQuickSearch

public FileTable.QuickSearch getQuickSearch()
Returns the FileTable.QuickSearch inner class instance used by this FileTable.

Returns:
the QuickSearch inner class instance used by this FileTable

getSelectedFile

public AbstractFile getSelectedFile()
Returns the file that is currently selected (highlighted), null if the parent folder '..' is currently selected.

Returns:
the file that is currently selected (highlighted), null if the parent folder '..' is currently selected

getSelectedFile

public AbstractFile getSelectedFile(boolean includeParentFolder)
Returns the file that is currently selected (highlighted). If the currently selected file is the parent folder '..', the parent folder is returned only if the corresponding parameter is true.

Parameters:
includeParentFolder - if true and parent folder '..' is currently selected, the parent folder will be returned.
Returns:
the file that is currently selected (highlighted)

getSelectedFile

public AbstractFile getSelectedFile(boolean includeParentFolder,
                                    boolean returnCachedFile)
Returns the file that is currently selected (highlighted), wrapped in a CachedFile instance if the corresponding parameter is true. If the currently selected file is the parent folder '..', the parent folder is returned only if the corresponding parameter is true.

Parameters:
includeParentFolder - if true and the parent folder '..' is currently selected, the parent folder file will be returned. If false, null will be returned if the parent folder file is currently selected.
returnCachedFile - if true, a CachedFile corresponding to the currently selected file will be returned
Returns:
the file that is currently selected (highlighted)

getSelectedFiles

public FileSet getSelectedFiles()
Returns selected files in a FileSet. Selected files are either the marked files or the currently selected file if no file is currently marked. The parent folder '..' is never included in the returned set.

Returns:
selected files in a FileSet

isParentFolderSelected

public boolean isParentFolderSelected()
Returns true if the currently selected row/file is the parent folder '..' .

Returns:
true if the currently selected row/file is the parent folder '..'

isParentFolder

public boolean isParentFolder(int row)
Returns true if the given row is the parent folder '..' .

Parameters:
row - index of the row to test
Returns:
true if the given row is the parent folder '..'

getCurrentFolder

public AbstractFile getCurrentFolder()
Returns the folder currently displayed by this FileTable.

Returns:
the folder currently displayed by this FileTable

setCurrentFolder

public void setCurrentFolder(AbstractFile folder,
                             AbstractFile[] children)
Changes the current folder, preserving the current file selection if the folder hasn't changed.

Parameters:
folder - the new folder
children - child files of the new folder

setCurrentFolder

public void setCurrentFolder(AbstractFile folder,
                             AbstractFile[] children,
                             AbstractFile select)
Changes the current folder, selecting the specified file if it can be found in the folder. The current file selection is preserved if the folder hasn't changed.

Parameters:
folder - the new folder
children - child files of the new folder
select - the file to select (highlight), can be null.

isAutoSizeColumnsEnabled

public boolean isAutoSizeColumnsEnabled()
Returns true if the auto-columns sizing is currently enabled.

Returns:
true if the auto-columns sizing is currently enabled

setAutoSizeColumnsEnabled

public void setAutoSizeColumnsEnabled(boolean enabled)
Enables/disables auto-columns sizing, which automatically resizes columns to fit the table's width.

Parameters:
enabled - true to enable auto-columns sizing, false to disable it

getAutoSizeColumnsEnabled

public boolean getAutoSizeColumnsEnabled()
Returns true if auto columns sizing is currently enabled.

Returns:
true if auto columns sizing is currently enabled

setFoldersFirst

public void setFoldersFirst(boolean enabled)
Controls whether folders are displayed first in this FileTable or mixed with regular files. After calling this method, the table is refreshed to reflect the change.

Parameters:
enabled - if true, folders are displayed before regular files. If false, files are mixed with directories.

selectFile

public void selectFile(AbstractFile file)
Selects the given file, does nothing if this table does not contain the file.

Parameters:
file - the file to select

selectRow

public void selectRow(int row)
Makes the given row the currently selected one.

Parameters:
row - index of the row to select

setRowMarked

public void setRowMarked(int row,
                         boolean marked)
Sets the given row as marked/unmarked in the table model, repaints the row to reflect the change, and notifies registered TableSelectionListener that the files currently marked on this FileTable have changed.

This method has no effect if the row corresponds to the parent folder row '..' .

Parameters:
row - index of the row to select
marked - true to mark the row, false to unmark it

setFileMarked

public void setFileMarked(AbstractFile file,
                          boolean marked)
Sets the given file as marked/unmarked in the table model, repaints the corresponding row to reflect the change, and notifies registered TableSelectionListener that currently marked files have changed on this FileTable.

Parameters:
file - file to select
marked - true to mark the file, false to unmark it

markSelectedFile

public void markSelectedFile()
Marks or unmarks the current selected file (current row) and advance current row to the next one, with the following exceptions:

See Also:
MarkSelectedFileAction

setRangeMarked

public void setRangeMarked(int startRow,
                           int endRow,
                           boolean marked)
Marks or unmarks a range of rows, delimited by the provided start row index and end row index (inclusive). End row index can be lower, greater or equals to the start row.

Parameters:
startRow - index of the first row to repaint
endRow - index of the last row to mark, can be lower, greater or equals to startRow
marked - if true, the rows will be marked, unmarked otherwise

getPageRowIncrement

public int getPageRowIncrement()
Returns the number of rows that a page down/page up action should jump, based on this FileTable's viewport size. The returned number doesn't take into account the number of rows available in this FileTable.

Returns:
the number of rows that a page down/page up action should jump

sortBy

public void sortBy(int criterion,
                   boolean ascending,
                   boolean foldersFirst)
Sorts this FileTable by the given sort criterion, order and 'folders first' value. The criterion and ascending order will be ignored if the corresponding column is not currently visible, but the 'folders first' value will still be taken into account.

Parameters:
criterion - the sort criterion, see Columns for allowed values
ascending - true for ascending order, false for descending order
foldersFirst - if true, folders are displayed before regular files. If false, files are mixed with directories.

sortBy

public void sortBy(SortInfo sortInfo)
Calls sortBy(int, boolean, boolean) with the sort information contained in the given SortInfo.

Parameters:
sortInfo - the information to use to sort this table.

sortBy

public void sortBy(int criterion,
                   boolean ascending)
Sorts this FileTable by the given sort criterion and order. The column corresponding to the specified criterion has to be visible when this method is called. If it isn't, this method won't have any effect.

Parameters:
criterion - the sort criterion, see Columns for allowed values
ascending - true for ascending order, false for descending order

sortBy

public void sortBy(int criterion)
Sorts this FileTable by the given sort criterion. If the criterion is already the current one, the sort order (ascending or descending) will be reversed.

Parameters:
criterion - the sort criterion, see Columns for allowed values

getFileTableColumnModel

public FileTableColumnModel getFileTableColumnModel()
Convenience method that returns this table's javax.swing.table.TableColumnModel cast as a FileTableColumnModel.

Returns:
this table's TableColumnModel cast as a FileTableColumnModel

setColumnModel

public void setColumnModel(javax.swing.table.TableColumnModel columnModel)
Overrides:
setColumnModel in class javax.swing.JTable

isColumnVisible

public boolean isColumnVisible(int colNum)
Returns true if the specified column is currently visible.

Parameters:
colNum - column index, see Columns for allowed values
Returns:
true if the specified column is currently visible

isColumnDisplayable

public boolean isColumnDisplayable(int colNum)
Returns true if the given column can be displayed given the current folder. Certain columns such as Columns.OWNER and Columns.GROUP can be displayed only if the current folder can supply this information for the files it contains. Note that the return value does not take into account the column's current enabled state.

Parameters:
colNum - column index, see Columns for allowed values
Returns:
true if the given column can be displayed given the current folder

updateColumnsVisibility

public void updateColumnsVisibility()
Updates the visibility of all columns based on their enabled state, and for conditional columns on the current folder.


isColumnEnabled

public boolean isColumnEnabled(int colNum)
Returns true if the specified column is enabled.

Parameters:
colNum - column index, see Columns for allowed values
Returns:
true if the specified column is enabled

setColumnEnabled

public void setColumnEnabled(int colNum,
                             boolean enabled)
Enables/disables the specified column. Disabling a column will make it invisible. Enabling a column will make it visible only if the column can be displayed. See isColumnDisplayable(int) for more information about this.

If the current sort criterion corresponds to the specified column and this column is disabled, the sort criterion will be reset to Columns.NAME to prevent the table from being sorted by an invisible column/criterion.

Parameters:
colNum - identifier of the column which should be enabled or disabled, see Columns for allowed values
enabled - true to enable the column, false to disable it.

getColumnPosition

public int getColumnPosition(int colNum)

reverseSortOrder

public void reverseSortOrder()
Reverses the current sort order, from ascending to descending or vice-versa.


editCurrentFilename

public void editCurrentFilename()
Turns on the filename editor on current row.


addTableSelectionListener

public void addTableSelectionListener(TableSelectionListener listener)
Adds the given TableSelectionListener to the list of listeners that are registered to receive notifications when the currently selected file changes.

Parameters:
listener - the TableSelectionListener instance to add to the list of registered listeners.

removeTableSelectionListener

public void removeTableSelectionListener(TableSelectionListener listener)
Removes the given TableSelectionListener from the list of listeners that are registered to receive notifications when the currently selected file changes. The listener will not receive any further notification after this method has been called (or soon after if events are pending).

Parameters:
listener - the TableSelectionListener instance to add to the list of registered listeners.

fireSelectedFileChangedEvent

public void fireSelectedFileChangedEvent()
Notifies all registered listeners that the currently selected file has changed on this FileTable.


fireMarkedFilesChangedEvent

public void fireMarkedFilesChangedEvent()
Notifies all registered listeners that the currently marked files have changed on this FileTable.


doLayout

public void doLayout()
Overrides JTable's doLayout() method to use a custom column layout (if auto-column sizing is enabled).

Overrides:
doLayout in class javax.swing.JTable

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)
Method overriden to return a custom TableCellRenderer.

Overrides:
getCellRenderer in class javax.swing.JTable

processKeyBinding

protected boolean processKeyBinding(javax.swing.KeyStroke ks,
                                    java.awt.event.KeyEvent ke,
                                    int condition,
                                    boolean pressed)
Method overriden to consume keyboard events when quick search is active or when a row is being editing in order to prevent registered actions from being fired.

Overrides:
processKeyBinding in class javax.swing.JTable

changeSelection

public void changeSelection(int rowIndex,
                            int columnIndex,
                            boolean toggle,
                            boolean extend)
Overrides the changeSelection method from JTable to track the current selected row (the one that has focus) and fire a TableSelectionListener.selectedFileChanged(FileTable) event to registered listeners.

Overrides:
changeSelection in class javax.swing.JTable

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
Overrides:
getPreferredScrollableViewportSize in class javax.swing.JTable

toString

public java.lang.String toString()
Overridden for debugging purposes.

Overrides:
toString in class java.awt.Component

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Restores selection when focus is gained.

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Hides selection when focus is lost.

Specified by:
focusLost in interface java.awt.event.FocusListener

activePanelChanged

public void activePanelChanged(FolderPanel folderPanel)
Description copied from interface: ActivePanelListener
This method is invoked when the currently active (i.e. that has focus) folder panel has changed on the MainFrame.

Specified by:
activePanelChanged in interface ActivePanelListener
Parameters:
folderPanel - the new active FolderPanel.

configurationChanged

public void configurationChanged(ConfigurationEvent event)
Listens to certain configuration variables.

Specified by:
configurationChanged in interface ConfigurationListener
Parameters:
event - describes the configuration modification.

colorChanged

public void colorChanged(ColorChangedEvent event)
Not used.

Specified by:
colorChanged in interface ThemeListener

fontChanged

public void fontChanged(FontChangedEvent event)
Receives theme font changes notifications.

Specified by:
fontChanged in interface ThemeListener

getConfiguration

public FileTableConfiguration getConfiguration()

getColumnWidth

public int getColumnWidth(int columnId)


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard