Example usage for org.dom4j Node selectNodes

List of usage examples for org.dom4j Node selectNodes

Introduction

In this page you can find the example usage for org.dom4j Node selectNodes.

Prototype

List<Node> selectNodes(String xpathExpression);

Source Link

Document

selectNodes evaluates an XPath expression and returns the result as a List of Node instances or String instances depending on the XPath expression.

Usage

From source file:org.pentaho.platform.repository.subscription.SubscriptionRepository.java

License:Open Source License

public Element importContent(final Document doc) {
    Element resultElement = DocumentHelper.createElement("importContentResults"); //$NON-NLS-1$

    if (doc == null) {
        Element ele = resultElement.addElement("message") //$NON-NLS-1$
                .addText(Messages.getString("PRO_SUBSCRIPTREP.DOCUMENT_IS_NULL")); //$NON-NLS-1$
        ele.addAttribute("result", "ERROR"); //$NON-NLS-1$//$NON-NLS-2$
        return (resultElement);
    }/*from   w w  w  . j  ava  2s.  c om*/

    List contentNodes = doc.selectNodes("//subscription-content/*"); //$NON-NLS-1$
    if (contentNodes.size() == 0) {
        Element ele = resultElement.addElement("message") //$NON-NLS-1$
                .addText(Messages.getString("PRO_SUBSCRIPTREP.NO_SCHEDULES_DEFINED")); //$NON-NLS-1$
        ele.addAttribute("result", "WARNING"); //$NON-NLS-1$//$NON-NLS-2$
        return (resultElement);
    }

    synchronized (SubscriptionRepository.SyncLock) {

        Node contentNode = null;
        Node tempNode = null;
        String actionRef, contentType, allowAllSchedules;
        ISubscribeContent subscribeContent = null;

        List schedList = getSchedules();
        Map scheduleMap = new HashMap();
        Map groupMap = new HashMap();

        for (int j = 0; j < schedList.size(); ++j) {
            Schedule aSchedule = (Schedule) schedList.get(j);
            scheduleMap.put(aSchedule.getScheduleReference(), aSchedule);
            List groupList = (List) groupMap.get(aSchedule.getGroup());
            if (groupList == null) {
                groupList = new ArrayList();
                groupMap.put(aSchedule.getGroup(), groupList);
            }
            groupList.add(aSchedule);
        }

        try {
            SubscriptionRepository.logger.info(Messages.getString(
                    "PRO_SUBSCRIPTREP.USER_PROCESSING_CONTENT_NODES", Integer.toString(contentNodes.size()))); //$NON-NLS-1$
            for (int i = 0; i < contentNodes.size(); i++) {
                contentNode = (Node) contentNodes.get(i);
                actionRef = contentNode.selectSingleNode("@action").getText(); //$NON-NLS-1$
                contentType = contentNode.selectSingleNode("@type").getText(); //$NON-NLS-1$
                tempNode = contentNode.selectSingleNode("@allowAllSchedules"); //$NON-NLS-1$
                if (tempNode != null) {
                    allowAllSchedules = tempNode.getText();
                } else {
                    allowAllSchedules = "false"; //$NON-NLS-1$
                }

                try {
                    subscribeContent = getContentByActionReference(actionRef);
                    if (subscribeContent != null) {
                        subscribeContent.setType(contentType);
                        resultElement.addElement("modified").addText(actionRef); //$NON-NLS-1$
                        SubscriptionRepository.logger.info(Messages
                                .getString("PRO_SUBSCRIPTREP.MODIFIED_SUBSCRIPTION_CONTENT", actionRef)); //$NON-NLS-1$
                    } else {
                        subscribeContent = addContent(actionRef, contentType);
                        resultElement.addElement("added").addText(actionRef); //$NON-NLS-1$
                        SubscriptionRepository.logger.info(
                                Messages.getString("PRO_SUBSCRIPTREP.ADDED_SUBSCRIPTION_CONTENT", actionRef)); //$NON-NLS-1$
                    }

                } catch (Exception e) {
                    resultElement.addElement("message").addText(Messages.getString( //$NON-NLS-1$
                            "PRO_SUBSCRIPTREP.ERROR_WITH_CONTENT", actionRef, e.getLocalizedMessage())); //$NON-NLS-1$ 
                    SubscriptionRepository.logger
                            .warn(Messages.getString("PRO_SUBSCRIPTREP.ERROR_WITH_CONTENT_LOG", actionRef), e); //$NON-NLS-1$ 
                }

                List contentSchedules = new ArrayList();
                if ("true".equalsIgnoreCase(allowAllSchedules)) { //$NON-NLS-1$
                    contentSchedules.addAll(schedList);
                } else {

                    List suppliedSchedules = contentNode.selectNodes("schedule"); //$NON-NLS-1$
                    if (suppliedSchedules != null) {
                        for (int j = 0; j < suppliedSchedules.size(); j++) {
                            tempNode = (Node) suppliedSchedules.get(j);
                            String schName = tempNode.getText();
                            if (schName != null) {
                                Object aSchedule = scheduleMap.get(schName);
                                if (aSchedule != null) {
                                    contentSchedules.add(aSchedule);
                                }
                            }
                        }
                    }

                    List suppliedGroups = contentNode.selectNodes("group"); //$NON-NLS-1$
                    if (suppliedGroups != null) {
                        for (int j = 0; j < suppliedGroups.size(); j++) {
                            tempNode = (Node) suppliedGroups.get(j);
                            String grpName = tempNode.getText();
                            if (grpName != null) {
                                List groupList = (List) groupMap.get(grpName);
                                if (groupList != null) {
                                    contentSchedules.addAll(groupList);
                                }
                            }
                        }
                    }
                }
                HibernateUtil.beginTransaction(); // Need to do this or the schedules don't get saved if the content item is new
                subscribeContent.setSchedules(contentSchedules);
                HibernateUtil.commitTransaction();
            }
        } catch (Exception e) {
            Element ele = resultElement.addElement("message").addText( //$NON-NLS-1$
                    Messages.getString("PRO_SUBSCRIPTREP.ERROR_PROCESSING_IMPORTS") + e.getLocalizedMessage()); //$NON-NLS-1$
            ele.addAttribute("result", "ERROR"); //$NON-NLS-1$ //$NON-NLS-2$
            SubscriptionRepository.logger
                    .error(Messages.getString("PRO_SUBSCRIPTREP.EXCEPTION_PROCESSING_IMPORTS"), e); //$NON-NLS-1$
            return (resultElement);
        }

    }
    return (resultElement);
}

From source file:org.pentaho.platform.uifoundation.chart.BarLineChartDefinition.java

License:Open Source License

public void setBarSeries(final Node barSeriesNode) {
    if (barSeriesNode != null) {
        List barNodes = barSeriesNode.selectNodes(BarLineChartDefinition.SERIES_NODE_NAME);
        String[] bars = new String[barNodes.size()];
        for (int i = 0; i < barNodes.size(); i++) {
            Node barNode = (Node) barNodes.get(i);
            bars[i] = barNode.getText();
        }//from ww  w . j a  va2  s  . c om
        setBarColumns(bars);
    }
}

From source file:org.pentaho.platform.uifoundation.chart.BarLineChartDefinition.java

License:Open Source License

public void setLineSeries(final Node lineSeriesNode) {
    if (lineSeriesNode != null) {
        List lineNodes = lineSeriesNode.selectNodes(BarLineChartDefinition.SERIES_NODE_NAME);
        String[] lines = new String[lineNodes.size()];
        for (int i = 0; i < lineNodes.size(); i++) {
            Node lineNode = (Node) lineNodes.get(i);
            lines[i] = lineNode.getText();
        }//from www .  j  av a 2  s  .c  om
        setLineColumns(lines);
    }
}

From source file:org.pentaho.platform.uifoundation.chart.CategoryDatasetChartDefinition.java

License:Open Source License

private void setChartAttributes(final Node chartAttributes) {
    if (chartAttributes == null) {
        return;/*from   www.  j  av  a 2 s .  c  o  m*/
    }

    // set the alfa layers
    Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME);
    Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME);

    if (backgroundAlphaNode != null) {
        setBackgroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME));
    }
    if (foregroundAlphaNode != null) {
        setForegroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME));
    }

    // get the chart type from the chart node -- this overrides the current
    // chart type
    setChartType(chartAttributes.selectSingleNode(ChartDefinition.TYPE_NODE_NAME));

    // set the chart background
    setChartBackground(chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME));

    // set the plot background
    setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME));

    // set the orientation
    setOrientation(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.ORIENTATION_NODE_NAME));

    // do we want a legend
    setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME));

    // get the chart title
    setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME));

    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subTitleNodes = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subTitleNodes == null) || (subTitleNodes.isEmpty())) {
        Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subTitleNodes = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        CategoryDatasetChartDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                        ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        CategoryDatasetChartDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subTitleNodes != null) {
        addSubTitles(subTitleNodes);
    }

    // get the paint sequence
    setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME));

    // get the stacked value
    setStacked(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.STACKED_NODE_NAME));

    // get the 3D value
    setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME));

    // set the width
    setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME));

    // set the height
    setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME));

    // set category rotation direction
    setCategoryLabelRotation(
            chartAttributes
                    .selectSingleNode(CategoryDatasetChartDefinition.DOMAIN_LABEL_ROTATION_DIRECTION_NODE_NAME),
            chartAttributes
                    .selectSingleNode(CategoryDatasetChartDefinition.DOMAIN_LABEL_ROTATION_ANGLE_NODE_NAME));

    // set the border on or off
    setBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME));

    // set the border Paint
    setBorderPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_PAINT_NODE_NAME)));

    // set the title location
    setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME));

    // set the legend position
    setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME));

    // set the title font
    setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME));

    // set the domain title
    setDomainTitle(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.DOMAIN_TITLE_NODE_NAME));

    // set the domain font
    setDomainTitleFont(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.DOMAIN_TITLE_FONT_NODE_NAME));

    // set the range minimum
    setRangeMinimum(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_MINIMUM_NODE_NAME));

    // set the range minimum
    setRangeMaximum(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_MAXIMUM_NODE_NAME));

    // set the range tick units
    setRangeTickUnits(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_TICK_UNITS_NODE_NAME));

    // the the range tick label number format
    setDomainTickFont(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.DOMAIN_TICK_FONT_NODE_NAME));

    // set the range title
    setRangeTitle(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_TITLE_NODE_NAME));

    // the the range font
    setRangeTitleFont(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_TITLE_FONT_NODE_NAME));

    // the the range tick label number format
    setRangeTickFormat(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_TICK_FORMAT_NODE_NAME));

    // the the range ticklabel font
    setRangeTickFont(
            chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.RANGE_TICK_FONT_NODE_NAME));

    // set the line style
    setLineStyle(chartAttributes.selectSingleNode(ChartDefinition.LINE_STYLE_NODE_NAME));

    // set the line width
    setLineWidth(chartAttributes.selectSingleNode(ChartDefinition.LINE_WIDTH_NODE_NAME));

    // set the marker visibility
    setMarkersVisible(chartAttributes.selectSingleNode(ChartDefinition.MARKER_VISIBLE_NODE_NAME));

    // set the marker visibility
    setMaxBarWidth(chartAttributes.selectSingleNode(CategoryDatasetChartDefinition.MAX_BAR_WIDTH_NODE_NAME));

    // set legend font
    setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME));

    // set legend border visible
    setLegendBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME));

    // first see if Hitachi Vantara System sets this property
    String defaultIncludeNullCategories = PentahoSystem
            .getSystemSetting("Charting/" + INCLUDE_NULL_CATEGORIES_NODE_NAME, "true"); //$NON-NLS-1$ //$NON-NLS-2$

    setIncludeNullCategories("true".equals(defaultIncludeNullCategories)); //$NON-NLS-1$

    // set whether to include null categories
    setIncludeNullCategories(chartAttributes.selectSingleNode(INCLUDE_NULL_CATEGORIES_NODE_NAME));
}

From source file:org.pentaho.platform.uifoundation.chart.CategoryDatasetChartDefinition.java

License:Open Source License

public void setPaintSequence(final Node paletteNode) {
    if (paletteNode != null) {
        List colorNodes = paletteNode.selectNodes(ChartDefinition.COLOR_NODE_NAME);
        Paint[] paints = new Paint[colorNodes.size()];
        for (int i = 0; i < colorNodes.size(); i++) {
            paints[i] = JFreeChartEngine.getPaint((Node) colorNodes.get(i));
        }//from   ww w.j av  a 2s.c o  m
        setPaintSequence(paints);
    }
}

From source file:org.pentaho.platform.uifoundation.chart.DialWidgetDefinition.java

License:Open Source License

/**
 * Create a dial definition object from an XML document
 * /*  ww  w . j  a  va  2 s  .c o m*/
 * @param doc
 *          definition XML document
 * @return Dial definition object
 */
public static void createDial(final DialWidgetDefinition widgetDefinition, final Node dialNode, final int width,
        final int height, final IPentahoSession session) {

    Node node = dialNode.selectSingleNode("units"); //$NON-NLS-1$
    if (node != null) {
        String units = node.getText();
        widgetDefinition.setUnits(units);
    }

    // set the background Paint
    Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("background-color")); //$NON-NLS-1$
    if (paint == null) {
        Element backgroundNode = (Element) dialNode.selectSingleNode("chart-background"); //$NON-NLS-1$
        if (backgroundNode != null) {
            String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
            if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session);
            } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
            }
        }
    } else {
        // log a deprecation warning for background-color ...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$
                "background-color", "chart-background")); //$NON-NLS-1$ //$NON-NLS-2$    
        DialWidgetDefinition.getLogger().warn(
                Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "background-color")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (paint != null) {
        widgetDefinition.setChartBackgroundPaint(paint);
    }

    // set the dial background Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("plot-background-color")); //$NON-NLS-1$
    if (paint == null) {
        Element backgroundNode = (Element) dialNode.selectSingleNode("plot-background"); //$NON-NLS-1$
        if (backgroundNode != null) {
            String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
            if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session);
            } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
            }
        }
    } else {
        // log a deprecation warning for plot-background-color ...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$
                "plot-background-color", "plot-background")); //$NON-NLS-1$ //$NON-NLS-2$    
        DialWidgetDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "plot-background-color")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (paint != null) {
        widgetDefinition.setPlotBackgroundPaint(paint);
    }

    // set the needle Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("needle-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setNeedlePaint(paint);
    }

    // set the tick Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("tick-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setTickPaint(paint);
    }

    Node tmpNode = dialNode.selectSingleNode("tick-interval"); //$NON-NLS-1$
    if (tmpNode != null) {
        widgetDefinition.setTickSize(Integer.parseInt(dialNode.selectSingleNode("tick-interval").getText())); //$NON-NLS-1$
    }

    // set the value Paint
    paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("value-color")); //$NON-NLS-1$
    if (paint != null) {
        widgetDefinition.setValuePaint(paint);
    }

    // TODO get this from the XML document
    widgetDefinition.setDialShape(DialShape.CHORD);

    Node titleFontNode = dialNode.selectSingleNode("title-font"); //$NON-NLS-1$
    if (titleFontNode != null) {
        Node fontNode = titleFontNode.selectSingleNode("font"); //$NON-NLS-1$
        if (fontNode != null) {
            String titleFontStr = fontNode.getText().trim();
            if (!"".equals(titleFontStr)) { //$NON-NLS-1$
                Node titleFontSizeNode = titleFontNode.selectSingleNode("size"); //$NON-NLS-1$
                int size = titleFontSizeNode != null ? Integer.parseInt(titleFontSizeNode.getText()) : 12;
                widgetDefinition.setTitleFont(new Font(titleFontStr, Font.BOLD, size));
            }
        } else {
            String titleFontStr = titleFontNode.getText().trim();
            if (!"".equals(titleFontStr)) { //$NON-NLS-1$
                widgetDefinition.setTitleFont(new Font(titleFontStr, Font.ITALIC, 24));
            }
        }
    }

    Node valueFontNode = dialNode.selectSingleNode("domain-tick-font"); //$NON-NLS-1$
    if (valueFontNode != null) {
        Node fontNode = valueFontNode.selectSingleNode("font"); //$NON-NLS-1$
        if (fontNode != null) {
            String fontStr = fontNode.getText().trim();
            if (!"".equals(fontStr)) { //$NON-NLS-1$
                Node valueFontSizeNode = valueFontNode.selectSingleNode("size"); //$NON-NLS-1$
                int size = valueFontSizeNode != null ? Integer.parseInt(valueFontSizeNode.getText()) : 12;
                widgetDefinition.setValueFont(new Font(fontStr, Font.BOLD, size));
            }
        } else {
            String fontStr = valueFontNode.getText().trim();
            if (!"".equals(fontStr)) { //$NON-NLS-1$
                widgetDefinition.setValueFont(new Font(fontStr, Font.ITALIC, 24));
            }
        }
    }

    // set any intervals that are defined in the document

    // A list of interval nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <interval> as a child of the main node , and now require an <intervals> parent node
    // under which <intervals> can exist.

    List intervals = dialNode.selectNodes("interval"); //$NON-NLS-1$

    if ((intervals == null) || (intervals.isEmpty())) {
        Node intervalsNode = dialNode.selectSingleNode("intervals"); //$NON-NLS-1$
        if (intervalsNode != null) {
            intervals = intervalsNode.selectNodes("interval"); //$NON-NLS-1$
        }
    } else {
        // log a deprecation warning for this property...
        DialWidgetDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", "interval", "intervals")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$    
        DialWidgetDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "interval")); //$NON-NLS-1$ //$NON-NLS-2$     
    }

    if (intervals != null) {

        Iterator intervalIterator = intervals.iterator();
        while (intervalIterator.hasNext()) {
            // get the interval node
            Node intervalNode = (Node) intervalIterator.next();

            // get the interval name
            String label = intervalNode.selectSingleNode("label").getText(); //$NON-NLS-1$

            // get the range of the interval
            double minimum = Double.parseDouble(intervalNode.selectSingleNode("minimum").getText()); //$NON-NLS-1$
            double maximum = Double.parseDouble(intervalNode.selectSingleNode("maximum").getText()); //$NON-NLS-1$
            Range range = new Range(minimum, maximum);

            Paint backgroundPaint = JFreeChartEngine.getPaint(intervalNode.selectSingleNode("color")); //$NON-NLS-1$
            if (backgroundPaint == null) {
                Element backgroundNode = (Element) intervalNode.selectSingleNode("interval-background"); //$NON-NLS-1$
                if (backgroundNode != null) {
                    String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$
                    if ("texture".equals(backgroundType)) { //$NON-NLS-1$
                        backgroundPaint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height,
                                session);
                    } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$
                        backgroundPaint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height);
                    }
                }
            }

            // get the text color of the interval
            String textColor = intervalNode.selectSingleNode("text-color").getText(); //$NON-NLS-1$
            Stroke outlineStroke;
            if (intervalNode.selectSingleNode("stroke-width") != null) { //$NON-NLS-1$
                outlineStroke = new BasicStroke(
                        Float.parseFloat(intervalNode.selectSingleNode("stroke-width").getText())); //$NON-NLS-1$
            } else {
                outlineStroke = new BasicStroke();
            }
            Paint outlinePaint = JFreeChartEngine.getPaint(textColor);

            // create the interval object
            MeterInterval interval = new MeterInterval(label, range, outlinePaint, outlineStroke,
                    backgroundPaint);

            // add the interval to the widget
            widgetDefinition.addInterval(interval);
        }
    }

    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = dialNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = dialNode.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        DialWidgetDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subtitles != null) {
        widgetDefinition.addSubTitles(subtitles);
    }

}

From source file:org.pentaho.platform.uifoundation.chart.PieDatasetChartDefinition.java

License:Open Source License

private void setChartAttributes(final Node chartAttributes) {
    if (chartAttributes == null) {
        return;//from  w  ww .ja  va  2  s .  c o  m
    }
    // set the chart background
    setChartBackground(chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME));

    // set the plot background
    setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME));

    // do we want a legend
    setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME));

    // get the chart title
    setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME));

    Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME);
    Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME);

    if (backgroundAlphaNode != null) {
        setBackgroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME));
    }
    if (foregroundAlphaNode != null) {
        setForegroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME));
    }
    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        PieDatasetChartDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                        ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        PieDatasetChartDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subtitles != null) {
        addSubTitles(subtitles);
    }

    // get the chart's exploded sections

    List slicesNodes = null;
    Node slicesNode = chartAttributes.selectSingleNode(PieDatasetChartDefinition.EXPLODE_SLICE_NODE_NAME);
    if (slicesNode != null) {
        slicesNodes = slicesNode.selectNodes(PieDatasetChartDefinition.SLICE_NODE_NAME);
    }

    if (slicesNodes != null) {
        addExplodedSlices(slicesNodes);
    }

    // get the paint sequence
    setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME));

    // get the 3D value
    setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME));

    // set the width
    setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME));

    // set the height
    setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME));

    // set the border on or off
    setBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME));

    // set the border Paint
    setBorderPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_PAINT_NODE_NAME)));

    // set the title location
    setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME));

    // set the title font
    setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME));

    // set the interior gap
    setInteriorGap(chartAttributes.selectSingleNode(PieDatasetChartDefinition.INTERIOR_GAP_NODE_NAME));

    // set the start angle
    setStartAngle(chartAttributes.selectSingleNode(PieDatasetChartDefinition.START_ANGLE_NODE_NAME));

    // set if we want labels
    setDisplayLabels(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LABELS_NODE_NAME));

    // set the label font
    setLabelFont(chartAttributes.selectSingleNode(PieDatasetChartDefinition.LABEL_FONT_NODE_NAME));

    // set the label paint
    setLabelPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(PieDatasetChartDefinition.LABEL_PAINT_NODE_NAME)));

    // set the label background paint
    setLabelBackgroundPaint(JFreeChartEngine.getPaint(
            chartAttributes.selectSingleNode(PieDatasetChartDefinition.LABEL_BACKGROUND_PAINT_NODE_NAME)));

    // set the label gap
    setLabelGap(chartAttributes.selectSingleNode(PieDatasetChartDefinition.LABEL_GAP_NODE_NAME));

    // set legend font
    setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME));

    // set legend border visible
    setLegendBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME));

    setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME));
}

From source file:org.pentaho.platform.uifoundation.chart.TimeSeriesCollectionChartDefinition.java

License:Open Source License

private void setChartAttributes(final Node chartAttributes) {
    if (chartAttributes == null) {
        return;//from w ww.ja  v a  2  s .co m
    }
    // get the chart type from the chart node -- this overrides the current
    // chart type
    setChartType(chartAttributes.selectSingleNode(ChartDefinition.TYPE_NODE_NAME));

    // set the chart background
    setChartBackground(chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME));

    // set the plot background
    setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME));

    // set the orientation
    setOrientation(chartAttributes.selectSingleNode(XYChartDefinition.ORIENTATION_NODE_NAME));

    // do we want a legend
    setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME));

    // get the chart title
    setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME));

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        getLogger().warn(Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", //$NON-NLS-1$
                ChartDefinition.SUBTITLE_NODE_NAME));
    }

    if (subtitles != null) {
        addSubTitles(subtitles);
    }

    // get the paint sequence
    setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME));
    Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME);
    Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME);

    if (backgroundAlphaNode != null) {
        setBackgroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME));
    }
    if (foregroundAlphaNode != null) {
        setForegroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME));
    }
    // get the stacked value
    setStacked(chartAttributes.selectSingleNode(ChartDefinition.STACKED_NODE_NAME));

    // get the 3D value
    setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME));

    // set the width
    setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME));

    // set the height
    setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME));

    // set the dot width
    setDotWidth(chartAttributes.selectSingleNode(ChartDefinition.DOT_WIDTH_NODE_NAME));

    // set the dot height
    setDotHeight(chartAttributes.selectSingleNode(ChartDefinition.DOT_HEIGHT_NODE_NAME));

    // set vertical tick labels flag
    setDomainVerticalTickLabels(
            chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_VERTICAL_TICK_LABELS_NODE_NAME));

    // set the border on or off
    setBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME));

    // set the border Paint
    setBorderPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(XYChartDefinition.CHART_BORDER_PAINT_NODE_NAME)));

    // set the title location
    setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME));

    // set the legend location
    setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME));

    // set the title font
    setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME));

    // set the domain title
    setDomainTitle(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_NODE_NAME));

    // set the domain font
    setDomainTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_FONT_NODE_NAME));

    // set the range title
    setRangeTitle(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_NODE_NAME));

    // the the range font
    setRangeTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_FONT_NODE_NAME));

    // set the range minimum
    setRangeMinimum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MINIMUM_NODE_NAME));

    // set the range minimum
    setRangeMaximum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MAXIMUM_NODE_NAME));

    // set the date minimum
    setDateMinimum(
            chartAttributes.selectSingleNode(TimeSeriesCollectionChartDefinition.DATE_MINIMUM_NODE_NAME));

    // set the date minimum
    setDateMaximum(
            chartAttributes.selectSingleNode(TimeSeriesCollectionChartDefinition.DATE_MAXIMUM_NODE_NAME));

    // set the Period type
    setDomainPeriodType(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_PERIOD_TYPE_NODE_NAME));

    // set the line style
    setLineStyle(chartAttributes.selectSingleNode(ChartDefinition.LINE_STYLE_NODE_NAME));

    // set the line width
    setLineWidth(chartAttributes.selectSingleNode(ChartDefinition.LINE_WIDTH_NODE_NAME));

    // set the marker visibility
    setMarkersVisible(chartAttributes.selectSingleNode(ChartDefinition.MARKER_VISIBLE_NODE_NAME));

    // set legend font
    setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME));

    // set legend border visible
    setLegendBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME));

    setTooltipContent(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_CONTENT_NODE_NAME));

    setTooltipYFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_Y_FORMAT_NODE_NAME));

    setTooltipXFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_X_FORMAT_NODE_NAME));
}

From source file:org.pentaho.platform.uifoundation.chart.TimeTableXYDatasetChartDefinition.java

License:Open Source License

private void setChartAttributes(final Node chartAttributes) {
    if (chartAttributes == null) {
        return;/*from w ww  . jav  a  2 s  .c o m*/
    }
    // get the chart type from the chart node -- this overrides the current
    // chart type
    setChartType(chartAttributes.selectSingleNode(ChartDefinition.TYPE_NODE_NAME));

    // set the chart background
    setChartBackground(chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME));

    // set the plot background
    setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME));

    // set the orientation
    setOrientation(chartAttributes.selectSingleNode(XYChartDefinition.ORIENTATION_NODE_NAME));

    // do we want a legend
    setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME));

    // get the chart title
    setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME));

    Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME);
    Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME);

    if (backgroundAlphaNode != null) {
        setBackgroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME));
    }
    if (foregroundAlphaNode != null) {
        setForegroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME));
    }
    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        TimeTableXYDatasetChartDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                        ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        TimeTableXYDatasetChartDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subtitles != null) {
        addSubTitles(subtitles);
    }

    // get the paint sequence
    setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME));

    // get the stacked value
    setStacked(chartAttributes.selectSingleNode(ChartDefinition.STACKED_NODE_NAME));

    // get the 3D value
    setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME));

    // set the width
    setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME));

    // set the height
    setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME));

    // set the dot width
    setDotWidth(chartAttributes.selectSingleNode(ChartDefinition.DOT_WIDTH_NODE_NAME));

    // set the dot height
    setDotHeight(chartAttributes.selectSingleNode(ChartDefinition.DOT_HEIGHT_NODE_NAME));

    // set vertical tick labels flag
    setDomainVerticalTickLabels(
            chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_VERTICAL_TICK_LABELS_NODE_NAME));

    // set the border on or off
    setBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME));

    // set the border Paint
    setBorderPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(XYChartDefinition.CHART_BORDER_PAINT_NODE_NAME)));

    // set the title location
    setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME));

    // set the title font
    setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME));

    // set the domain title
    setDomainTitle(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_NODE_NAME));

    // set the domain font
    setDomainTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_FONT_NODE_NAME));

    // set the range title
    setRangeTitle(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_NODE_NAME));

    // the the range font
    setRangeTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_FONT_NODE_NAME));

    // set the range minimum
    setRangeMinimum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MINIMUM_NODE_NAME));

    // set the Period type
    setDomainPeriodType(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_PERIOD_TYPE_NODE_NAME));

    // set the line style
    setLineStyle(chartAttributes.selectSingleNode(ChartDefinition.LINE_STYLE_NODE_NAME));

    // set the line width
    setLineWidth(chartAttributes.selectSingleNode(ChartDefinition.LINE_WIDTH_NODE_NAME));

    // set the marker visibility
    setMarkersVisible(chartAttributes.selectSingleNode(ChartDefinition.MARKER_VISIBLE_NODE_NAME));

    // set legend font
    setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME));

    // set legend border visible
    setLegendBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME));

    // set the legend position
    setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME));

    setTooltipContent(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_CONTENT_NODE_NAME));

    setTooltipYFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_Y_FORMAT_NODE_NAME));

    setTooltipXFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_X_FORMAT_NODE_NAME));

}

From source file:org.pentaho.platform.uifoundation.chart.XYSeriesCollectionChartDefinition.java

License:Open Source License

private void setChartAttributes(final Node chartAttributes) {
    if (chartAttributes == null) {
        return;/*from  w  ww .  ja va  2s  .c o m*/
    }
    // get the chart type from the chart node -- this overrides the current
    // chart type
    setChartType(chartAttributes.selectSingleNode(ChartDefinition.TYPE_NODE_NAME));

    // set the chart background
    setChartBackground(chartAttributes.selectSingleNode(ChartDefinition.CHART_BACKGROUND_NODE_NAME));

    // set the plot background
    setPlotBackground(chartAttributes.selectSingleNode(ChartDefinition.PLOT_BACKGROUND_NODE_NAME));

    // set the orientation
    setOrientation(chartAttributes.selectSingleNode(XYChartDefinition.ORIENTATION_NODE_NAME));

    // do we want a legend
    setLegendIncluded(chartAttributes.selectSingleNode(ChartDefinition.INCLUDE_LEGEND_NODE_NAME));

    // get the chart title
    setTitle(chartAttributes.selectSingleNode(ChartDefinition.TITLE_NODE_NAME));
    Node backgroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME);
    Node foregroundAlphaNode = chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME);

    if (backgroundAlphaNode != null) {
        setBackgroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.BACKGROUND_ALPHA_NODE_NAME));
    }
    if (foregroundAlphaNode != null) {
        setForegroundAlpha(chartAttributes.selectSingleNode(ChartDefinition.FOREGROUND_ALPHA_NODE_NAME));
    }
    // get the chart subtitles

    // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema
    // to
    // be well constructed and validate the XML .
    // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node
    // under which <subtitle> can exist.

    List subtitles = chartAttributes.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);

    if ((subtitles == null) || (subtitles.isEmpty())) {
        Node subTitlesNode = chartAttributes.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME);
        if (subTitlesNode != null) {
            subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME);
        }
    } else {
        // log a deprecation warning for this property...
        XYSeriesCollectionChartDefinition.getLogger()
                .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$
                        ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME));
        XYSeriesCollectionChartDefinition.getLogger().warn(Messages.getInstance()
                .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$  
    }

    if (subtitles != null) {
        addSubTitles(subtitles);
    }

    // get the paint sequence
    setPaintSequence(chartAttributes.selectSingleNode(ChartDefinition.PALETTE_NODE_NAME));

    // get the stacked value
    setStacked(chartAttributes.selectSingleNode(ChartDefinition.STACKED_NODE_NAME));

    // get the 3D value
    setThreeD(chartAttributes.selectSingleNode(ChartDefinition.THREED_NODE_NAME));

    // set the width
    setWidth(chartAttributes.selectSingleNode(ChartDefinition.WIDTH_NODE_NAME));

    // set the height
    setHeight(chartAttributes.selectSingleNode(ChartDefinition.HEIGHT_NODE_NAME));

    // set the dot width
    setDotWidth(chartAttributes.selectSingleNode(ChartDefinition.DOT_WIDTH_NODE_NAME));

    // set the dot height
    setDotHeight(chartAttributes.selectSingleNode(ChartDefinition.DOT_HEIGHT_NODE_NAME));

    // set vertical tick labels flag
    setDomainVerticalTickLabels(
            chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_VERTICAL_TICK_LABELS_NODE_NAME));

    // set the border on or off
    setBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.CHART_BORDER_VISIBLE_NODE_NAME));

    // set the border Paint
    setBorderPaint(JFreeChartEngine
            .getPaint(chartAttributes.selectSingleNode(XYChartDefinition.CHART_BORDER_PAINT_NODE_NAME)));

    // set the title location
    setTitlePosition(chartAttributes.selectSingleNode(ChartDefinition.TITLE_POSITION_NODE_NAME));

    // set the title font
    setTitleFont(chartAttributes.selectSingleNode(ChartDefinition.TITLE_FONT_NODE_NAME));

    // set the domain title
    setDomainTitle(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_NODE_NAME));

    // set the domain title font
    setDomainTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TITLE_FONT_NODE_NAME));

    // set the domain tick font
    setDomainTickFont(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TICK_FONT_NODE_NAME));

    // the the domain tick label number format
    setDomainTickFormat(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_TICK_FORMAT_NODE_NAME));

    // set the range title
    setRangeTitle(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_NODE_NAME));

    // the the range title font
    setRangeTitleFont(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TITLE_FONT_NODE_NAME));

    // the the range tick font
    setRangeTickFont(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TICK_FONT_NODE_NAME));

    // the the range tick label number format
    setRangeTickFormat(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_TICK_FORMAT_NODE_NAME));

    // set the domain minimum
    setDomainMinimum(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_MINIMUM_NODE_NAME));

    // set the domain minimum
    setDomainMaximum(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_MAXIMUM_NODE_NAME));

    // set the range minimum
    setRangeMinimum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MINIMUM_NODE_NAME));

    // set the range minimum
    setRangeMaximum(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_MAXIMUM_NODE_NAME));

    // set we want domain to include zero
    setDomainIncludesZero(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_INCLUDES_ZERO_NODE_NAME));

    // set we want domain to force zero
    setDomainStickyZero(chartAttributes.selectSingleNode(XYChartDefinition.DOMAIN_STICKY_ZERO_NODE_NAME));

    // set we want domain to include zero
    setRangeIncludesZero(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_INCLUDES_ZERO_NODE_NAME));

    // set we want domain to force zero
    setRangeStickyZero(chartAttributes.selectSingleNode(XYChartDefinition.RANGE_STICKY_ZERO_NODE_NAME));

    // set the line style
    setLineStyle(chartAttributes.selectSingleNode(ChartDefinition.LINE_STYLE_NODE_NAME));

    // set the line width
    setLineWidth(chartAttributes.selectSingleNode(ChartDefinition.LINE_WIDTH_NODE_NAME));

    // set the marker visibility
    setMarkersVisible(chartAttributes.selectSingleNode(ChartDefinition.MARKER_VISIBLE_NODE_NAME));

    // set legend font
    setLegendFont(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_FONT_NODE_NAME));

    // set legend border visible
    setLegendBorderVisible(chartAttributes.selectSingleNode(ChartDefinition.DISPLAY_LEGEND_BORDER_NODE_NAME));

    setLegendPosition(chartAttributes.selectSingleNode(ChartDefinition.LEGEND_POSITION_NODE_NAME));

    setTooltipContent(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_CONTENT_NODE_NAME));

    setTooltipYFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_Y_FORMAT_NODE_NAME));

    setTooltipXFormat(chartAttributes.selectSingleNode(XYChartDefinition.TOOLTIP_X_FORMAT_NODE_NAME));

}