Mp3dings 
20100427

de.mospace.swing
Class IOPane.VectorHistory

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.Vector
              extended by de.mospace.swing.IOPane.VectorHistory
All Implemented Interfaces:
IOPane.History, Serializable, Cloneable, Iterable, Collection, List, RandomAccess
Enclosing class:
IOPane

public static final class IOPane.VectorHistory
extends Vector
implements IOPane.History

Default implementation of the IOPane.History interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IOPane.VectorHistory()
          Creates a new VectorHistory object.
 
Method Summary
 void add(String item)
          Adds the specified item to this history.
 void clear()
          Removes all items from this history.
 ActionListener getAddListener()
          Returns the ActionListener that adds items to this history.
 int getLength()
          Returns the maximum number of items this history can hold.
 String next()
          If there was no call to next() after the last add(java.lang.String) this method will return the last item added to this history.
 String previous()
          Returns the item added after the item returned by the last call to next() or previous().
 void resetPointer()
          Resets the current position in this history such that the next item returned by next() will be the item last added or null if no such item exists.
 void setLength(int maxitems)
          Sets the maximum number of items in the history.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IOPane.VectorHistory

public IOPane.VectorHistory()
Creates a new VectorHistory object.

Method Detail

getAddListener

public ActionListener getAddListener()
Returns the ActionListener that adds items to this history. It should usually add(java.lang.String) the value returned by ActionEvent.getActionCommand().

Specified by:
getAddListener in interface IOPane.History
Returns:
an action listener that adds new items to this history

setLength

public void setLength(int maxitems)
Sets the maximum number of items in the history. Default is 100. when maxitems is <= 0 the history has unlimited size.

Specified by:
setLength in interface IOPane.History
Parameters:
maxitems - the maximum number of items
See Also:
getLength()

getLength

public int getLength()
Returns the maximum number of items this history can hold.

Specified by:
getLength in interface IOPane.History
Returns:
the maximum number of items, default is 100
See Also:
setLength(int)

add

public void add(String item)
Adds the specified item to this history. The next call to next() must return item.

Specified by:
add in interface IOPane.History
Parameters:
item - the item to add
Throws:
NullPointerException - if item is null

clear

public void clear()
Removes all items from this history.

Specified by:
clear in interface IOPane.History
Specified by:
clear in interface Collection
Specified by:
clear in interface List
Overrides:
clear in class Vector

next

public String next()
If there was no call to next() after the last add(java.lang.String) this method will return the last item added to this history. Otherwise, it returns the item added before the item returned by the last call to next() or previous(). It returns null if no such item exists.

Specified by:
next in interface IOPane.History
Returns:
the next item in this history or null at its end

previous

public String previous()
Returns the item added after the item returned by the last call to next() or previous(). Even if no such item exists this method must return a non-null value, preferably the empty string.

Specified by:
previous in interface IOPane.History
Returns:
the previous item in this history

resetPointer

public void resetPointer()
Resets the current position in this history such that the next item returned by next() will be the item last added or null if no such item exists.

Specified by:
resetPointer in interface IOPane.History

Mp3dings 
20100427