Display Tree Nodes from LDIF
I have to read the contents form an ldif file and display it with in a tree, in that the first dn, should be displayed as root dn, and next as child nodes with all the properties of dn.
I displayed all the dn's but am not understanding how to take root dn and child nodes. please help me if any one know.
Thanks,
Raga
Hi,
When you delete a node and all of its children, what do you want to do with the grandchildren? If you want to set their parent_id to NULL, do that in a separate UPDATE statement first, then DELETE the original node and all its remaining descendants, as show below.
If, when you say "children", you mean "descendants" (including
children,
children of children,
children of children of children,
and so on, to any level,
) then do a CONNECT BY query to find their primary keys, and DELETE everything in that list, like this:
DELETE subforms
WHERE id IN
SELECT id
FROM subforms
START WITH id = :specified_id
CONNECT BY PRIOR id = parent_id
);
Similar Messages
-
Display tree node data in bold characters
Hi,
I have a requirement where I need to display tree nodes data in bold characters. If I click on a particular tree node, next time it should appear in normal font only which means that some task had done using that tree node. Is my question clear??
Plz help me....
thanks,
ravindra.Hi Ravindra,
I think it is possible, i have not done it but let me explain how we can do it.
In <htmlb:treeNode> tag there is an attribute 'text' in
which we specify title of that treeNode.
Now you define a page attribute 'treeNodeTitle' type
edpline and in onCreate assign it value <html><b>MyTreeNode</b></html>
When you click on this node then you do event handling
in onInputProcessing, there assign only 'MyTreeNode' to
treeNodeTitle.
sample code may look like this...
<htmlb:treeNode
id = 'treeNode1'
text = '<%=treeNodeTitle %>' >
</htmlb:treeNode>
Page Attribute
treeNodeTitle type edpline
in onCreate
treeNodeTitle = '<html><b>MyTreeNode</b></html>'
in onInputProcessing
in event-handling code for that treeNode write
treeNodeTitle = 'MyTreeNode'
I hope this will work.
Regards,
Narinder Hartala -
How to hide a tree node from the GUI but still keep it in the tree model?
Hi, All
I used a JTree in my project in which I have a DefaultTreeModel to store all the tree structure and a JTree show it on the screen. But for some reason, I want to hide some of the nodes from the user, but I don't want to remove them from the tree model because later on I still need to use them.
I searched on the web, some people suggested method to hide the root node, but that's not appliable to my project because I want to hide some non-root nodes; Some people also suggested to collapse the parent node when there are child to hide, it is not appliable to me either, because there still some other childnodes (sibling of the node to hide) I want to show.
How can I hide some of the tree node from the user? Thanks for any information.
LindaHere's an example using a derivation of DefaultTreeModel that shows (or does not show) two types of Sneech (appologies to the good Dr Zeus) by overiding two methods on the model.
Now, there are many things wrong with this example (using instanceof, for example), but it's pretty tight and shows one way of doing what you want.
Note: to make it useful, you''d have to change the implementation of setShowStarBelliedSneeches() to do something more sophisticated than simply firing a structure change event on the root node. You'd want to find all the star bellied sneech nodes and call fireTreeNodesRemoved(). That way the tree would stay expanded rather than collapse as it does now.
import javax.swing.JTree;
import javax.swing.JScrollPane;
import javax.swing.JOptionPane;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.tree.TreePath;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
class FilteredTree
private class PlainBelliedSneech {
public String toString() { return "Plain Bellied Sneech"; }
private class StarBelliedSneech {
public String toString() { return "Star Bellied Sneech"; }
private class FilteredTreeModel
extends DefaultTreeModel
private boolean mShowStarBelliedSneeches= true;
private DefaultMutableTreeNode mRoot;
FilteredTreeModel(DefaultMutableTreeNode root)
super(root);
mRoot= root;
public Object getChild(Object parent, int index)
DefaultMutableTreeNode node=
(DefaultMutableTreeNode) parent;
if (mShowStarBelliedSneeches)
return node.getChildAt(index);
int pos= 0;
for (int i= 0, cnt= 0; i< node.getChildCount(); i++) {
if (((DefaultMutableTreeNode) node.getChildAt(i)).getUserObject()
instanceof PlainBelliedSneech)
if (cnt++ == index) {
pos= i;
break;
return node.getChildAt(pos);
public int getChildCount(Object parent)
DefaultMutableTreeNode node=
(DefaultMutableTreeNode) parent;
if (mShowStarBelliedSneeches)
return node.getChildCount();
int childCount= 0;
Enumeration children= node.children();
while (children.hasMoreElements()) {
if (((DefaultMutableTreeNode) children.nextElement()).getUserObject()
instanceof PlainBelliedSneech)
childCount++;
return childCount;
public boolean getShowStarBelliedSneeches() {
return mShowStarBelliedSneeches;
public void setShowStarBelliedSneeches(boolean showStarBelliedSneeches)
if (showStarBelliedSneeches != mShowStarBelliedSneeches) {
mShowStarBelliedSneeches= showStarBelliedSneeches;
Object[] path= { mRoot };
int[] childIndices= new int[root.getChildCount()];
Object[] children= new Object[root.getChildCount()];
for (int i= 0; i< root.getChildCount(); i++) {
childIndices= i;
children[i]= root.getChildAt(i);
fireTreeStructureChanged(this, path, childIndices, children);
private FilteredTree()
final DefaultMutableTreeNode root= new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode parent;
DefaultMutableTreeNode child;
for (int i= 0; i< 2; i++) {
parent= new DefaultMutableTreeNode(new PlainBelliedSneech());
root.add(parent);
for (int j= 0; j< 2; j++) {
child= new DefaultMutableTreeNode(new StarBelliedSneech());
parent.add(child);
for (int k= 0; k< 2; k++)
child.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
for (int j= 0; j< 2; j++)
parent.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
parent= new DefaultMutableTreeNode(new StarBelliedSneech());
root.add(parent);
for (int j= 0; j< 2; j++) {
child= new DefaultMutableTreeNode(new PlainBelliedSneech());
parent.add(child);
for (int k= 0; k< 2; k++)
child.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
for (int j= 0; j< 2; j++)
parent.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
final FilteredTreeModel model= new FilteredTreeModel(root);
JTree tree= new JTree(model);
tree.setShowsRootHandles(true);
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.setRootVisible(false);
JScrollPane sp= new JScrollPane(tree);
sp.setPreferredSize(new Dimension(200,400));
final JCheckBox check= new JCheckBox("Show Star Bellied Sneeches");
check.setSelected(model.getShowStarBelliedSneeches());
check.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
model.setShowStarBelliedSneeches(check.isSelected());
JPanel panel= new JPanel(new BorderLayout());
panel.add(check, BorderLayout.NORTH);
panel.add(sp, BorderLayout.CENTER);
JOptionPane.showOptionDialog(
null, panel, "Sneeches on Beeches",
JOptionPane.DEFAULT_OPTION,
JOptionPane.PLAIN_MESSAGE,
null, new String[0], null
System.exit(0);
public static void main(String[] argv) {
new FilteredTree(); -
WD ABAP: selecting a tree node from program and scroll to it
Hi guys!
I am using a tree in Web Dynpro ABAP. I would like to select/highlight one node from the coding, without user interaction. Is it possible? I couldn't find any (obvious) way so far...
If it is possible, then let us go a little bit further. Suppose, that the tree grew so big, that cannot fit in the container. Suppose, that you can scroll the tree up/down to see all the nodes. Now, if you mark one tree node from the coding, is it possible somehow, that you scroll the tree automatically, so that the selected node is visible?
I am interested in any solutions within WD ABAP.
If you can only answer one of the questions, that is also appreciated!
Thanks for the help in advance.
Best regards,
Janos Kis
Aerospace&Defense(ERP)Hi Thomas,
thanks for the advice, it works, I have already tried it. The tree node in the lead selection appears highlighted.
The scrolling doesn't work, though. I have tried to put the tree in a scroll container, and I have also tried it without (relying on the browser to scroll). Neither of them worked, it doesn't scroll to the selected node, it remains offscreen. Can you think of a way, to bring it automatically within the visible range? Ideas, anyone?
Actually we would like to implement a search function in the tree, and show the result within the tree (highlight the node, expand, if necessary, and bring it on the screen, if off-screen)
A negative answer is good enough for me, so that I know, that I can stop looking for a solution. Thanks in advance.
Janos -
Error in Getting Selected Tree node From POPUPMENU
Environment: Forms 9i, 9i AS
The Folowing code is written with in POPUP MENU to get the selected tree node. It always returns 0. The samE code works fine with in any other TRIGGER. Is it Forms BUG?
v_sel_tree := ftree.GET_TREE_SELECTION(v_item,1);Whether or not it is a bug you need a workaround.
How about getting the when-tree-node-selected to set a package variable and look at its value in the pop-up menu code. -
Access tree nodes from context
Hi all,
I have context with a parent node having a recursive node. if we populate data in this node i will get a tree structure. Now my question is how can I traverse to recursive node and display all informations to an excel. I know how to export the tree contents to excel. but my doubt is how to export the recursive node contents of the context to export to excel. can anybody help
Thank you,
Philip ThayilHi Philip,
Check this threads,
Looking for example to export data from a DynPro table to Excel file
getLeadSelection when using a recursive MasterColumn
Regards,
Mithu -
Display Tree node label/title on page
I'm using Apex version 4.
I have a tree and I want to display (below the tree) the label or title of the node value that's selected.
So my tree query is like:
SELECT (case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end) status,
level,
office_name title,
null icon
How can I display the office_name on my report page below the tree? Can I somehow capture the value selected in a page item and then display that page item below the tree?
Thanks.Hi Ravindra,
I think it is possible, i have not done it but let me explain how we can do it.
In <htmlb:treeNode> tag there is an attribute 'text' in
which we specify title of that treeNode.
Now you define a page attribute 'treeNodeTitle' type
edpline and in onCreate assign it value <html><b>MyTreeNode</b></html>
When you click on this node then you do event handling
in onInputProcessing, there assign only 'MyTreeNode' to
treeNodeTitle.
sample code may look like this...
<htmlb:treeNode
id = 'treeNode1'
text = '<%=treeNodeTitle %>' >
</htmlb:treeNode>
Page Attribute
treeNodeTitle type edpline
in onCreate
treeNodeTitle = '<html><b>MyTreeNode</b></html>'
in onInputProcessing
in event-handling code for that treeNode write
treeNodeTitle = 'MyTreeNode'
I hope this will work.
Regards,
Narinder Hartala -
I have created a tree table
create table subforums (
id NUMBER(5) primary key,
parent_id references subforums,
name varchar2(100)
And now i dont know how to delete a tree with a specified id and all of his children.
I tried to find out but i couldntHi,
When you delete a node and all of its children, what do you want to do with the grandchildren? If you want to set their parent_id to NULL, do that in a separate UPDATE statement first, then DELETE the original node and all its remaining descendants, as show below.
If, when you say "children", you mean "descendants" (including
children,
children of children,
children of children of children,
and so on, to any level,
) then do a CONNECT BY query to find their primary keys, and DELETE everything in that list, like this:
DELETE subforms
WHERE id IN
SELECT id
FROM subforms
START WITH id = :specified_id
CONNECT BY PRIOR id = parent_id
); -
How to cut, copy and paste a tree node in JTree?????
Hi, Java GUI guru. Thank you for your help in advance.
I am working on a File Explorer project with JTree. There are cut, copy and paste item menus in my menu bar. I need three EventAction methods or classes to implements the three tasks. I tried to use Clipboard to copy and paste tree node. But I can not copy any tree node from my tree.
Are there any body has sample source code about cut, copy, and paste for tree? If possible, would you mind send me your sample source code to [email protected]
I would appreciate you very very much for your help!!!!
X.G.Hi, Paul Clapham:
Thank you for your quick answer.
I store the node in a DefaultMutableTreeNode variable, and assign it to another DefaultMutableTreeNode variable. I set up two classes (CopyNode and PasteNode). Here they are as follows:
//CopyNode class
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class CopyNode implements ActionListener{
private TreeList jtree;
String treeNodeName;
TreePath currentSelection;
DefaultMutableTreeNode currentNode;
public CopyNode(TreeList t){
jtree = t;
public void actionPerformed(ActionEvent e){
currentSelection = jtree.tree.getSelectionPath();
if(currentSelection != null){
currentNode = (DefaultMutableTreeNode)(currentSelection.getLastPathComponent());
treeNodeName = currentNode.toString();
//PasteNode class
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class PasteNode extends DefaultMutableTreeNode{
private TreeList jtree;
CopyNode copyNode;
public PasteNode(TreeList t){
jtree = t;
copyNode = new CopyNode(t);
public DefaultMutableTreeNode addObject(Object child){
DefaultMutableTreeNode parentNode = null;
TreePath parentPath = jtree.tree.getSelectionPath();
if(parentPath == null){
parentNode = jtree.root;
else{
parentNode = (DefaultMutableTreeNode)parentPath.getLastPathComponent();
return addObject(parentNode, child, true);
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child, boolean shouldBeVisible){
DefaultMutableTreeNode childNode = copyNode.currentNode;
if(parent == null){
parent = jtree.root;
jtree.treemodel.insertNodeInto(childNode, parent, parent.getChildCount());
if(shouldBeVisible){
jtree.tree.scrollPathToVisible(new TreePath(childNode.getPath()));
return childNode;
I used these two classes objects in "actionPerformed(ActionEvent e)" methods in my tree:
//invoke copyNode
copyItem = new JMenuItem("Copy");
copyItem.addActionListener(copyNode);
//invoke pasteNode
pasteItem = new JMenuItem("Paste");
pasteItem.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
pasteName.addObject(copyName.treeNodeName);
When I run the drive code, making a copy some node from my tree list, I got bunch of error messages.
Can you figour out what is wrong in my two classes? If you have sample code, would you mind mail me for reference.
Thank you very much in advance.
X.G. -
Expand tree node by clicking onto the node label
I have followed this example to expand the nodes with a clic on the tree :
[http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf]
My code:
JSPX:
<af:resource type="javascript" source="js/glasspane.js"/>
<af:tree value="#{bindings.OpcionesPadreView1.treeModel}" var="node"
rowSelection="single" id="t1" partialTriggers=":::cbNuevCpta"
binding="#{pageFlowScope.GestionDocumentos.t1}"
selectionListener="#{bindings.OpcionesPadreView1.treeModel.makeCurrent}">
<f:facet name="nodeStamp">
<af:commandImageLink text="#{node.Gesdopcach}" id="ot1"
action="#{bindings.LoadDir.execute}"
actionListener="#{bindings.LoadFile.execute}"
icon="/images/GestionDocumentos/folder20x20.png"
partialSubmit="true">
</af:commandImageLink>
</f:facet>
<af:clientListener method="expandTree" type="selection"/>
</af:tree>
Js:
function expandTree(evt) {
alert('In');
var tree = event.getSource();
rwKeySet = event.getAddedSet();
var firstRowKey;
for (rowKey in rwKeySet) {
firstRowKey = rowKey;
if (tree.isPathExpanded(firstRowKey)) {
tree.setDisclosedRowKey(firstRowKey, false);
}else {
tree.setDisclosedRowKey(firstRowKey, true);
When i clic on the labels the tree doesn't expand, the alert also is not shown. The problem could be the <af:resource>, but i have this tag in all my pages and all javascripts work. I also changed the commandLink with an outputText, but doesn't work.
Edited by: Miguel Angel on 21/06/2012 12:53 PMAt least the call the javascript works, but this line doesn't work, anybody know why?:
rwKeySet = evt.getAddedSet(); -
Hi Experts,
Working jdev 11.1.1.3.0.
we are using tree component on the page which as 6 childs. so if i click on add button once it will add child to that node and once i click on save done will come back to tree page. so everything is working fine. but the problem is once the node is added child node is not expanding. to resolve this issue i am using tree object in session, but while using this process its taking lot of performance.
manually i can able to expand the tree but if once i add node to the parent tree and coming back to the page node is not expanding i have to manually expand it.
so can any one suggest me what could be the best approch to expand the tree.
Thanks,Hi,
Hope followings useful
http://andrejusb.blogspot.com/2010/02/how-to-traverse-adf-tree.html
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/21-expand-tree-on-initial-render-169158.pdf -
Navigation from tree node to page
Hi
plz suggest me from where should i start. I have similar use case as given in this link
http://jdevadf.oracle.com/adf-richclient-demo/faces/index.jspx
left side i have tree and right side pages .Whenever i click on tree node corresponding page should display.
How can i achieve this ?
Thanks
niteshYou know that the sample you are referring to comes with the source code. You just have to click on the page source link to get to the source.
One way to archive this is to use a link element to render the node. The link can directly navigate to the right target or show the right region.
If you need something not sophisticated you can use a selection listener (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/november2011-otn-harvest-1389769.pdf) and to everything from a bean method.
As you did not give any information about your Jdev version and how the tree is connected to the navigation it's hard to give more advice.
Timo -
Displaying data in tableview on click of a tree node
Hi,
I am new to BSP. I created a tree structure having the tablenames as tree nodes, and now if I click on a node I want to display corresponding table data in a tableview. How can I acheive this....??
Thanks in advance,
Ravindra.Hi Ravindra,
You can achieve this by reading the node clicked OnInput Processing and You can assign name of your table in "onNodeClick" attribute .
then onInputprocessing you can read the name of your table from
"event->server_event" .
Check this sample code .
****************OnLayout*******************************
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:tree id = "myTree1"
title = "Tree"
tooltip = "Tooltip for myTree1">
<htmlb:treeNode id="NODE1" text="TABLE1" isOpen="true" onNodeClick="TABLE1">
</htmlb:treeNode>
<htmlb:treeNode id="NODE2" text="TABLE2" isOpen="true" onNodeClick="TABLE2">
</htmlb:treeNode>
<htmlb:treeNode id="NODE3" text="TABLE3" onNodeClick="TABLE3"/>
<htmlb:treeNode id="NODE4" text="TABLE4"onNodeClick="TABLE4" />
<htmlb:treeNode id="NODE5" text="TABLE5" isOpen="false" onNodeClick="TABLE5">
</htmlb:treeNode>
<htmlb:treeNode id="NODE6" text="TABLE6" onNodeClick="TABLE6"/>
</htmlb:tree>
</htmlb:form>
</htmlb:page>
</htmlb:content>
*****************OnInputProcessing****************
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
Data: TABLE_NAME type STRING.
Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
Scenario 1: Read event from manager.
DATA: event TYPE REF TO CL_HTMLB_EVENT.
event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
IF event IS NOT INITIAL AND event->name = 'tree'.
DATA: tree_event TYPE REF TO CL_HTMLB_EVENT_TREE.
tree_event ?= event.
TABLE_NAME = event->server_event.
ENDIF.
ENDIF.
Check examples given in "SBSPEXT_HTMLB" bsp application.
I hope this will help.
Regards,
Monica -
Create a Tree Node Structure from XML
Hi
We have a requirement where we have an XML file we want to create the Tree Node structure from the XML can anyone help out on this
We are referring to the following blog but in that it is coming from KM content and we require the tree structure to form from a XML file
http://wiki.sdn.sap.com/wiki/display/Snippets/SmartNavigationTreeforKM+Folders
Can anyone help me
Regards
JMHi,
Could you elaborate a litle more exacly what you need to do?
I found the link http://help.sap.com/saphelp_470/helpdata/en/86/8280db12d511d5991b00508b6b8b11/content.htm that maybe assist you.
Please remember to evaluate the replays, this incentive the SDN to keep growing,
regards,
Fabio -
Tree node selection lost after returning from called page
Hi
in a default unbound task flow i have a Page1 calling Page2.
Page1 displays a master-detail data using treetable component, while Page2 displays detail data (selected from Page1) as a read-only form.
When coming back from Page2, Page1 tree node selection is lost and tree table is rendered as if was called for a first time (detail data are disclosed).
How can I restore an original selection?
(Jdev 11.1.2.2)
Many thanx1. before goind to the Page 2, remember somewhere the selected row keys, as follows:
RowKeySet rks = yourTreeTable.getSelectedRowKeys();2. after returning to the page 1, do as follows:
Iterator rksIterator = rks.iterator();
if (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeTableBinding = null;
treeTableBinding =
(JUCtrlHierBinding)((CollectionModel)table.getValue()).getWrappedData();
JUCtrlHierNodeBinding node =
treeTableBinding.findNodeByKeyPath(key);
RowKeySet newRks = new RowKeySetImpl();
if (node != null)
newRks.add(node.getKeyPath());
callSelectionListener(yourTreeTable, newRks);
// refresh your tree table - ommited here
// where is:
protected void callSelectionListener(RichTreeTable table, RowKeySet discRows) {
SelectionEvent selEv =
new SelectionEvent(table, new RowKeySetImpl(), discRows);
JSFUtils.resloveMethodExpression("bindings.YourVO.treeModel.makeCurrent", // <-- of course, adjust this value to the your selectionListener expression
null,
new Class[] { SelectionEvent.class },
new Object[] { selEv });
} // of makeCurrent()
public Object resloveMethodExpression(String expression, Class returnType, Class[] argTypes, Object[] argValues) {
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
MethodExpression methodExpression = elFactory.createMethodExpression(elContext, expression, returnType, argTypes);
return methodExpression.invoke(elContext, argValues);
}
Maybe you are looking for
-
Is there a Front Row music preference to turn off the song time bar?
In fact, are there ANY preferences for the display of the music info at all?
-
We are getting a 500 error on the web gates when logging in. They have been working before, but are now reporting the error below. 2010/01/27@07:09:25.632239 18521 33 WEB ERROR 0x0000151F /export/build40/Oblix/coreid1014/palantir/commonlib/src/apache
-
What is the permission to restrict end user to use Report builder
Hi experts, What is the permission to restrict send user to user report builder in SSRS? Thanks
-
Hi All When I insert records into my table it should update Queue also. What is the best way to implement this? Thanks in Advance Raghu.
-
Problems with getting email to work in iFS.
Hi, I have stumbled into some problems with the sendmail functionality in iFS. I have a working installation of iFS and now I would like my users to be able to receive mail and have these appear in the inbox folder. I think that I have followed the i