use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.
the class SelectBackwardAction method performAction.
// ///////////////////////////
// MuAction implementation //
// ///////////////////////////
@Override
public void performAction() {
FileTable activeTable = mainFrame.getActiveTable();
activeTable.selectRow(Math.max(activeTable.getSelectedRow() - getRowDecrement(), 0));
}
use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.
the class ShowFilePopupMenuAction method performAction.
@Override
public void performAction() {
try {
AbstractFile selectedFile = mainFrame.getActiveTable().getSelectedFile();
FileTable fileTable = mainFrame.getActiveTable();
FileTableModel tableModel = (FileTableModel) fileTable.getModel();
int selectedRow = fileTable.getSelectedRow();
Rectangle rect = fileTable.getCellRect(selectedRow, fileTable.convertColumnIndexToView(Column.NAME.ordinal()), true);
boolean parentFolderSelected = selectedRow == 0 && tableModel.hasParentFolder();
new TablePopupMenu(mainFrame, fileTable.getFolderPanel().getCurrentFolder(), parentFolderSelected ? null : selectedFile, parentFolderSelected, tableModel.getMarkedFiles()).show(fileTable, rect.x + rect.width, rect.y);
} catch (Exception e) {
InformationDialog.showErrorDialog(mainFrame);
}
}
use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.
the class ToggleShowFoldersFirstAction method performAction.
@Override
public void performAction() {
FileTable activeTable = mainFrame.getActiveTable();
boolean showFoldersFirst = !activeTable.getSortInfo().getFoldersFirst();
activeTable.setFoldersFirst(showFoldersFirst);
MuConfigurations.getPreferences().setVariable(MuPreference.SHOW_FOLDERS_FIRST, showFoldersFirst);
}
use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.
the class SwitchActiveTableAction method performAction.
@Override
public void performAction() {
FileTable activeTable = mainFrame.getActiveTable();
FileTable leftTable = mainFrame.getLeftPanel().getFileTable();
FileTable rightTable = mainFrame.getRightPanel().getFileTable();
if (activeTable == leftTable)
rightTable.requestFocus();
else if (activeTable == rightTable)
leftTable.requestFocus();
}
use of com.mucommander.ui.main.table.FileTable in project mucommander by mucommander.
the class FileDragSourceListener method dragGestureRecognized.
// /**
// * Creates a custom DragGestureEvent instance re-using the information contained in the given DragGestureEvent, but
// * overridding the actions with the specified actions bitwise mask.
// * When used with <code>DragSource.startDrag</code>, this allows to start a drag operation with a different source
// * action set from the one specified in the <code>DragGestureRecognizer</code>, based on the current state and
// * contents of the FolderPanel.
// */
// private DragGestureEvent createCustomDragGestureEvent(DragGestureEvent originalDGE, int actions) {
// Vector eventList = new Vector();
// Iterator eventIterator = originalDGE.iterator();
//
// while(eventIterator.hasNext())
// eventList.add(eventIterator.next());
//
// DragGestureRecognizer dragGestureRecognizer = originalDGE.getSourceAsDragGestureRecognizer();
// dragGestureRecognizer.setSourceActions(actions);
//
// return new DragGestureEvent(dragGestureRecognizer,
// actions,
// originalDGE.getDragOrigin(),
// eventList);
// }
// ///////////////////////////////
// DragGestureListener methods //
// ///////////////////////////////
public void dragGestureRecognized(DragGestureEvent event) {
if (folderPanel.getMainFrame().getNoEventsMode())
return;
FileTable fileTable = folderPanel.getFileTable();
FileTableModel tableModel = fileTable.getFileTableModel();
// Return (do not initiate drag) if mouse button2 or button3 was used
if ((event.getTriggerEvent().getModifiers() & (InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK)) != 0)
return;
// Do not use that to retrieve the current selected file as it is inaccurate: the selection could have changed since the
// the mouse was clicked.
// AbstractFile selectedFile = fileTable.getSelectedFile(false);
// // Return if selected file is null (could happen if '..' is selected)
// if(selectedFile==null)
// return;
// Find out which row was clicked
int clickedRow = fileTable.rowAtPoint(event.getDragOrigin());
// Return (do not initiate drag) if the selected file is the parent folder '..'
if (clickedRow == -1 || fileTable.isParentFolder(clickedRow))
return;
// Retrieve the file corresponding to the clicked row
AbstractFile selectedFile = tableModel.getFileAtRow(clickedRow);
// Find out which files are to be dragged, based on the selected file and currenlty marked files.
// If there are some files marked, drag marked files only if the selected file is one of the marked files.
// In any other case, only drag the selected file.
FileSet markedFiles;
FileSet draggedFiles;
if (tableModel.getNbMarkedFiles() > 0 && (markedFiles = fileTable.getSelectedFiles()).contains(selectedFile)) {
draggedFiles = markedFiles;
} else {
draggedFiles = new FileSet(folderPanel.getCurrentFolder(), selectedFile);
}
// Set initial DnDContext information
DnDContext.setDragInitiatedByMucommander(true);
DnDContext.setDragInitiator(folderPanel);
DnDContext.setDragGestureModifiersEx(event.getTriggerEvent().getModifiersEx());
// Start dragging
DragSource.getDefaultDragSource().startDrag(event, null, new TransferableFileSet(draggedFiles), this);
// DragSource.getDefaultDragSource().startDrag(createCustomDragGestureEvent(event, DnDConstants.ACTION_MOVE), null, new TransferableFileSet(draggedFiles), this);
}
Aggregations