public class StyleSelectorListModel extends Object implements ListModel
Modifier and Type | Field and Description |
---|---|
protected Vector<IStyle> |
elements |
protected FileFilter |
fFilter |
protected String |
fileExt |
protected File |
folder |
protected SelectorFilter |
sFilter |
static String |
STYLE_FILE_EXTENSION |
Constructor and Description |
---|
StyleSelectorListModel(File dir,
SelectorFilter filter,
String fileExtension)
Creates a new instance of the model for the list in the Style Selector window
where the styles are stored in the dir (root directory) param.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Object o)
Appends the specified element to the end of this Vector
|
void |
addListDataListener(ListDataListener l) |
Object |
getElementAt(int index) |
Vector<IStyle> |
getObjects()
TODO: use the new Persistence API.
|
int |
getSize() |
void |
insertAt(int i,
Object o)
Inserts the specified element at the specified position in this Vector.
|
Object |
remove(int i)
Removes the element at the specified position in this Vector. shifts any
subsequent elements to the left (subtracts one from their indices).
|
void |
removeListDataListener(ListDataListener l) |
public static final String STYLE_FILE_EXTENSION
protected File folder
protected FileFilter fFilter
protected SelectorFilter sFilter
protected String fileExt
public StyleSelectorListModel(File dir, SelectorFilter filter, String fileExtension)
Creates a new instance of the model for the list in the Style Selector window
where the styles are stored in the dir (root directory) param.
The currentElement defines which element is pre-selected.
The filter is a user defined filter used to know which elements in
the folder are accepted or rejected for this list and it is used to avoid
mixing marker styles for polygons for example.
fileExtension param defines the extension of the file to be parsed. This is like that to enable inheritance of this class to other file selector such as StyleSelector.
dir,
- the root dir where styles are located.currentElemet,
- the element to be pre-selected.filter,
- the filter used to show or hide some elements.fileExtension,
- file extension used for the files to be parsed.public Vector<IStyle> getObjects()
public void add(Object o)
ListModel
o
- element to be appended to this Vectorpublic Object getElementAt(int index)
getElementAt
in interface ListModel
public void addListDataListener(ListDataListener l)
addListDataListener
in interface ListModel
public void removeListDataListener(ListDataListener l)
removeListDataListener
in interface ListModel
public Object remove(int i) throws ArrayIndexOutOfBoundsException
ListModel
i
- Índice del elemento que se quiere eliminarArrayIndexOutOfBoundsException
- Si el índice está fuera del arraypublic void insertAt(int i, Object o)
ListModel
i
- index at which the specified element is to be inserted.o
- element to be inserted.