public class BasicDirectoryModel extends AbstractListModel<Object> implements PropertyChangeListener
Basic implementation of a file list.
listenerList
public BasicDirectoryModel(JFileChooser filechooser)
public void propertyChange(PropertyChangeEvent e)
Description copied from interface: PropertyChangeListener
This method gets called when a bound property is changed.
propertyChange
in interface PropertyChangeListener
e
- A PropertyChangeEvent object describing the event source and the property that has changed.public void invalidateFileCache()
This method is used to interrupt file loading thread.
public Vector<File> getDirectories()
public Vector<File> getFiles()
public void validateFileCache()
public boolean renameFile(File oldFile, File newFile)
Renames a file in the underlying file system.
oldFile
- a File
object representing the existing filenewFile
- a File
object representing the desired new file nametrue
if rename succeeded, otherwise false
public void fireContentsChanged()
public int getSize()
Description copied from interface: ListModel
Returns the length of the list.
public boolean contains(Object o)
public int indexOf(Object o)
public Object getElementAt(int index)
Description copied from interface: ListModel
Returns the value at the specified index.
getElementAt
in interface ListModel<Object>
index
- the requested indexindex
public void intervalAdded(ListDataEvent e)
Obsolete - not used.
public void intervalRemoved(ListDataEvent e)
Obsolete - not used.
protected void sort(Vector<? extends File> v)
protected boolean lt(File a, File b)
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class.
If listener
is null
, no exception is thrown and no action is performed.
listener
- the property change listener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
, getPropertyChangeListeners()
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.
If listener is null, no exception is thrown and no action is performed.
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
, getPropertyChangeListeners()
public PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component.
PropertyChangeListener
s or an empty array if no property change listeners are currently registeredaddPropertyChangeListener(java.beans.PropertyChangeListener)
, removePropertyChangeListener(java.beans.PropertyChangeListener)
, PropertyChangeSupport.getPropertyChangeListeners()
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.