intervalsAttrsList = intervalsSB.getContainedSourceBeanAttributes();
}
if(intervalsAttrsList==null || intervalsAttrsList.isEmpty()){ // if intervals are not defined realize a single interval
logger.warn("intervals not defined; default settings");
KpiInterval interval=new KpiInterval();
interval.setMin(getLower());
interval.setMax(getUpper());
interval.setColor(Color.WHITE);
addInterval(interval);
}
else{
Iterator intervalsAttrsIter = intervalsAttrsList.iterator();
while(intervalsAttrsIter.hasNext()) {
SourceBeanAttribute paramSBA = (SourceBeanAttribute)intervalsAttrsIter.next();
SourceBean param = (SourceBean)paramSBA.getValue();
String min= (String)param.getAttribute(MIN_INTERVAL);
String max= (String)param.getAttribute(MAX_INTERVAL);
String col= (String)param.getAttribute(COLOR_INTERVAL);
KpiInterval interval=new KpiInterval();
interval.setMin(Double.valueOf(min).doubleValue());
interval.setMax(Double.valueOf(max).doubleValue());
Color color=new Color(Integer.decode(col).intValue());
if(color!=null){
interval.setColor(color);}
else{
// sets default color
interval.setColor(Color.WHITE);
}
addInterval(interval);
}
}
//reading values colors if present
SourceBean colors = (SourceBean)content.getAttribute(VALUES_COLORS);
if(colors!=null){
colorMap=new HashMap();
List atts=colors.getContainedAttributes();
String colorValue="";
for (Iterator iterator = atts.iterator(); iterator.hasNext();) {
SourceBeanAttribute object = (SourceBeanAttribute) iterator.next();
String valueName=new String(object.getKey());
colorValue=new String((String)object.getValue());
Color col=new Color(Integer.decode(colorValue).intValue());
if(col!=null){
colorMap.put(valueName,col);
}
}
}
}
else{
logger.debug("configuration defined in LOV "+confDataset);
String increment=(String)sbRow.getAttribute("increment");
String minorTickCount=(String)sbRow.getAttribute("minor_tick");
setIncrement(Double.valueOf(increment).doubleValue());
setMinorTickCount(Integer.valueOf(minorTickCount).intValue());
String intervalsNumber=(String)sbRow.getAttribute(INTERVALS_NUMBER);
if(intervalsNumber==null || intervalsNumber.equals("") || intervalsNumber.equals("0")){ // if intervals are not specified
KpiInterval interval=new KpiInterval();
interval.setMin(getLower());
interval.setMax(getUpper());
interval.setColor(Color.WHITE);
addInterval(interval);
}
else{
for(int i=1;i<=Integer.valueOf(intervalsNumber).intValue();i++){
KpiInterval interval=new KpiInterval();
String min=(String)sbRow.getAttribute("min"+(new Integer(i)).toString());
String max=(String)sbRow.getAttribute("max"+(new Integer(i)).toString());
String col=(String)sbRow.getAttribute("color"+(new Integer(i)).toString());
interval.setMin(Double.valueOf(min).doubleValue());
interval.setMax(Double.valueOf(max).doubleValue());
Color color=new Color(Integer.decode(col).intValue());
interval.setColor(color);
addInterval(interval);
}
}
//reading values colors if present