public abstract class AbstractDocumentModel<T extends DocumentComponent<T>> extends AbstractModel<T> implements DocumentModel<T>
AbstractModel.ModelUndoableEdit, AbstractModel.ModelUndoableEditSupport
Model.State
Modifier and Type | Field and Description |
---|---|
protected DocumentModelAccess |
access
Do not assign to this field.
|
ues
STATE_PROPERTY
Constructor and Description |
---|
AbstractDocumentModel(ModelSource source) |
Modifier and Type | Method and Description |
---|---|
void |
addChildComponent(Component target,
Component child,
int index)
Adds child component at specified index.
|
boolean |
areSameNodes(Node n1,
Node n2) |
abstract T |
createRootComponent(Element root) |
AbstractDocumentComponent |
findComponent(AbstractDocumentComponent base,
List<Element> pathFromRoot,
int current) |
DocumentComponent |
findComponent(Element e) |
DocumentComponent |
findComponent(int position)
Find component given a position into the Swing document.
|
DocumentComponent |
findComponent(List<Element> pathFromRoot)
Find the component given a path to its element node from root.
|
protected void |
firePropertyChangedEvents(SyncUnit unit) |
protected void |
firePropertyChangedEvents(SyncUnit unit,
Element oldElement) |
DocumentModelAccess |
getAccess() |
static DocumentModelAccessProvider |
getAccessProvider() |
Document |
getBaseDocument() |
protected abstract ComponentUpdater<T> |
getComponentUpdater() |
Document |
getDocument() |
Set<String> |
getElementNames() |
Set<QName> |
getQNames()
Returns QName of elements used in model.
|
Map<QName,List<QName>> |
getQNameValuedAttributes()
Returns QName of all attributes with QName value, sorted by containing
element QName.
|
String |
getXPathExpression(DocumentComponent component)
Return XPath expression for the given component.
|
protected boolean |
isDomainElement(Node e) |
protected boolean |
needsSync()
This method is overridden by subclasses to determine if sync needs to be
performed.
|
ChangeInfo |
prepareChangeInfo(List<? extends Node> pathToRoot,
List<? extends Node> nsContextPathToRoot)
Performs intermediate stage of synchronization XDM --> XAM.
|
ChangeInfo |
prepareChangeInfo(List<Node> pathToRoot)
Deprecated.
Use
AbstractDocumentModel.prepareChangeInfo(java.util.List, java.util.List) instead. It is necessary for fixing bug #166177. |
SyncUnit |
prepareSyncUnit(ChangeInfo change,
SyncUnit order) |
void |
processSyncUnit(SyncUnit syncOrder) |
protected void |
refresh()
Refresh the domain model component trees.
|
void |
removeChildComponent(Component child)
Removes specified component from model.
|
protected void |
setIdentifyingAttributes()
Set the identifying attributes for underlying access to merge.
|
protected void |
syncCompleted()
This method is invoked when sync has completed.
|
protected void |
syncStarted()
This method is invoked when sync has started.
|
protected static String |
toLocalName(String tagName) |
addComponentListener, addPropertyChangeListener, addUndoableEditListener, addUndoableRefactorListener, createModelUndoableEdit, endTransaction, endTransaction, finishTransaction, fireComponentChangedEvent, firePropertyChangeEvent, getModelSource, getState, inSync, inUndoRedo, isAutoSyncActive, isIntransaction, removeComponentListener, removePropertyChangeListener, removeUndoableEditListener, removeUndoableRefactorListener, rollbackTransaction, setAutoSyncActive, setInSync, setInUndoRedo, setState, startedFiringEvents, startTransaction, sync, transactionCompleted, transactionStarted, undoableEditHappened, validateWrite
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createComponent, getRootComponent
addComponentListener, addPropertyChangeListener, addUndoableEditListener, addUndoableRefactorListener, endTransaction, getModelSource, getState, inSync, isIntransaction, removeComponentListener, removePropertyChangeListener, removeUndoableEditListener, removeUndoableRefactorListener, startTransaction, sync
protected DocumentModelAccess access
public AbstractDocumentModel(ModelSource source)
public Document getBaseDocument()
public boolean areSameNodes(Node n1, Node n2)
areSameNodes
in interface DocumentModel<T extends DocumentComponent<T>>
public Set<QName> getQNames()
protected boolean needsSync()
AbstractModel
needsSync
in class AbstractModel<T extends DocumentComponent<T>>
protected void syncStarted()
AbstractModel
syncStarted
in class AbstractModel<T extends DocumentComponent<T>>
protected void syncCompleted()
AbstractModel
syncCompleted
in class AbstractModel<T extends DocumentComponent<T>>
protected abstract ComponentUpdater<T> getComponentUpdater()
@Deprecated public ChangeInfo prepareChangeInfo(List<Node> pathToRoot)
AbstractDocumentModel.prepareChangeInfo(java.util.List, java.util.List)
instead. It is necessary for fixing bug #166177.pathToRoot
- public ChangeInfo prepareChangeInfo(List<? extends Node> pathToRoot, List<? extends Node> nsContextPathToRoot)
ChangeInfo
object
is generated here.pathToRoot
- a path of DOM objects from root to changed one.nsContextPathToRoot
- Usually the same path as previous param,
but in case of deletion it contains the same path from old model's tree.
It is required in case of prefix declaration deletion, because the deleted
declaration is present only in old model's tree.
Be aware that the method is designed to be called only from XDM
org.netbeans.modules.xml.xdm.xam.XDMListener
,
but it also can be redifined. An example can be found in
org.netbeans.modules.xml.wsdl.model.WSDLModel
.public SyncUnit prepareSyncUnit(ChangeInfo change, SyncUnit order)
protected void firePropertyChangedEvents(SyncUnit unit)
protected void firePropertyChangedEvents(SyncUnit unit, Element oldElement)
public void processSyncUnit(SyncUnit syncOrder)
public void addChildComponent(Component target, Component child, int index)
Model
addChildComponent
in interface Model<T extends DocumentComponent<T>>
target
- the parent component.child
- the child component to be added.index
- position among same type of child components, or -1 if not relevant.public void removeChildComponent(Component child)
Model
removeChildComponent
in interface Model<T extends DocumentComponent<T>>
public DocumentComponent findComponent(Element e)
public DocumentComponent findComponent(List<Element> pathFromRoot)
pathFromRoot
- list of elements from model root to backing element of target component.public AbstractDocumentComponent findComponent(AbstractDocumentComponent base, List<Element> pathFromRoot, int current)
public DocumentComponent findComponent(int position)
DocumentModel
findComponent
in interface DocumentModel<T extends DocumentComponent<T>>
public String getXPathExpression(DocumentComponent component)
DocumentModel
getXPathExpression
in interface DocumentModel<T extends DocumentComponent<T>>
public Document getDocument()
getDocument
in interface DocumentModel<T extends DocumentComponent<T>>
public DocumentModelAccess getAccess()
getAccess
in class AbstractModel<T extends DocumentComponent<T>>
public static DocumentModelAccessProvider getAccessProvider()
protected void setIdentifyingAttributes()
protected boolean isDomainElement(Node e)
protected void refresh()
AbstractModel
refresh
in class AbstractModel<T extends DocumentComponent<T>>
public Map<QName,List<QName>> getQNameValuedAttributes()