use of com.github.bordertech.wcomponents.subordinate.AbstractCompare in project wcomponents by BorderTech.
the class WSubordinateControlRenderer method paintCondition.
/**
* Paints a condition.
*
* @param condition the condition to paint.
* @param xml the writer to send the output to
*/
private void paintCondition(final Condition condition, final XmlStringBuilder xml) {
if (condition instanceof And) {
xml.appendTag("ui:and");
for (Condition operand : ((And) condition).getConditions()) {
paintCondition(operand, xml);
}
xml.appendEndTag("ui:and");
} else if (condition instanceof Or) {
xml.appendTag("ui:or");
for (Condition operand : ((Or) condition).getConditions()) {
paintCondition(operand, xml);
}
xml.appendEndTag("ui:or");
} else if (condition instanceof Not) {
xml.appendTag("ui:not");
paintCondition(((Not) condition).getCondition(), xml);
xml.appendEndTag("ui:not");
} else if (condition instanceof AbstractCompare) {
AbstractCompare compare = (AbstractCompare) condition;
xml.appendTagOpen("ui:condition");
xml.appendAttribute("controller", compare.getTrigger().getId());
xml.appendAttribute("value", compare.getComparePaintValue());
xml.appendOptionalAttribute("operator", getCompareTypeName(compare.getCompareType()));
xml.appendEnd();
} else {
throw new SystemException("Unknown condition: " + condition);
}
}
Aggregations