PropertyChangeListener
, Serializable
, EventListener
, ListModel<Object>
public class BasicDirectoryModel extends AbstractListModel<Object> implements PropertyChangeListener
listenerList
Constructor | Description |
---|---|
BasicDirectoryModel |
Constructs a new instance of BasicDirectoryModel . |
Modifier and Type | Method | Description |
---|---|---|
void |
addPropertyChangeListener |
Adds a PropertyChangeListener to the listener list. |
boolean |
contains |
Returns true if an element o is in file cache, otherwise, returns false . |
void |
fireContentsChanged() |
Invoked when a content is changed. |
protected void |
firePropertyChange |
Support for reporting bound property changes for boolean properties. |
Vector |
getDirectories() |
Returns a list of directories. |
Object |
getElementAt |
Returns the value at the specified index. |
Vector |
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 |
Returns an index of element o in file cache. |
void |
intervalAdded |
Deprecated, for removal: This API element is subject to removal in a future version. Obsolete method, not used anymore. |
void |
intervalRemoved |
Deprecated, for removal: This API element is subject to removal in a future version. Obsolete method, not used anymore. |
void |
invalidateFileCache() |
This method is used to interrupt file loading thread. |
protected boolean |
lt |
Deprecated, for removal: This API element is subject to removal in a future version. Obsolete method, not used anymore. |
void |
propertyChange |
This method gets called when a bound property is changed. |
void |
removePropertyChangeListener |
Removes a PropertyChangeListener from the listener list. |
boolean |
renameFile |
Renames a file in the underlying file system. |
protected void |
sort |
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 Vector<File> getFiles()
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
@Deprecated(since="17", forRemoval=true) public void intervalAdded(ListDataEvent e)
e
- list data event@Deprecated(since="17", forRemoval=true) public void intervalRemoved(ListDataEvent e)
e
- list data eventprotected void sort(Vector<? extends File> v)
v
- a list of files@Deprecated(since="17", forRemoval=true) protected 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 addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
listener
- the PropertyChangeListener to be removedpublic PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener
s or an empty array if no property change listeners are currently registeredprotected 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
© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/plaf/basic/BasicDirectoryModel.html