use of org.apache.xmlbeans.XmlObject in project ocvn by devgateway.
the class XSSFAreaChartData method createNewSerie.
@Override
protected CustomChartSeries createNewSerie(final int id, final int order, final ChartDataSource<?> categories, final ChartDataSource<? extends Number> values) {
return new AbstractSeries(id, order, categories, values) {
@Override
public void addToChart(final XmlObject ctChart) {
final CTAreaChart ctAreaChart = (CTAreaChart) ctChart;
final CTAreaSer ctAreaSer = ctAreaChart.addNewSer();
ctAreaSer.addNewIdx().setVal(this.id);
ctAreaSer.addNewOrder().setVal(this.order);
final CTAxDataSource catDS = ctAreaSer.addNewCat();
XSSFChartUtil.buildAxDataSource(catDS, this.categories);
final CTNumDataSource valueDS = ctAreaSer.addNewVal();
XSSFChartUtil.buildNumDataSource(valueDS, this.values);
if (isTitleSet()) {
ctAreaSer.setTx(getCTSerTx());
}
}
};
}
use of org.apache.xmlbeans.XmlObject in project ocvn by devgateway.
the class XSSFBubbleChartData method createNewSerie.
@Override
protected CustomChartSeries createNewSerie(final int id, final int order, final ChartDataSource<?> categories, final ChartDataSource<? extends Number> values) {
return new AbstractSeries(id, order, categories, values) {
@Override
public void addToChart(final XmlObject ctChart) {
final CTBubbleChart ctBubbleChart = (CTBubbleChart) ctChart;
final CTBubbleSer bubbleSer = ctBubbleChart.addNewSer();
bubbleSer.addNewIdx().setVal(this.id);
bubbleSer.addNewOrder().setVal(this.order);
final CTAxDataSource catDS = bubbleSer.addNewXVal();
XSSFChartUtil.buildAxDataSource(catDS, this.categories);
final CTNumDataSource valueDS = bubbleSer.addNewBubbleSize();
XSSFChartUtil.buildNumDataSource(valueDS, this.values);
if (isTitleSet()) {
bubbleSer.setTx(getCTSerTx());
}
}
};
}
use of org.apache.xmlbeans.XmlObject in project oc-explorer by devgateway.
the class XSSFBubbleChartData method createNewSerie.
@Override
protected CustomChartSeries createNewSerie(final int id, final int order, final ChartDataSource<?> categories, final ChartDataSource<? extends Number> values) {
return new AbstractSeries(id, order, categories, values) {
@Override
public void addToChart(final XmlObject ctChart) {
final CTBubbleChart ctBubbleChart = (CTBubbleChart) ctChart;
final CTBubbleSer bubbleSer = ctBubbleChart.addNewSer();
bubbleSer.addNewIdx().setVal(this.id);
bubbleSer.addNewOrder().setVal(this.order);
final CTAxDataSource catDS = bubbleSer.addNewXVal();
XSSFChartUtil.buildAxDataSource(catDS, this.categories);
final CTNumDataSource valueDS = bubbleSer.addNewBubbleSize();
XSSFChartUtil.buildNumDataSource(valueDS, this.values);
if (isTitleSet()) {
bubbleSer.setTx(getCTSerTx());
}
}
};
}
use of org.apache.xmlbeans.XmlObject in project knime-core by knime.
the class PMMLRuleTranslator method findFirst.
/**
* Finds the first xml {@link SimpleRule} within the {@code rule} {@link CompoundRule}.
*
* @param rule A {@link CompoundRule}.
* @return The first {@link SimpleRule} the should provide the outcome.
*/
private SimpleRule findFirst(final CompoundRule rule) {
XmlCursor newCursor = rule.newCursor();
if (newCursor.toFirstChild()) {
do {
XmlObject object = newCursor.getObject();
if (object instanceof SimpleRuleDocument.SimpleRule) {
SimpleRuleDocument.SimpleRule sr = (SimpleRuleDocument.SimpleRule) object;
return sr;
}
if (object instanceof CompoundRule) {
CompoundRule cp = (CompoundRule) object;
SimpleRule first = findFirst(cp);
if (first != null) {
return first;
}
}
} while (newCursor.toNextSibling());
}
assert false : rule;
return null;
}
use of org.apache.xmlbeans.XmlObject in project knime-core by knime.
the class PMMLPortObject method addPMMLModelFromHandler.
/**
* Appends the pmml model of the content handler by invoking its
* {@link PMMLContentHandler#addPMMLModel(DocumentFragment,
* PMMLPortObjectSpec)} method.
* Only {@link PMMLModelType} elements can be added.
* @param handler PMML content handler
* @throws SAXException if the pmml model could not be added
*/
@Deprecated
public void addPMMLModelFromHandler(final PMMLContentHandler handler) throws SAXException {
XmlObject model = null;
try {
model = XmlObject.Factory.parse(handler.getPMMLModelFragment(m_spec));
} catch (Exception e) {
throw new SAXException(e);
}
PMML pmmlXml = m_pmmlDoc.getPMML();
XmlCursor pmmlCursor = pmmlXml.newCursor();
pmmlCursor.toEndToken();
XmlCursor modelCursor = model.newCursor();
modelCursor.toFirstChild();
modelCursor.copyXml(pmmlCursor);
modelCursor.dispose();
pmmlCursor.dispose();
}
Aggregations