javax.swing.plaf.metal
Class MetalFileChooserUI.DirectoryComboBoxModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxModel
All Implemented Interfaces:
Serializable, ComboBoxModel, ListModel
Enclosing class:
MetalFileChooserUI

protected class MetalFileChooserUI.DirectoryComboBoxModel
extends AbstractListModel
implements ComboBoxModel

A combo box model containing the selected directory and all its parent directories.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
MetalFileChooserUI.DirectoryComboBoxModel()
          Creates a new model.
 
Method Summary
 int getDepth(int index)
          Returns the depth of the item at the given index.
 Object getElementAt(int index)
          Returns the item at the specified index.
 Object getSelectedItem()
          Returns the selected item, or null if no item is selected.
 int getSize()
          Returns the number of items in the model.
 void setSelectedItem(Object selectedDirectory)
          Sets the selected item.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

MetalFileChooserUI.DirectoryComboBoxModel

public MetalFileChooserUI.DirectoryComboBoxModel()
Creates a new model.

Method Detail

getSize

public int getSize()
Returns the number of items in the model.

Specified by:
getSize in interface ListModel
Returns:
The number of items in the model.

getElementAt

public Object getElementAt(int index)
Returns the item at the specified index.

Specified by:
getElementAt in interface ListModel
Parameters:
index - the item index.
Returns:
The item.

getDepth

public int getDepth(int index)
Returns the depth of the item at the given index.

Parameters:
index - the item index.
Returns:
The depth.

getSelectedItem

public Object getSelectedItem()
Returns the selected item, or null if no item is selected.

Specified by:
getSelectedItem in interface ComboBoxModel
Returns:
The selected item, or null.

setSelectedItem

public void setSelectedItem(Object selectedDirectory)
Sets the selected item. This clears all the directories from the existing list, and repopulates it with the new selected directory and all its parent directories.

Specified by:
setSelectedItem in interface ComboBoxModel
Parameters:
selectedDirectory - the selected directory.