package com.drbob42.ibeans; import com.borland.internetbeans.*; public class IxConditional extends IxSpan { private boolean condition; public IxConditional() { } public void mergeBody(ParseUnit[] units, int begin, int end) { // See if any body text is available by looking if the // begin index is less than end index. if (begin < end) { // If condition is true we assign the tag body to the value if (condition) { StringBuffer body = new StringBuffer(); // A body can contain other HTML tags, like , // so we go through all unit elements until we are // at the end element for (; begin < end; begin++) { body.append(units[begin].toString()); } value = body.toString(); // If condition is false we assign empty string to value } else { value = new String(""); } } } public void setCondition(boolean newCondition) { condition = newCondition; } public boolean isCondition() { return condition; } }