当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsNode.getParent方法代码示例

本文整理汇总了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);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:39,代码来源:BindableElementBridge.java

示例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);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:39,代码来源:XBLShadowTreeElementBridge.java

示例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);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:39,代码来源:SVGGElementBridge.java


注:本文中的org.apache.batik.gvt.GraphicsNode.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。