3261N/A * Copyright (c) 1998, 2010, 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 * Basic L&F implementation of a FileChooser. 0N/A * @author Jeff Dinkins 0N/A /* FileView icons */ 0N/A * The mnemonic keycode used for the approve button when a directory 0N/A * is selected and the current selection mode is FILES_ONLY. 0N/A * The label text displayed on the approve button when a directory 0N/A * is selected and the current selection mode is FILES_ONLY. 0N/A * The tooltip text displayed on the approve button when a directory 0N/A * is selected and the current selection mode is FILES_ONLY. 0N/A // Some generic FileChooser functions 0N/A // The accessoryPanel is a container to place the JFileChooser accessory component 2871N/A * Creates a {@code BasicFileChooserUI} implementation 2871N/A * for the specified component. By default 2871N/A * the {@code BasicLookAndFeel} class uses 2871N/A * {@code createUI} methods of all basic UIs classes 2871N/A * @param c the {@code JFileChooser} which needs a UI 2871N/A * @return the {@code BasicFileChooserUI} object 2871N/A * @see UIDefaults#getUI(JComponent) 0N/A "FileChooser.ancestorInputMap");
0N/A // ******************************************** 0N/A // ************ Create Listeners ************** 0N/A // ******************************************** 0N/A // Note: we can't depend on evt.getSource() because of backward 0N/A // Strip trailing ".." 0N/A // That's ok, we'll use f as is 0N/A // NOTE: This class exists only for backward compatability. All 0N/A // its functionality has been moved into Handler. If you need to add 0N/A // new functionality add it to the Handler, but make sure this 0N/A // class calls into the Handler. 0N/A * The JList used for representing the files is created by subclasses, but the 0N/A * selection is monitored in this class. The TransferHandler installed in the 0N/A * JFileChooser is also installed in the file list as it is used as the actual 0N/A * transfer source. The list is updated on a mouse enter to reflect the current 0N/A * data transfer state of the file chooser. 0N/A // NOTE: This class exists only for backward compatability. All 0N/A // its functionality has been moved into Handler. If you need to add 0N/A // new functionality add it to the Handler, but make sure this 0N/A // class calls into the Handler. 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 whether a directory is currently selected in the UI. 0N/A * This is normally called by the UI on a selection event. 0N/A * @param b 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 #setDirectory 0N/A * Property to remember the directory that is currently selected in the UI. 0N/A * This is normally called by the UI on a selection event. 0N/A * @param f the <code>File</code> object representing the directory that is 0N/A * currently selected 0N/A * Returns the mnemonic for the given key. 0N/A // ******************************************************* 0N/A // ************ FileChooser UI PLAF methods ************** 0N/A // ******************************************************* 0N/A * Returns the default accept all file filter 0N/A * Returns the title of this dialog 0N/A // ***************************** 0N/A // ***** Directory Actions ***** 0N/A // ***************************** 0N/A // Note: Don't return null for readOnly, it might 0N/A // break older apps. 0N/A * Creates a new folder. 0N/A * Acts on the "home" key event or equivalent event. 0N/A * Responds to an Open or Save request 0N/A // Strip trailing ".." 626N/A // Remove whitespaces from end of filename 0N/A // no file selected, multiple selection off, therefore cancel the approve action 626N/A // Unix: Resolve '~' to user's home directory 626N/A // Optimize searching files by names in "children" array 626N/A // check for wildcard pattern 626N/A // Not a valid glob pattern. Abandon filter. 626N/A // Check for directory change action 0N/A // Do it again. This is a fix for bug 4949273 to force the 0N/A // selected value in case the ListSelectionModel clears it 0N/A // for non-existing file names. 0N/A /* A file filter which accepts file patterns containing 0N/A * the special wildcards *? on Windows and *?[] on Unix. 0N/A // On windows, a pattern ending with *.* is equal to ending with * 0N/A for (
int i =
0; i <
len; i++) {
0N/A //if ("+()|^$.{}<>".indexOf(gPat[i]) >= 0) { 0N/A * Responds to a cancel request. 0N/A * Rescans the files in the current directory 0N/A // Traverse shortcuts on Windows 4392N/A // If linkedTo is null we try to use dir 0N/A // ***************************************** 0N/A // ***** default AcceptAll file filter ***** 0N/A // ***************************************** 0N/A // *********************** 0N/A // * FileView operations * 0N/A // *********************** 0N/A /* FileView type descriptions */ 0N/A // PENDING(jeff) - pass in the icon cache size 0N/A // Note: Returns display name rather than file name 0N/A * Data transfer support for the file chooser. Since files are currently presented 0N/A * as a list, the list support is reused with the added flavor of DataFlavor.javaFileListFlavor 0N/A * Create a Transferable to use as the source for a data transfer. 0N/A * @param c The component holding the data to be transfered. This 0N/A * argument is provided to enable sharing of TransferHandlers by 0N/A * multiple components. 0N/A * @return The representation of the data to be transfered. 0N/A // remove the last newline 0N/A * The only richer format supported is the file list flavor