Package org.geotools.swing.dialog
Class CRSListModel
- Object
-
- AbstractListModel<String>
-
- CRSListModel
-
- All Implemented Interfaces:
Serializable
,ListModel<String>
public class CRSListModel extends AbstractListModel<String>
List model class forJCRSChooser
. Supports filtering by case-insensitive sub-string matching.- Since:
- 8.0
- Author:
- Michael Bedward
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description CRSListModel(String authority)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
findCode(String code)
Searches for the element with the given code.String
getCodeAt(int i)
Gets the code for the given element index.String
getElementAt(int i)
int
getSize()
void
setFilter(String subStr)
Filters the model items by searching for the given sub-string.-
Methods inherited from class AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Constructor Detail
-
CRSListModel
public CRSListModel(String authority)
Constructor. Populates the model with available reference systems for the specified authority. Ifauthority
isnull
or empty, it defaults toJCRSChooser.DEFAULT_AUTHORITY
.- Parameters:
authority
- the authority name
-
-
Method Detail
-
getSize
public int getSize()
- Returns:
- the length of the list with the current filter applied
-
getElementAt
public String getElementAt(int i)
- Returns:
- a
String
of the formreference code: description
-
setFilter
public void setFilter(String subStr)
Filters the model items by searching for the given sub-string. Case is ignored for matching.- Parameters:
subStr
- sub-string to filter on; ornull
or empty string for no filtering
-
getCodeAt
public String getCodeAt(int i)
Gets the code for the given element index.- Parameters:
i
- the index- Returns:
- the code
-
findCode
public int findCode(String code)
Searches for the element with the given code. The search is undertaken on the filtered items.- Parameters:
code
- the code to match; may benull
or empty in which case -1 is returned- Returns:
- index of the matching element or -1 if not found.
-
-