Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java code using prize Tags

 
sanjib kumar mandal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
Please help me for java coding using Prize Tags. Below i have written the java code that i have used in jsp page.

In this below code the the tree is already build in the ontology object and we are retrieving the tree. Let the tree be in the form like the rootnode is "thing" and child nodes are A,B,C,D. Suppose we want to create achild A1 with in node A and then we want to create a child A2 within the node A1. When we have created child A1 we are getting the parent A using session where the A stored for first case similarly we are obtaining A1, A and thing nodes(these are parent nodes) by using ITreeNode and ITree interface methods. But i want to highligt the parent under which i want to create the child for that i have used
select() method ,suppose i want to create a child with in A ie A1 for this i want to highlight the node A and for this i have used the method select(A) but the node A is not being highlighted insted the root node which is "thing" is being higligted.


if(session.getAttribute("tree.modelWb") == null && session.getAttribute("ontologyWb")!=null)
{
OWLOntology ontology = (OWLOntology)session.getAttribute("ontologyWb");
ITree tree = TreeBuilder.getTree(ontology);
//tree.unSelectAll();
System.out.println("The parent is "+(String)session.getAttribute("selectedParent"));
ITreeNode nodeName= tree.findNode((String)session.getAttribute("selectedParent"));
String assgnParent=(String)session.getAttribute("selectedParent");

String parentName="";
if(nodeName !=null){
parentName=nodeName.getName();
tree.expand(parentName);
ITreeNode parentNode;
ITreeNode parentNodeName=nodeName;
while(!parentName.equals("Thing"))
{
parentNode=parentNodeName.getParent();
String parenNam=parentNode.getName();
tree.expand(parenNam);
parentNodeName=parentNode;
parentName=parenNam;
}
tree.expand("Thing");
tree.unSelectAll();
}
//tree.unSelectAll();
//tree.select(parentName);
if(session.getAttribute("selectedParent") !=null)
{
tree.setSingleSelectionMode(true);
tree.select((String)session.getAttribute("selectedParent"));
System.out.println("++++++ the selected node is :+++++++" +(String)session.getAttribute("selectedParent"));
}

session.setAttribute("tree.modelWb", tree);
}




With Regards
sanjeev
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic