本文整理汇总了Java中org.apache.batik.gvt.GraphicsNode.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsNode.getParent方法的具体用法?Java GraphicsNode.getParent怎么用?Java GraphicsNode.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.batik.gvt.GraphicsNode
的用法示例。
在下文中一共展示了GraphicsNode.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleElementAdded
import org.apache.batik.gvt.GraphicsNode; //导入方法依赖的package包/类
/**
* Rebuild the graphics tree.
*/
protected void handleElementAdded(CompositeGraphicsNode gn,
Node parent,
Element childElt) {
// build the graphics node
GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode childNode = builder.build(ctx, childElt);
if (childNode == null) {
return; // the added element is not a graphic element
}
// Find the index where the GraphicsNode should be added
int idx = -1;
for(Node ps = childElt.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE)
continue;
Element pse = (Element)ps;
GraphicsNode psgn = ctx.getGraphicsNode(pse);
while ((psgn != null) && (psgn.getParent() != gn)) {
// In some cases the GN linked is
// a child (in particular for images).
psgn = psgn.getParent();
}
if (psgn == null)
continue;
idx = gn.indexOf(psgn);
if (idx == -1)
continue;
break;
}
// insert after prevSibling, if
// it was -1 this becomes 0 (first slot)
idx++;
gn.add(idx, childNode);
}
示例2: handleElementAdded
import org.apache.batik.gvt.GraphicsNode; //导入方法依赖的package包/类
/**
* Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
*/
public void handleElementAdded(CompositeGraphicsNode gn,
Node parent,
Element childElt) {
// build the graphics node
GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode childNode = builder.build(ctx, childElt);
if (childNode == null) {
return; // the added element is not a graphic element
}
// Find the index where the GraphicsNode should be added
int idx = -1;
for(Node ps = childElt.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE)
continue;
Element pse = (Element)ps;
GraphicsNode psgn = ctx.getGraphicsNode(pse);
while ((psgn != null) && (psgn.getParent() != gn)) {
// In some cases the GN linked is
// a child (in particular for images).
psgn = psgn.getParent();
}
if (psgn == null)
continue;
idx = gn.indexOf(psgn);
if (idx == -1)
continue;
break;
}
// insert after prevSibling, if
// it was -1 this becomes 0 (first slot)
idx++;
gn.add(idx, childNode);
}
示例3: handleElementAdded
import org.apache.batik.gvt.GraphicsNode; //导入方法依赖的package包/类
/**
* Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
*/
protected void handleElementAdded(CompositeGraphicsNode gn,
Node parent,
Element childElt) {
// build the graphics node
GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode childNode = builder.build(ctx, childElt);
if (childNode == null) {
return; // the added element is not a graphic element
}
// Find the index where the GraphicsNode should be added
int idx = -1;
for(Node ps = childElt.getPreviousSibling(); ps != null;
ps = ps.getPreviousSibling()) {
if (ps.getNodeType() != Node.ELEMENT_NODE)
continue;
Element pse = (Element)ps;
GraphicsNode psgn = ctx.getGraphicsNode(pse);
while ((psgn != null) && (psgn.getParent() != gn)) {
// In some cases the GN linked is
// a child (in particular for images).
psgn = psgn.getParent();
}
if (psgn == null)
continue;
idx = gn.indexOf(psgn);
if (idx == -1)
continue;
break;
}
// insert after prevSibling, if
// it was -1 this becomes 0 (first slot)
idx++;
gn.add(idx, childNode);
}