Two Laptop Bag*
The moose likes JSP and the fly likes java code using prize Tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "java code using prize Tags" Watch "java code using prize Tags" New topic
Author

java code using prize Tags

sanjib kumar mandal
Greenhorn

Joined: Jul 20, 2005
Posts: 8
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java code using prize Tags
 
Similar Threads
Showing PLUS sign(tree expansion) even if child is not present
help needed with sax parser
Modification of Jtree at Runtime ...Forurth Posting on this Prb..Help me
How to recursively traverse JTree?
maintaining the current state in weblogic portal