gt: 				int c = getChildCount();
context: package org.openhealthtools.mdht.mdmi.editor.tree;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Enumeration;
  
  import javax.swing.tree.DefaultMutableTreeNode;
  import javax.swing.tree.TreeNode;
  
  import org.openhealthtools.mdht.mdmi.editor.map.editor.AbstractComponentEditor;
  import org.openhealthtools.mdht.mdmi.editor.map.tree.EditableObjectNode;
  import org.openhealthtools.mdht.mdmi.editor.map.tree.NewObjectInfo;
  import org.openhealthtools.mdht.mdmi.editor.map.tree.TreeNodeIcon;
  import org.openhealthtools.mdht.mdmi.model.MessageGroup;
  import org.openhealthtools.mdht.mdmi.service.entities.MdmiNetConcept;
  
  /** Tree node for all concepts of a given type. Children will be concepts of this type, but with a specified name */
  public class ConceptTypeNode extends AbstractConceptNode {
  	private Collection<NewObjectInfo> m_newObjectInfo = null;
  
  	public ConceptTypeNode(MdmiNetConceptWrapper concept) {
  		super(concept);
  		setNodeIcon(TreeNodeIcon.SyntaxBagIcon);
  	}
  
  	public ConceptNameNode addConceptNameNode(MdmiNetConceptWrapper concept) {
  
  		// do we already have a name node
  		String conceptName = concept.getName();
  		if (conceptName == null || conceptName.isEmpty()) {
  			// shouldn't happen
  			return null;
  		}
  
  		String property = concept.getProperty();
  		// make sure it has something for property
  		if (property == null || property.isEmpty()) {
  			property = ConceptSetNode.EMPTY_FIELD;
  			concept.setProperty(property);
  		}
  
  		ConceptNameNode conceptNameNode = findConceptNameNode(conceptName);
  
  		// create a name node if we don't already have one
  		if (conceptNameNode == null) {
  
  			// save our concept display
  			if (concept.getConceptTypeDisplay() == null || concept.getConceptTypeDisplay().isEmpty()) {
  				concept.setConceptTypeDisplay(getConceptTypeDisplay());
  			}
  
  			// use this concept if it doesn't have a property
  			if (ConceptSetNode.EMPTY_FIELD.equals(property)) {
  				conceptNameNode = new ConceptNameNode(concept);
  
  			} else {
  				// otherwise, create a new concept wrapper
  				MdmiNetConceptWrapper emptyConcept = new MdmiNetConceptWrapper();
  				emptyConcept.setConceptType(concept.getConceptType());
  				emptyConcept.setConceptTypeDisplay(getConceptTypeDisplay());
  				emptyConcept.setName(conceptName);
  				emptyConcept.setProperty(ConceptSetNode.EMPTY_FIELD);
  				emptyConcept.setQualifier(ConceptSetNode.EMPTY_FIELD);
  				conceptNameNode = new ConceptNameNode(emptyConcept);
  			}
  
  			conceptNameNode.setExistingConcept(true);
  			addSorted(conceptNameNode);
  		}
  
  		if (ConceptSetNode.EMPTY_FIELD.equals(property)) {
  			// if this concept doesn't have a property, it should be used for the name node
  			conceptNameNode.setUserObject(concept);
  		} else {
  			// if this concept has a property, add property node
  			conceptNameNode.addConceptPropertyNode(concept);
  		}
  
  		return conceptNameNode;
  	}
  
  	// find the ConceptNameNode for this concept name
  	public ConceptNameNode findConceptNameNode(String conceptName) {
  		ConceptNameNode conceptNameNode = null;
  		for (int i = 0; i < getChildCount(); i++) {
  			TreeNode child = getChildAt(i);
  			if (child instanceof ConceptNameNode &&
  					((ConceptNameNode) child).getMdmiNetConcept().getName().equalsIgnoreCase(conceptName)) {
  				conceptNameNode = (ConceptNameNode) child;
  				break;
  			}
  		}
  		return conceptNameNode;
  	}
  
  	/** Find the concept node with this concept
  	 * @param value
  	 * @return
  	 */
  	public AbstractConceptNode findConceptNode(MdmiNetConcept concept) {
  		for (Enumeration<?> en = depthFirstEnumeration(); en != null && en.hasMoreElements();) {
  			DefaultMutableTreeNode child = (DefaultMutableTreeNode) en.nextElement();
  			if (child instanceof AbstractConceptNode) {
  				AbstractConceptNode conceptNode = (AbstractConceptNode) child;
  				if (conceptNode.getMdmiNetConcept().mdmiNetConcept == concept) {
  					return conceptNode;
  				}
  			}
  		}
  		return null;
  	}
  
  	/** Find all ConceptName nodes that are related to the provide name */
  	public ArrayList<ConceptNameNode> findRelatedConceptNameNodes(String conceptName) {
  		ArrayList<ConceptNameNode> relatedNodes = new ArrayList<ConceptNameNode>();
  
  		// find the ConceptNameNode for the provided name
  		ConceptNameNode sourceNode = findConceptNameNode(conceptName);
  		if (sourceNode != null) {
  			// get the names of all related concepts
  			for (String relatedName : sourceNode.getRelatedConceptNames()) {
  				// look up the concept node
  				ConceptNameNode relatedNode = findConceptNameNode(relatedName);
  				if (relatedNode != null) {
  					relatedNodes.add(relatedNode);
  				}
  			}
  		}
  
  		return relatedNodes;
  	}
  
  	@Override
  	public String getDisplayName(Object userObject) {
  		// list by concept type
  		MdmiNetConceptWrapper wrapper = (MdmiNetConceptWrapper) userObject;
  		String conceptType = wrapper.getConceptTypeDisplay();
  		if (conceptType == null || conceptType.isEmpty()) {
  			conceptType = wrapper.getConceptType();
  		}
  		return conceptType;
  	}
  
  	/** get the concept type for this node */
  	public String getConceptType() {
  		return getMdmiNetConcept().getConceptType();
  	}
  
  	/** get the concept display type for this node */
  	public String getConceptTypeDisplay() {
  		String conceptType = getMdmiNetConcept().getConceptTypeDisplay();
  		if (conceptType == null || conceptType.isEmpty()) {
  			conceptType = getMdmiNetConcept().getConceptType();
  		}
  		return conceptType;
  	}
  
  	@Override
  	public String getToolTipText() {
  		return "All " + getConceptTypeDisplay() + " Concepts";
  	}
  
  	@Override
  	public AbstractComponentEditor getEditorForNode() {
  		return new CustomEditor(getMessageGroup(), getUserObject().getClass());
  	}
  
  	//////////////////////////////////////////////////////////////////
  	// Custom Classes
  	//////////////////////////////////////////////////////////////
  
  	///////////////////////////////////////////////////////////////
  	// Custom Concept Editor - read only
  	public class CustomEditor extends CustomConceptEditor {
  		public CustomEditor(MessageGroup group, Class<?> objectClass) {
  			super(group, objectClass);
  		}
  
  		/** Determine if this field should be shown read-only */
  		@Override
  		public boolean isReadOnlyFields(String fieldName) {
  			// everything is read only
  			return true;
  		}
  	}
  
  	/** What new items can be created */
  	@Override
  	public Collection<NewObjectInfo> getNewObjectInformation(boolean changeType) {
  		if (m_newObjectInfo == null) {
  			m_newObjectInfo = super.getNewObjectInformation(changeType);
  			m_newObjectInfo.add(new NewConceptName());
  		}
  
  		return m_newObjectInfo;
  	}
  
  	// Class to create a new child node (Concept Name)
  	public class NewConceptName extends NewObjectInfo {
  
  		@Override
  		public EditableObjectNode addNewChild(Object childObject) {
  			MdmiNetConceptWrapper concept = (MdmiNetConceptWrapper) childObject;
  
  			// set the type and name
  			// use our concept type for the new ones
  			concept.setConceptType(((MdmiNetConceptWrapper) getUserObject()).getConceptType());
  			// add next value
  			if (concept.getName() == null || concept.getName().isEmpty()) {
  