use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class ChoiceValueBinding method read.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValueBindingImpl#read()
*/
@Override
public String read() {
XmlElement parent = xml(false);
// System.out.println( "ChoiceValueBinding.read() - \n" + parent );
String value = null;
if (parent != null) {
// System.out.println( "ChoiceValueBinding.read()" + params[0] );
XmlElement param1Element = parent.getChildElement(params[1], false);
XmlElement param2Element = parent.getChildElement(params[2], false);
if ((param1Element != null) && params[0].equals(params[1])) {
// System.out.println( "ChoiceValueBinding.read() - \n" + eventNameElement );
value = param1Element.getText();
} else if ((param2Element != null) && params[0].equals(params[2])) {
// System.out.println( "ChoiceValueBinding.read() - \n" + eventQNameElement );
value = param2Element.getText();
}
}
return value;
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class NameAndQNameChoiceValueBinding method getXmlNode.
@Override
public XmlNode getXmlNode() {
XmlElement parent = xml();
XmlElement element = parent.getChildElement(Q_NAME, false);
if (element != null) {
return element;
}
element = parent.getChildElement(NAME, false);
if (element != null) {
return element;
}
return null;
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class NameAndQNameChoiceValueBinding method write.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#write(java.lang.String)
*/
@Override
public void write(String value) {
XmlElement parent = xml(true);
// System.out.println( "EventDefinitionValueBinding.write()" + parent );
XmlElement eventNameElement = parent.getChildElement(NAME, false);
XmlElement eventQNameElement = parent.getChildElement(Q_NAME, false);
if (NAME.equals(params[0]) && eventQNameElement != null) {
parent.removeChildNode(Q_NAME);
} else if (Q_NAME.equals(params[0]) && eventNameElement != null) {
parent.removeChildNode(NAME);
}
parent.setChildNodeText(this.path, value, true);
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class QNameTextNodeValueBinding method write.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#write(java.lang.String)
*/
@Override
public void write(String value) {
String qNameAsString = value;
XmlElement parent = xml(true);
if ((qNameAsString != null) && !"Q_NAME".equals(qNameAsString)) {
qNameAsString = value.trim();
QName qName = QName.valueOf(qNameAsString);
XmlElement qNamedElement = parent.getChildElement(this.params[0], true);
String qualifiedNodeValue = PortletModelUtil.defineNS(qNamedElement, qName);
qNamedElement.setText(qualifiedNodeValue);
} else {
// System.out.println( "Remove:" + params[0] + " from " + parent );
parent.remove();
}
// System.out.println( "TextNodeValueBinding.write() - Parent " + xml( true
// ).getParent() );
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class QNameValueBinding method read.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
*/
@Override
public String read() {
XmlElement parent = xml(false);
String value = null;
if (parent != null) {
XmlElement qNameElement = parent.getChildElement(params[0], false);
value = qNameElement.getText();
}
return value;
}
Aggregations