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);
}
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));
}
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();
}
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);
}
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();
}
}
Aggregations