Search in sources :

Example 1 with FileTable

use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.

the class ShowFilePopupMenuAction method performAction.

@Override
public void performAction(FileSet files) {
    FileTable table = mainFrame.getActiveTable();
    int currentRow = table.getSelectedRow();
    // Does the row correspond to the parent '..' folder ?
    boolean parentFolderClicked = currentRow == 0 && table.getFileTableModel().hasParentFolder();
    TablePopupMenu popupMenu = new TablePopupMenu(mainFrame, table.getFolderPanel().getCurrentFolder(), parentFolderClicked ? null : table.getSelectedFile(), parentFolderClicked, files);
    // find coordinates of current row and show popup menu bellow it
    Rectangle rect = table.getCellRect(currentRow, table.getSelectedColumn(), true);
    popupMenu.show(table, 0, rect.y + rect.height);
}
Also used : Rectangle(java.awt.Rectangle) FileTable(com.mucommander.ui.main.table.FileTable) TablePopupMenu(com.mucommander.ui.main.menu.TablePopupMenu)

Example 2 with FileTable

use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.

the class MarkForwardAction method performAction.

// ///////////////////////////
// MuAction implementation //
// ///////////////////////////
@Override
public void performAction() {
    FileTable fileTable = mainFrame.getActiveTable();
    int currentRow = fileTable.getSelectedRow();
    int lastRow = fileTable.getRowCount() - 1;
    int endRow = Math.min(lastRow, currentRow + getRowIncrement() - 1);
    fileTable.setRangeMarked(currentRow, endRow, !fileTable.getFileTableModel().isRowMarked(currentRow));
    fileTable.selectRow(Math.min(lastRow, endRow + 1));
}
Also used : FileTable(com.mucommander.ui.main.table.FileTable)

Example 3 with FileTable

use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.

the class CompareFoldersAction method performAction.

@Override
public void performAction() {
    FileTable leftTable = mainFrame.getLeftPanel().getFileTable();
    FileTable rightTable = mainFrame.getRightPanel().getFileTable();
    FileTableModel leftTableModel = leftTable.getFileTableModel();
    FileTableModel rightTableModel = rightTable.getFileTableModel();
    int nbFilesLeft = leftTableModel.getFileCount();
    int nbFilesRight = rightTableModel.getFileCount();
    int fileIndex;
    String tempFileName;
    AbstractFile tempFile;
    for (int i = 0; i < nbFilesLeft; i++) {
        tempFile = leftTableModel.getFileAt(i);
        if (tempFile.isDirectory())
            continue;
        tempFileName = tempFile.getName();
        fileIndex = -1;
        for (int j = 0; j < nbFilesRight; j++) if (rightTableModel.getFileAt(j).getName().equals(tempFileName)) {
            fileIndex = j;
            break;
        }
        if (fileIndex == -1 || rightTableModel.getFileAt(fileIndex).getDate() < tempFile.getDate()) {
            leftTableModel.setFileMarked(tempFile, true);
            leftTable.repaint();
        }
    }
    for (int i = 0; i < nbFilesRight; i++) {
        tempFile = rightTableModel.getFileAt(i);
        if (tempFile.isDirectory())
            continue;
        tempFileName = tempFile.getName();
        fileIndex = -1;
        for (int j = 0; j < nbFilesLeft; j++) if (leftTableModel.getFileAt(j).getName().equals(tempFileName)) {
            fileIndex = j;
            break;
        }
        if (fileIndex == -1 || leftTableModel.getFileAt(fileIndex).getDate() < tempFile.getDate()) {
            rightTableModel.setFileMarked(tempFile, true);
            rightTable.repaint();
        }
    }
    // Notify registered listeners that currently marked files have changed on the file tables
    leftTable.fireMarkedFilesChangedEvent();
    rightTable.fireMarkedFilesChangedEvent();
}
Also used : FileTableModel(com.mucommander.ui.main.table.FileTableModel) AbstractFile(com.mucommander.commons.file.AbstractFile) FileTable(com.mucommander.ui.main.table.FileTable)

Example 4 with FileTable

use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.

the class FocusNextAction method performAction.

@Override
public void performAction() {
    Component focusOwner = mainFrame.getFocusOwner();
    // Abort if the focus is not in the MainFrame this action is tied to
    if (focusOwner == null)
        return;
    FolderPanel folderPanel = mainFrame.getActivePanel();
    FileTable fileTable = folderPanel.getFileTable();
    JTextField locationField = folderPanel.getLocationTextField();
    JTree tree = folderPanel.getFoldersTreePanel().getTree();
    // Request focus on the 'next' component, the cycle order being from left to right, top to bottom.
    Component nextComponent;
    if (focusOwner == locationField)
        nextComponent = folderPanel.isTreeVisible() ? tree : fileTable;
    else if (focusOwner == tree)
        nextComponent = fileTable;
    else if (focusOwner == fileTable)
        nextComponent = locationField;
    else
        return;
    FocusRequester.requestFocusInWindow(nextComponent);
}
Also used : JTree(javax.swing.JTree) FileTable(com.mucommander.ui.main.table.FileTable) Component(java.awt.Component) JTextField(javax.swing.JTextField) FolderPanel(com.mucommander.ui.main.FolderPanel)

Example 5 with FileTable

use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.

the class RenameAction method performAction.

@Override
public void performAction() {
    FileTable activeTable = mainFrame.getActiveTable();
    AbstractFile selectedFile = activeTable.getSelectedFile(false);
    // Trigger in-table editing only if a file other than parent folder '..' is selected
    if (selectedFile != null) {
        // Trigger in-table renaming
        activeTable.editCurrentFilename();
    }
}
Also used : AbstractFile(com.mucommander.commons.file.AbstractFile) FileTable(com.mucommander.ui.main.table.FileTable)

Aggregations

FileTable (com.mucommander.ui.main.table.FileTable)25 AbstractFile (com.mucommander.commons.file.AbstractFile)10 FileTableModel (com.mucommander.ui.main.table.FileTableModel)8 FolderPanel (com.mucommander.ui.main.FolderPanel)3 MainFrame (com.mucommander.ui.main.MainFrame)2 TablePopupMenu (com.mucommander.ui.main.menu.TablePopupMenu)2 Component (java.awt.Component)2 Rectangle (java.awt.Rectangle)2 JTextField (javax.swing.JTextField)2 JTree (javax.swing.JTree)2 AbstractFilenameFilter (com.mucommander.commons.file.filter.AbstractFilenameFilter)1 AndFileFilter (com.mucommander.commons.file.filter.AndFileFilter)1 AttributeFileFilter (com.mucommander.commons.file.filter.AttributeFileFilter)1 ContainsFilenameFilter (com.mucommander.commons.file.filter.ContainsFilenameFilter)1 EndsWithFilenameFilter (com.mucommander.commons.file.filter.EndsWithFilenameFilter)1 EqualsFilenameFilter (com.mucommander.commons.file.filter.EqualsFilenameFilter)1 ExtensionFilenameFilter (com.mucommander.commons.file.filter.ExtensionFilenameFilter)1 FileFilter (com.mucommander.commons.file.filter.FileFilter)1 FilenameFilter (com.mucommander.commons.file.filter.FilenameFilter)1 PassThroughFileFilter (com.mucommander.commons.file.filter.PassThroughFileFilter)1