本文整理了Java中com.bc.ceres.binding.dom.XppDomElement
类的一些代码示例,展示了XppDomElement
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XppDomElement
类的具体详情如下:
包路径:com.bc.ceres.binding.dom.XppDomElement
类名称:XppDomElement
暂无
代码示例来源:origin: senbox-org/snap-desktop
private DomElement readXml(Reader reader) throws IOException {
try (BufferedReader br = new BufferedReader(reader)) {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
line = br.readLine();
}
return new XppDomElement(createDom(sb.toString()));
}
}
代码示例来源:origin: senbox-org/snap-desktop
public void convertToDOM(final XppDomElement parentElement) throws GraphException {
setParamsToConfiguration(parentElement.getXppDom());
return;
if (domConverter != null) {
try {
final DomElement childElement = parentElement.createChild(getElementName(p));
domConverter.convertValueToDom(p.getValue(), childElement);
} catch (ConversionException e) {
final DomElement childElement = descriptor.getItemsInlined() ? parentElement : parentElement.createChild(getElementName(p));
final Object array = p.getValue();
final Converter itemConverter = getItemConverter(descriptor);
final DomElement childElement = parentElement.createChild(getElementName(p));
final Object childValue = p.getValue();
final Converter converter = descriptor.getConverter();
代码示例来源:origin: bcdev/beam
private DomElement readXml(Reader reader) throws IOException {
try (BufferedReader br = new BufferedReader(reader)) {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
line = br.readLine();
}
return new XppDomElement(createDom(sb.toString()));
}
}
代码示例来源:origin: senbox-org/snap-desktop
void updateParameters() throws GraphException {
if (operatorUI != null) {
final XppDomElement config = new XppDomElement("parameters");
updateParameterMap(config);
node.setConfiguration(config);
}
}
代码示例来源:origin: bcdev/beam
public String convertObjectToXml(Object object) throws ConversionException {
DefaultDomConverter domConverter = new DefaultDomConverter(object.getClass(), parameterDescriptorFactory);
DomElement parametersDom = new XppDomElement(parameterElementName);
domConverter.convertValueToDom(object, parametersDom);
return parametersDom.toXml();
}
代码示例来源:origin: bcdev/beam
public DomElement convertXmlToDomElement(String xml) {
XppDomWriter domWriter = new XppDomWriter();
new HierarchicalStreamCopier().copy(new XppReader(new StringReader(xml)), domWriter);
XppDom xppDom = domWriter.getConfiguration();
return new XppDomElement(xppDom);
}
代码示例来源:origin: bcdev/beam
private static DomElement createDomElement(String xml) {
XppDomWriter domWriter = new XppDomWriter();
new HierarchicalStreamCopier().copy(new XppReader(new StringReader(xml), new MXParser()), domWriter);
XppDom xppDom = domWriter.getConfiguration();
return new XppDomElement(xppDom);
}
代码示例来源:origin: bcdev/beam
@Override
public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException {
Style style = (Style) value;
final SLDTransformer transformer = new SLDTransformer();
transformer.setIndentation(2);
try {
final String s = transformer.transform(style);
XppDomWriter domWriter = new XppDomWriter();
new HierarchicalStreamCopier().copy(new XppReader(new StringReader(s)), domWriter);
parentElement.addChild(new XppDomElement(domWriter.getConfiguration()));
} catch (TransformerException e) {
throw new IllegalArgumentException(e);
}
}
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException {
Style style = (Style) value;
final SLDTransformer transformer = new SLDTransformer();
transformer.setIndentation(2);
try {
final String s = transformer.transform(style);
XppDomWriter domWriter = new XppDomWriter();
new HierarchicalStreamCopier().copy(new XppReader(new StringReader(s)), domWriter);
parentElement.addChild(new XppDomElement(domWriter.getConfiguration()));
} catch (TransformerException e) {
throw new IllegalArgumentException(e);
}
}
}
代码示例来源:origin: bcdev/beam
return null;
DomElement resolvedElement = new XppDomElement(domElement.getName());
Set<OperatorConfiguration.Reference> references = new HashSet<>(17);
DomElement[] children = domElement.getChildren();
代码示例来源:origin: senbox-org/snap-desktop
private void replaceProductSetWithReaders(final GraphNode sourceNode, final String id, final String value) {
final GraphNode newReaderNode = GraphExecuter.createNewGraphNode(graph, graphNodeList,
OperatorSpi.getOperatorAlias(ReadOp.class), id);
newReaderNode.setOperatorUI(null);
final DomElement config = newReaderNode.getNode().getConfiguration();
final DomElement fileParam = new XppDomElement("file");
fileParam.setValue(value);
config.addChild(fileParam);
final String format = CommonReaders.findCommonProductFormat(new File(value));
if(format != null) {
final DomElement formatParam = new XppDomElement("formatName");
formatParam.setValue(format);
config.addChild(formatParam);
}
graphNodeList.switchConnections(sourceNode, newReaderNode.getID());
}
代码示例来源:origin: senbox-org/snap-desktop
public void setOperatorParam(final String id, final String paramName, final String value) {
final Node node = graph.getNode(id);
DomElement xml = node.getConfiguration().getChild(paramName);
if (xml == null) {
xml = new XppDomElement(paramName);
node.getConfiguration().addChild(xml);
}
xml.setValue(value);
}
代码示例来源:origin: bcdev/beam
@Override
public void write(Layer layer, Writer writer, DomConverter domConverter) {
initIO();
final XppDomElement configuration = new XppDomElement("configuration");
try {
domConverter.convertValueToDom(layer, configuration);
} catch (com.bc.ceres.binding.ConversionException e) {
e.printStackTrace();
}
final LayerMemento memento = new LayerMemento(layer.getLayerType().getClass().getSimpleName(), configuration);
xs.toXML(memento, writer);
}
代码示例来源:origin: senbox-org/snap-desktop
static GraphNode createNewGraphNode(final Graph graph, final GraphNodeList graphNodeList,
final String opName, final String id) {
final Node newNode = new Node(id, opName);
final XppDomElement parameters = new XppDomElement("parameters");
newNode.setConfiguration(parameters);
graph.addNode(newNode);
final GraphNode newGraphNode = new GraphNode(newNode);
graphNodeList.add(newGraphNode);
newGraphNode.setOperatorUI(OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName()));
return newGraphNode;
}
代码示例来源:origin: senbox-org/snap-desktop
@Before
public void setUp() throws Exception {
node = new Node("id", "readOp");
final XppDomElement parameters = new XppDomElement("parameters");
node.setConfiguration(parameters);
graphNode = new GraphNode(node);
}
代码示例来源:origin: senbox-org/snap-desktop
private GraphNode createNewGraphNode(final Graph graph, final String opName, final String id) {
final Node newNode = new Node(id, opName);
final XppDomElement parameters = new XppDomElement("parameters");
newNode.setConfiguration(parameters);
graph.addNode(newNode);
final GraphNode newGraphNode = new GraphNode(newNode);
graphNodeList.add(newGraphNode);
newGraphNode.setOperatorUI(OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName()));
moveWriterToLast(graph);
return newGraphNode;
}
代码示例来源:origin: bcdev/beam
private static void appendXmlUsage(StringBuilder usageText, OperatorDescriptor operatorDescriptor) {
final DomElement graphElem = new XppDomElement("graph");
graphElem.setAttribute("id", "someGraphId");
final DomElement versionElem = graphElem.createChild("version");
versionElem.setValue("1.0");
final DomElement nodeElem = graphElem.createChild("node");
nodeElem.setAttribute("id", "someNodeId");
final DomElement operatorElem = nodeElem.createChild("operator");
operatorElem.setValue(operatorDescriptor.getAlias());
DomElement sourcesElem = nodeElem.createChild("sources");
for (SourceProductDescriptor sourceProduct : operatorDescriptor.getSourceProductDescriptors()) {
convertSourceProductFieldToDom(sourceProduct, sourcesElem);
}
if (operatorDescriptor.getSourceProductsDescriptor() != null) {
String name = getName(operatorDescriptor.getSourceProductsDescriptor());
final DomElement child = sourcesElem.createChild(name);
child.setValue(String.format("${%s}", name));
}
DomElement parametersElem = nodeElem.createChild("parameters");
for (ParameterDescriptor parameter : operatorDescriptor.getParameterDescriptors()) {
if (!parameter.isDeprecated()) {
convertParameterFieldToDom(parameter, parametersElem);
}
}
final StringTokenizer st = new StringTokenizer(graphElem.toXml().replace('\r', ' '), "\n");
while (st.hasMoreElements()) {
appendLine(usageText, " ", st.nextToken());
}
}
代码示例来源:origin: bcdev/beam
final XppDomElement parametersDom = new XppDomElement("parameters");
try {
domConverter.convertValueToDom(context.operator, parametersDom);
代码示例来源:origin: bcdev/beam
XppDomElement element = new XppDomElement(createDom(expectedXml));
LineFigure actualFigure = (LineFigure) domConverter.convertDomToValue(element, null);
代码示例来源:origin: senbox-org/snap-desktop
@Test
public void testSourceConnection() {
final Node sourceNode = new Node("sourceID", "testSourceNodeOp");
final XppDomElement parameters = new XppDomElement("parameters");
sourceNode.setConfiguration(parameters);
GraphNode sourceGraphNode = new GraphNode(sourceNode);
// test connect
graphNode.connectOperatorSource(sourceGraphNode.getID());
NodeSource ns = node.getSource(0);
assertNotNull(ns);
assertEquals(ns.getSourceNodeId(), sourceNode.getId());
// test disconnect
graphNode.disconnectOperatorSources(sourceGraphNode.getID());
NodeSource[] nsList = node.getSources();
assertEquals(nsList.length, 0);
}
}
内容来源于网络,如有侵权,请联系作者删除!