public class ChangeForwarder extends Object implements ChangeListener
Modifier and Type | Class and Description |
---|---|
static class |
ChangeForwarder.Retyper
A ChangeForwarder that systematically uses a given type and wraps the old
event.
|
ChangeListener.AlwaysVetoListener, ChangeListener.ChangeEventRecorder, ChangeListener.LoggingListener
ALWAYS_VETO, LOG_TO_OUT
Constructor and Description |
---|
ChangeForwarder(Object source,
ChangeSupport changeSupport)
Create a new ChangeForwarder for forwarding events.
|
Modifier and Type | Method and Description |
---|---|
ChangeSupport |
changeSupport()
Return the underlying
ChangeSupport instance that can be used to
fire ChangeEvent s and mannage listeners. |
protected ChangeEvent |
generateEvent(ChangeEvent ce)
Return the new event to represent the originating event ce.
|
Object |
getSource()
Retrieve the 'source' object for
ChangeEvent s fired by this forwarder. |
void |
postChange(ChangeEvent ce)
Called when a change has just taken place.
|
void |
preChange(ChangeEvent ce)
Called before a change takes place.
|
public ChangeForwarder(Object source, ChangeSupport changeSupport)
source
- the new source ObjectchangeSupport
- the ChangeSupport managing the listenerspublic Object getSource()
ChangeEvent
s fired by this forwarder.public ChangeSupport changeSupport()
ChangeSupport
instance that can be used to
fire ChangeEvent
s and mannage listeners.protected ChangeEvent generateEvent(ChangeEvent ce) throws ChangeVetoException
Return the new event to represent the originating event ce.
The returned ChangeEvent is the event that will be fired, and should be built from information in the original event. If it is null, then no event will be fired.
The default implementation just constructs a ChangeEvent of the same type that chains back to ce.
ce
- the originating ChangeEventChangeVetoException
- if for any reason this event can't be handledpublic void preChange(ChangeEvent ce) throws ChangeVetoException
ChangeListener
Called before a change takes place.
This is your chance to stop the change by throwing a ChangeVetoException. This method does not indicate that the change will definitely take place, so it is not recomended that you take any positive action within this handler.
preChange
in interface ChangeListener
ce
- An event encapsulating the change which is about
to take place.ChangeVetoException
- Description of Exceptionpublic void postChange(ChangeEvent ce)
ChangeListener
Called when a change has just taken place.
This method is the place to perform any behavior in response to the change event.
postChange
in interface ChangeListener
ce
- An event encapsulating the change which has
occured.Copyright © 2014 BioJava. All rights reserved.