Search in sources :

Example 1 with XmlElement

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

the class BeforeAfterFilterNameBinding method read.

@Override
public String read() {
    String retval = null;
    XmlElement filterElement = null;
    XmlElement xmlElement = xml();
    BeforeAfterFilterType filterType = _getFilterType();
    String filterTypeText = filterType.getText();
    filterElement = xmlElement.getChildElement(filterTypeText, false);
    if (filterElement != null) {
        retval = filterElement.getText();
    }
    return retval;
}
Also used : BeforeAfterFilterType(com.liferay.ide.hook.core.model.BeforeAfterFilterType) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 2 with XmlElement

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

the class BeforeAfterFilterNameBinding method write.

@Override
public void write(String value) {
    XmlElement xmlElement = xml();
    BeforeAfterFilterType filterType = _getFilterType();
    String filterTypeText = filterType.getText();
    XmlElement filterElement = xmlElement.getChildElement(filterTypeText, true);
    filterElement.setText(value);
}
Also used : BeforeAfterFilterType(com.liferay.ide.hook.core.model.BeforeAfterFilterType) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 3 with XmlElement

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

the class BeforeAfterFilterTypeBinding method read.

@Override
public String read() {
    // check for existence of before-filter or after-filter elements, if neither
    // exist, then return default value
    XmlElement xmlElement = xml();
    XmlElement beforeFilterElement = xmlElement.getChildElement(BeforeAfterFilterType.BEFORE_FILTER.getText(), false);
    if (beforeFilterElement != null) {
        return BeforeAfterFilterType.BEFORE_FILTER.getText();
    }
    XmlElement afterFilterElement = xmlElement.getChildElement(BeforeAfterFilterType.AFTER_FILTER.getText(), false);
    if (afterFilterElement != null) {
        return BeforeAfterFilterType.AFTER_FILTER.getText();
    }
    if (_localValue != null) {
        return _localValue;
    }
    return _defaultValueText;
}
Also used : XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 4 with XmlElement

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

the class BeforeAfterFilterTypeBinding method write.

@Override
public void write(String value) {
    XmlElement xmlElement = xml();
    XmlElement filterElement = xmlElement.getChildElement(BeforeAfterFilterType.BEFORE_FILTER.getText(), false);
    if (filterElement == null) {
        filterElement = xmlElement.getChildElement(BeforeAfterFilterType.AFTER_FILTER.getText(), false);
    }
    String existingFilterValue = null;
    if (filterElement != null) {
        existingFilterValue = filterElement.getText();
        filterElement.remove();
        XmlElement newElement = xmlElement.getChildElement(value, true);
        newElement.setText(existingFilterValue);
    } else {
        _localValue = value;
    }
}
Also used : XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Example 5 with XmlElement

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

the class TextNodeValueBinding method read.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
	 */
@Override
public String read() {
    String value = null;
    final XmlElement element = xml(false);
    if (element != null) {
        value = xml(true).getText();
        if (value != null) {
            value = value.trim();
        }
    }
    return value;
}
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