Integer xValue = new Integer(5);
List thValues = t.getThresholdValues();
if(thValues!=null && !thValues.isEmpty()){
Iterator thIt = thValues.iterator();
while(thIt.hasNext()){
ThresholdValue val = (ThresholdValue)thIt.next();
if (val!=null){
SourceBean semaphor1=new SourceBean(semaphor);
SourceBean thresholdTextValue1=new SourceBean(thresholdTextValue);
//Semaphore Threshold creation
xValue = xValue + thresholdFieldWidth;
if(xValue +thresholdSemaphoreWidth + thresholdFieldWidth>=maxSubTemplateWIdtht){
xValue = new Integer(5) + thresholdFieldWidth;
actualHeight+=valueHeight;
yValue = actualHeight;
}
String colorSemaphor = val.getColourString();
semaphor1.setAttribute("reportElement.x", xValue.toString());
semaphor1.setAttribute("reportElement.y", new Integer(yValue.intValue()+2).toString());
if(colorSemaphor!=null){
semaphor1.setAttribute("reportElement.forecolor", "#000000");
semaphor1.setAttribute("reportElement.backcolor", colorSemaphor);
}else{
semaphor1.setAttribute("reportElement.forecolor", "#FFFFFF");
semaphor1.setAttribute("reportElement.backcolor", "#FFFFFF");
}
sourceBeansToAdd.add(semaphor1);
xValue = xValue + thresholdFieldSeparatorWidth;
//Threshold Value Creation
String labelTh=val.getLabel() != null ? val.getLabel() : "";
String min = val.getMinValue()!= null ? val.getMinValue().toString() : null;
String max = val.getMaxValue()!= null ? val.getMaxValue().toString() : null;
String valueTh = "Value: ";
if(val.getThresholdType().equalsIgnoreCase("RANGE")){
if (min!=null && max !=null){
valueTh = valueTh + min+"-"+max+" "+labelTh;
}else if (min!=null && max==null){
valueTh = valueTh + "> "+min+" "+labelTh;
}else if (min==null && max!=null){
valueTh = valueTh + "< "+max+" "+labelTh;
}
}else if(val.getThresholdType().equalsIgnoreCase("MINIMUM")){
valueTh = valueTh + "< "+min+" "+labelTh;
}else if(val.getThresholdType().equalsIgnoreCase("MAXIMUM")){
valueTh = valueTh + "> "+max+" "+labelTh;
}
if(valueTh.length()>25)valueTh = valueTh.substring(0, 24);
thresholdTextValue1.setAttribute("reportElement.x", xValue.toString());