/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Synth FileChooserUI implementation.
* <p>
* Note that the classes in the com.sun.java.swing.plaf.synth
* package are not
* part of the core Java APIs. They are a part of Sun's JDK and JRE
* distributions. Although other licensees may choose to distribute
* these classes, developers cannot depend on their availability in
* non-Sun implementations. Additionally this API may change in
* incompatible ways between releases. While this class is public, it
* shoud be considered an implementation detail, and subject to change.
*
* @author Leif Samuelsson
* @author Jeff Dinkins
*/
private boolean readOnly;
// Preferred and Minimum sizes for the dialog box
// Labels, mnemonics, and tooltips (oh my!)
if (fileNameLabel != null) {
}
}
};
private void populateFileNameLabel() {
} else {
}
}
super(b);
}
return SynthFileChooserUIImpl.this.getFileChooser();
}
return SynthFileChooserUIImpl.this.getModel();
}
return null;
}
return null;
}
public boolean isDirectorySelected() {
return SynthFileChooserUIImpl.this.isDirectorySelected();
}
return SynthFileChooserUIImpl.this.getDirectory();
}
return SynthFileChooserUIImpl.this.getChangeToParentDirectoryAction();
}
return SynthFileChooserUIImpl.this.getApproveSelectionAction();
}
return SynthFileChooserUIImpl.this.getNewFolderAction();
}
list);
}
}
}
super.installDefaults(fc);
}
super.installComponents(fc);
// ********************************* //
// **** Construct the top panel **** //
// ********************************* //
// Directory manipulation buttons
// Add the top panel to the fileChooser
// ComboBox Label
// CurrentDir ComboBox
directoryComboBox = new JComboBox();
// Add 'Go Up' to context menu, plus 'Go Home' if on Unix
if (contextMenu != null) {
}
}
// Up Button
// Home Button
}
b.setMargin(shrinkwrap);
topButtonPanel.add(b);
// New Directory Button
if (!readOnly) {
b.setIcon(newFolderIcon);
b.setMargin(shrinkwrap);
topButtonPanel.add(b);
}
// View button group
// List Button
listViewButton.setSelected(true);
// Details Button
public void propertyChange(PropertyChangeEvent e) {
switch (viewType) {
case FilePane.VIEWTYPE_LIST:
listViewButton.setSelected(true);
break;
case FilePane.VIEWTYPE_DETAILS:
detailsViewButton.setSelected(true);
break;
}
}
}
});
// ************************************** //
// ******* Add the directory pane ******* //
// ************************************** //
}
// ********************************** //
// **** Construct the bottom panel ** //
// ********************************** //
bottomPanel = new JPanel();
// FileName label and textfield
fileNameLabel = new AlignedLabel();
public Dimension getMaximumSize() {
}
};
new FocusAdapter() {
public void focusGained(FocusEvent e) {
if (!getFileChooser().isMultiSelectionEnabled()) {
}
}
}
);
if (fc.isMultiSelectionEnabled()) {
} else {
}
// Filetype label and combobox
// buttons
buttonPanel = new JPanel();
if (fc.getControlButtonsAreShown()) {
}
}
super.installListeners(fc);
}
super.uninstallListeners(fc);
}
return null;
} else {
} else {
}
}
}
if (i > 0) {
}
}
}
}
}
// Remove listeners
}
super.uninstallUI(c);
}
super.installStrings(fc);
detailsViewButtonAccessibleName = UIManager.getString("FileChooser.detailsViewButtonAccessibleName",l);
}
}
if (fileNameTextField != null) {
return fileNameTextField.getText();
} else {
return null;
}
}
if (fileNameTextField != null) {
}
}
}
super.doSelectedFileChanged(e);
if (f != null
}
}
super.doSelectedFilesChanged(e);
}
}
super.doDirectoryChanged(e);
}
if (currentDirectory != null) {
if (model instanceof DirectoryComboBoxModel) {
}
}
} else {
}
}
}
}
super.doFileSelectionModeChanged(e);
if (currentDirectory != null
&& !fc.isFileSelectionEnabled()
} else {
}
}
if (getAccessoryPanel() != null) {
if (e.getOldValue() != null) {
}
}
}
}
super.doControlButtonsChanged(e);
if (getFileChooser().getControlButtonsAreShown()) {
} else {
}
}
protected void addControlButtons() {
if (bottomPanel != null) {
}
}
protected void removeControlButtons() {
if (bottomPanel != null) {
}
}
// *******************************************************
// ************ FileChooser UI PLAF methods **************
// *******************************************************
// add standard actions
// add synth only actions
return map;
}
// *****************************
// ***** Directory Actions *****
// *****************************
return directoryComboBox;
}
return directoryComboBoxAction;
}
}
//
// Renderer for DirectoryComboBox
//
// Synth has some odd behavior with regards to renderers. Renderers are styled
// in a specific manner by the SynthComboBoxUI. If we extend DefaultListCellRenderer
// here, then we get none of those benefits or behaviors, leading to poor
// looking combo boxes.
// So what we do here is delegate most jobs to the "real" or original renderer,
// and simply monkey with the icon and text of the renderer.
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
assert c instanceof JLabel;
return label;
}
return label;
}
}
if (c.getComponentOrientation().isLeftToRight()) {
} else {
}
}
}
public int getIconWidth() {
}
public int getIconHeight() {
}
}
//
// DataModel for DirectoryComboxbox
//
return new DirectoryComboBoxModel();
}
/**
* Data model for a type-face selection combo-box.
*/
public DirectoryComboBoxModel() {
// Add the current directory to the model, and make it the
// selectedDirectory
}
}
/**
* Adds the directory to the model and sets it to be selected,
* additionally clears out the previous selected directory and
* the paths leading up to it, if any.
*/
return;
}
directories.clear();
if (oldSize > 0) {
}
File[] baseFolders;
if (useShellFolder) {
}
});
} else {
}
// Get the canonical (full) path. This has the side
// benefit of removing extraneous chars from the path,
try {
} catch (IOException e) {
// Maybe drive is not ready. Can't abort here.
}
// create File instances of each directory leading up to the top
try {
: canonical;
do {
path.addElement(f);
} while ((f = f.getParentFile()) != null);
// Insert chain at appropriate place in vector
for (int i = 0; i < pathCount; i++) {
if (directories.contains(f)) {
for (int j = i-1; j >= 0; j--) {
}
break;
}
}
} catch (FileNotFoundException ex) {
}
}
private void calculateDepths() {
depths[i] = 0;
for (int j = i-1; j >= 0; j--) {
break;
}
}
}
}
}
public int getDepth(int i) {
}
}
return selectedDirectory;
}
public int getSize() {
return directories.size();
}
}
}
/**
* Acts when DirectoryComboBox has changed the selected item.
*/
protected DirectoryComboBoxAction() {
super("DirectoryComboBoxAction");
}
}
}
}
//
// Renderer for Types ComboBox
//
}
/**
* Render different type sizes and styles.
*/
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
}
//this should always be true, since SynthComboBoxUI's SynthComboBoxRenderer
//extends JLabel
assert c instanceof JLabel;
}
return c;
}
}
//
// DataModel for Types Comboxbox
//
return new FilterComboBoxModel();
}
/**
* Data model for a type-face selection combo-box.
*/
protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener {
protected FilterComboBoxModel() {
super();
}
}
}
}
}
// Ensure that the current filter is in the list.
// NOTE: we shouldnt' have to do this, since JFileChooser adds
// the filter to the choosable filters list when the filter
// is set. Lets be paranoid just in case someone overrides
// setFileFilter in JFileChooser.
boolean found = false;
if(currentFilter != null) {
if (filter == currentFilter) {
found = true;
}
}
if(found == false) {
}
}
return getFileChooser().getFileFilter();
}
public int getSize() {
} else {
return 0;
}
}
// This shouldn't happen. Try to recover gracefully.
return getFileChooser().getFileFilter();
}
} else {
return null;
}
}
}
/**
* <code>ButtonAreaLayout</code> behaves in a similar manner to
* <code>FlowLayout</code>. It lays out all components from left to
* right, flushed right. The widths of all components will be set
* to the largest preferred size width.
*/
}
int maxWidth = 0;
}
} else {
}
}
}
}
if (c != null) {
int height = 0;
int maxWidth = 0;
}
extraHeight + height);
}
}
}
return minimumLayoutSize(c);
}
}
}
}
AlignedLabel() {
super();
}
super(text);
}
Dimension d = super.getPreferredSize();
// Align the width with all other labels in group.
}
private int getMaxWidth() {
int max = 0;
}
}
}
return maxWidth;
}
private int getSuperPreferredWidth() {
return super.getPreferredSize().width;
}
}
}