org.geotools.gui.tools
Class ToolListImpl

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.geotools.gui.tools.ToolListImpl
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable, ToolList

public class ToolListImpl
extends java.util.ArrayList
implements ToolList

A list of tools provided by the MapViewer to the operator, including the selectedTool which is the current tool in use. An event is sent to interested classes when the selectedTool changes.
No event is sent if a tool is added or removed from the ToolList as the ToolList is expected to be set up once at startup and not change after that.

Version:
$Id: ToolListImpl.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Cameron Shorter
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ToolListImpl()
          Creates a new instance of ToolList.
 
Method Summary
 void addSelectedToolListener(SelectedToolListener listener)
          Register interest in being called when Tool changes.
 void clear()
          Removes all of the elements from this collection (optional operation).
protected  void fireSelectedToolListener()
          Send events to all SelectedToolListeners.
 Tool getSelectedTool()
          Get the tool.
 java.lang.Object remove(int index)
          Removes the element at the specified position in this list (optional operation).
 boolean remove(java.lang.Object o)
          Removes a single instance of the specified element from this collection, if it is present (optional operation).
 boolean removeAll(java.util.Collection c)
          Removes all this collection's elements that are also contained in the specified collection (optional operation).
 void removeSelectedToolListener(SelectedToolListener listener)
          Remove interest in bening notified when Tool changes.
 boolean retainAll(java.util.Collection c)
          Retains only the elements in this collection that are contained in the specified collection (optional operation).
 java.lang.Object set(int index, java.lang.Object element)
          Replaces the element at the specified position in this list with the specified element (optional operation).
 void setSelectedTool(int i)
          Set the tool.
 void setSelectedTool(Tool selectedTool)
          Set the tool.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, removeRange, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray
 

Constructor Detail

ToolListImpl

public ToolListImpl()
Creates a new instance of ToolList.

Method Detail

addSelectedToolListener

public void addSelectedToolListener(SelectedToolListener listener)
Register interest in being called when Tool changes.

Specified by:
addSelectedToolListener in interface ToolList
Parameters:
listener - The object to notify when tool changes.

removeSelectedToolListener

public void removeSelectedToolListener(SelectedToolListener listener)
Remove interest in bening notified when Tool changes.

Specified by:
removeSelectedToolListener in interface ToolList
Parameters:
listener - The listener.

fireSelectedToolListener

protected void fireSelectedToolListener()
Send events to all SelectedToolListeners.


getSelectedTool

public Tool getSelectedTool()
Get the tool.

Specified by:
getSelectedTool in interface ToolList
Returns:
The selected tool.

setSelectedTool

public void setSelectedTool(int i)
Set the tool. Added by Jamison Conley, May 24, 2004

Specified by:
setSelectedTool in interface ToolList
Parameters:
i - The index of the selected tool.

setSelectedTool

public void setSelectedTool(Tool selectedTool)
Set the tool.

Specified by:
setSelectedTool in interface ToolList
Parameters:
selectedTool - The new tool.

clear

public void clear()
Removes all of the elements from this collection (optional operation). This collection will be empty after this method returns unless it throws an exception.
The selectedTool is set to null.

Specified by:
clear in interface java.util.List

remove

public java.lang.Object remove(int index)
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Specified by:
remove in interface java.util.List
Parameters:
index - the index of the element to removed.
Returns:
the element previously at the specified position.

remove

public boolean remove(java.lang.Object o)
Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).

Specified by:
remove in interface java.util.List
Parameters:
o - element to be removed from this collection, if present.
Returns:
true if this collection changed as a result of the call

removeAll

public boolean removeAll(java.util.Collection c)
Removes all this collection's elements that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.

Specified by:
removeAll in interface java.util.List
Parameters:
c - elements to be removed from this collection.
Returns:
true if this collection changed as a result of the call
See Also:
remove(Object), ArrayList.contains(Object)

retainAll

public boolean retainAll(java.util.Collection c)
Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.

Specified by:
retainAll in interface java.util.List
Parameters:
c - elements to be retained in this collection.
Returns:
true if this collection changed as a result of the call
See Also:
remove(Object), ArrayList.contains(Object)

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Replaces the element at the specified position in this list with the specified element (optional operation).

Specified by:
set in interface java.util.List
Parameters:
index - index of element to replace.
element - element to be stored at the specified position.
Returns:
the element previously at the specified position.


Copyright © GeoTools. All Rights Reserved.