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


Java MutableTreeNode.setParent方法代码示例

本文整理汇总了Java中javax.swing.tree.MutableTreeNode.setParent方法的典型用法代码示例。如果您正苦于以下问题:Java MutableTreeNode.setParent方法的具体用法?Java MutableTreeNode.setParent怎么用?Java MutableTreeNode.setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.tree.MutableTreeNode的用法示例。


在下文中一共展示了MutableTreeNode.setParent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public synchronized void insert(MutableTreeNode child, int index) {
	if (!getAllowsChildren())
		throw new IllegalStateException("Node does not allow children");
	if (!(child instanceof IterationStrategyNode))
		throw new IllegalArgumentException(
				"Child not an instance of IterationStrategyNode: " + child);
	if (child == this)
		throw new IllegalArgumentException("Can't be it's own parent");

	// Check if it is already there (in case we'll just move it)
	int alreadyExistsIndex = children.indexOf(child);

	children.add(index, (IterationStrategyNode) child);

	if (alreadyExistsIndex > -1) {
		// Remove it from the old position
		if (index < alreadyExistsIndex
				&& alreadyExistsIndex + 1 < children.size())
			alreadyExistsIndex++;
		children.remove(alreadyExistsIndex);
	}
	if (child.getParent() != this)
		child.setParent(this);
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:26,代码来源:AbstractIterationStrategyNode.java

示例2: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode child, int index) {
    if (child == null) {
        throw new NullPointerException("Cannot add null child to " + getClass().getSimpleName());
    }
    if (index < 0) {
        throw new ArrayIndexOutOfBoundsException(index);
    }
    
    if (children == null) {
        children = new ArrayList<>();
    }
    children.add(index, (KatNode) child);
    child.setParent(this);
}
 
开发者ID:m-lima,项目名称:KATscans,代码行数:16,代码来源:KatNode.java

示例3: remove

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public synchronized void remove(MutableTreeNode node) {
	if (!getAllowsChildren())
		throw new IllegalStateException("Node does not allow children");
	children.remove(node);
	if (node.getParent() == this)
		node.setParent(null);
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:9,代码来源:AbstractIterationStrategyNode.java

示例4: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode newChild, int index) {
    FontCollectionNode oldParent = (FontCollectionNode) newChild.getParent();
    if (oldParent != null) {
        oldParent.remove(newChild);
    }
    newChild.setParent(this);
    children.add(index, (FontFamilyNode) newChild);
}
 
开发者ID:umple,项目名称:umple,代码行数:10,代码来源:FontCollectionNode.java

示例5: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode newChild, int index) {
    FontFamilyNode oldParent = (FontFamilyNode) newChild.getParent();
    if (oldParent != null) {
        oldParent.remove(newChild);
    }
    newChild.setParent(this);
    children.add(index, (FontFaceNode) newChild);
}
 
开发者ID:umple,项目名称:umple,代码行数:10,代码来源:FontFamilyNode.java

示例6: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode child, int index) {
    child.setParent(this);
    this.childrenOfService.add(index, (QInfoItem) child);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:6,代码来源:QInfoItem.java

示例7: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode child, int index) {
    child.setParent(this);
    this.childrenOfService.add(index, (QRespItem) child);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:6,代码来源:QRespItem.java

示例8: insert

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void insert(MutableTreeNode child, int index) {
    child.setParent(this);
    this.childrenOfService.add(index, (QService) child);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:6,代码来源:QService.java

示例9: add

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
public void add(MutableTreeNode newChild)
{
   super.add(newChild);
   newChild.setParent(this);
}
 
开发者ID:realxujiang,项目名称:bigtable-sql,代码行数:6,代码来源:ObjectTreeNode.java

示例10: remove

import javax.swing.tree.MutableTreeNode; //导入方法依赖的package包/类
@Override
public void remove(int childIndex) {
    MutableTreeNode child = (MutableTreeNode) getChildAt(childIndex);
    children.remove(childIndex);
    child.setParent(null);
}
 
开发者ID:umple,项目名称:umple,代码行数:7,代码来源:FontCollectionNode.java


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