Search in sources :

Example 16 with XmlElement

use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.

the class WorkflowMetadataBindingImpl method readUnderlyingObject.

@Override
protected Object readUnderlyingObject() {
    WorkflowNodeMetadataObject metadataObject = null;
    Element element = property().element();
    Resource resource = element.resource();
    XmlResource xmlResource = resource.adapt(XmlResource.class);
    XmlElement xmlElement = xmlResource.getXmlElement();
    XmlElement metadataElement = xmlElement.getChildElement("metadata", false);
    if (metadataElement != null) {
        String metadata = metadataElement.getChildNodeText("");
        if (!CoreUtil.empty(metadata)) {
            metadataObject = new WorkflowNodeMetadataObject(metadata.trim());
        }
    }
    if (metadataObject == null) {
        metadataObject = new WorkflowNodeMetadataObject();
    }
    if (!metadataObject.equals(_underlyingObject)) {
        _underlyingObject = metadataObject;
    }
    return _underlyingObject;
}
Also used : XmlResource(org.eclipse.sapphire.modeling.xml.XmlResource) Element(org.eclipse.sapphire.Element) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement) XmlResource(org.eclipse.sapphire.modeling.xml.XmlResource) Resource(org.eclipse.sapphire.Resource) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 17 with XmlElement

use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.

the class CDataValueBindingImpl method write.

@Override
public void write(String value) {
    XmlElement xmlElement = xml(true);
    XmlNode childNode = xmlElement.getChildNode(_path, true);
    Node cdataNode = childNode.getDomNode();
    CoreUtil.removeChildren(cdataNode);
    Document document = cdataNode.getOwnerDocument();
    cdataNode.insertBefore(document.createCDATASection(value), null);
}
Also used : XmlNode(org.eclipse.sapphire.modeling.xml.XmlNode) XmlNode(org.eclipse.sapphire.modeling.xml.XmlNode) Node(org.w3c.dom.Node) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement) Document(org.w3c.dom.Document)

Example 18 with XmlElement

use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.

the class CDataValueBindingImpl method read.

@Override
public String read() {
    String retval = null;
    XmlElement xmlElement = xml(false);
    if (xmlElement != null) {
        retval = xmlElement.getChildNodeText(_path);
    }
    return retval;
}
Also used : XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 19 with XmlElement

use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.

the class CDATAValueBinding method write.

@Override
public void write(String value) {
    XmlElement xmlElement = xml(true);
    Node childNode = xmlElement.getChildNode(this.path, true).getDomNode();
    CoreUtil.removeChildren(childNode);
    Document document = childNode.getOwnerDocument();
    childNode.insertBefore(document.createCDATASection(value), null);
}
Also used : Node(org.w3c.dom.Node) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement) Document(org.w3c.dom.Document)

Example 20 with XmlElement

use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.

the class CDATAValueBinding method read.

@Override
public String read() {
    String retval = null;
    XmlElement xmlElement = xml(false);
    if (xmlElement != null) {
        retval = xmlElement.getChildNodeText(this.path);
    }
    return retval;
}
Also used : XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Aggregations

XmlElement (org.eclipse.sapphire.modeling.xml.XmlElement)29 Attr (org.w3c.dom.Attr)3 Document (org.w3c.dom.Document)3 Element (org.w3c.dom.Element)3 BeforeAfterFilterType (com.liferay.ide.hook.core.model.BeforeAfterFilterType)2 QName (javax.xml.namespace.QName)2 XmlResource (org.eclipse.sapphire.modeling.xml.XmlResource)2 Node (org.w3c.dom.Node)2 IOException (java.io.IOException)1 Locale (java.util.Locale)1 TransformerException (javax.xml.transform.TransformerException)1 Element (org.eclipse.sapphire.Element)1 Resource (org.eclipse.sapphire.Resource)1 XmlAttribute (org.eclipse.sapphire.modeling.xml.XmlAttribute)1 XmlNode (org.eclipse.sapphire.modeling.xml.XmlNode)1 JSONException (org.json.JSONException)1 CDATASection (org.w3c.dom.CDATASection)1