Package com.mucommander.ui.main.table

Examples of com.mucommander.ui.main.table.FileTable


        super(mainFrame, properties);
    }

    @Override
    protected int getRowIncrement() {
        FileTable activeTable = mainFrame.getActiveTable();

        return activeTable.getRowCount()-activeTable.getSelectedRow();
    }
View Full Code Here


    public void updateSelectedFilesInfo() {
        // No need to waste precious cycles if status bar is not visible
        if(!isVisible())
            return;

        FileTable currentFileTable = mainFrame.getActiveTable();

        // Currently select file, can be null
        AbstractFile selectedFile = currentFileTable.getSelectedFile(false, true);
        FileTableModel tableModel = currentFileTable.getFileTableModel();
        // Number of marked files, can be 0
        int nbMarkedFiles = tableModel.getNbMarkedFiles();
        // Combined size of marked files, 0 if no file has been marked
        long markedTotalSize = tableModel.getTotalMarkedSize();
        // number of files in folder
View Full Code Here

        super(mainFrame, properties);
    }

    @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();
    }
View Full Code Here

          new BookmarksQL(this),
          new RootFoldersQL(this),
                new TabsQL(this)};

        // Create the FileTable
        fileTable = new FileTable(mainFrame, this, conf);

        locationChanger = new LocationChanger(mainFrame, this, locationManager);
       
        // Create the Tabs (Must be called after the fileTable was created and current folder was set)
        tabs = new FileTableTabs(mainFrame, this, initialTabs);
View Full Code Here

        super(mainFrame, properties);
    }

    @Override
    public void performAction() {
        FileTable fileTable = mainFrame.getActiveTable();
        FileTableModel tableModel = fileTable.getFileTableModel();

        // Starts at 1 if current folder is not root so that '..' is not marked
        AbstractFile file;
        int nbRows = tableModel.getRowCount();
        for(int i=tableModel.getFirstMarkableRow(); i<nbRows; i++) {
            file = tableModel.getFileAtRow(i);
            if(!file.isDirectory())
                tableModel.setRowMarked(i, !tableModel.isRowMarked(i));
        }
        fileTable.repaint();

        // Notify registered listeners that currently marked files have changed on the FileTable
        fileTable.fireMarkedFilesChangedEvent();
    }
View Full Code Here

    ////////////////////////////
 
    public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();

        FileTable activeTable = mainFrame.getActiveTable();

        // Action coming from the selection dialog
        if ((source==okButton || source==selectionField)) {
            // Save values for next time this dialog is invoked
            caseSensitive = caseSensitiveCheckBox.isSelected();
            includeFolders = includeFoldersCheckBox.isSelected();
            comparison = comparisonComboBox.getSelectedIndex();


            String testString;
            keywordString = selectionField.getText();
            if(comparison!=REGEXP) {
                // Remove '*' characters
                testString = keywordString.replace("*", "");
            }
            else {
                testString = keywordString;
            }

            // Instantiate the main file filter
            FileFilter filter;
            switch (comparison) {
                case CONTAINS:
                    filter = new ContainsFilenameFilter(testString, caseSensitive);
                    break;
                case STARTS_WITH:
                    filter = new StartsWithFilenameFilter(testString, caseSensitive);
                    break;
                case ENDS_WIDTH:
                    filter = new EndsWithFilenameFilter(testString, caseSensitive);
                    break;
                case IS:
                    filter = new EqualsFilenameFilter(testString, caseSensitive);
                    break;
                case REGEXP:
                default:
                    try {
                        filter = new RegexpFilenameFilter(testString, caseSensitive);
                    }
                    catch(PatternSyntaxException ex) {
                        // Todo: let the user know the regexp is invalid
                        LOGGER.debug("Invalid regexp", ex);

                        // This filter does match any file
                        filter = new PassThroughFileFilter(false);
                    }
                    break;
            }

            // If folders are excluded, add a regular file filter and chain it with an AndFileFilter
            if(!includeFolders) {
                filter = new AndFileFilter(
                    new AttributeFileFilter(FileAttribute.FILE),
                    filter
                );
            }

            // Mark/unmark the files using the filter
            activeTable.getFileTableModel().setFilesMarked(filter, addToSelection);

            // Notify registered listeners that currently marked files have changed on this FileTable
            activeTable.fireMarkedFilesChangedEvent();

            activeTable.repaint();
        }
   
        dispose();
    }
View Full Code Here

               FileURL[] leftLocationHistory, FileURL[] rightLocationHistory) { */
        init(new FolderPanel(this, leftTabs, indexOfLeftSelectedTab, leftTableConf),
           new FolderPanel(this, rightTabs, indexOfRightSelectedTab, rightTableConf));

        for (boolean isLeft = true; ; isLeft=false) {
          FileTable fileTable = isLeft ? leftTable : rightTable;
          fileTable.sortBy(Column.valueOf(MuConfigurations.getSnapshot().getVariable(MuSnapshot.getFileTableSortByVariable(0, isLeft), MuSnapshot.DEFAULT_SORT_BY).toUpperCase()),
                    !MuConfigurations.getSnapshot().getVariable(MuSnapshot.getFileTableSortOrderVariable(0, isLeft), MuSnapshot.DEFAULT_SORT_ORDER).equals(MuSnapshot.SORT_ORDER_DESCENDING));
         
          FolderPanel folderPanel = isLeft ? leftFolderPanel : rightFolderPanel;
          folderPanel.setTreeWidth(MuConfigurations.getSnapshot().getVariable(MuSnapshot.getTreeWidthVariable(0, isLeft), 150));
          folderPanel.setTreeVisible(MuConfigurations.getSnapshot().getVariable(MuSnapshot.getTreeVisiblityVariable(0, isLeft), false));
View Full Code Here

     * Copy constructor
     */
    public MainFrame(MainFrame mainFrame) {
      FolderPanel leftFolderPanel = mainFrame.getLeftPanel();
      FolderPanel rightFolderPanel = mainFrame.getRightPanel();
      FileTable leftFileTable = leftFolderPanel.getFileTable();
      FileTable rightFileTable = rightFolderPanel.getFileTable();

      init(new FolderPanel(this, new ConfFileTableTab[] {new ConfFileTableTab(leftFolderPanel.getCurrentFolder().getURL())}, 0, leftFileTable.getConfiguration()),
             new FolderPanel(this, new ConfFileTableTab[] {new ConfFileTableTab(rightFolderPanel.getCurrentFolder().getURL())}, 0, rightFileTable.getConfiguration()));

      // TODO: Sorting should be part of the FileTable configuration
        this.leftTable.sortBy(leftFileTable.getSortInfo());
        this.rightTable.sortBy(rightFileTable.getSortInfo());
    }
View Full Code Here

        leftFolderPanel.setTreeVisible(rightFolderPanel.isTreeVisible());
        rightFolderPanel.setTreeVisible(tempTreeVisible);
       

        // Resets the tables.
        FileTable tempTable = leftTable;
        leftTable = rightTable;
        rightTable = tempTable;

        // Preserve the sort order and columns visibility.
        TableColumnModel model = leftTable.getColumnModel();
View Full Code Here

    public void menuSelected(MenuEvent e) {
        Object source = e.getSource();

        if(source==viewMenu) {
            FileTable activeTable = mainFrame.getActiveTable();

            // Select the 'sort by' criterion currently in use in the active table
            sortByItems[activeTable.getSortInfo().getCriterion().ordinal()].setSelected(true);

            toggleShowFoldersFirstItem.setSelected(activeTable.getSortInfo().getFoldersFirst());
            toggleShowHiddenFilesItem.setSelected(MuConfigurations.getPreferences().getVariable(MuPreference.SHOW_HIDDEN_FILES, MuPreferences.DEFAULT_SHOW_HIDDEN_FILES));
            toggleTreeItem.setSelected(activeTable.getFolderPanel().isTreeVisible());
            toggleToggleAutoSizeItem.setSelected(mainFrame.isAutoSizeColumnsEnabled());
            /* TODO branch toggleBranchView.setSelected(activeTable.getFolderPanel().isBranchView()); */
        }
        else if(source==columnsMenu) {
            // Update the selected and enabled state of each column menu item.
            FileTable activeTable = mainFrame.getActiveTable();
            for(Column c : Column.values()) {
                if(c==Column.NAME)     // Name column doesn't have a menu item as it cannot be disabled
                    continue;

                JCheckBoxMenuItem item = toggleColumnItems[c.ordinal()];
                item.setSelected(activeTable.isColumnEnabled(c));
                item.setEnabled(activeTable.isColumnDisplayable(c));
                // Override the action's label to a shorter one
                item.setText(c.getLabel());
            }
        }
        else if(source==goMenu) {
View Full Code Here

TOP

Related Classes of com.mucommander.ui.main.table.FileTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.