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

The following are Jave code examples for showing how to use getParent() 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
protected void onBtnBuildClick() throws ims.framework.exceptions.PresentationLogicException
{
	TreeNode node = form.treTemplate().getSelectedNode();

	if (node == null || node.getParent() == null)
	{
		engine.showMessage("Please select at template !");
		return;
	}

	form.getGlobalContext().Core.setCurrentFormName(engine.getPreviousNonDialogFormName());

	form.getGlobalContext().Core.setReportID(((ReportVo) node.getParent().getValue()).getID_ReportBo());
	form.getGlobalContext().Core.setTemplateID(((ReportTemplateVo) node.getValue()).getID_TemplateBo());

	if (form.getGlobalContext().Core.getAutoOpenViewReportIsNotNull() && form.getGlobalContext().Core.getAutoOpenViewReport().equals(Boolean.TRUE))
		engine.open(form.getForms().Core.ViewReport);

	engine.close(DialogResult.OK);
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
public ValueObject getRootNod()
{
	TreeNode node = form.treCategoryGroupSite().getSelectedNode();
	
	if (node == null)
		return null;
	
	while (node.getParent() != null)
		node = node.getParent();
	
	return (ValueObject) node.getValue();
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
public TNMStagingClassificationVersionRefVo getSelectedBranchVersion()
{
	TreeNode node = form.treCategoryGroupSite().getSelectedNode();
	
	if (node == null)
		return null;
	
	while (node.getParent() != null)
	{
		if (node.getValue() instanceof TumourCategoryVersionGroupsLiteVo)
			return ((TumourCategoryVersionGroupsLiteVo)node.getValue()).getTNMVersion();
		
		node = node.getParent();
	}

	return null;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void displayConfigItem(ProblemListVoCollection voCollProblems)
{
	if (voCollProblems == null)
		return;

	TreeNode nodeToUse = form.treConfig().getSelectedNode();
	if (nodeToUse == null)
		return;

	while (nodeToUse.getParent() != null)
		nodeToUse = nodeToUse.getParent();

	nodeToUse.getNodes().clear();

	for (int i = 0; i < voCollProblems.size(); i++)
	{
		TreeNode nodeProblem = null;
		nodeProblem = nodeToUse.getNodes().add(voCollProblems.get(i), voCollProblems.get(i).getPresentingProblem().getPCName());
		nodeProblem.setExpandedImage(form.getImages().Core.BlueSquare);
		nodeProblem.setCollapsedImage(form.getImages().Core.BlueSquare);
		nodeProblem.setSelectedImage(form.getImages().Core.BlueSquare);
	}

	nodeToUse.setExpanded(true);
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void menuActivityUpdatePriceClick()
{
	TreeNode node = form.lyr1().Edit().lyrLocationDetail().tabPagePricing().trePricing().getSelectedNode();
	if (node == null)
		return;

	if (node.getParent() == null)
		return;

	form.getLocalContext().setSelectedLocationServiceActivity((LocationServiceActivityVo) node.getParent().getValue());
	form.getGlobalContext().Admin.setActivityContextPricingDetail((ActivityContextPricingDetailsVo) node.getValue());

	form.getGlobalContext().Admin.setLSAPricingAction(Integer.valueOf(PRICING_UPDATE));
	form.getGlobalContext().Admin.setActivityContextPricingDetailCollection(((LocationServiceActivityVo) node.getParent().getValue()).getActivityContextPricings());

	engine.open(form.getForms().Admin.ActivityContextPricingDetails);
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void removeMenuActionsDenied()
{		
	TreeNode selectedNode = form.lyrRights().tabActionsDenied().treActions().getSelectedNode();
	if(selectedNode != null)
	{
		if(selectedNode.getParent() == null)
		{
			form.lyrRights().tabActionsDenied().treActions().getNodes().remove(selectedNode);
		}
		else
		{
			selectedNode.getParent().getNodes().remove(selectedNode);
		}
	}
	
	updateContextMenuState(); //WDEV-15632
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
protected void onTreTypesTreeViewNodeDropped(TreeNode node, TreeNode oldParent) throws PresentationLogicException
{
	if (node.getValue() != null && node.getValue() instanceof LookupInstVo )
	{
		LookupInstVo vo = (LookupInstVo)node.getValue();
		if (node.getParent() == null)
		{
			vo.setParentInstance(null);
		}
		else
		{
			if (node.getParent().getValue() instanceof LookupTypeVo)
			{
				vo.setParentInstance(null);
			}
			else
			{
				vo.setParentInstance((LookupInstVo)node.getParent().getValue());
			}				
		}
	}
	
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 6 votes
private void unassignTemplate()
{
	TreeNode node = form.treBOList().getSelectedNode();
	
	if(node != null && node.getParent() != null)
		form.getLocalContext().setLastNode((String) node.getParent().getValue());
	
	ReportTemplateBoRefVo item = (ReportTemplateBoRefVo) form.treBOList().getValue();
	
	try
	{
		domain.removeLink(item);
		open();
	}
	catch (ForeignKeyViolationException e)
	{
		engine.showMessage("Error unassigning the template: " + e.toString());
		return;
	}
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean removeUntickedNodes(TreeNode node) 
{
	if (node.getNodes().size() > 0 )
	{
		for (int j = 0 ; j < node.getNodes().size() ; j++)
		{
			if(removeUntickedNodes(node.getNodes().get(j))) 
				j--;
		}
	}
	if (!node.isChecked())
	{
		if (node.getNodes().size() == 0)
		{
			if (node.getParent() != null) 
			{
				TreeNode parentNode = node.getParent();
				parentNode.getNodes().remove(node);
				
				return true;
			}
			else
			{
				form.lyr1().tabPageDetails().treContactTypes().getNodes().remove(node);
				return true;
			}
		}
	}
	
	return false;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
public ValueObject getParentNod()
	{
		TreeNode node = form.treCategoryGroupSite().getSelectedNode();
		
		if (node == null)
			return null;
		
		if (node.getParent() == null)
			return null;
		
		return (ValueObject) node.getParent().getValue();
//		
//		//Category
//		if (node.getParent() == null)
//		{
//			form.getLocalContext().setParentNode(null);
//		}
//		else
//		{
//			//Group
//			if (node.getParent().getParent() == null)
//			{
//				form.getLocalContext().setParentNode((ValueObject) node.getParent().getValue());
//			}
//			//Site
//			else
//			{
//				form.getLocalContext().setParentNode((ValueObject) node.getParent().getValue());
//			}
//		}
//		
//		return form.getLocalContext().getParentNode();
	}
 
Example 11
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void findRootNode()
{
	TreeNode treeNode = null;
	treeNode = form.treList().getSelectedNode(); 
	if (treeNode != null)
	{
		while ( treeNode.getValue() instanceof ContactTypesByDisciplineItemVo)
		{
			treeNode = treeNode.getParent();
		}
	}

	form.getLocalContext().setSelectedRecord(treeNode != null ? ((ContactTypesByDisciplineVo)treeNode.getValue()) : null);
}
 
Example 12
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
protected void onTreFavouritesTreeViewNodeDropped(TreeNode node, TreeNode previousParentNode) throws PresentationLogicException
{
	if(form.getMode().equals(FormMode.VIEW))
		form.setMode(FormMode.EDIT);
	
	TreeNode 
	parent = node.getParent();
	if(parent != null)
	{
		parent.setCollapsedImage(form.getImages().Core.CollapseAll);
		parent.setExpandedImage(form.getImages().Core.ExpandAll);
	}
	
}
 
Example 13
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private void editFolder()
{
	TreeNode folderNode = form.lyr1().tabFavourites().treFavourites().getSelectedNode();
	if (folderNode == null && folderNode.getParent() != null)
	{
		engine.showMessage("Please select a Folder");
		return;
	}

	form.lyr1().tabFavourites().treFavourites().beginEditSelectedNode();

	if (form.getMode().equals(FormMode.VIEW))
		form.setMode(FormMode.EDIT);
}
 
Example 14
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
@Override
protected void onTreFavouritesTreeViewNodeDropped(TreeNode node, TreeNode previousParentNode) throws PresentationLogicException
{
	if (form.getMode().equals(FormMode.VIEW))
		form.setMode(FormMode.EDIT);

	TreeNode parent = node.getParent();
	if (parent != null)
	{
		parent.setCollapsedImage(form.getImages().Core.CollapseAll);
		parent.setExpandedImage(form.getImages().Core.ExpandAll);
	}
}
 
Example 15
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private TreeNode getRootNode(TreeNode node)
{
	if (node == null)
		return null;

	TreeNode parent = node;
	while (parent.getParent() != null)
	{
		parent = parent.getParent();
	}
	return parent;
}
 
Example 16
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
protected TreeNode getNodeToAddTo()
{
	TreeNode toNode = form.treNav().getSelectedNode();
	if (toNode == null || toNode.getValue() == null)
		return null;
	if (toNode.getValue() instanceof AppNavRootGroupVo)
		return toNode;
	if (toNode.getValue() instanceof AppNavSecondGroupVo)
		return toNode;
	if (toNode.getValue() instanceof AppNavFormVo)
		return toNode.getParent();
	return null;
}
 
Example 17
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 5 votes
private boolean oneChildOnlyAllowed(TreeNode node)
{
	if (node.getNodes() != null && node.getNodes().size() > 0)
		if (node.getParent() != null)
			if (node.getParent().getParent() != null)
				return true;

	return false;
}
 
Example 18
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
private void displayRecord(PMHChecklistConfigVo config)
	{
		TreeNode nodeDiagnosis = null;
		TreeNode nodeProcedures = null;
//		if (form.getLocalContext().getUseSpecialties().booleanValue())
//		{
			TreeNode nodeToUse = form.treConfig().getSelectedNode();
			if (nodeToUse == null)
				return;
			
			if (nodeToUse.getParent() != null)
				if (nodeToUse.getParent().getParent() != null)
					nodeToUse = nodeToUse.getParent().getParent();
				else
					nodeToUse = nodeToUse.getParent();
				
			nodeToUse.getNodes().clear();
			
			nodeDiagnosis = nodeToUse.getNodes().add(config.getDiagnosisList(), "Diagnoses");
			nodeDiagnosis.setExpandedImage(form.getImages().Core.BlueSquare);
			nodeDiagnosis.setCollapsedImage(form.getImages().Core.BlueSquare);
			nodeDiagnosis.setSelectedImage(form.getImages().Core.BlueSquare);
			
			nodeProcedures = nodeToUse.getNodes().add(config.getProcedureList(), "Procedures");
			nodeProcedures.setExpandedImage(form.getImages().Core.GreenSquare);
			nodeProcedures.setCollapsedImage(form.getImages().Core.GreenSquare);
			nodeProcedures.setSelectedImage(form.getImages().Core.GreenSquare);
/*		}
		else
		{
	  		form.treConfig().clear();

			nodeDiagnosis = form.treConfig().getNodes().add("D", "Diagnosis");
			nodeDiagnosis.setExpandedImage(form.getImages().Core.BlueSquare);
			nodeDiagnosis.setCollapsedImage(form.getImages().Core.BlueSquare);
			nodeDiagnosis.setSelectedImage(form.getImages().Core.BlueSquare);
			
			nodeProcedures = form.treConfig().getNodes().add("P", "Procedures");
			nodeProcedures.setExpandedImage(form.getImages().Core.GreenSquare);
			nodeProcedures.setCollapsedImage(form.getImages().Core.GreenSquare);
			nodeProcedures.setSelectedImage(form.getImages().Core.GreenSquare);
		}
*/
		if (config.getDiagnosisList() != null)
		{
			DiagnosisListVoCollection diagColl = config.getDiagnosisList().sort();
			for(int i = 0; i < diagColl.size(); i++)
				nodeDiagnosis.getNodes().add(diagColl.get(i).getDiagnosis(), diagColl.get(i).getDiagnosis().getDiagnosisName());
		}

		if (config.getProcedureList() != null)
		{
			ProcedureListVoCollection procColl = config.getProcedureList().sort();
			for(int i = 0; i < procColl.size(); i++)
				nodeProcedures.getNodes().add(procColl.get(i).getProcedure(), procColl.get(i).getProcedure().getProcedureName());
		}
		nodeDiagnosis.setExpanded(true);
		nodeProcedures.setExpanded(true);
	}
 
Example 19
Project: AvoinApotti   File: Logic.java   Source Code and License Vote up 4 votes
protected void onBtnUpdateClick() throws PresentationLogicException
{
	form.setMode(FormMode.EDIT);
	displaySubmenus();
	hideNewUpdate();
	showSpecialtyControls(false);
	
	TreeNode selectedNode = form.treConfig().getSelectedNode();
	TreeNode nodeParentOfSelectedNode = selectedNode;
	
	if (selectedNode != null && selectedNode.getParent() != null) //If not the top level node chosen
	{
		nodeParentOfSelectedNode = selectedNode.getParent(); // See if the 
		if (nodeParentOfSelectedNode.getParent() != null)
			nodeParentOfSelectedNode = nodeParentOfSelectedNode.getParent();
	}
	
	for (int i = 0 ; i < form.treConfig().getNodes().size() ; i++)
	{
		if ( (!form.treConfig().getNodes().get(i).equals(selectedNode) )
				&& ( !form.treConfig().getNodes().get(i).equals(nodeParentOfSelectedNode)) )
		{
			TreeNode nodeSpecialtyOrTopNode = form.treConfig().getNodes().get(i); 
			nodeSpecialtyOrTopNode.setEnabled(false);
			
			if (nodeSpecialtyOrTopNode.getNodes().size() > 0)
			{
				for (int j = 0 ; j < nodeSpecialtyOrTopNode.getNodes().size() ; j++)
				{
					TreeNode nodeDiagProcOrConfigItem  =  nodeSpecialtyOrTopNode.getNodes().get(j);
					nodeDiagProcOrConfigItem.setEnabled(false);
					
					if (nodeDiagProcOrConfigItem.getNodes().size() > 0)
					{
						for (int k = 0 ; k < nodeDiagProcOrConfigItem.getNodes().size() ; k++)
							nodeDiagProcOrConfigItem.getNodes().get(k).setEnabled(false);
					}
				}
			}
		}
	}
}