JIDE 3.5.15

com.jidesoft.list
Class UndoableListDataEvent

java.lang.Object
  extended by java.util.EventObject
      extended by javax.swing.event.ListDataEvent
          extended by com.jidesoft.list.UndoableListDataEvent
All Implemented Interfaces:
Serializable, UndoableEdit

public class UndoableListDataEvent
extends ListDataEvent
implements UndoableEdit

A special ListDataEvent that contains the information of UndoableEdit.

Since:
3.3.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.event.ListDataEvent
CONTENTS_CHANGED, INTERVAL_ADDED, INTERVAL_REMOVED
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
UndoableListDataEvent(Object source, int type, int index0, int index1)
          The constructor.
 
Method Summary
 void addEdit(int rowIndex, int type, Object oldContent, Object newContent)
          Adds a new cell edit into the UndoableEdit.
 boolean addEdit(UndoableEdit anEdit)
           
 boolean canRedo()
           
 boolean canUndo()
           
 void die()
           
static void fireListDataEvent(AbstractListModel listModel, ListDataEvent e)
          Helper method to fire an UndoableListDataEvent.
 com.jidesoft.list.UndoableListDataEvent.ListModelEdit[] getEdits()
          Gets all the ListModelEdit instance in array.
 int getIndex0()
           
 int getIndex1()
           
 String getPresentationName()
           
 String getRedoPresentationName()
           
 int getType()
           
 String getUndoPresentationName()
           
 boolean isSignificant()
           
 boolean isUndoRedo()
          Gets the flag indicating if this event is triggered by an undo/redo activity or not.
 void redo()
           
 boolean replaceEdit(UndoableEdit anEdit)
           
 void setIndex0(int index0)
          Sets the first row of this event.
 void setIndex1(int index1)
          Sets the last row of this event.
 void setType(int type)
          Sets the event type of this event.
 void setUndoRedo(boolean undoRedo)
          Sets the flag indicating if this event is triggered by an undo/redo activity or not.
 void undo()
           
 
Methods inherited from class javax.swing.event.ListDataEvent
toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndoableListDataEvent

public UndoableListDataEvent(Object source,
                             int type,
                             int index0,
                             int index1)
The constructor.

Parameters:
source - the list model
type - the event type
index0 - the start index
index1 - the end index
Method Detail

addEdit

public void addEdit(int rowIndex,
                    int type,
                    Object oldContent,
                    Object newContent)
Adds a new cell edit into the UndoableEdit.

Parameters:
rowIndex - the row index
type - the edit type
oldContent - the old content
newContent - the new content

die

public void die()
Specified by:
die in interface UndoableEdit

undo

public void undo()
          throws CannotUndoException
Specified by:
undo in interface UndoableEdit
Throws:
CannotUndoException

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Throws:
CannotRedoException

canRedo

public boolean canRedo()
Specified by:
canRedo in interface UndoableEdit

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Specified by:
replaceEdit in interface UndoableEdit

isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface UndoableEdit

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit

getUndoPresentationName

public String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit

getRedoPresentationName

public String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit

setUndoRedo

public void setUndoRedo(boolean undoRedo)
Sets the flag indicating if this event is triggered by an undo/redo activity or not.

Parameters:
undoRedo - the flag

isUndoRedo

public boolean isUndoRedo()
Gets the flag indicating if this event is triggered by an undo/redo activity or not.

Returns:
true if this event is triggered by an undo/redo activity. Otherwise false.

getEdits

public com.jidesoft.list.UndoableListDataEvent.ListModelEdit[] getEdits()
Gets all the ListModelEdit instance in array.

Returns:
the ListModelEdit array. An empty array if no edit is found inside this event.

setType

public void setType(int type)
Sets the event type of this event.

Parameters:
type - tye type.

getType

public int getType()
Overrides:
getType in class ListDataEvent

setIndex0

public void setIndex0(int index0)
Sets the first row of this event.

Parameters:
index0 - the first row

getIndex0

public int getIndex0()
Overrides:
getIndex0 in class ListDataEvent

setIndex1

public void setIndex1(int index1)
Sets the last row of this event.

Parameters:
index1 - the last row

getIndex1

public int getIndex1()
Overrides:
getIndex1 in class ListDataEvent

fireListDataEvent

public static void fireListDataEvent(AbstractListModel listModel,
                                     ListDataEvent e)
Helper method to fire an UndoableListDataEvent.

Parameters:
listModel - the list model
e - the event to fire

JIDE 3.5.15