Search in sources :

Example 6 with FileTable

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));
}
Also used : FileTable(com.mucommander.ui.main.table.FileTable)

Example 7 with FileTable

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);
    }
}
Also used : AbstractFile(com.mucommander.commons.file.AbstractFile) FileTableModel(com.mucommander.ui.main.table.FileTableModel) Rectangle(java.awt.Rectangle) FileTable(com.mucommander.ui.main.table.FileTable) TablePopupMenu(com.mucommander.ui.main.menu.TablePopupMenu)

Example 8 with FileTable

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);
}
Also used : FileTable(com.mucommander.ui.main.table.FileTable)

Example 9 with FileTable

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();
}
Also used : FileTable(com.mucommander.ui.main.table.FileTable)

Example 10 with FileTable

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);
}
Also used : FileTableModel(com.mucommander.ui.main.table.FileTableModel) AbstractFile(com.mucommander.commons.file.AbstractFile) FileSet(com.mucommander.commons.file.util.FileSet) 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