use of org.dom4j.Node in project pentaho-platform by pentaho.
the class TimeTableXYDatasetChartDefinition method setChartAttributes.
private void setChartAttributes(final Node chartAttributes) {
if (chartAttributes == null) {
return;
}
// 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", ChartDefinition.SUBTITLE_NODE_NAME, // $NON-NLS-1$
ChartDefinition.SUBTITLES_NODE_NAME));
TimeTableXYDatasetChartDefinition.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));
// 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));
}
use of org.dom4j.Node in project pentaho-platform by pentaho.
the class TimeTableXYDatasetChartDefinition method setPlotBackground.
public void setPlotBackground(final Node plotBackgroundNode) {
if (plotBackgroundNode != null) {
Node backgroundTypeNode = plotBackgroundNode.selectSingleNode(ChartDefinition.BACKGROUND_TYPE_ATTRIBUTE_NAME);
if (backgroundTypeNode != null) {
String backgroundTypeStr = backgroundTypeNode.getText();
if (ChartDefinition.COLOR_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) {
setPlotBackgroundPaint(JFreeChartEngine.getPaint(plotBackgroundNode));
setPlotBackgroundImage((Image) null);
} else if (ChartDefinition.IMAGE_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) {
setPlotBackgroundImage(plotBackgroundNode);
setPlotBackgroundPaint(null);
} else if (ChartDefinition.TEXTURE_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) {
setPlotBackgroundPaint(JFreeChartEngine.getTexturePaint(plotBackgroundNode, getWidth(), getHeight(), getSession()));
setPlotBackgroundImage((Image) null);
} else if (ChartDefinition.GRADIENT_TYPE_NAME.equalsIgnoreCase(backgroundTypeStr)) {
setPlotBackgroundPaint(JFreeChartEngine.getGradientPaint(plotBackgroundNode, getWidth(), getHeight()));
setPlotBackgroundImage((Image) null);
}
}
}
}
use of org.dom4j.Node in project pentaho-platform by pentaho.
the class XYSeriesCollectionChartComponent method createChart.
@Override
public Dataset createChart(final Document doc) {
if (actionPath != null) {
// if we have a solution then get the values
values = getActionData();
}
if (values == null) {
// we could not get any data
return null;
}
// get the chart node from the document
// $NON-NLS-1$
Node chartAttributes = doc.selectSingleNode("//" + AbstractChartComponent.CHART_NODE_NAME);
// create the definition
XYSeriesCollectionChartDefinition chartDefinition = new XYSeriesCollectionChartDefinition((IPentahoResultSet) values, byRow, chartAttributes, getSession());
// set the misc values from chartDefinition
setChartType(chartDefinition.getChartType());
setTitle(chartDefinition.getTitle());
// get the URL template
Node urlTemplateNode = chartAttributes.selectSingleNode(AbstractChartComponent.URLTEMPLATE_NODE_NAME);
if (urlTemplateNode != null) {
setUrlTemplate(urlTemplateNode.getText());
}
// get the additional parameter
Node paramName2Node = chartAttributes.selectSingleNode(AbstractChartComponent.PARAM2_NODE_NAME);
if (paramName2Node != null) {
seriesName = paramName2Node.getText();
}
if ((chartDefinition.getWidth() != -1) && (width == -1)) {
setWidth(chartDefinition.getWidth());
}
if ((chartDefinition.getHeight() != -1) && (height == -1)) {
setHeight(chartDefinition.getHeight());
}
return chartDefinition;
}
use of org.dom4j.Node in project pentaho-platform by pentaho.
the class XYSeriesCollectionChartDefinition method setChartAttributes.
private void setChartAttributes(final Node chartAttributes) {
if (chartAttributes == null) {
return;
}
// 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", ChartDefinition.SUBTITLE_NODE_NAME, // $NON-NLS-1$
ChartDefinition.SUBTITLES_NODE_NAME));
XYSeriesCollectionChartDefinition.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));
// 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));
}
use of org.dom4j.Node in project pentaho-platform by pentaho.
the class XYZSeriesCollectionChartComponent method createChart.
@Override
public Dataset createChart(final Document doc) {
if (actionPath != null) {
// if we have a solution then get the values
values = getActionData();
}
if (values == null) {
// we could not get any data
return null;
}
// get the chart node from the document
// $NON-NLS-1$
Node chartAttributes = doc.selectSingleNode("//" + AbstractChartComponent.CHART_NODE_NAME);
// create the definition
XYZSeriesCollectionChartDefinition chartDefinition = new XYZSeriesCollectionChartDefinition((IPentahoResultSet) values, byRow, chartAttributes, getSession());
// set the misc values from chartDefinition
setChartType(chartDefinition.getChartType());
setTitle(chartDefinition.getTitle());
// get the URL template
Node urlTemplateNode = chartAttributes.selectSingleNode(AbstractChartComponent.URLTEMPLATE_NODE_NAME);
if (urlTemplateNode != null) {
setUrlTemplate(urlTemplateNode.getText());
}
// get the additional parameter
Node paramName2Node = chartAttributes.selectSingleNode(AbstractChartComponent.PARAM2_NODE_NAME);
if (paramName2Node != null) {
seriesName = paramName2Node.getText();
}
if ((chartDefinition.getWidth() != -1) && (width == -1)) {
setWidth(chartDefinition.getWidth());
}
if ((chartDefinition.getHeight() != -1) && (height == -1)) {
setHeight(chartDefinition.getHeight());
}
return chartDefinition;
}
Aggregations