Java Code Examples for ims.framework.controls.TreeNode.getNodes()

The following are Jave code examples for showing how to use getNodes() of the ims.framework.controls.TreeNode class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private StringBuilder getFormattedNodeDetails(TreeNode node, StringBuilder out)
{
	if (node.getValue() instanceof LocShortVo)
	{
		LocShortVo vo = (LocShortVo) node.getValue();
		out = formatLocationDetails(out, vo);
		if (node.isExpanded())
		{
			TreeNodeCollection treeNodeColl = node.getNodes();
			for (int i = 0; i < treeNodeColl.size(); i++)
			{
				out = getFormattedNodeDetails(treeNodeColl.get(i), out);
			}
		}
	}
	else if (node.getValue() instanceof LocationServiceVo)
	{
		out = formatServiceDetails(out, (LocationServiceVo) node.getValue());
	}
	return out;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void addGridClassification(QuestionClassificationCollection coll, TreeNode parentNode, boolean addParents) 
{
	TreeNode childNode;
	for(int i=0; parentNode != null && i<parentNode.getNodes().size(); i++)
	{
		childNode = parentNode.getNodes().get(i);
		//Use && childrenSelected(node.getNodes()) == false if you want to have parent or child selected ( as in the Prev method)
		if(childNode.isChecked())
		{
			coll.add((QuestionClassification)childNode.getValue());
			//Add the parent as well
			if(addParents)
			{
				if(coll.indexOf((QuestionClassification)parentNode.getValue()) < 0)
					coll.add((QuestionClassification)parentNode.getValue());
			}
		}
		if(childNode.getNodes() != null && childNode.getNodes().size() > 0)
			addGridClassification(coll, childNode, addParents);
	}
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void clearSearchTreeNodes() 
{
	TreeNode parent;
	
	TreeNodeCollection coll;
	if(isTextAndClassSearch())
		coll = form.lyrSearch().tabPageTextClass().treTextAndClass().getNodes();
	else
		coll = form.lyrSearch().tabPageClassification().treClassification().getNodes();
	for(int i=0; i<coll.size(); i++)
	{
		parent = coll.get(i);
		if(parent.isChecked())
			parent.setChecked(false);
		if(parent.getNodes() != null && parent.getNodes().size() > 0)
			clearChildren(parent.getNodes());
	}
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isClassificationSelected() 
{
	TreeNodeCollection nodeColl;
	TreeNode node;
	if(isTextAndClassSearch() == false)
		nodeColl = form.lyrSearch().tabPageClassification().treClassification().getNodes();
	else
		nodeColl = form.lyrSearch().tabPageTextClass().treTextAndClass().getNodes();
		
	for(int i=0; i<nodeColl.size(); i++)
	{
		node = nodeColl.get(i);
		if(node.isChecked())
			return true;
		if(node.getNodes() != null && node.getNodes().size() > 0)
			if(isChildClassificationSel(node))
				return true;
	}
	return false;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private TreeNode getNodeByText(TreeNode parent, String textNode)
{
	TreeNodeCollection nodes = null;
	
	if(parent == null)
	{
		nodes = form.treBOList().getNodes();
	}
	else
	{
		nodes = parent.getNodes();
	}
	
	for (int i = 0; i < nodes.size(); i++)
	{
		if(nodes.get(i).getText().equals(textNode))
			return nodes.get(i); 
	}
	
	return null;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void loadClassification(QuestionInformationVo voQInfo) 
{
	if(voQInfo != null && voQInfo.getClassificationIsNotNull())
	{
		QuestionClassification qClassInfo;
		TreeNode node;
		for(int j=0; j<voQInfo.getClassification().size(); j++)
		{
			qClassInfo = voQInfo.getClassification().get(j);
			for(int i=0; i<form.treClassification().getNodes().size(); i++)
			{
				node = form.treClassification().getNodes().get(i);
				if(qClassInfo.equals(node.getValue()))
					node.setChecked(true);

				if(node.getNodes() != null && node.getNodes().size() > 0)
					setClassificationValue(qClassInfo, node);
			}
		}
	}
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void saveOrder()
{
	LookupInstanceCollection instColl = new LookupInstanceCollection();
	TreeNode rootNode = getRootNode();

	if (rootNode == null)
		return;

	LookupTypeVo type = (LookupTypeVo) rootNode.getValue();
	TreeNodeCollection coll = rootNode.getNodes();
	if (coll == null)
		return;
	
	addToOrderedColl(coll, instColl);		
	try
	{
		domain.saveInstanceOrder(type, instColl);
	}
	catch (StaleObjectException ex)
	{
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
	}
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private boolean isNodesChecked()
{
	for (int i = 0; i < form.treICP().getNodes().size(); i++)
	{
		TreeNode stageNode = form.treICP().getNodes().get(i);

		if (stageNode.isChecked())
			return true;
		
		if (stageNode.getNodes() != null && stageNode.getNodes().size() > 0)
		{
			for (int j = 0; j < stageNode.getNodes().size(); j++)
			{
				TreeNode phaseNode = stageNode.getNodes().get(j);
				
				if (phaseNode.isChecked())
					return true;
			}
		}
	}

	return false;
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void expandNodes(TreeNodeCollection nodes) 
{
	TreeNode node;
	for (int i = 0; nodes != null && i < nodes.size(); i++) 
	{
		node = nodes.get(i);
		if(node.isExpanded() == false)
			node.setExpanded(true);
		if(node.getNodes() != null && node.getNodes().size() > 0)
			expandNodes(node.getNodes());
	}
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void collapseNodes(TreeNodeCollection nodes) 
{
	TreeNode node;
	for (int i = 0; nodes != null && i < nodes.size(); i++) 
	{
		node = nodes.get(i);
		if(node.isExpanded())
			node.setExpanded(false);
		if(node.getNodes() != null && node.getNodes().size() > 0)
			collapseNodes(node.getNodes());
	}
}
 
Example 11
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void addClassification(QuestionClassificationCollection coll, TreeNode parentNode) 
{
	TreeNode childNode;
	for(int i=0; parentNode != null && i<parentNode.getNodes().size(); i++)
	{
		childNode = parentNode.getNodes().get(i);
		//Use && childrenSelected(node.getNodes()) == false if you want to have parent or child selected ( as in the Prev method)
		if(childNode.isChecked())
			coll.add((QuestionClassification)childNode.getValue());
		if(childNode.getNodes() != null && childNode.getNodes().size() > 0)
			addClassification(coll, childNode);
	}
}
 
Example 12
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void clearChildren(TreeNodeCollection parentNodes) 
{
	TreeNode childNode;
	for(int i=0; parentNodes != null && i<parentNodes.size(); i++)
	{
		childNode = parentNodes.get(i);
		if(childNode.isChecked())
			childNode.setChecked(false);
		if(childNode.getNodes() != null && childNode.getNodes().size() > 0)
			clearChildren(childNode.getNodes());
	}
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean isChildClassificationSel(TreeNode parentNode) 
{
	TreeNode childNode;
	for(int i=0; parentNode != null && i<parentNode.getNodes().size(); i++)
	{
		childNode = parentNode.getNodes().get(i);
		if(childNode.isChecked())
			return true;
		if(childNode.getNodes() != null && childNode.getNodes().size() > 0)
			isChildClassificationSel(childNode);
	}
	return false;
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void collapseNodes(TreeNodeCollection nodes)
{
	for (int i = 0; nodes != null && i < nodes.size(); i++)
	{
		TreeNode node = nodes.get(i);
		if (node.isExpanded())
			node.setExpanded(false);
		if (node.getNodes() != null && node.getNodes().size() > 0)
			collapseNodes(node.getNodes());
	}
}
 
Example 15
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void expandNodes(TreeNodeCollection nodes)
{
	for (int i = 0; nodes != null && i < nodes.size(); i++)
	{
		TreeNode node = nodes.get(i);
		if (node.isExpanded() == false)
			node.setExpanded(true);
		if (node.getNodes() != null && node.getNodes().size() > 0)
			expandNodes(node.getNodes());
	}
}
 
Example 16
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void clearServiceNodes(TreeNode node)
{
	TreeNodeCollection coll = node.getNodes();
	List<TreeNode> removes = new ArrayList<TreeNode>();
	for (int i = 0; coll != null && i < coll.size(); i++)
	{
		TreeNode childNode = coll.get(i);
		if (!(childNode.getValue() instanceof LocationRefVo))
			removes.add(childNode);
	}
	for (int i = 0; i < removes.size(); i++)
	{
		coll.remove(removes.get(i));
	}
}
 
Example 17
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void setClassificationValue(QuestionClassification voQInfo, TreeNode parentNode) 
{
	TreeNode childNode;
	for(int i=0; parentNode != null && i<parentNode.getNodes().size(); i++)
	{
		childNode = parentNode.getNodes().get(i);
		if(voQInfo.equals(childNode.getValue()))
			childNode.setChecked(true);
		if(childNode.getNodes() != null && childNode.getNodes().size() > 0)
			setClassificationValue(voQInfo, childNode);
	}
}
 
Example 18
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void expandNodes(TreeNodeCollection nodes) 
{
	for (int i = 0; nodes != null && i < nodes.size(); i++) 
	{
		TreeNode node = nodes.get(i);
		if(node.isExpanded() == false)
			node.setExpanded(true);
		if(node.getNodes() != null && node.getNodes().size() > 0)
			expandNodes(node.getNodes());
	}
}
 
Example 19
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private ArrayList<Object> populateCheckedNodesCollection()
{
	// Hold all checked stages / phases
	ArrayList<Object> checkedIdentifiers = new ArrayList<Object>();
	
	// Iterate all Stage nodes
	for (int i = 0; i < form.treICP().getNodes().size(); i++)
	{
		TreeNode stageNode = form.treICP().getNodes().get(i);
		
		// If the stage node is checked add the stage to the collection of items to be brought into scope
		if (stageNode.isChecked())
			checkedIdentifiers.add(stageNode.getIdentifier());

		// For a Stage node iterate all Phase nodes
		if (stageNode.getNodes() != null && stageNode.getNodes().size() > 0)
		{
			for (int j = 0; j < stageNode.getNodes().size(); j++)
			{
				TreeNode phaseNode = stageNode.getNodes().get(j);
				
				// If the phase is checked add the phase to the collection of items to be brought into scope
				if (phaseNode.isChecked())
					checkedIdentifiers.add(phaseNode.getIdentifier());
			}
		}
	}

	// Return items to be brought into scope
	return checkedIdentifiers;
}
 
Example 20
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
private void clearDetails()
{

	if (form.treList().getSelectedNode() == null)
	{
		form.ctnDetails().cmbActivity().setValue(null);
		form.ctnDetails().cmbStatus().setValue(null);
		form.ctnDetails().txtEvent().setValue("");
		form.getLocalContext().setActivityStatusToPathwayEvent(null);
		return;
	}
	if (form.treList().getSelectedNode() != null)
	{
		if (form.treList().getSelectedNode().getValue() != null)
		{

			Object treValue = form.treList().getSelectedNode().getValue();
			if (treValue instanceof ActivityStatusToPathwayEventVo)
			{

				ActivityStatusToPathwayEventVo parNodeValue = (ActivityStatusToPathwayEventVo) form.treList().getSelectedNode().getValue();
				form.ctnDetails().cmbActivity().setValue(parNodeValue.getActivity());
				form.ctnDetails().cmbStatus().setValue(null);
				form.ctnDetails().txtEvent().setValue("");
				form.getLocalContext().setActivityStatusToPathwayEvent(null);
			}

			TreeNode parentNode = form.treList().getSelectedNode();

			TreeNodeCollection childrenNodes = parentNode.getNodes();

			for (int iNode = 0; iNode < childrenNodes.size(); iNode++)
			{

				Object aNode = childrenNodes.get(iNode).getValue();

				if (aNode instanceof ActivityStatusToPathwayEventVo)
				{
					ActivityStatusToPathwayEventVo usedLink = (ActivityStatusToPathwayEventVo) childrenNodes.get(iNode).getValue();

					form.ctnDetails().cmbStatus().removeRow(usedLink.getAppointmentStatus());

				}
			}
		}
	}
}