public class BasicDirectoryModel extends AbstractListModel<Object> implements PropertyChangeListener
listenerList
Constructor and Description |
---|
BasicDirectoryModel(JFileChooser filechooser)
Constructs a new instance of
BasicDirectoryModel . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
|
boolean |
contains(Object o)
Returns
true if an element o is in file cache,
otherwise, returns false . |
void |
fireContentsChanged()
Invoked when a content is changed.
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting bound property changes for boolean properties.
|
Vector<File> |
getDirectories()
Returns a list of directories.
|
Object |
getElementAt(int index)
Returns the value at the specified index.
|
Vector<File> |
getFiles()
Returns a list of files.
|
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners
registered on this component.
|
int |
getSize()
Returns the length of the list.
|
int |
indexOf(Object o)
Returns an index of element
o in file cache. |
void |
intervalAdded(ListDataEvent e)
Obsolete - not used.
|
void |
intervalRemoved(ListDataEvent e)
Obsolete - not used.
|
void |
invalidateFileCache()
This method is used to interrupt file loading thread.
|
protected boolean |
lt(File a,
File b)
Obsolete - not used
|
void |
propertyChange(PropertyChangeEvent e)
This method gets called when a bound property is changed.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.
|
boolean |
renameFile(File oldFile,
File newFile)
Renames a file in the underlying file system.
|
protected void |
sort(Vector<? extends File> v)
Sorts a list of files.
|
void |
validateFileCache()
Validates content of file cache.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
public BasicDirectoryModel(JFileChooser filechooser)
BasicDirectoryModel
.filechooser
- an instance of {JFileChooser}public void propertyChange(PropertyChangeEvent e)
PropertyChangeListener
propertyChange
in interface PropertyChangeListener
e
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void invalidateFileCache()
public Vector<File> getDirectories()
public void validateFileCache()
public boolean renameFile(File oldFile, File newFile)
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()
ListModel
public boolean contains(Object o)
true
if an element o
is in file cache,
otherwise, returns false
.o
- an elementtrue
if an element o
is in file cachepublic int indexOf(Object o)
o
in file cache.o
- an elemento
in file cachepublic Object getElementAt(int index)
ListModel
getElementAt
in interface ListModel<Object>
index
- the requested indexindex
public void intervalAdded(ListDataEvent e)
e
- list data eventpublic void intervalRemoved(ListDataEvent e)
e
- list data eventprotected void sort(Vector<? extends File> v)
v
- a list of filesprotected boolean lt(File a, File b)
a
- a fileb
- another filepublic void addPropertyChangeListener(PropertyChangeListener listener)
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)
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()
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)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait