|
org.netbeans.modules.xml.xam/1 1.18.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.modules.xml.xam.AbstractComponent<C>
org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent<C>
public abstract class AbstractDocumentComponent<C extends DocumentComponent<C>>
An abstract implementation of the Component with support of underlaying DOM model.
| Nested Class Summary | |
|---|---|
static class |
AbstractDocumentComponent.PrefixAttribute
|
| Field Summary |
|---|
| Fields inherited from interface org.netbeans.modules.xml.xam.dom.DocumentComponent |
|---|
TEXT_CONTENT_PROPERTY |
| Constructor Summary | |
|---|---|
AbstractDocumentComponent(AbstractDocumentModel model,
Element e)
|
|
| Method Summary | ||
|---|---|---|
void |
addPrefix(String prefix,
String namespace)
Declare prefix for given namespace (without any refactoring action). |
|
protected void |
appendChildQuietly(C component,
List<C> children)
|
|
DocumentComponent |
copy(C parent)
Returns a copy of this component for adding into the given parent component. |
|
protected Attribute |
createPrefixAttribute(String prefix)
|
|
protected String |
ensureUnique(String prefix,
String namespace)
Returns a unique prefix for the given namespace by appending number from 1 to 100. |
|
protected void |
ensureValueNamespaceDeclared(String newNamespace,
String oldNamespace,
String preferredPrefix)
|
|
int |
findAttributePosition(String attributeName)
Returns position of the attribute by the given name, or -1 if not found. |
|
C |
findChildComponent(Element e)
Returns child component backed by given element node. |
|
C |
findChildComponentByIdentity(Element e)
|
|
protected int |
findDomainIndex(Element e)
|
|
int |
findPosition()
Returns the position of this component in the schema document, expressed as an offset from the start of the document. |
|
protected void |
fireChildAdded()
|
|
protected void |
fireChildRemoved()
|
|
protected void |
firePropertyChange(String propName,
Object oldValue,
Object newValue)
|
|
protected void |
fireValueChanged()
|
|
protected DocumentModelAccess |
getAccess()
|
|
String |
getAnyAttribute(QName attr)
Returns string value of the attribute from different namespace or null if the attribute is currently undefined. |
|
String |
getAttribute(Attribute attr)
|
|
Map<QName,String> |
getAttributeMap()
|
|
protected abstract Object |
getAttributeValueOf(Attribute attr,
String stringValue)
|
|
protected Element |
getChildElement(QName qname)
|
|
protected String |
getChildElementText(QName qname)
Returns value of all text nodes from the child element with given QName. |
|
protected AbstractDocumentComponent |
getEffectiveParent()
|
|
protected String |
getLeadingText(C child)
Returns leading text for the child component of the given index. |
|
AbstractDocumentModel |
getModel()
|
|
protected String |
getNamespaceURI()
|
|
protected int |
getNodeIndexOf(Node parent,
Node child)
|
|
Element |
getPeer()
Returns the DOM element corresponding to this component. |
|
protected String |
getPrefixedName(QName q,
boolean declarePrefix)
|
|
protected String |
getPrefixedName(String namespace,
String localName)
|
|
protected String |
getPrefixedName(String namespace,
String name,
String prefix,
boolean declarePrefix)
|
|
Map<String,String> |
getPrefixes()
|
|
QName |
getQName()
Returns QName of the component. |
|
static QName |
getQName(Node n)
|
|
protected String |
getText()
Return text value of this component. |
|
protected String |
getText(C child,
boolean leading,
boolean includeComments)
|
|
static String |
getText(Element e)
|
|
protected String |
getTrailingText(C child)
Returns trailing text for the child component of the given index. |
|
protected String |
getXmlFragment()
Get the XML fragment text that make up the children the component peer node. |
|
String |
getXmlFragmentInclusive()
Get the XML fragment text that make up the peer node. |
|
protected void |
insertAtIndexQuietly(C newComponent,
List<C> children,
int index)
|
|
boolean |
isInDocumentModel()
Returns true if the component is part of the document model. |
|
String |
lookupNamespaceURI(String prefix)
|
|
String |
lookupNamespaceURI(String prefix,
boolean optimized)
Returns namespace for the given prefix. |
|
String |
lookupPrefix(String namespace)
|
|
protected abstract void |
populateChildren(List<C> children)
|
|
boolean |
referencesSameNode(Node n)
Returns true if the node referenced by this component is n. |
|
protected void |
removeAttributeQuietly(Element element,
String name)
|
|
protected void |
removeChildQuietly(C component,
List<C> children)
|
|
void |
removePrefix(String prefix)
Remove declared prefix (without refactoring). |
|
protected ModelSource |
resolveModel(String hint)
Resolves reference to external models using location hint. |
|
void |
setAnyAttribute(QName attr,
String value)
Set string value of the attribute identified by given QName. |
|
void |
setAttribute(String eventPropertyName,
Attribute attr,
Object value)
Sets the component attribute String value and fire property change event with the given property name. |
|
protected void |
setAttributeQuietly(Attribute type,
Object newVal)
|
|
protected void |
setChildElementText(String propertyName,
String text,
QName qname)
Set the value of the text node from the child element with given QName. |
|
protected void |
setLeadingText(String propName,
String text,
C child)
Set leading text for the child component which position is the given index. |
|
protected void |
setQNameAttribute(String propertyName,
QName attr,
String value)
|
|
protected void |
setText(String propertyName,
String text)
Set text value of the component. |
|
protected void |
setText(String propName,
String value,
C child,
boolean leading,
boolean includeComments)
|
|
protected void |
setTrailingText(String propName,
String text,
C child)
Set trailing text for the child component which position is the given index. |
|
protected void |
setXmlFragment(String propertyName,
String text)
Set text as XML fragment children the component peer node. |
|
protected void |
updatePeer(String propertyName,
Element newPeer)
Shared utility for implementation to replace the current peer and ensure the document tree also get update properly. |
|
void |
updateReference(Element element)
|
|
protected
|
updateReference(Element peer,
List<N> updatingPath)
Updates peer node with given peer and the path for context of the update. |
|
|
updateReference(List<N> pathToRoot)
Update all parents with fresh nodes. |
|
protected void |
verifyWrite()
This method ensures that a transaction is currently in progress and that the current thread is able to write the model. |
|
| Methods inherited from class org.netbeans.modules.xml.xam.AbstractComponent |
|---|
addAfter, addBefore, addPropertyChangeListener, appendChild, canPaste, checkChildrenPopulated, checkNullOrDuplicateChild, getChild, getChildren, getChildren, getChildren, getChildrenCount, getParent, insertAtIndex, insertAtIndex, isChildrenInitialized, removeChild, removeComponentListener, removePropertyChangeListener, setChild, setChild, setChildAfter, setChildBefore, setModel, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.netbeans.modules.xml.xam.Component |
|---|
canPaste, getChildren, getChildren, getChildren, getParent |
| Constructor Detail |
|---|
public AbstractDocumentComponent(AbstractDocumentModel model,
Element e)
| Method Detail |
|---|
protected abstract void populateChildren(List<C> children)
populateChildren in class AbstractComponent<C extends DocumentComponent<C>>public Element getPeer()
DocumentComponent
getPeer in interface DocumentComponent<C extends DocumentComponent<C>>public String getAttribute(Attribute attr)
getAttribute in interface DocumentComponent<C extends DocumentComponent<C>>
public void setAttribute(String eventPropertyName,
Attribute attr,
Object value)
setAttribute in interface DocumentComponent<C extends DocumentComponent<C>>eventPropertyName - property name to be used in firing property change event.attr - attribute namevalue - for the attribute.
protected abstract Object getAttributeValueOf(Attribute attr,
String stringValue)
public String getAnyAttribute(QName attr)
attr - non-null QName represents the attribute name.
public void setAnyAttribute(QName attr,
String value)
attr - non-null QName represents the attribute name.value - string value for the attribute.
protected void setQNameAttribute(String propertyName,
QName attr,
String value)
protected String getPrefixedName(QName q,
boolean declarePrefix)
protected String getPrefixedName(String namespace,
String localName)
protected String getPrefixedName(String namespace,
String name,
String prefix,
boolean declarePrefix)
protected String ensureUnique(String prefix,
String namespace)
protected void setAttributeQuietly(Attribute type,
Object newVal)
protected void removeAttributeQuietly(Element element,
String name)
protected void appendChildQuietly(C component,
List<C> children)
appendChildQuietly in class AbstractComponent<C extends DocumentComponent<C>>
protected void insertAtIndexQuietly(C newComponent,
List<C> children,
int index)
insertAtIndexQuietly in class AbstractComponent<C extends DocumentComponent<C>>
protected void removeChildQuietly(C component,
List<C> children)
removeChildQuietly in class AbstractComponent<C extends DocumentComponent<C>>protected String getNamespaceURI()
public String lookupNamespaceURI(String prefix,
boolean optimized)
public String lookupNamespaceURI(String prefix)
public String lookupPrefix(String namespace)
protected String getXmlFragment()
public String getXmlFragmentInclusive()
protected void setXmlFragment(String propertyName,
String text)
throws IOException
propertyName - name of property event to firetext - text value to set to.
IOException - if text is not well-formed.
protected void setText(String propertyName,
String text)
propertyName - name of property event to firetext - text value to set to.protected String getText()
public static String getText(Element e)
public AbstractDocumentModel getModel()
getModel in interface Component<C extends DocumentComponent<C>>getModel in class AbstractComponent<C extends DocumentComponent<C>>public boolean referencesSameNode(Node n)
DocumentComponent
referencesSameNode in interface DocumentComponent<C extends DocumentComponent<C>>public void updateReference(Element element)
updateReference in interface DocumentModelAccess.NodeUpdaterpublic <N extends Node> void updateReference(List<N> pathToRoot)
updateReference in interface DocumentModelAccess.NodeUpdater
protected <N extends Node> void updateReference(Element peer,
List<N> updatingPath)
peer - the peer node to update withupdatingPath - full path for context of the updateprotected DocumentModelAccess getAccess()
public int findPosition()
DocumentComponent
findPosition in interface DocumentComponent<C extends DocumentComponent<C>>
protected void updatePeer(String propertyName,
Element newPeer)
protected Attribute createPrefixAttribute(String prefix)
public void addPrefix(String prefix,
String namespace)
public void removePrefix(String prefix)
public Map<String,String> getPrefixes()
protected void ensureValueNamespaceDeclared(String newNamespace,
String oldNamespace,
String preferredPrefix)
public C findChildComponent(Element e)
DocumentComponent
findChildComponent in interface DocumentComponent<C extends DocumentComponent<C>>public C findChildComponentByIdentity(Element e)
public DocumentComponent copy(C parent)
Component
copy in interface Component<C extends DocumentComponent<C>>protected void verifyWrite()
AbstractComponent
verifyWrite in class AbstractComponent<C extends DocumentComponent<C>>
protected void firePropertyChange(String propName,
Object oldValue,
Object newValue)
firePropertyChange in class AbstractComponent<C extends DocumentComponent<C>>protected void fireValueChanged()
fireValueChanged in class AbstractComponent<C extends DocumentComponent<C>>protected void fireChildRemoved()
fireChildRemoved in class AbstractComponent<C extends DocumentComponent<C>>protected void fireChildAdded()
fireChildAdded in class AbstractComponent<C extends DocumentComponent<C>>public boolean isInDocumentModel()
isInDocumentModel in interface DocumentComponent<C extends DocumentComponent<C>>public int findAttributePosition(String attributeName)
DocumentComponent
findAttributePosition in interface DocumentComponent<C extends DocumentComponent<C>>public QName getQName()
public static QName getQName(Node n)
protected ModelSource resolveModel(String hint)
throws CatalogModelException
hint - on location of where external model reference could reside.
CatalogModelException - if the model cannot be located or the
hint is not well-formed URIpublic Map<QName,String> getAttributeMap()
protected int findDomainIndex(Element e)
protected AbstractDocumentComponent getEffectiveParent()
protected Element getChildElement(QName qname)
protected String getChildElementText(QName qname)
qname - QName of the child element to get text from.
protected void setChildElementText(String propertyName,
String text,
QName qname)
propertyName - property change event nametext - the string to set value of the child element text node.qname - QName of the child element to get text from.protected String getLeadingText(C child)
child - the child to get associated text from
protected void setLeadingText(String propName,
String text,
C child)
child - the child to set associated texttext - value of the leading text node, or null to remove the leading text node.protected String getTrailingText(C child)
child - the child to get associated text from
protected void setTrailingText(String propName,
String text,
C child)
child - the child to get associated text fromtext - value of the trailing text node, or null to remove the trailing text node.
protected String getText(C child,
boolean leading,
boolean includeComments)
protected void setText(String propName,
String value,
C child,
boolean leading,
boolean includeComments)
protected int getNodeIndexOf(Node parent,
Node child)
|
org.netbeans.modules.xml.xam/1 1.18.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||