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


Java DefaultMutableTreeNode.getChildAt方法代码示例

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


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

示例1: getMultipleNodesAvailable

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Provides the Vector of all currently available nodes of the same kind as the current node.
 *
 * @param currNode The current node of the object structure
 * @return the multiple nodes available
 */
private Vector<DefaultMutableTreeNode> getMultipleNodesAvailable(DefaultMutableTreeNode currNode) {
	
	// --- The result vector of all needed nodes ------------------------------------ 
	Vector<DefaultMutableTreeNode> nodesFound = new Vector<DefaultMutableTreeNode>();
	// --- Can we find the number of similar nodes to the current one? -------------- 
	DynType currDT = (DynType) currNode.getUserObject();
	
	// --- The current parentNode and the position of the current node --------------
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) currNode.getParent();

	// --- Search for all similar nodes --------------------------------------------- 
	for (int i = 0; i < parentNode.getChildCount(); i++) {
		DefaultMutableTreeNode checkNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);
		DynType checkDT = (DynType) checkNode.getUserObject();
		if (checkDT.equals(currDT)) {
			nodesFound.add(checkNode);
		} 
	}
	return nodesFound;

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:DynFormBase.java

示例2: resetValuesOnSubForm

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Reset sub object.
 * @param node the node
 */
private void resetValuesOnSubForm(DefaultMutableTreeNode node) {
	
	// --- Set the value to null ----------------------
	DynType dynType = (DynType) node.getUserObject(); 
	this.setSingleValue(dynType, null);
	
	// --- Is there a multiple button to remove? ------
	JButton multipleButton = dynType.getJButtonMultipleOnDynFormPanel();
	if (multipleButton!=null) {
		if (multipleButton.getText().equals("+")==false) {
			multipleButton.doClick();
		}
	}

	// --- Are there any sub nodes available? ---------
	if (node.getChildCount()>0) {
		for (int i=0; i < node.getChildCount(); i++) {
			DefaultMutableTreeNode subNode = (DefaultMutableTreeNode) node.getChildAt(i);
			this.resetValuesOnSubForm(subNode);
		}
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:DynFormBase.java

示例3: setJPanelInvisibleAndSmall

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Sets the invisible.
 *
 * @param parentNode the new invisible
 * @return the rectangle
 */
private Rectangle setJPanelInvisibleAndSmall(DefaultMutableTreeNode parentNode) {
	
	Rectangle feBounds = null; // --- First element Bounds ------
	DynType parentDT = (DynType) parentNode.getUserObject();
	
	for (int i = 0; i < parentNode.getChildCount(); i++) {
		DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);
		if (childNode.getChildCount()>0) {
			// --- recursively edit all sub panels --------------
			feBounds = this.setJPanelInvisibleAndSmall(childNode);
		}
		DynType dt = (DynType) childNode.getUserObject();
		
		if (feBounds==null) {
			feBounds = dt.getPanel().getBounds();
		}
		dt.getPanel().setVisible(false);
		dt.getPanel().setBounds(feBounds);
	}
	
	this.setPanelBounds(parentDT.getPanel());		
	return feBounds;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:DynForm.java

示例4: getOntologyClassEditorJPanel

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Returns the OntologyClassEditorJPanel for the specified index of the current data model.
 *
 * @param targetDataModelIndex the target data model index
 * @return the ontology class editor j panel
 */
public Vector<OntologyClassEditorJPanel> getOntologyClassEditorJPanel(int targetDataModelIndex) {

	Vector<OntologyClassEditorJPanel> ontoVisPanel = new Vector<OntologyClassEditorJPanel>();

	if (this.getSelectedIndex()==0) {
		// --- An open visualization of the DynTable ------------
		OntologyClassEditorJPanel ocep = this.getDynTableJPanel().getOntologyClassEditorJPanel(targetDataModelIndex);
		if (ocep!=null) {
			ontoVisPanel.add(ocep);	
		}
	} else if (this.getSelectedIndex()==1) {
		// --- Visualization on the DynForm himself -------------
		DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) this.getDynForm().getObjectTree().getRoot();
		DefaultMutableTreeNode targetNode = (DefaultMutableTreeNode) rootNode.getChildAt(targetDataModelIndex);
		OntologyClassWidget widget = this.getDynForm().getOntologyClassWidget(targetNode);
		ontoVisPanel.add(widget);
	}
	
	if (ontoVisPanel.size()==0) ontoVisPanel=null;
	return ontoVisPanel;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:OntologyInstanceViewer.java

示例5: sort

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
public static void sort(DefaultMutableTreeNode parent) {
	int n = parent.getChildCount();
	for (int i = 0; i < n - 1; i++) {
		int min = i;
		for (int j = i + 1; j < n; j++) {
			if (tnc.compare((DefaultMutableTreeNode) parent.getChildAt(min), (DefaultMutableTreeNode) parent.getChildAt(j)) > 0) {
				min = j;
			}
		}
		if (i != min) {
			MutableTreeNode a = (MutableTreeNode) parent.getChildAt(i);
			MutableTreeNode b = (MutableTreeNode) parent.getChildAt(min);
			parent.insert(b, i);
			parent.insert(a, min);
			
			updateTree = true;
		}
	}
}
 
开发者ID:adelbs,项目名称:ISO8583,代码行数:20,代码来源:SortTreeHelper.java

示例6: getNamedTreeNode

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
public static DefaultMutableTreeNode getNamedTreeNode(final DefaultMutableTreeNode parent, final String... names) {
	final List<String> escNames = Arrays.asList(names).stream().map(n -> escapeString(n)).collect(Collectors.toList());
	final int cnt = parent.getChildCount();
	for (int i=0; i<cnt; i++) {
		final DefaultMutableTreeNode c = (DefaultMutableTreeNode)parent.getChildAt(i);
		final TreeModelEntry poifsEntry = (TreeModelEntry)c.getUserObject();
		if (escNames.contains(poifsEntry.toString())) {
			return c;
		}
	}
	return null;
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:13,代码来源:TreeModelUtils.java

示例7: stringToPath

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
@Override
public TreePath stringToPath(String value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)treeModel.getRoot();
    if (designSupport.isSimpleExpression(value)) {
        value = designSupport.unwrapSimpleExpression(value);
    } else {
        if ("null".equals(value)) { // NOI18N
            return new TreePath(new Object[] {node, node.getChildAt(0)});
        }
        return null;
    }
    List<DefaultMutableTreeNode> path = new LinkedList<DefaultMutableTreeNode>();
    // always include root
    path.add(node);
    int index;
    while ((index = value.indexOf('.')) != -1) {
        String item = value.substring(0, index);
        node = findNode(node, item);
        if (node == null) {
            return null;
        } else {
            path.add(node);
        }
        value = value.substring(index+1);
    }
    // add last
    node = findNode(node, value);
    if (node != null) {
        path.add(node);
    } else {
        return null;
    }
    return new TreePath(path.toArray());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:BindingCustomizer.java

示例8: findNode

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private DefaultMutableTreeNode findNode(DefaultMutableTreeNode parent, String userObject) {
    for (int i=0; i<parent.getChildCount(); i++) {
        DefaultMutableTreeNode child = (DefaultMutableTreeNode)parent.getChildAt(i);
        if (userObject.equals(child.getUserObject())) {
            return child;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:BindingCustomizer.java

示例9: isSelected

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
boolean isSelected( DefaultMutableTreeNode node ) {
    for( int i = 0; i < node.getChildCount(); i++ ) {
        DefaultMutableTreeNode ch = (DefaultMutableTreeNode) node.getChildAt(i);
        Object o = ch.getUserObject();
        if ( o instanceof Rule ) {
            UserConfigurableRule hint = (UserConfigurableRule) o;
            if ( HintsSettings.isEnabled(manager, hint, getCurrentPrefernces(hint)) ) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HintsPanelLogic.java

示例10: isSelected

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
boolean isSelected( DefaultMutableTreeNode node ) {
    for( int i = 0; i < node.getChildCount(); i++ ) {
        DefaultMutableTreeNode ch = (DefaultMutableTreeNode) node.getChildAt(i);
        Object o = ch.getUserObject();
        if ( o instanceof POMErrorFixBase ) {
            POMErrorFixBase hint = (POMErrorFixBase)o;
            if ( hint.getConfiguration().isEnabled(getCurrentPrefernces(hint)) ) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HintsPanelLogic.java

示例11: getChildNodeVector

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Gets the child node vector.
 * @return the child node vector
 */
private Vector<Object> getChildNodeVector(DefaultMutableTreeNode parentNode, boolean visibleInTableView) {
	
	Vector<Object> childVector = new Vector<Object>();
	boolean childNodesVisible = true;
	for (int i=0; i<parentNode.getChildCount(); i++) {

		// --------------------------------------------
		// --- Create data row for this node ----------
		DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);
		DynType dynType = (DynType) childNode.getUserObject();
		dynType.setVisibleInTableView(visibleInTableView);
		
		if (visibleInTableView==true) {
			// --- Are child slots visible in the table ---
			if (OntologyVisualisationConfiguration.isRegisteredOntologyClassVisualisation(dynType.getClassName())) {
				childNodesVisible = false;
			} else {
				childNodesVisible = true;
			}
			
		} else {
			// --- nodes and sub node are invisible ---
			childNodesVisible = visibleInTableView;
		}
		
		// --- Create data row ------------------------
		Vector<Object> dataRow = new Vector<Object>();			
		dataRow.add(dynType);
		dataRow.add(dynType);
		// --- Add to mainVector ----------------------
		childVector.add(dataRow);
		
		// --------------------------------------------
		// --- Remind the row number as editable!? ----
		if (dynType.getTypeName().equals(DynType.typeRawType)) {
			this.getEditableRowsVector().add(this.rowCounter);
		}
		this.rowCounter++;
		
		// --------------------------------------------
		// --- Add the Child nodes, if available ------
		if (childNode.getChildCount()!=0) {
			// --- get child nodes first --------------
			childVector.addAll(this.getChildNodeVector(childNode, childNodesVisible));
		}
		
	}
	return childVector;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:54,代码来源:DynTableDataVector.java

示例12: displayAcquisitions

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
private void displayAcquisitions(DefaultMutableTreeNode selectednode, boolean mode) {
    // clean layer first
    wwjPanel.removeAllAreas();
    // scan through tree
    DefaultMutableTreeNode parentnode = (DefaultMutableTreeNode)jTree1.getModel().getRoot();
    if(parentnode != null)
    {
        for(int index = 0; index < jTree1.getModel().getChildCount(parentnode); index++)
        {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)parentnode.getChildAt(index);
            if(node != null)
            {
                if(node.getUserObject() instanceof ImagePlanning)
                {
                    ImagePlanning imagePlanning = (ImagePlanning)node.getUserObject();
                    if(imagePlanning != null)
                    {
                        // if display all
                        if(mode)
                        {
                            // display the image frame depending on node
                            wwjPanel.toggleAcquisitionArea(imagePlanning.getArea(), imagePlanning.getAcquisitionTime(), node.equals(selectednode));
                        } else {
                            // display only selected node image frame
                            if(node.equals(selectednode))
                                wwjPanel.toggleAcquisitionArea(imagePlanning.getArea(), imagePlanning.getAcquisitionTime(), true);
                        }
                    }
                }
            }
        }
    }
    wwjPanel.refresh();
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:PlanningPanel.java

示例13: setJPanelConfiguration

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Sets the panel configuration.
 *
 * @param dynType the DynType
 * @param startArgIndex the start argument index
 * @param doExpand the new frame configuration
 */
private void setJPanelConfiguration(boolean doExpand) {
	
	if (this.getDynType()==null) doExpand=false;

	// --- Clean up the old instances -------------------------------------
	this.removeAll();
	this.jSplitPaneExpanded=null;
	
	this.removeUserFunctions2JToolBar4UserFunction();
	this.stolenComponentsFromJToolBar=null;
	this.jComponent2Add=null;
	
	// --- Do expand the view (or not) ------------------------------------
	if (doExpand==true) {
		// --- Expand view and show widget or editor panel ----------------
		this.add(this.getJSplitPaneExpanded(), BorderLayout.CENTER);
		
		// --- Find the corresponding startArgIndex -----------------------
		int startArgIndex = this.getStartArgumentIndex(this.getDynType());
		
		// --- Configure the component for the display --------------------
		String missingText = Language.translate("Die Klasse vom Typ 'OntologyClassVisualisation' wurde nicht gefunden!");
		OntologyClassVisualisation ontoClassVis = OntologyVisualisationConfiguration.getOntologyClassVisualisation(this.getDynType().getClassName());
		if (ontoClassVis!=null) {
			switch (this.getExpansionDirection()) {
			case DynTableJPanel.EXPANSION_Horizontal:
				missingText = Language.translate("Das Editor-Panel für die Klasse ist nicht definiert!");
				OntologyClassEditorJPanel ocej = ontoClassVis.getEditorJPanel(this.dynForm, startArgIndex);
				this.jComponent2Add = ocej;
				
				DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) this.dynForm.getObjectTree().getRoot();
				DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) rootNode.getChildAt(startArgIndex);
				DynType dynType = (DynType) childNode.getUserObject();
				
				String clazzName = dynType.getClassName();
				if (clazzName.contains(".")==true) {
					clazzName = clazzName.substring(clazzName.lastIndexOf(".")+1);
				}
				this.stealJToolBarFromOntologyClassEditorJPanel(ocej);
				this.addUserFunctions2JToolBar4UserFunction(clazzName);
				break;

			case DynTableJPanel.EXPANSION_Vertical:
				missingText = Language.translate("Das Widget für die Klasse ist nicht definiert!");
				OntologyClassWidget ocw = ontoClassVis.getWidget(this.dynForm, startArgIndex);
				this.jComponent2Add = ocw;
				break;
			}
		} 
		if (this.jComponent2Add==null) {
			this.jComponent2Add = getJPanelEmpty(missingText);
		}
		
		// --- Add the component to the JSplitPane ------------------------
		switch (this.getExpansionDirection()) {
		case DynTableJPanel.EXPANSION_Horizontal:
			this.getJSplitPaneExpanded().setRightComponent(jComponent2Add);
			break;

		case DynTableJPanel.EXPANSION_Vertical:
			this.getJSplitPaneExpanded().setBottomComponent(jComponent2Add);
			break;
		}
					
	} else {
		// --- Remove the Split view --------------------------------------
		this.add(this.getJScrollPaneDynTable(), BorderLayout.CENTER);
		
	}
	// --- Control the expansion of the mainFraime ------------------------
	this.expandMainFrame(doExpand);

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:81,代码来源:DynTableJPanel.java

示例14: moveAfterAddOrRemove

import javax.swing.tree.DefaultMutableTreeNode; //导入方法依赖的package包/类
/**
 * Move all elements which are available after the node given by the parameter node.
 *
 * @param movement the movement
 * @param node the node
 */
private void moveAfterAddOrRemove(int movement, DefaultMutableTreeNode node) {
	
	if (node==this.getRootNode()) return;
	
	DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
	JPanel parentPanel = null;
	if (parentNode.getUserObject() instanceof DynType) {
		DynType dynType = (DynType) parentNode.getUserObject();
		parentPanel = dynType.getPanel();
	}
	
	int numOfChilds = parentNode.getChildCount();
	int indexOfNextNode = parentNode.getIndex(node) + 1;
	
	for (int i = indexOfNextNode; i < numOfChilds; i++) {
		
		DefaultMutableTreeNode currNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);

		DynType dt = (DynType) currNode.getUserObject();
		JPanel movePanel = dt.getPanel();
		movePanel.setBounds(movePanel.getX(), movePanel.getY()+movement, movePanel.getWidth(), movePanel.getHeight());
		
		JComponent parentComp = (JComponent) movePanel.getParent();
		parentComp.validate();
		if (parentComp instanceof JPanel) {
			this.setPanelBounds((JPanel) parentComp);	
		}
		
	}

	// --- Configure size of parent panel -----------------------
	if (parentPanel!=null) {
		parentPanel.validate();
		this.setPanelBounds(parentPanel);
	}
	
	// --- do the same at the parent node -----------------------
	this.moveAfterAddOrRemove(movement, parentNode);
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:47,代码来源:DynForm.java


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