* Rebuild the list model contents based on the ImageTiles contained on the
* OMGraphicList.
*
*/
protected void rebuildListModel() {
DefaultListModel dlm = (DefaultListModel) getListModel();
OMGraphicList list = getList();
int[] selectedIndicies = null;
boolean checkForIndicies = false;
if (list != null) {
if (selectedTiles != null && selectedTiles.length > 0) {
selectedIndicies = new int[selectedTiles.length];
checkForIndicies = true;
}
int tileCount = 0;
for (Iterator it = list.iterator(); it.hasNext(); tileCount++) {
ImageTile imageTile = (ImageTile) it.next();
if (checkForIndicies) {
for (int i = 0; i < selectedTiles.length; i++) {
if (imageTile == selectedTiles[i]) {
for (int j = 0; j < selectedIndicies.length; j++) {
selectedIndicies[j] = tileCount + j;
}
checkForIndicies = false;
}
}
}
}
// Causes value changed() to be called, which then unsets selected
// tiles. So we need to find out which tiles were selected above,
// and then set them again later.
dlm.clear();
for (Iterator it = list.iterator(); it.hasNext(); tileCount++) {
dlm.addElement(it.next());
}
}
if (resultsList != null) {