Node in a tree
Hi,
How do i get nodeDef of a tree in hgird region programatically ?
Thanks,
Anupama
Hi,
I saw your note in the OTN about problems working eith trees.
I wondered if you know maybe how to focus on tree node(not hgrid),
Thanks in advance,
Aviv
Similar Messages
-
How to not display nodes in a tree if Oracle roles are NOT used?
How to not display nodes in a tree if Oracle roles are NOT used?
We don't use Oracle DB roles to grant users access to Forms from the menu. We use a template and role system of our own. Basically a few tables with templates and roles.
We want to convert our normal Forms menu to a tree menu and one of our key requirements is that when the tree is populated ONLY nodes with programs (i.e. forms) he has been granted to execute is shown.
Since we don't use Oracle Roles how to do this in a tree?
I created a function to show/hide LEAF nodes, BUT problem is that there are sub-menu nodes showing even if the leaf-nodes under it has not being displayed. My function has suppressed it.
My tree query is like this:
SELECT
t.status, LEVEL, t.label, t.icon, t.node VALUE
FROM
tma_tree_menu t
WHERE
tma_authenticate_sys_chk_role(USER, t.node) = 1
CONNECT BY
PRIOR t.node = t.master
START WITH
t.MASTER IS NULL
ORDER SIBLINGS BY
t.position
The tma_authenticate_sys_chk_role will return 1 only if the user has access to the form under that node.
I tried the FTree functions in Forms but even that has nothing.
Any help would be greatly appreciated.
Edited by: Channa on Mar 17, 2010 6:49 AMWould you share the source code? I guess what I need is how exactly you retreive the user credentials from the DB table and set that boolean variable.
and then how to condition it in UIX? -
Runtime error while i add a node in ALV Tree in oops
i am adding a node to alv tree using oop am passing a work area and when i execute it is going for a dump and it says UC_OBJECTS_NOT_CONVERTIBLE
and the below where it is bold and italic it is where the dump is occuring
METHOD ADD_NODE.
FIELD-SYMBOLS: <TAB1> TYPE standard TABLE,
<wa> type any.
assign mt_outtab->* to <tab1>.
insert line in outtab
DATA: L_INDEX TYPE SY-TABIX.
if is_outtab_line is initial.
create initial line
data l_dref_wa type ref to data.
create data l_dref_wa like line of <tab1>.
assign l_dref_wa->* to <wa>.
l_index = 0.
append <wa> to <Tab1>.
else.
APPEND IS_OUTTAB_LINE TO <TAB1>. endif.
L_INDEX = SY-TABIX.
add node to model
CALL METHOD ME->ADD_MODEL_NODE
EXPORTING
I_RELAT_NODE_KEY = I_RELAT_NODE_KEY
I_RELATIONSHIP = I_RELATIONSHIP
IS_NODE_LAYOUT = IS_NODE_LAYOUT
IT_ITEM_LAYOUT = IT_ITEM_LAYOUT
I_NODE_TEXT = I_NODE_TEXT
I_INDEX_OUTTAB = L_INDEX
IMPORTING
E_NEW_NODE_KEY = E_NEW_NODE_KEY.
ENDMETHOD.HI Mohsin,
please refer to the below ....
might be helpful for u .....
https://scn.sap.com/thread/2050188
http://scn.sap.com/message/6407195
http://r0005001.benxbrain.com/de%28bD1lbiZjPTAwMQ==%29/index.do?onInputProcessing=brai_thread&001_thread_id=1759814%20&001_temp=R3TR|PROG|RCSBI010||P01|
Hope thiw will help ....
Regards,
AKS -
Fetch the index of the node in a tree
hi,
i am using a recursive tree structure,
i need to get the index value of a selected node in a tree structure,
can any one help me?
thanks in advance,
Regards,
MeyyappanHello Ganesh,
in that case, just call
lr_node_tmp = context_element->get_node().
lr_parent_element = lr_node_tmp->get_parent_element().
lr_parent_node = lr_parent_element->get_node().
Best regards,
Thomas -
How can I get the previous clicked node in a Tree?
I have a JTree. If a node is selected, before the user select another, I need to make a question if he have sure about the new selection.
If the user answers not, I need to select the previous node.
I have in my class a variable, type of DefaultMutableTreeNode, that makes reference to the last node selected.
How can I turn this node selected again, if the user select "No"?
Thanks for any help.
Renato de MeloYou don't want to maintain a reference to the last selected node, but to the last selected path. Nodes within a tree are addressed using a TreePath, with contains references to each node from the root, down to a specific node. Look at the JavaDocs of javax.swing.tree.TreePath for more info.
Also, JTree has getter/setter methods for the selectionPath. -
Can't remove a node from a tree
I am using the custom tree dataDescriptor provided in Flex live
doc. It works for creating the tree and add notes, however when I
try to remove a node from the tree it cant work. Does anyone have
any idea?
This is the code for MyCustomeTreeDataDescriptor.as
package
import mx.collections.ArrayCollection;
import mx.collections.CursorBookmark;
import mx.collections.ICollectionView;
import mx.collections.IViewCursor;
import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
import mx.controls.treeClasses.*;
public class MyCustomTreeDataDescriptor implements
ITreeDataDescriptor
// The getChildren method requires the node to be an Object
// with a children field.
// If the field contains an ArrayCollection, it returns the
field
// Otherwise, it wraps the field in an ArrayCollection.
public function getChildren(node:Object,
model:Object=null):ICollectionView
try
if (node is Object) {
if(node.children is ArrayCollection){
return node.children;
}else{
return new ArrayCollection(node.children);
catch (e:Error) {
trace("[Descriptor] exception checking for getChildren");
return null;
// The isBranch method simply returns true if the node is an
// Object with a children field.
// It does not support empty branches, but does support null
children
// fields.
public function isBranch(node:Object,
model:Object=null):Boolean {
try {
if (node is Object) {
if (node.children != null) {
return true;
catch (e:Error) {
trace("[Descriptor] exception checking for isBranch");
return false;
// The hasChildren method Returns true if the node actually
has children.
public function hasChildren(node:Object,
model:Object=null):Boolean {
if (node == null)
return false;
var children:ICollectionView = getChildren(node, model);
try {
if (children.length > 0)
return true;
catch (e:Error) {
return false;
// The getData method simply returns the node as an Object.
public function getData(node:Object,
model:Object=null):Object {
try {
return node;
catch (e:Error) {
return null;
// The addChildAt method does the following:
// If the parent parameter is null or undefined, inserts
// the child parameter as the first child of the model
parameter.
// If the parent parameter is an Object and has a children
field,
// adds the child parameter to it at the index parameter
location.
// It does not add a child to a terminal node if it does not
have
// a children field.
public function addChildAt(parent:Object, child:Object,
index:int,
model:Object=null):Boolean {
var event:CollectionEvent = new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
event.kind = CollectionEventKind.ADD;
event.items = [child];
event.location = index;
if (!parent) {
var iterator:IViewCursor = model.createCursor();
iterator.seek(CursorBookmark.FIRST, index);
iterator.insert(child);
else if (parent is Object) {
if (parent.children != null) {
if(parent.children is ArrayCollection) {
parent.children.addItemAt(child, index);
if (model){
model.dispatchEvent(event);
model.itemUpdated(parent);
return true;
else {
parent.children.splice(index, 0, child);
if (model)
model.dispatchEvent(event);
return true;
return false;
// The removeChildAt method does the following:
// If the parent parameter is null or undefined, removes
// the child at the specified index in the model.
// If the parent parameter is an Object and has a children
field,
// removes the child at the index parameter location in the
parent.
public function removeChildAt(parent:Object, child:Object,
index:int, model:Object=null):Boolean
var event:CollectionEvent = new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
event.kind = CollectionEventKind.REMOVE;
event.items = [child];
event.location = index;
//handle top level where there is no parent
if (!parent)
var iterator:IViewCursor = model.createCursor();
iterator.seek(CursorBookmark.FIRST, index);
iterator.remove();
if (model)
model.dispatchEvent(event);
return true;
else if (parent is Object)
if (parent.children != undefined)
parent.children.splice(index, 1);
if (model)
model.dispatchEvent(event);
return true;
return false;
This is my tree definition:
<mx:Tree width="143" top="0" bottom="0" left="0"
height="100%"
id="publicCaseTree"
dataDescriptor="{new MyCustomTreeDataDescriptor()}"
dataProvider="{ac}"
defaultLeafIcon="@Embed('assets/caseIcon.png')"
change="publicTreeChanged(event)"
dragEnabled="true"
dragMoveEnabled="false"/>
This is how I remove the selected node from the tree. When
Delete button is clicked, the doDeleteCase function is
exectuted.
public function publicTreeChanged(event:Event):void {
selectedNode =
publicCaseTree.dataDescriptor.getData(Tree(event.target).selectedItem,
ac);
public function doDeleteCase(event:Event):void{
publicCaseTree.dataDescriptor.removeChildAt(publicCaseTree.firstVisibleItem,
selectedNode, 0, ac);
Any help would be appreciated.Thanks.Finally I removed nodes from tree, but not sure I did in the
right way. Anybody encounter the same problem, please
discuss. -
How to get the root node of a tree?
I wanna get all the leaf node of a tree.But JTree have no method about how to get the root TreeNode of a tree.Then how should I do?
try this:
http://javaalmanac.com/egs/javax.swing.tree/GetNodes.html?l=rel -
Displaying the entire text of a tree node when the tree isn�t wide enough
Hi,
I have a JTree displayed in a JScrollPane, so there is a chance that some of the tree data may be hidden if the tree's width is insufficient, so when the user moves the cursor over a tree node whose text is not completely visible (cut off by the right edge of the scroll pane and/or window), a tooltip is displayed to show the entire node text. So far so good!
If the user double click a node in the tree a new window is supposed to be opened. This works fine if the tooltip hasn�t been displayed jet, but if it has then the user has to click 3 times to open the window.
The first time to remove the tooltip and the next 2 opens the window.
How can I awoid this?
Thanks!!!!
:-)LisaAny ideas, please?
-
I add some node to a tree but it is not shown in web page.
Hi
thank you for reading my post.
I read some tutorial in the web and i add some tree node to a tree dynamically.
but none of them is shown :(.
I should say that i write the code that create a tree in session scope bean because my tree is placed in a fragment and fragment has no preRender method.
here is code that initiate a tree, and i think it is correct.
public void initiateTree() {
getTree1().setClientSide(true);
System.out.println("Setter called");
Context ctx=null;
DataSource ds=null ;
Connection con=null ;
Statement st = null ;
List rootMenuItems = new ArrayList();
ResultSet rs = null;
try {
ctx = new InitialContext();
ds= (DataSource) ctx.lookup("java:comp/env/jdbc/dataSource");
con= ds.getConnection();
st= con.createStatement();
} catch (Exception ex) {
ex.printStackTrace();
try {
java.sql.PreparedStatement childsPSt = con.prepareStatement("select * from categories where parentcategory = ?");
rs= st.executeQuery("select * from categories where parentcategory= 0 and language = " +"'"+getLang()+"'");
//roots
while(rs.next()){
int parentID = rs.getInt("categoryID");
System.out.println("A root has been added "+parentID );
TreeNode aRootNode = new TreeNode();
aRootNode.setText(rs.getString("categoryname"));
//childs
childsPSt.setInt(1,parentID);
ResultSet cRs = childsPSt.executeQuery();
while(cRs.next()){
System.out.println("Achild has been added "+ cRs.getString("categoryname")+ " " + parentID);
TreeNode childNode = new TreeNode();
childNode.setText(cRs.getString("categoryname"));
aRootNode.getChildren().add(childNode);
getTree1().getChildren().add(aRootNode);
} catch (SQLException ex) {
ex.printStackTrace();
I call this method in session bean constructor.
here is code that bind the tree in page fragment to session bean tree1
<ui:tree binding="#{SessionBean1.tree1}" id="tree1" style="height: 167px"/>here is console output that prove the initiate method do some works.
Setter called
A root has been added 1
Achild has been added cat name 2 1
Achild has been added cat name 3 1
A root has been added 5i think u need to add hyperlink component to the node thus cause node must carry hyperlink or anything u like to add like staticText or checkBox ....
add this code after creation the aRootNode and childNode
it may works :)
Hyperlink h = new Hyperlink();
h.setText(cRs.getString("categoryname"));
childNode .getFacets().put( childNode .CONTENT_FACET_KEY, h ); -
Selecting/highlighting a node in Flex Tree using HierarchicalCollectionView as DataProvider
Hi,
I am using GroupingCollection2 as the dataprovider for HierarchicalCollectionView. The GroupingCollection2 takes its data from an ArrayCollection. And finally I have a Tree whose dataprovider is the HierarchicalCollectionView . I want to acheive 2 things:
1) I want to programatically select/highlight a node in this tree. Using expandItem and passing the Object from the arraycollection is not working.
2) Refresh the tree if there is a change in the arrayCollection.
For the second task, I have a Java Layer that gives me the ArrayCollection (dp for GroupingCollection2) when I fire a CairngormEvent. But the problem is that every node in the tree is duplicated. I can clearly see that say there are 8 items in the array collection but still the tree shows 16 items ( Each item duplicated as the node in the tree.)
I have been trying to figure this out for many days now without any luck. Any sort of suggestion would be appreciated.
Thank u in advance.I got the refreshing of the tree part by myself. One needs to call the refresh method on the GroupingCollection2 and HierarchicalCollectionView objects when the arraycollection has just arrived from the database.
But I still havent been able to figure out how to highlight or open a tree node programatically. I am repeating that using (calling / setting) tree.expandItem() and tree.openItems is not helping me. Plz somebody help. -
Displaying a mixture of text and links in a single node of af:tree
Hi,
I want to display few links embedded in text as a node in <af:tree>.
For example, I want a single node in a tree to show three links with text - "Different type of email services are gmail, yahoomail,hotmail".
(gmail,yahoomail and hotmail are links)
Is there a good way of displaying this? I tried following options
1) I have a property named "linkText" in a bean instance mybean of MyBean.java. "linkText" contains required text and "a href" tags to display links. I used the following code in jsp page
<af:tree>
<f:facet name="nodeStamp">
<f:verbatim>
#{mybean.linkText>
</f:verbatim>
</f:facet>
</af:tree>
<f:verbatim> displays the EL expression as it is. I am not able to access the value.
2) I also tried to use <af:outputFormatted>. Though it supports "a href" tag, it does not support "target" attribute of the same tag.
Is there any other way of doing this?
On a related note ...is it possible to call a commandLink to call an existing java bean/function within an outputText?
For example:
Say I had an outputText that dumped a /etc/hosts file and I wanted to put in a command link to ping each host and pass the particular IP address to it. What would be the best method for doing that?
135.122.29.122 host1.me.com {color:#ff0000}_PingMeLink_
{color}135.122.29.117 host2.sd.me.com _{color:#ff0000}PingMeLink{color}_
So can I embed this in an outputText somehow or is there a better way to do this?
<af:commandLink text="PingMeLink"
action="#{NetworkController.PingAHost}"/>
Thanks for your help!
On a related note ...is it possible to call a commandLink to call an existing java bean/function within an outputText?
For example:
Say I had an outputText that dumped a /etc/hosts file and I wanted to put in a command link to ping each host and pass the particular IP address to it. What would be the best method for doing that?
135.122.29.122 host1.me.com {color:#ff0000}_PingMeLink_
{color}135.122.29.117 host2.sd.me.com _{color:#ff0000}PingMeLink{color}_
So can I embed this in an outputText somehow or is there a better way to do this?
<af:commandLink text="PingMeLink"
action="#{NetworkController.PingAHost}"/>
Thanks for your help!
Select the multiple nodes in a tree
Hi Experts,
We need to select the multiple nodes in a tree.Whatever we are selecting,that has to be added in the table as a tree structure itself.
For ex:
A
|--A1
|--B1
If We select the A then A,A1 and B1 has to be added in a table.Please help me out for this.
Regards
Nutan
Edited by: Armin Reichert on Jan 29, 2008 2:33 PM
Hi,
You have to create a recursive node and use the tree by nesting UI component
Following tutorial will be of use
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20tutorials%20and%20articles%20archive/constructing%20a%20recursive%20and%20loadable%20web%20dynpro%20tree.pdf
Recursive Node
http://help.sap.com/saphelp_nw70/helpdata/en/5d/97384162316532e10000000a1550b0/frameset.htm
TreeByNesting
http://help.sap.com/saphelp_nw70/helpdata/en/92/12a74046033913e10000000a155106/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#31 [original link is broken]
Regards
Ayyapparaj
Add checkbox on the nodes of Hierarchical tree in oracle forms 9i
Hi,
I am working on oracle forms 9i.I have to add checkbox at the place of node(+/-) in Hierarchical tree so,
that user can select or deselect the Tree.That can do in oracle forms but how i don't know.
can anybody help me.....
Regards,
Hemant
You can't change this aspect of the Tree Control in Oracle Forms using built-in functionality. You might be able to extend the Tree Control using Java, but you have to do this yourself. : (
Craig...
Programmatic, using bean add Parent and child nodes in af:tree dynamically
Hi All,
i have to add parent and child nodes dynamically in tree .
Example :
i have created a tree like below.On click of button i will get value A ,from pl/sql function i will A1 and A 2 values.which i have to show in pop as tree.
A
|-----A1
|-----A2
If user clicks on A2.I have to catch A2 value and pass to pl/sql function which gives A2.01 and A2.02 values.
A
|-----A1
|-----A2
|------A2.01
|------A2.02.
A, A1 ,A2,A2.01 ...........values comes from pl/sql funchtion .
thanks in advance ......... any suggestion will greatly helps
no use ......................
Problem when selecting child node in Hierarchical Tree
I have a hierarchical tree on a form populated thru a table query(form1). When I click on a child node, it opens form2 which contains a tab canvas. After closing forms, I return to the form1(containing Tree). At this point If I want to click on the same child node, I should be able to open form2 again. This doesn't happen.
I have the following code in my When-Tree-node_selected trigger:
Declare
htree item;
vnode_label varchar2(50);
node_clicked FTREE.NODE;
vnode_value number;
vnode_depth number;
v_type number;
v_value varchar2(100);
v_form_name varchar2(100);
v_alert_return number;
begin
-- Find the tree itself.
htree := FIND_ITEM('tree_block.tree');
node_clicked := :SYSTEM.TRIGGER_NODE;
vnode_value := FTREE.NODE_label;
-- Find the value of the node clicked on.
vnode_label := FTREE.GET_TREE_NODE_PROPERTY (htree,:SYSTEM.TRIGGER_NODE,FTREE.NODE_label);
vnode_depth := to_number(ftree.get_tree_node_property(htree,:SYSTEM.TRIGGER_NODE,ftree.Node_depth));
--Open form for node selected on tree and/or specific tab page
if vnode_depth <> 1 then
if :system.trigger_node_selected = 'TRUE' then CASE vnode_label
WHEN 'Personal' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Citizenship' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Emergency Contact' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
if id_null(Find_form(v_form_name)) then
open_form(:global.application_path || v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);
else
go_form(v_form_name);
end if;
END IF;
elsif vnode_depth = 1 then
if :system.trigger_node_SELECTED = 'TRUE' then CASE vnode_label
WHEN 'EMPLOYEE INFO' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
vnode_label := 'Personal';
WHEN 'REPORTS' then
v_form_name :='HR_REPORTS';
vnode_label := '';
if id_null(Find_form(v_form_name)) then
v_form_name := :global.application_path || v_form_name;
open_form(v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);--,p_list);
else
go_form(v_form_name);
end if;
end if;
end;
Can anyone please help me? I don't want the user to double click. They should only click once.
Thanks,
Mercedes
Right clicking does not change the current selection. The tree has no way to report what node was right clicked. Only work around is to left click the node you wish then right click it.
--pat
How to next consecutive node in binary tree and insert in sql server
i need to find next node in this tree and insert in sql server ...
dilip kumar
It depends you data structure. How do you store this tree structure in the database? What's the database design? BTW, you can see this article which include a related sample :
Custom Sort in Acyclic Digraph
T-SQL e-book by TechNet Wiki Community
My Blog
My Articles
Maybe you are looking for
-
Java.lang.AbstractMethodError "setSavepoint()"
Hello all, I tried to use the method setSavepoint() in interface java.sql.Connection and i had this exception in run time (java.lang.AbstractMethodError). From the JDK documentaion i understood that this can happen in run time only if a definition of
-
I am deployed and tried to download an app to my iphone but the sytem won't take my debit card. Just wondering if its because I am in another country. Help
-
TestStand - Default Values 82.llb missing
I've recently upgraded to Labview 8.2 (I already had TestStand 3.5), and when I try to call a VI using some default parameters and some defined parameters, I get an error saying that "C:\Program Files\National Instruments\TestStand 3.5\AdapterSupport
-
Restoring play count from library.xml?
OK, i just reformatted my hard drive, and not sure i backed up everything correctly. All my music is there, but there is no play count/date added/playlists. I am ok with this, but i opened the iTunes Music Library xml file just for fun, and i noticed
-
How do I view videos transferred from the Treo 700 to my computer? Is there particular software that is required? Post relates to: Treo 700p (Verizon)