use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class QNamespaceValueBinding method read.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
*/
@Override
public String read() {
String value = null;
XmlElement parent = xml(false);
XmlElement qNameElement = null;
if (parent.getLocalName().equals(params[0])) {
qNameElement = parent;
} else {
qNameElement = parent.getChildElement(params[0], false);
}
if (qNameElement != null) {
// System.out.println( qNameElement );
List<XmlAttribute> listOfAttibutes = qNameElement.getAttributes();
XmlAttribute xmlAttribute = listOfAttibutes != null && listOfAttibutes.size() > 0 ? listOfAttibutes.get(0) : null;
if (xmlAttribute != null) {
value = xmlAttribute.getText();
}
}
if (value != null) {
return value.trim();
}
return value;
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class ChoiceValueBinding method getXmlNode.
@Override
public XmlNode getXmlNode() {
XmlElement parent = xml();
XmlElement element = parent.getChildElement(params[1], false);
if (element != null) {
return element;
}
element = parent.getChildElement(params[1], false);
if (element != null) {
return element;
}
return null;
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class ChoiceValueBinding method write.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValueBindingImpl#write(java.lang.String)
*/
@Override
public void write(String value) {
XmlElement parent = xml(true);
// System.out.println( "EventDefinitionValueBinding.write()" + parent );
XmlElement param1Element = parent.getChildElement(params[1], false);
XmlElement param2Element = parent.getChildElement(params[2], false);
if ((param1Element != null) && params[0].equals(params[1])) {
parent.removeChildNode(params[2]);
} else if ((param2Element != null) && params[0].equals(params[2])) {
parent.removeChildNode(params[1]);
}
parent.setChildNodeText(this.path, value, true);
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class LocaleTextNodeValueBinding method read.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
*/
@Override
public String read() {
String value = null;
XmlElement element = xml(false);
if (element != null) {
value = xml(true).getText();
if (!value.isEmpty()) {
value = value.trim();
for (int i = 0; i < AVAILABLE_LOCALES.length; i++) {
Locale locale = AVAILABLE_LOCALES[i];
if (value.equals(locale.toString())) {
value = PortletUtil.buildLocaleDisplayString(locale.getDisplayName(), locale);
break;
}
}
}
}
return value;
}
use of org.eclipse.sapphire.modeling.xml.XmlElement in project liferay-ide by liferay.
the class NameAndQNameChoiceValueBinding method read.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
*/
@Override
public String read() {
XmlElement parent = xml(false);
// System.out.println( "NameAndQNameChoiceValueBinding.read() - \n" + parent );
String value = null;
if (parent != null) {
// System.out.println( "NameAndQNameChoiceValueBinding.read()" + params[0] );
XmlElement eventNameElement = parent.getChildElement(NAME, false);
XmlElement eventQNameElement = parent.getChildElement(Q_NAME, false);
if ((eventNameElement != null) && NAME.equals(params[0])) {
// System.out.println( "NameAndQNameChoiceValueBinding.read() - \n" +
// eventNameElement );
value = eventNameElement.getText();
} else if ((eventQNameElement != null) && Q_NAME.equals(params[0])) {
// System.out.println( "NameAndQNameChoiceValueBinding.read() - \n" +
// eventQNameElement );
value = eventQNameElement.getText();
}
}
return value;
}
Aggregations