org.norvelle.textcite.model
Class Clipboard

java.lang.Object
  extended by org.norvelle.textcite.model.Clipboard
All Implemented Interfaces:
ListModelAdaptee

public class Clipboard
extends java.lang.Object
implements ListModelAdaptee

The Clipboard holds objects that have been cut from one or another data structure (the Category tree or the Book Outline tree) and have not yet been pasted into another location. Acts as a Stack (i.e. last-in. first-out)


Constructor Summary
Clipboard()
           
 
Method Summary
 void addAdapter(ListModelChangeListener adapter)
           
 void deleteItem(ClipboardHostable item)
          Deletes the item from the stack, calling its "destroy" method in the process.
 void empty()
          Deletes all items from the stack, destroying each one as it does so.
 java.lang.Object getElementAt(int pos)
          Returns the ClipboardHostable item at the given position in the sorted list.
 int getPosInList(java.lang.Object item)
           
 int getSize()
           
 boolean hasMoreItems(java.lang.Class itemClass)
           
 void moveDown(ClipboardHostable item)
          Move the given item down in the stack, so that it will be available later for pasting
 void moveUp(ClipboardHostable item)
          Move the given item up in the stack, so that it will be available earlier for pasting
 ClipboardHostable pop(java.lang.Class itemClass)
           
 void push(ClipboardHostable item)
          Put the given item on the top of the stack
 void recreateAdapterCollection()
          After loading a new file, the AdapterCollection (which is marked as transient) will not be recreated during the deserialization process.
 void removeAdapter(ListModelChangeListener adapter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Clipboard

public Clipboard()
Method Detail

push

public void push(ClipboardHostable item)
Put the given item on the top of the stack


hasMoreItems

public boolean hasMoreItems(java.lang.Class itemClass)
Parameters:
itemClass - The Class to search for
Returns:
Returns true if there is at least one object of the given class on the stack, false otherwise

pop

public ClipboardHostable pop(java.lang.Class itemClass)
Returns:
Returns the top item on the stack, of the class indicated (null if none found).

deleteItem

public void deleteItem(ClipboardHostable item)
Deletes the item from the stack, calling its "destroy" method in the process.


empty

public void empty()
Deletes all items from the stack, destroying each one as it does so.


moveUp

public void moveUp(ClipboardHostable item)
Move the given item up in the stack, so that it will be available earlier for pasting


moveDown

public void moveDown(ClipboardHostable item)
Move the given item down in the stack, so that it will be available later for pasting


getSize

public int getSize()
Specified by:
getSize in interface ListModelAdaptee
Returns:
The number of items on the Clipboard currently

getElementAt

public java.lang.Object getElementAt(int pos)
Returns the ClipboardHostable item at the given position in the sorted list.

Specified by:
getElementAt in interface ListModelAdaptee
See Also:
ListModel.getElementAt(int)

getPosInList

public int getPosInList(java.lang.Object item)
Specified by:
getPosInList in interface ListModelAdaptee

addAdapter

public void addAdapter(ListModelChangeListener adapter)
Specified by:
addAdapter in interface ListModelAdaptee

removeAdapter

public void removeAdapter(ListModelChangeListener adapter)
Specified by:
removeAdapter in interface ListModelAdaptee

recreateAdapterCollection

public void recreateAdapterCollection()
After loading a new file, the AdapterCollection (which is marked as transient) will not be recreated during the deserialization process. This procedure needs to be called to recreate an empty AdapterCollection.

Specified by:
recreateAdapterCollection in interface ListModelAdaptee