2362N/A * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <b>WARNING:</b> This class is an implementation detail and is only 0N/A * public so that it can be used by two packages. You should NOT consider 0N/A * This component is intended to be used in a subclass of 0N/A * javax.swing.plaf.basic.BasicFileChooserUI. It realies heavily on the 0N/A * implementation of BasicFileChooserUI, and is intended to be API compatible 0N/A * with earlier implementations of MetalFileChooserUI and WindowsFileChooserUI. 0N/A * @author Leif Samuelsson 0N/A // Constants for actions. These are used for the actions' ACTION_COMMAND_KEY 0N/A // and as keys in the action maps for FilePane and the corresponding UI classes 0N/A // "enums" for setViewType() 0N/A * Moves the keyboard focus to the first element whose prefix matches 0N/A * the sequence of alphanumeric keys pressed by the user with delay 0N/A * less than value of <code>timeFactor</code>. Subsequent same key 0N/A * presses move the keyboard focus to the next object that starts with 0N/A * the same letter until another key is pressed, then it is treated 0N/A * as the prefix with appropriate number of the same letters followed 0N/A * by first typed another letter. 0N/A // Subsequent same key presses move the keyboard focus to the next 0N/A // object that starts with the same letter. 0N/A // Provides a way to recognize a newly created folder, so it can 0N/A // be selected when it appears in the model. 0N/A // Used for accessing methods in the corresponding UI class 0N/A for (
int i =
0; i < n; i++) {
0N/A // TODO: On windows, get the following localized strings from the OS 0N/A * Fetches the command list for the FilePane. These commands 0N/A * are useful for binding to events, such as in a keymap. 0N/A * @return the command list 0N/A // start search from the next element before/after the selected element 0N/A // 4835633 : tell BasicListUI that this is a file list 0N/A * This model allows for sorting JList 0N/A // JList doesn't support RowSorter so far, so we put it into the list model 0N/A // Leave dir without changing 0N/A // check if preserved sortKeys are valid for this folder 0N/A // Note: It is very important to avoid getting info on drives, as 0N/A // this will trigger "No disk in A:" and similar dialogs. 0N/A // Use (f.exists() && !chooser.getFileSystemView().isFileSystemRoot(f)) to 0N/A // determine if it is safe to call methods directly on f. 0N/A ? f
// always return the file itself for the 1st column 0N/A //Check if extension is hidden from user 4091N/A // The setSelectedFile method produces a new setValueAt invocation while the JTable 4091N/A // is editing. Postpone file selection to be sure that edit mode of the JTable 0N/A // Could be because of delay in updating Desktop folder 0N/A // chooser.setSelectedFile(null); 0N/A // Update the selection after the model has been updated 0N/A // the column must have a string resource that we try to get 0N/A // otherwise we let JTable to decide the actual width 0N/A // Install cell editor for editing file name 0N/A * This class sorts directories before files, comparing directory to 0N/A * directory and file to file using the wrapped comparator. 0N/A // directories go first 0N/A // For this column we need to pass the file itself (not a 0N/A // column value) to the comparator 0N/A // Restrict width to actual text 0N/A // Provide some space between columns 0N/A // formatting cell text 0N/A // TODO: it's rather a temporary trick, to be revised 0N/A // Handle Escape key events here 0N/A // We are not editing, forward to filechooser. 0N/A // update header with possibly changed column set 0N/A // So that drag can be started on a mouse press 0N/A // No need to addListSelectionListener because selections are forwarded 0N/A // 4835633 : tell BasicTableUI that this is a file list 0N/A // We don't want them to navigate within the table 0N/A // Adjust width of first column so the table fills the viewport when 0N/A // first displayed (temporary listener). 0N/A // If the mouse is pressed in the area below the Details view table, the 0N/A // event is not dispatched to the Table MouseListener but to the 0N/A // scrollpane. Listen for that here so we can clear the selection. 0N/A }
// createDetailsView 0N/A * Creates a selection listener for the list of files and directories. 0N/A * @return a <code>ListSelectionListener</code> 0N/A * @param index visual index of the file to be edited 241N/A // PENDING - grab padding (4) below from defaults table. 0N/A //Check if extension is hidden from user 0N/A //Could be because of delay in updating Desktop folder 0N/A //chooser.setSelectedFile(null); 0N/A // Remove files that shouldn't be selected and add files which should be selected 0N/A // Note: Assume files are already sorted in compareTo order. 0N/A // restore the anchor and lead 0N/A // could be missed in the current directory if it changed 0N/A /* The following methods are used by the PropertyChange Listener */ 0N/A * Listen for filechooser property changes, such as 0N/A * the selected file changing, or the type of the dialog changing. 0N/A }
else if (s.
equals(
"componentOrientation")) {
0N/A // Translate point from table to list 0N/A // Make a new event with the list as source, placing the 0N/A // click in the corresponding list cell. 0N/A // For single click, we handle editing file name 0N/A // on double click (open or drill down one directory) be 0N/A // sure to clear the edit index 0N/A // Forward event to Basic 0N/A // Forward event to Basic 0N/A // Forward event to Basic 0N/A // Forward event to Basic 0N/A // Forward event to Basic 0N/A // Lazy creation of Basic's listener 0N/A * Property to remember whether a directory is currently selected in the UI. 0N/A * @return <code>true</code> iff a directory is currently selected. 0N/A * Property to remember the directory that is currently selected in the UI. 0N/A * @return the value of the <code>directory</code> property 0N/A * @see javax.swing.plaf.basic.BasicFileChooserUI#setDirectory 0N/A for (
int i =
0; i < n; i++) {
0N/A // Return false for non FileSystem files or if file doesn't exist. 0N/A // File doesn't exist 823N/A * Returns true if specified FileChooser should use ShellFolder 0N/A // This interface is used to access methods in the FileChooserUI 0N/A // that are not public.