Methods Summary |
---|
private void | changeDirectory(java.io.File dir)
JFileChooser fc = getFileChooser();
// Traverse shortcuts on Windows
if (dir != null && File.separatorChar == '\\" && dir.getPath().endsWith(".lnk")) {
try {
File linkedTo = ShellFolder.getShellFolder(dir).getLinkLocation();
if (linkedTo != null && fc.isTraversable(linkedTo)) {
dir = linkedTo;
} else {
return;
}
} catch (FileNotFoundException ex) {
return;
}
}
fc.setCurrentDirectory(dir);
|
public void | clearIconCache()
fileView.clearIconCache();
|
javax.swing.ActionMap | createActionMap()
ActionMap map = new ActionMapUIResource();
Action refreshAction = new UIAction(FilePane.ACTION_REFRESH) {
public void actionPerformed(ActionEvent evt) {
getFileChooser().rescanCurrentDirectory();
}
};
map.put(FilePane.ACTION_APPROVE_SELECTION, getApproveSelectionAction());
map.put(FilePane.ACTION_CANCEL, getCancelSelectionAction());
map.put(FilePane.ACTION_REFRESH, refreshAction);
map.put(FilePane.ACTION_CHANGE_TO_PARENT_DIRECTORY,
getChangeToParentDirectoryAction());
return map;
|
protected java.awt.event.MouseListener | createDoubleClickListener(javax.swing.JFileChooser fc, javax.swing.JList list)
return new Handler(list);
|
public javax.swing.event.ListSelectionListener | createListSelectionListener(javax.swing.JFileChooser fc)
return getHandler();
|
protected void | createModel()
model = new BasicDirectoryModel(getFileChooser());
|
public java.beans.PropertyChangeListener | createPropertyChangeListener(javax.swing.JFileChooser fc)
return null;
|
public void | ensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)
|
public javax.swing.filechooser.FileFilter | getAcceptAllFileFilter(javax.swing.JFileChooser fc)Returns the default accept all file filter
return acceptAllFileFilter;
|
public javax.swing.JPanel | getAccessoryPanel()
return accessoryPanel;
|
javax.swing.ActionMap | getActionMap()
return createActionMap();
|
protected javax.swing.JButton | getApproveButton(javax.swing.JFileChooser fc)
return null;
|
public int | getApproveButtonMnemonic(javax.swing.JFileChooser fc)
int mnemonic = fc.getApproveButtonMnemonic();
if (mnemonic > 0) {
return mnemonic;
} else if (fc.getDialogType() == JFileChooser.OPEN_DIALOG) {
return openButtonMnemonic;
} else if (fc.getDialogType() == JFileChooser.SAVE_DIALOG) {
return saveButtonMnemonic;
} else {
return mnemonic;
}
|
public java.lang.String | getApproveButtonText(javax.swing.JFileChooser fc)
String buttonText = fc.getApproveButtonText();
if (buttonText != null) {
return buttonText;
} else if (fc.getDialogType() == JFileChooser.OPEN_DIALOG) {
return openButtonText;
} else if (fc.getDialogType() == JFileChooser.SAVE_DIALOG) {
return saveButtonText;
} else {
return null;
}
|
public java.lang.String | getApproveButtonToolTipText(javax.swing.JFileChooser fc)
String tooltipText = fc.getApproveButtonToolTipText();
if(tooltipText != null) {
return tooltipText;
}
if(fc.getDialogType() == JFileChooser.OPEN_DIALOG) {
return openButtonToolTipText;
} else if(fc.getDialogType() == JFileChooser.SAVE_DIALOG) {
return saveButtonToolTipText;
}
return null;
|
public javax.swing.Action | getApproveSelectionAction()
return approveSelectionAction;
|
public javax.swing.Action | getCancelSelectionAction()
return cancelSelectionAction;
|
public javax.swing.Action | getChangeToParentDirectoryAction()
return changeToParentDirectoryAction;
|
public java.lang.String | getDialogTitle(javax.swing.JFileChooser fc)Returns the title of this dialog
String dialogTitle = fc.getDialogTitle();
if (dialogTitle != null) {
return dialogTitle;
} else if (fc.getDialogType() == JFileChooser.OPEN_DIALOG) {
return openDialogTitleText;
} else if (fc.getDialogType() == JFileChooser.SAVE_DIALOG) {
return saveDialogTitleText;
} else {
return getApproveButtonText(fc);
}
|
protected java.io.File | getDirectory()Property to remember the directory that is currently selected in the UI.
return directory;
|
public java.lang.String | getDirectoryName()
return null;
|
public javax.swing.JFileChooser | getFileChooser()
return filechooser;
|
public java.lang.String | getFileName()
return null;
|
public javax.swing.filechooser.FileView | getFileView(javax.swing.JFileChooser fc)
return fileView;
|
public javax.swing.Action | getGoHomeAction()
return goHomeAction;
|
private javax.swing.plaf.basic.BasicFileChooserUI$Handler | getHandler()
if (handler == null) {
handler = new Handler();
}
return handler;
|
javax.swing.InputMap | getInputMap(int condition)
if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
return (InputMap)DefaultLookup.get(getFileChooser(), this,
"FileChooser.ancestorInputMap");
}
return null;
|
private int | getMnemonic(java.lang.String key, java.util.Locale l)Returns the mnemonic for the given key.
Object value = UIManager.get(key, l);
if (value instanceof Integer) {
return (Integer)value;
}
if (value instanceof String) {
try {
return Integer.parseInt((String)value);
} catch (NumberFormatException nfe) { }
}
return 0;
|
public javax.swing.plaf.basic.BasicDirectoryModel | getModel()
return model;
|
public javax.swing.Action | getNewFolderAction()
if (newFolderAction == null) {
newFolderAction = new NewFolderAction();
// Note: Don't return null for readOnly, it might
// break older apps.
if (readOnly) {
newFolderAction.setEnabled(false);
}
}
return newFolderAction;
|
public javax.swing.Action | getUpdateAction()
return updateAction;
|
public void | installComponents(javax.swing.JFileChooser fc)
|
protected void | installDefaults(javax.swing.JFileChooser fc)
installIcons(fc);
installStrings(fc);
usesSingleFilePane = UIManager.getBoolean("FileChooser.usesSingleFilePane");
readOnly = UIManager.getBoolean("FileChooser.readOnly");
TransferHandler th = fc.getTransferHandler();
if (th == null || th instanceof UIResource) {
fc.setTransferHandler(defaultTransferHandler);
}
LookAndFeel.installProperty(fc, "opaque", Boolean.FALSE);
|
protected void | installIcons(javax.swing.JFileChooser fc)
directoryIcon = UIManager.getIcon("FileView.directoryIcon");
fileIcon = UIManager.getIcon("FileView.fileIcon");
computerIcon = UIManager.getIcon("FileView.computerIcon");
hardDriveIcon = UIManager.getIcon("FileView.hardDriveIcon");
floppyDriveIcon = UIManager.getIcon("FileView.floppyDriveIcon");
newFolderIcon = UIManager.getIcon("FileChooser.newFolderIcon");
upFolderIcon = UIManager.getIcon("FileChooser.upFolderIcon");
homeFolderIcon = UIManager.getIcon("FileChooser.homeFolderIcon");
detailsViewIcon = UIManager.getIcon("FileChooser.detailsViewIcon");
listViewIcon = UIManager.getIcon("FileChooser.listViewIcon");
|
protected void | installListeners(javax.swing.JFileChooser fc)
propertyChangeListener = createPropertyChangeListener(fc);
if(propertyChangeListener != null) {
fc.addPropertyChangeListener(propertyChangeListener);
}
fc.addPropertyChangeListener(getModel());
InputMap inputMap = getInputMap(JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(fc, JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);
ActionMap actionMap = getActionMap();
SwingUtilities.replaceUIActionMap(fc, actionMap);
|
protected void | installStrings(javax.swing.JFileChooser fc)
Locale l = fc.getLocale();
newFolderErrorText = UIManager.getString("FileChooser.newFolderErrorText",l);
newFolderErrorSeparator = UIManager.getString("FileChooser.newFolderErrorSeparator",l);
fileDescriptionText = UIManager.getString("FileChooser.fileDescriptionText",l);
directoryDescriptionText = UIManager.getString("FileChooser.directoryDescriptionText",l);
saveButtonText = UIManager.getString("FileChooser.saveButtonText",l);
openButtonText = UIManager.getString("FileChooser.openButtonText",l);
saveDialogTitleText = UIManager.getString("FileChooser.saveDialogTitleText",l);
openDialogTitleText = UIManager.getString("FileChooser.openDialogTitleText",l);
cancelButtonText = UIManager.getString("FileChooser.cancelButtonText",l);
updateButtonText = UIManager.getString("FileChooser.updateButtonText",l);
helpButtonText = UIManager.getString("FileChooser.helpButtonText",l);
directoryOpenButtonText = UIManager.getString("FileChooser.directoryOpenButtonText",l);
saveButtonMnemonic = getMnemonic("FileChooser.saveButtonMnemonic", l);
openButtonMnemonic = getMnemonic("FileChooser.openButtonMnemonic", l);
cancelButtonMnemonic = getMnemonic("FileChooser.cancelButtonMnemonic", l);
updateButtonMnemonic = getMnemonic("FileChooser.updateButtonMnemonic", l);
helpButtonMnemonic = getMnemonic("FileChooser.helpButtonMnemonic", l);
directoryOpenButtonMnemonic = getMnemonic("FileChooser.directoryOpenButtonMnemonic", l);
saveButtonToolTipText = UIManager.getString("FileChooser.saveButtonToolTipText",l);
openButtonToolTipText = UIManager.getString("FileChooser.openButtonToolTipText",l);
cancelButtonToolTipText = UIManager.getString("FileChooser.cancelButtonToolTipText",l);
updateButtonToolTipText = UIManager.getString("FileChooser.updateButtonToolTipText",l);
helpButtonToolTipText = UIManager.getString("FileChooser.helpButtonToolTipText",l);
directoryOpenButtonToolTipText = UIManager.getString("FileChooser.directoryOpenButtonToolTipText",l);
|
public void | installUI(javax.swing.JComponent c)
accessoryPanel = new JPanel(new BorderLayout());
filechooser = (JFileChooser) c;
createModel();
clearIconCache();
installDefaults(filechooser);
installComponents(filechooser);
installListeners(filechooser);
filechooser.applyComponentOrientation(filechooser.getComponentOrientation());
|
protected boolean | isDirectorySelected()Property to remember whether a directory is currently selected in the UI.
return directorySelected;
|
private static boolean | isGlobPattern(java.lang.String filename)
return ((File.separatorChar == '\\" && (filename.indexOf('*") >= 0
|| filename.indexOf('?") >= 0))
|| (File.separatorChar == '/" && (filename.indexOf('*") >= 0
|| filename.indexOf('?") >= 0
|| filename.indexOf('[") >= 0)));
|
public void | rescanCurrentDirectory(javax.swing.JFileChooser fc)
|
private void | resetGlobFilter()
if (actualFileFilter != null) {
JFileChooser chooser = getFileChooser();
FileFilter currentFilter = chooser.getFileFilter();
if (currentFilter != null && currentFilter.equals(globFilter)) {
chooser.setFileFilter(actualFileFilter);
chooser.removeChoosableFileFilter(globFilter);
}
actualFileFilter = null;
}
|
protected void | setDirectory(java.io.File f)Property to remember the directory that is currently selected in the UI.
This is normally called by the UI on a selection event.
directory = f;
|
public void | setDirectoryName(java.lang.String dirname)
|
protected void | setDirectorySelected(boolean b)Property to remember whether a directory is currently selected in the UI.
This is normally called by the UI on a selection event.
directorySelected = b;
|
public void | setFileName(java.lang.String filename)
|
public void | uninstallComponents(javax.swing.JFileChooser fc)
|
protected void | uninstallDefaults(javax.swing.JFileChooser fc)
uninstallIcons(fc);
uninstallStrings(fc);
if (fc.getTransferHandler() instanceof UIResource) {
fc.setTransferHandler(null);
}
|
protected void | uninstallIcons(javax.swing.JFileChooser fc)
directoryIcon = null;
fileIcon = null;
computerIcon = null;
hardDriveIcon = null;
floppyDriveIcon = null;
newFolderIcon = null;
upFolderIcon = null;
homeFolderIcon = null;
detailsViewIcon = null;
listViewIcon = null;
|
protected void | uninstallListeners(javax.swing.JFileChooser fc)
if(propertyChangeListener != null) {
fc.removePropertyChangeListener(propertyChangeListener);
}
fc.removePropertyChangeListener(getModel());
SwingUtilities.replaceUIInputMap(fc, JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
SwingUtilities.replaceUIActionMap(fc, null);
|
protected void | uninstallStrings(javax.swing.JFileChooser fc)
saveButtonText = null;
openButtonText = null;
cancelButtonText = null;
updateButtonText = null;
helpButtonText = null;
directoryOpenButtonText = null;
saveButtonToolTipText = null;
openButtonToolTipText = null;
cancelButtonToolTipText = null;
updateButtonToolTipText = null;
helpButtonToolTipText = null;
directoryOpenButtonToolTipText = null;
|
public void | uninstallUI(javax.swing.JComponent c)
uninstallListeners((JFileChooser) filechooser);
uninstallComponents((JFileChooser) filechooser);
uninstallDefaults((JFileChooser) filechooser);
if(accessoryPanel != null) {
accessoryPanel.removeAll();
}
accessoryPanel = null;
getFileChooser().removeAll();
handler = null;
|