org.netbeans.modules.xml.xam/1 1.18.0 1

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

All Superinterfaces:
Referenceable
All Known Subinterfaces:
DocumentModel<C>
All Known Implementing Classes:
AbstractDocumentModel, AbstractModel

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.


Nested Class Summary
static class Model.State
          State of the model.
 
Field Summary
static String STATE_PROPERTY
           
 
Method Summary
 void addChildComponent(Component target, Component child, int index)
          Adds child component at specified index.
 void addComponentListener(ComponentListener cl)
          Removes component event listener.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Adds fine-grained property change listener for events on model components.
 void addUndoableEditListener(UndoableEditListener uel)
          Adds undoable edit listener.
 void addUndoableRefactorListener(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()
          Returns true if sync is being performed.
 boolean isIntransaction()
          Be very careful while using this method.
 void removeChildComponent(Component child)
          Removes specified component from model.
 void removeComponentListener(ComponentListener cl)
          Adds coarse-grained change listener for events on model components.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          Remove property change listener.
 void removeUndoableEditListener(UndoableEditListener uel)
          Removes undoable edit listener.
 void removeUndoableRefactorListener(UndoableEditListener uel)
          Removes undoable refactoring edit listener.
 boolean startTransaction()
          This method will block until a transaction can be started.
 void sync()
          Makes the current memory model consistent with the underlying representation, typically a swing document.
 

Field Detail

STATE_PROPERTY

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

removeComponentListener

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


addComponentListener

void addComponentListener(ComponentListener cl)
Removes component event listener.


addPropertyChangeListener

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


removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener pcl)
Remove property change listener.


removeUndoableEditListener

void removeUndoableEditListener(UndoableEditListener uel)
Removes undoable edit listener.


addUndoableEditListener

void addUndoableEditListener(UndoableEditListener uel)
Adds undoable edit listener.


removeUndoableRefactorListener

void removeUndoableRefactorListener(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(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 IOException
Makes the current memory model consistent with the underlying representation, typically a swing document.

Throws:
IOException

inSync

boolean inSync()
Returns 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()
Be very careful while using this method. It returns only current state and doesn't inform if the transaction has been started by current thread. Only the thread, which owns the transaction can use it and do changes to the model.

Returns:
true if model is in middle of transformation tranasction.

startTransaction

@CheckReturnValue
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). Be aware that the method does nothing if the transaction hasn't been started or started by another thread.


addChildComponent

void addChildComponent(Component target,
                       Component child,
                       int index)
Adds 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)
Removes specified component from model.


getModelSource

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

org.netbeans.modules.xml.xam/1 1.18.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.