try{
Color color=Color.decode(colorS);
int size=Integer.valueOf(sizeS).intValue();
styleTitle=new StyleLabel(fontS,size,color);
}
catch (Exception e) {
logger.error("Wrong style Title settings, use default");
}
}
SourceBean styleSubTitleSB = (SourceBean)content.getAttribute(STYLE_SUBTITLE);
if(styleSubTitleSB!=null){
String subTitle = (String)styleSubTitleSB.getAttribute(NAME_STYLE);
if(subTitle!=null) {
String tmpSubTitle = subTitle;
while (!tmpSubTitle.equals("")){
if (tmpSubTitle.indexOf("$P{") >= 0){
String parName = tmpSubTitle.substring(tmpSubTitle.indexOf("$P{")+3, tmpSubTitle.indexOf("}"));
String parValue = (parametersObject.get(parName)==null)?"":(String)parametersObject.get(parName);
parValue = parValue.replaceAll("\'", "");
if(parValue.equals("%")) parValue = "";
int pos = tmpSubTitle.indexOf("$P{"+parName+"}") + (parName.length()+4);
subTitle = subTitle.replace("$P{" + parName + "}", parValue);
tmpSubTitle = tmpSubTitle.substring(pos);
}
else
tmpSubTitle = "";
}
setSubName(subTitle);
}
else setSubName("");
String fontS = (String)styleSubTitleSB.getAttribute(FONT_STYLE);
String sizeS = (String)styleSubTitleSB.getAttribute(SIZE_STYLE);
String colorS = (String)styleSubTitleSB.getAttribute(COLOR_STYLE);
try{
Color color=Color.decode(colorS);
int size=Integer.valueOf(sizeS).intValue();
styleSubTitle=new StyleLabel(fontS,size,color);
}
catch (Exception e) {
logger.error("Wrong style SubTitle settings, use default");
}
}
SourceBean styleLabelsSB = (SourceBean)content.getAttribute(STYLE_LABELS_DEFAULT);
if(styleLabelsSB!=null){
String fontS = (String)styleLabelsSB.getAttribute(FONT_STYLE);
if(fontS==null){
fontS = "Arial";
}
String sizeS = (String)styleLabelsSB.getAttribute(SIZE_STYLE);
if(sizeS==null){
sizeS = "12";
}
String colorS = (String)styleLabelsSB.getAttribute(COLOR_STYLE);
if(colorS==null){
colorS = "#000000";
}
String orientationS = (String)styleLabelsSB.getAttribute(ORIENTATION_STYLE);
if(orientationS==null){
orientationS = "horizontal";
}
try{
Color color=Color.decode(colorS);
int size=Integer.valueOf(sizeS).intValue();
defaultLabelsStyle=new StyleLabel(fontS,size,color,orientationS);
}
catch (Exception e) {
logger.error("Wrong style labels settings, use default");
}
}else{
defaultLabelsStyle=new StyleLabel("Arial", 12,Color.BLACK);
}
if(content.getAttribute("title_dimension")!=null)
{
String titleD=((String)content.getAttribute(TITLE_DIMENSION));
titleDimension=Integer.valueOf(titleD).intValue();
}
else setTitleDimension(18);
String colS = (String)content.getAttribute(COLORS_BACKGROUND);
if(colS!=null)
{
Color col=new Color(Integer.decode(colS).intValue());
if(col!=null){
setColor(col);}
else{
setColor(Color.white);
}
}
else {
setColor(Color.white);
}
String widthS = (String)content.getAttribute(DIMENSION_WIDTH);
String heightS = (String)content.getAttribute(DIMENSION_HEIGHT);
if(widthS==null || heightS==null){
logger.warn("Width or height non defined, use default ones");
widthS="400";
heightS="300";
}
width=Integer.valueOf(widthS).intValue();
height=Integer.valueOf(heightS).intValue();
// get all the data parameters
try{
Map dataParameters = new HashMap();
SourceBean dataSB = (SourceBean)content.getAttribute(CONF);
List dataAttrsList = dataSB.getContainedSourceBeanAttributes();
Iterator dataAttrsIter = dataAttrsList.iterator();
while(dataAttrsIter.hasNext()) {
SourceBeanAttribute paramSBA = (SourceBeanAttribute)dataAttrsIter.next();
SourceBean param = (SourceBean)paramSBA.getValue();
String nameParam = (String)param.getAttribute("name");
String valueParam = (String)param.getAttribute("value");
dataParameters.put(nameParam, valueParam);
}
if(dataParameters.get(CONF_DATASET)!=null && !(((String)dataParameters.get(CONF_DATASET)).equalsIgnoreCase("") )){
confDataset=(String)dataParameters.get(CONF_DATASET);
isLovConfDefined=true;
}
else {
isLovConfDefined=false;
}
legend=true;
if(dataParameters.get(LEGEND)!=null && !(((String)dataParameters.get(LEGEND)).equalsIgnoreCase("") )){
String leg=(String)dataParameters.get(LEGEND);
if(leg.equalsIgnoreCase("false"))
legend=false;
}
legendPosition="bottom";
if(dataParameters.get(LEGEND_POSITION)!=null && !(((String)dataParameters.get(LEGEND_POSITION)).equalsIgnoreCase("") )){
String leg=(String)dataParameters.get(LEGEND_POSITION);
if(leg.equalsIgnoreCase("bottom") || leg.equalsIgnoreCase("left") || leg.equalsIgnoreCase("right") || leg.equalsIgnoreCase("top"))
legendPosition=leg;
}
filter=true;
if(dataParameters.get(VIEW_FILTER)!=null && !(((String)dataParameters.get(VIEW_FILTER)).equalsIgnoreCase("") )){
String fil=(String)dataParameters.get(VIEW_FILTER);
if(fil.equalsIgnoreCase("false"))
filter=false;
}
slider=true;
if(dataParameters.get(VIEW_SLIDER)!=null && !(((String)dataParameters.get(VIEW_SLIDER)).equalsIgnoreCase("") )){
String sli=(String)dataParameters.get(VIEW_SLIDER);
if(sli.equalsIgnoreCase("false"))
slider=false;
}
sliderStartFromEnd=false;
if(dataParameters.get(SLIDER_START_FROM_END)!=null && !(((String)dataParameters.get(SLIDER_START_FROM_END)).equalsIgnoreCase("") )){
String sli=(String)dataParameters.get(SLIDER_START_FROM_END);
if(sli.equalsIgnoreCase("true"))
sliderStartFromEnd=true;
}
positionSlider="top";
if(dataParameters.get(POSITION_SLIDER)!=null && !(((String)dataParameters.get(POSITION_SLIDER)).equalsIgnoreCase("") )){
positionSlider=(String)dataParameters.get(POSITION_SLIDER);
}
//reading series orders if present
SourceBean sbSerieLabels = (SourceBean)content.getAttribute(SERIES_LABELS);
// back compatibility
if(sbSerieLabels==null){
sbSerieLabels = (SourceBean)content.getAttribute("CONF.SERIES_LABELS");
}
if(sbSerieLabels!=null){
seriesLabelsMap=new LinkedHashMap();
List atts=sbSerieLabels.getContainedAttributes();
String serieLabel="";
for (Iterator iterator = atts.iterator(); iterator.hasNext();) {
SourceBeanAttribute object = (SourceBeanAttribute) iterator.next();
String serieName=(String)object.getKey();
serieLabel=new String((String)object.getValue());
if(serieLabel!=null){
seriesLabelsMap.put(serieName, serieLabel);
}
}
}
SourceBean styleLegendSB = (SourceBean)content.getAttribute(LEGEND_STYLE);
if(styleLegendSB!=null){
String fontS = (String)styleLegendSB.getAttribute(FONT_STYLE);
String sizeS = (String)styleLegendSB.getAttribute(SIZE_STYLE);
String colorS = (String)styleLegendSB.getAttribute(COLOR_STYLE);
try{
Color color=Color.decode(colorS);
int size=Integer.valueOf(sizeS).intValue();
styleLegend=new StyleLabel(fontS,size,color);
}
catch (Exception e) {
logger.error("Wrong style Legend settings, use default");
}