當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。