org.netbeans.modules.xml.xam
Interface Model<C extends Component<C>>

All Superinterfaces:
Referenceable
All Known Subinterfaces:
BpelModel, DocumentModel<C>
All Known Implementing Classes:
AbstractDocumentModel, AbstractModel, BpelModelImpl, WSDLModel, WSDLModelImpl

public interface Model<C extends Component<C>>
extends Referenceable

Interface describing an abstract model. The model is based on a document representation that represents the persistent form.

Author:
Chris Webster, Nam Nguyen, Rico Cruz

Nested Class Summary
static class Model.State
          State of the model.
 
Field Summary
static java.lang.String STATE_PROPERTY
           
 
Method Summary
 void addChildComponent(Component target, Component child, int index)
          Add child component at specified index.
 void addComponentListener(ComponentListener cl)
          Remove component event listener.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Add fine-grained property change listener for events on model components.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener uel)
          Adds undoable edit listener.
 void addUndoableRefactorListener(javax.swing.event.UndoableEditListener uel)
          Adds undoable refactoring edit listener.
 void endTransaction()
          This method stops the transaction and causes all events to be fired.
 ModelSource getModelSource()
           
 Model.State getState()
           
 boolean inSync()
          return true if sync is being performed.
 boolean isIntransaction()
           
 void removeChildComponent(Component child)
          Remove specified component from model.
 void removeComponentListener(ComponentListener cl)
          Add coarse-grained change listener for events on model components.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Remove property change listener.
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener uel)
          Removes undoable edit listener.
 void removeUndoableRefactorListener(javax.swing.event.UndoableEditListener uel)
          Removes undoable refactoring edit listener.
 boolean startTransaction()
          This method will block until a transaction can be started.
 void sync()
          make the current memory model consistent with the underlying representation, typically a swing document.
 

Field Detail

STATE_PROPERTY

static final java.lang.String STATE_PROPERTY
See Also:
Constant Field Values
Method Detail

removeComponentListener

void removeComponentListener(ComponentListener cl)
Add coarse-grained change listener for events on model components.


addComponentListener

void addComponentListener(ComponentListener cl)
Remove component event listener.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Add fine-grained property change listener for events on model components.


removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Remove property change listener.


removeUndoableEditListener

void removeUndoableEditListener(javax.swing.event.UndoableEditListener uel)
Removes undoable edit listener.


addUndoableEditListener

void addUndoableEditListener(javax.swing.event.UndoableEditListener uel)
Adds undoable edit listener.


removeUndoableRefactorListener

void removeUndoableRefactorListener(javax.swing.event.UndoableEditListener uel)
Removes undoable refactoring edit listener. This will also restored the existing undoable edit listeners to the set before the start of refactoring. Note, if these listeners are UndoManager instances their queues are cleared of existing edits.


addUndoableRefactorListener

void addUndoableRefactorListener(javax.swing.event.UndoableEditListener uel)
Adds undoable refactoring edit listener. This is typically called by a refactoring manager before start refactoring changes. This will also save existing undoable edit listeners. Note, if these listeners are UndoManager instances, their queues will be cleared of existing edits.


sync

void sync()
          throws java.io.IOException
make the current memory model consistent with the underlying representation, typically a swing document.

Throws:
java.io.IOException

inSync

boolean inSync()
return true if sync is being performed.


getState

Model.State getState()
Returns:
the last known state of the document. This method is affected by invocations of #sync().

isIntransaction

boolean isIntransaction()
Returns:
true if model is in middle of transformation tranasction.

startTransaction

boolean startTransaction()
This method will block until a transaction can be started. A transaction in this context will fire events (such as property change) when #endTransaction() has been invoked. A transaction must be be acquired during a mutation, reading can be performed without a transaction. Only a single transaction at a time is supported. Mutations which occur based on events will not be reflected until the transaction has completed.

Returns:
true if transaction is acquired successfully, else false, for example if model has transitioned into invalid state.

endTransaction

void endTransaction()
This method stops the transaction and causes all events to be fired. After all events have been fired, the document representation will be modified to reflect the current value of the model (flush).


addChildComponent

void addChildComponent(Component target,
                       Component child,
                       int index)
Add child component at specified index.

Parameters:
target - the parent component.
child - the child component to be added.
index - position among same type of child components, or -1 if not relevant.

removeChildComponent

void removeChildComponent(Component child)
Remove specified component from model.


getModelSource

ModelSource getModelSource()
Returns:
the source of this model or null if this model does associate with any model source.