JIDE 3.5.15

com.jidesoft.list
Class DefaultUndoableListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by javax.swing.DefaultListModel
          extended by com.jidesoft.list.DefaultUndoableListModel
All Implemented Interfaces:
EventFireListModel, ListUndoableSupport, UndoableSupport, Serializable, ListModel

public class DefaultUndoableListModel
extends DefaultListModel
implements ListUndoableSupport

Default undoable ListModel.

Since:
3.3.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
DefaultUndoableListModel()
          The constructor.
 
Method Summary
 void add(int index, Object element)
           
 void addElement(Object obj)
           
 void beginCompoundEdit(boolean isUndoRedo)
          Begins the edit of the model.
 void clear()
           
 void endCompoundEdit()
          Ends the edit of the model.
 void fireListDataEvent(ListDataEvent event)
          Fires a ListDataEvent.
 UndoableEditSupport getUndoableEditSupport()
          Gets the UndoableEditSupport instance to add UndoableListener.
 UndoManager getUndoManager()
          Gets the UndoManager.
 void insertElementAt(Object obj, int index)
           
 Object remove(int index)
           
 void removeAllElements()
           
 boolean removeElement(Object obj)
           
 void removeElementAt(int index)
           
 void removeRange(int fromIndex, int toIndex)
           
 Object set(int index, Object element)
           
 void setElementAt(Object obj, int index)
           
 void undoableInsertElementAt(Object content, int index)
          Inserts a row at the designated row index.
 void undoableRemoveElementAt(int index)
          Removes a row at the designated row index.
 void undoableSetElementAt(Object newContent, int index)
          Updates a row at the designated row index with the new row content .
 
Methods inherited from class javax.swing.DefaultListModel
capacity, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, setSize, size, toArray, toString, trimToSize
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultUndoableListModel

public DefaultUndoableListModel()
The constructor.

Method Detail

setElementAt

public void setElementAt(Object obj,
                         int index)
Overrides:
setElementAt in class DefaultListModel

removeElementAt

public void removeElementAt(int index)
Overrides:
removeElementAt in class DefaultListModel

insertElementAt

public void insertElementAt(Object obj,
                            int index)
Overrides:
insertElementAt in class DefaultListModel

addElement

public void addElement(Object obj)
Overrides:
addElement in class DefaultListModel

removeElement

public boolean removeElement(Object obj)
Overrides:
removeElement in class DefaultListModel

removeAllElements

public void removeAllElements()
Overrides:
removeAllElements in class DefaultListModel

set

public Object set(int index,
                  Object element)
Overrides:
set in class DefaultListModel

add

public void add(int index,
                Object element)
Overrides:
add in class DefaultListModel

remove

public Object remove(int index)
Overrides:
remove in class DefaultListModel

clear

public void clear()
Overrides:
clear in class DefaultListModel

removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Overrides:
removeRange in class DefaultListModel

undoableInsertElementAt

public void undoableInsertElementAt(Object content,
                                    int index)
Description copied from interface: ListUndoableSupport
Inserts a row at the designated row index.

Invoking this method will be able to insert a row, then adds an UndoableEdit or fires an event if necessary.

Specified by:
undoableInsertElementAt in interface ListUndoableSupport
Parameters:
content - the row content
index - the row index

undoableRemoveElementAt

public void undoableRemoveElementAt(int index)
Description copied from interface: ListUndoableSupport
Removes a row at the designated row index.

Invoking this method will be able to remove a row, then adds an UndoableEdit or fires an event if necessary.

Specified by:
undoableRemoveElementAt in interface ListUndoableSupport
Parameters:
index - the row index

undoableSetElementAt

public void undoableSetElementAt(Object newContent,
                                 int index)
Description copied from interface: ListUndoableSupport
Updates a row at the designated row index with the new row content .

Invoking this method will be able to update a row, then adds an UndoableEdit or fires an event if necessary.

Specified by:
undoableSetElementAt in interface ListUndoableSupport
Parameters:
newContent - the row content
index - the row index

getUndoManager

public UndoManager getUndoManager()
Description copied from interface: UndoableSupport
Gets the UndoManager.

Specified by:
getUndoManager in interface UndoableSupport
Returns:
the UndoManager.

getUndoableEditSupport

public UndoableEditSupport getUndoableEditSupport()
Description copied from interface: UndoableSupport
Gets the UndoableEditSupport instance to add UndoableListener.

Specified by:
getUndoableEditSupport in interface UndoableSupport
Returns:
the UndoableEditSupport instance.

beginCompoundEdit

public void beginCompoundEdit(boolean isUndoRedo)
Description copied from interface: UndoableSupport
Begins the edit of the model.

Specified by:
beginCompoundEdit in interface UndoableSupport
Parameters:
isUndoRedo - the flag to indicate if this operation is triggered by undo/redo

endCompoundEdit

public void endCompoundEdit()
Description copied from interface: UndoableSupport
Ends the edit of the model.

Specified by:
endCompoundEdit in interface UndoableSupport

fireListDataEvent

public void fireListDataEvent(ListDataEvent event)
Description copied from interface: EventFireListModel
Fires a ListDataEvent.

Specified by:
fireListDataEvent in interface EventFireListModel
Parameters:
event - the event

JIDE 3.5.15