當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultMutableTreeNode.children方法代碼示例

本文整理匯總了Java中javax.swing.tree.DefaultMutableTreeNode.children方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultMutableTreeNode.children方法的具體用法?Java DefaultMutableTreeNode.children怎麽用?Java DefaultMutableTreeNode.children使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.tree.DefaultMutableTreeNode的用法示例。


在下文中一共展示了DefaultMutableTreeNode.children方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMachineNode

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
DefaultMutableTreeNode getMachineNode(String machineName) {
    if (machineName == null || machineName.isEmpty()) {
        return null;
    }
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) jTree.getModel().getRoot();
    Enumeration<DefaultMutableTreeNode> children = root.children();
    while (children.hasMoreElements()) {
        DefaultMutableTreeNode node = children.nextElement();

        String nodeString = node.getUserObject().toString();
        String nodeMachine = nodeString.substring(nodeString.lastIndexOf(' ') + 1, nodeString.length());
        if (nodeMachine.equals(machineName)) {
            return node;
        }
    }
    return null;
}
 
開發者ID:phweda,項目名稱:MFM,代碼行數:18,代碼來源:MAMEtoJTree.java

示例2: apply

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public void apply() throws ConfigurationException {
    Set<SelectedExchangeCurrencyPair> selectedExchangeCurrencyPairs = Sets.newHashSet();
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    Enumeration rootEnum = root.children();
    while (rootEnum.hasMoreElements()) {
        DefaultMutableTreeNode rootEnumObject = (DefaultMutableTreeNode) rootEnum.nextElement();
        String exchangeName = rootEnumObject.getUserObject().toString();
        Enumeration childEnum = rootEnumObject.children();
        Set<CurrencyPair> currencyPairs = Sets.newHashSet();
        while (childEnum.hasMoreElements()) {
            CheckedTreeNode childEnumObject = (CheckedTreeNode) childEnum.nextElement();
            if (childEnumObject.isChecked()) {
                currencyPairs.add(new CurrencyPair(childEnumObject.getUserObject().toString()));
            }
        }
        SelectedExchangeCurrencyPair selectedExchangeCurrencyPair = new SelectedExchangeCurrencyPair(exchangeName, currencyPairs);
        selectedExchangeCurrencyPairs.add(selectedExchangeCurrencyPair);
    }
    IdeaCurrencyConfig.getInstance().setSelectedExchangeCurrencyPairs(selectedExchangeCurrencyPairs);
    IdeaCurrencyConfig.getInstance().setReloadInterval(reloadIntervalSlider.getValue());
    IdeaCurrencyConfig.getInstance().setActive(activeCheckBox.isSelected());
    isModified = false;
    triggerConfigChange();
}
 
開發者ID:semihunaldi,項目名稱:IdeaCurrency,代碼行數:27,代碼來源:IdeaCurrencyConfigUI.java

示例3: childIndex

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
/**
 * Returns the index of a child of a given node, provided its string value.
 * 
 * @param node The node to search its children.
 * @param childValue The value of the child to compare with.
 * @return The index.
 */
private int childIndex(final DefaultMutableTreeNode node, final String childValue) {
  @SuppressWarnings("unchecked")
  Enumeration<DefaultMutableTreeNode> children = node.children();
  DefaultMutableTreeNode child = null;
  int index = -1;

  while (children.hasMoreElements() && index < 0) {
    child = children.nextElement();

    if (child.getUserObject() != null && childValue.equals(child.getUserObject())) {
      index = node.getIndex(child);
    }
  }

  return index;
}
 
開發者ID:oxygenxml,項目名稱:oxygen-dita-translation-package-builder,代碼行數:24,代碼來源:PreviewDialog.java

示例4: restoreExpandedState

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
public void restoreExpandedState()
{
	if (saved == null) return;

	DefaultMutableTreeNode root = (DefaultMutableTreeNode)getModel().getRoot();
	if (root == null) return;

	TreePath start = new TreePath(root);

	for (Enumeration<?> e = root.children(); e.hasMoreElements(); )
	{
		TreeNode tn = (TreeNode)e.nextElement();
		Object o = ((DefaultMutableTreeNode)tn).getUserObject();
		if ((o instanceof ClassNode) && (saved.contains((ClassNode)o)))
		{
			log.fine("Expand " + tn);
			setExpandedState(start.pathByAddingChild(tn), true);
		}
	}
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:21,代碼來源:CarTree.java

示例5: cloneTree

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
public DefaultMutableTreeNode cloneTree( DefaultMutableTreeNode root)
{
	DefaultMutableTreeNode retVal = (DefaultMutableTreeNode) root.clone();
	for (Enumeration e = root.children(); e.hasMoreElements();) {
         retVal.add(cloneTree((DefaultMutableTreeNode) e.nextElement()));
    }
	return retVal;
}
 
開發者ID:lead4good,項目名稱:open-java-trade-manager,代碼行數:9,代碼來源:IndicatorFactory.java

示例6: packageNodes

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
public Iterable<ClassSelectorPackageNode> packageNodes() {
	List<ClassSelectorPackageNode> nodes = Lists.newArrayList();
	DefaultMutableTreeNode root = (DefaultMutableTreeNode)getModel().getRoot();
	Enumeration<?> children = root.children();
	while (children.hasMoreElements()) {
		ClassSelectorPackageNode packageNode = (ClassSelectorPackageNode)children.nextElement();
		nodes.add(packageNode);
	}
	return nodes;
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:11,代碼來源:ClassSelector.java

示例7: getChild

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public DefaultMutableTreeNode getChild(DefaultMutableTreeNode node, TreeNodeUserObject name) {
	Enumeration<DefaultMutableTreeNode> entry = node.children();
	while (entry.hasMoreElements()) {
		DefaultMutableTreeNode nods = entry.nextElement();
		if (((TreeNodeUserObject) nods.getUserObject()).getOriginalName().equals(name.getOriginalName())) {
			return nods;
		}
	}
	return null;
}
 
開發者ID:KevinPriv,項目名稱:Luyten4Forge,代碼行數:12,代碼來源:Model.java

示例8: apply

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public void apply() {
    List<CodeRoot> roots = new ArrayList<>();
    DefaultTreeModel treeModel = (DefaultTreeModel) templateTree.getModel();
    DefaultMutableTreeNode topNode = (DefaultMutableTreeNode) treeModel.getRoot();
    Enumeration rootEnum = topNode.children();
    // 獲取所有root
    while (rootEnum.hasMoreElements()) {
        List<CodeGroup> groups = new ArrayList<>();
        DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) rootEnum.nextElement();
        Enumeration enumeration = rootNode.children();
        // 獲取所有組
        while(enumeration.hasMoreElements()){
            List<CodeTemplate> templates = new ArrayList<>();
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) enumeration.nextElement();
            Enumeration childEnum = node.children();
            // 獲取所有模板
            while(childEnum.hasMoreElements()){
                DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) childEnum.nextElement();
                CodeTemplate template = (CodeTemplate) childNode.getUserObject();
                if(templateEditor != null){
                    CodeTemplate tmp = templateEditor.getCodeTemplate();
                    if(template.getId().equals(tmp.getId())){
                        template = tmp;
                    }
                }
                templates.add(template);
            }
            CodeGroup group = (CodeGroup) node.getUserObject();
            group.setTemplates(templates);
            groups.add(group);
        }
        CodeRoot root = (CodeRoot) rootNode.getUserObject();
        root.setGroups(groups);
        roots.add(root);
    }
    settingManager.getTemplates().setRoots(roots);
    reset();
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:40,代碼來源:TemplatesUI.java

示例9: traverseTree

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
public void traverseTree(DefaultMutableTreeNode root, JMenu rootMenu) {
	for (Enumeration e = root.children(); e.hasMoreElements(); ) {
		DefaultMutableTreeNode child = (DefaultMutableTreeNode)e.nextElement();
		if ( child.isLeaf() ) {
			JMenuItem childMI = new JMenuItem(child.toString());
			rootMenu.add(childMI);
			childMI.addActionListener(this);
		} else {
			JMenu nextRootMenu = new JMenu(child.toString());
			traverseTree(child, nextRootMenu);
			rootMenu.add(nextRootMenu);
		}
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:15,代碼來源:AccessAllData.java

示例10: parseConfigToXML

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void parseConfigToXML() {
	MessageVO messageVo;
	FieldVO fieldVo;

	DefaultMutableTreeNode node;
	
	StringBuilder xmlISO = new StringBuilder();
	
	xmlISO.append("<?xml version=\"1.0\" ?>\n\n");
	xmlISO.append("<iso8583 delimiter=\"").append(isoDelimiter.getValue()).append("\">");
	
	//Capturando os MessageVO
	Enumeration<DefaultMutableTreeNode> enuParse = configTreeNode.children();
	Enumeration<DefaultMutableTreeNode> enuFields;
	Enumeration<DefaultMutableTreeNode> enuSubFields;
	
	while (enuParse.hasMoreElements()) {
		node = enuParse.nextElement();
		messageVo = (MessageVO) node.getUserObject();
		xmlISO.append("\n\n\t<message type=\"").append(messageVo.getType()).
				append("\" header-encoding=\"").append(messageVo.getHeaderEncoding().toPlainString()).
				append("\" bitmap-encoding=\"").append(messageVo.getBitmatEncoding().toPlainString()).append("\">");
		
		//Capturando os FieldVO
		enuFields = node.children();
		while (enuFields.hasMoreElements()) {
			node = enuFields.nextElement();
			fieldVo = (FieldVO) node.getUserObject();
			
			appendFieldVO(xmlISO, fieldVo, (node.getChildCount() > 0), false);
			
			if (node.getChildCount() > 0) {
				
				xmlISO.append(">");
				
				//Capturando os FieldVO filhos
				enuSubFields = node.children();
				while (enuSubFields.hasMoreElements()) {
					node = enuSubFields.nextElement();
					fieldVo = (FieldVO) node.getUserObject();
					
					appendFieldVO(xmlISO, fieldVo, false, true);
				}
				xmlISO.append("\n\t\t</field>");
			}
				
		}
		
		xmlISO.append("\n\t</message>");
	}

	xmlISO.append("\n</iso8583>");
	
	xmlText.setText(xmlISO.toString());
}
 
開發者ID:adelbs,項目名稱:ISO8583,代碼行數:57,代碼來源:Iso8583Config.java

示例11: isModified

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public boolean isModified(){
    Templates templates = settingManager.getTemplates();
    DefaultMutableTreeNode topNode = (DefaultMutableTreeNode) templateTree.getModel().getRoot();
    // 獲取映射map
    Map<String, List<CodeGroup>> groupsMap = templates.getGroupsMap();
    Map<String, List<CodeTemplate>> templateMap = templates.getTemplatesMap();

    // root的判斷, 數量判斷, name?
    List<CodeRoot> roots = templates.getRoots();
    if(topNode.getChildCount() != roots.size()){
        return true;
    }
    Enumeration rootEnum = topNode.children();
    while (rootEnum.hasMoreElements()) {
        // 組的判斷, 數量判斷
        DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) rootEnum.nextElement();
        CodeRoot root = (CodeRoot) rootNode.getUserObject();
        if (rootNode.getChildCount() != groupsMap.get(root.getId()).size()) {
            return true;
        }
        Enumeration enumeration = rootNode.children();
        while(enumeration.hasMoreElements()){
            // 模板判斷, 數量判斷
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) enumeration.nextElement();
            CodeGroup group = (CodeGroup) node.getUserObject();
            if(node.getChildCount() != templateMap.get(group.getId()).size()){
                return true;
            }
            if(templateEditor != null){
                Enumeration childEnum = node.children();
                while(childEnum.hasMoreElements()){
                    // 模板內容判斷
                    DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) childEnum.nextElement();
                    CodeTemplate template = (CodeTemplate) childNode.getUserObject();
                    CodeTemplate tmp = templateEditor.getCodeTemplate();
                    if(template.getId().equals(tmp.getId()) && !template.equals(tmp)){
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:46,代碼來源:TemplatesUI.java


注:本文中的javax.swing.tree.DefaultMutableTreeNode.children方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。