Printing a node tree

I have create a node tree with CREATE OBJECT G_TREE and i have show it in the screen, but now i have to print it and i don´t have the standard functionality and i can´t see any method in the class CL_GUI_LIST_TREE that is the principal class that i have used for creating the nodes, is there any way of doing it or is there any transaction in Sap where i can see how to do it?.
Thank you very much in advance

Hi Carl,
I dont think you can print a tree. It might be worthwhile to look at ALV Tree. I have used this and you can print this tree. The class is cl_gui_alv_tree. You can build hierarchical tree using this. Check the example BCALV_TREE_01.
Regards,
Vani

Similar Messages

  • Printing a Node

    Hello everyone:
    I am parsing an XML instance using xerces/w3cDOM, how do I print out a Node? I've looked around the API and only found a way of printing the whole document using getDocumentOwner and serializing it
    tempNode is a Node
    OutputFormat format = new OutputFormat( tempNode.getOwnerDocument(), "UTF-8", true ); /** Serialize DOM **/
    StringWriter stringOut = new StringWriter(); /** Writer will be a String **/
    XMLSerializer serial = new XMLSerializer( stringOut, format );
    try {
    serial.asDOMSerializer(); /** As a DOM Serializer **/
    serial.serialize( (tempNode.getOwnerDocument()).getDocumentElement());
    } catch (Exception exc){}
    System.out.println("Tree is:\n"+stringOut.toString());
    The above code prints out the whole document. How do I print tempNode?
    Thanks
    VP

    You can use a transformer.
    first import javax.xml.transform, set up an output stream (outStream) then:
        Transformer trans;
        TransformerFactory = transfac = TransformerFactory.newInstance();
        try{
          trans = transfac.newTransformer();
        catch(TransformerConfigurationException t){
          //do something
        catch(IllegalArgumentException i){
          //do something
        try{
          trans.transform(new DOMSource(tempNode), new StreamResult(outStream));
        catch(TransformerException t){
          //do something
        }If you want to print the Node to the screen just use System.out as your output stream. You can also store the text input in an array if you use a ByteArrayOutputStream.

  • Print XML from tree

    Hey, I'm trying to print tree nodes into XML. The code below prints out the tags, but I have no way of getting the end tags identified and printed. Any help will be much appreciated.
    public static void printDescendents(TreeNode node){
    System.out.prinln(node);  
    Enumeration children = root.children();
       if (children != null){
          while children.hasMoreElements()){
             printDescendents((TreeNode) children.nextElement());
    }

    I have no idea whether printing the node prints a start tag or an end tag or what. But here's what I would do:public static void printDescendants(TreeNode node){
      // print start tag
      Enumeration children = node.children();
      if (children != null){
        while children.hasMoreElements()){
          printDescendants((TreeNode) children.nextElement());
      // print end tag
    }I also corrected the spelling of your method name and changed the Enumeration so it gets the children of the node the method is dealing with.
    Looking at the result, I wouldn't call the method printDescendants if it's also going to print data from the node itself. Maybe printNode would be a better name.

  • [svn:fx-trunk] 10459: Change to ensure ScriptNodes are no longer part of the node tree after interface compilation stage in order to avoid the extra code that was necessary to avoid tripping over them during type checking , etc.

    Revision: 10459
    Author:   [email protected]
    Date:     2009-09-21 08:42:44 -0700 (Mon, 21 Sep 2009)
    Log Message:
    Change to ensure ScriptNodes are no longer part of the node tree after interface compilation stage in order to avoid the extra code that was necessary to avoid tripping over them during type checking, etc.
    Improving revision 10199 a bit, to allow for single line comments.
    QE notes: None
    Doc notes: None
    Bugs: SDK-22027
    Reviewer: Paul
    Tests run: Checking, Compiler cyclones
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22027
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/AbstractSyntaxTreeUtil.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/AbstractBuilder.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • CheckBox node tree with two diferent kind of nodes

    Hai ,
    I need to build a check box tree with two different kind of nodes , Child and Parent nodes .
    CheckBox node tree with two diferent kind of nodes.
    HOw will i write the renderer and editor for this ?

    Study the method getTreeCellRendererComponent() of the class DefaultTreeCellRenderer.

  • Could not load or refresh node tree creation failed on node

    Hi Experts
    I created one user with MSS role and ERP COMM role.
    It is working fine. We restarted the server for other purpose. Then surprisingly the MSS role was locked. I am unable to see the MSS tab in the top level navigation.
    When i expand the workset in line manager -> Manager Self Service -> Worksets
    I am getting the following error::
    Could not load or refresh node tree creation failed on node:
    pcd:portal_content/com.sap.pct/line_manager/com.sap.pct.erp.mss.bp_folder/com.sap.pct.erp.mss.worksets
    I can be able to expand and priveiw the Pages and iviews, except the worksets
    Please guide me, i am badly stucked here.
    Regards,
    Srinivas

    Hi KRISHNA,
    Check the below thread and notes mentioned in that
    Re: Tree creation failed on node: pcd:portal_content
    Koti Reddy

  • FPN Could not load or refresh node Tree creation failed on node: pcd:-Error

    Hi,
    I´m configuring a FPN using CRM Java as a producer and SAP Portal as a consumer, the SSO from SAP Portal to CRM Java is working fine, but we are having this Error when trying to Expand Content Administration > Portal Content > NetWeaver Content Producers > MyProducer System
    Could not load or refresh node Tree creation failed on node: pcd:NetWeaver_content_producers/........
    Also in Identity Management I can see the Federated Data Source but when search for roles no rol is retrieved and returns two messages.
    Last Search might be innacurate
    No element Found
    Has somebody faced this Error?
    Thanx in Advanced!
    Kind Regards,
    Gerardo J

    Hi KRISHNA,
    Check the below thread and notes mentioned in that
    Re: Tree creation failed on node: pcd:portal_content
    Koti Reddy

  • Chroma Key/Node Tree Question

    Please bare with me because there are times when I find building the node tree complex and somewhat confusing, but I think I'm close.
    I am using the keylight node and have made this tree configuration:
    Foreground into Color Space Node 1 and changing the RGB to output of YUV, to Blur Node, (did this to try to get rid of the jagged spill around the foreground figure), to Color Space 2 Node, changing the YUV back to output of RGB, then imput to Keylight Node, then to Color Match Node as Stuckfootage suggested yesterday, and then to Over Node. My Background Layer is connected to the Over node.
    I still have an edge of color around the foreground figure and I've tried to get rid of it and wonder if there's another way to do so? This is my question.
    Hope you all have an answer! I thought I had gotten rid of it, but after doing all of the above it seemed to return. I've made a green screen in keylight by the way.

    Patrick, when you say "fill" do you mean something like this?
    Background = Checker(1920, 1080, 1, 32, xSize/GetDefaultAspect());
    Color1 = Color(1920, 1080, 1, 0, 1, red, 1, 0);
    Color2 = Color(1920, 1080, 1, 0.505, 0.467430055, 0.28644523,
    1, 0);
    RotoShape1 = RotoShape(1920, 1080, 1, "v4.10", 0, 0, 0, 1, 1,
    xScale, width/2, height/2, 0, 0.5, 0, 384, "[email protected]7C3uDtY8WgH13 0Am04DKJHqhpqqR83G@YohJ@#ota77pDe1@UoFvqSQA8KZyoLS11qpK1qKGJmYy4abq0JKnqHeq3cMw5 xYkLTOcJruq1Ae6KlJk8eJ6kyqotXVj9j6xIIp8xMHeRC3TWpWClCdK2lCX02lCZ0@DWX025aO610YFu flDJu26DOV10Du83C3SIW6GFi8j00ZpgG8mG3CKFVX0WQv233AOi1vuB3BfS0sPv1dW@GnwYTm3MW97x nR6S06vuEGmNO1uubpCKK0HoiKhPuqmV8tOdyZb1176m8vE0W300G3H00000000002:",
    "[email protected]c1SQQLKGXeWH0 Qe0Y6AK9wbPWw9aXcdHvbffVvRI#YvMK#LEvtSEEDLa#HQfgfM1wPgfQAef2GU2I2AWDwOX9Gg1eAzYT frgESpDROg0TK3gtdj4q93KVQfxTkoaMSK9fP43h8qDsXEmPsNN6HgPNMIff5aQWXg94QeNp8eCeDAr2 I2DAGC0YHE2P6il00X6Si16E9G38rMgs0GPMKm1OeX31BjKWGIciuW26SGU#ODGYN0D8Fmb4p56FtjCS Q31WUi3v3cSikmG1UubZR32NvEWxMDK50S86XChA3N7LX5xaVB098umKUgz00000f03",
    "100W@0E000VDhsuH9RYbMXJCo8QUPcJkW66fOihMQZ5aCgWLQYvcdSP0#26ob1chH25QW60WPMQeGD A9Nb9cWG6QgYNbgcUOlBvNKRIvNNVovuOgKI#NJbfgcJdfgQaMWcAeW98D0ceWDsaQf5WcOBsjk2mE@K IKf3ujgeSJg6dCK1rDblxb1JQnbdcH8ShnGtOtIWcTtAZBpDGwGNZDoo03ipoUZCbmqGZCa6Pq1s19cH mJMXICg2EGiWGn0N6Q03ytWX20sW0aEm1TPkuW3pjmW33a0J30k4G12mnAGAlpxj06TTk11HE3SDnR74 fGU17OWPxxHBVaNm1fMblR3nlU#WWDrxeugpe@mBx9PgNOW1SXopj11SYn2D@6ZuVa@wFwHDV1tu4ytN 0aFa1Vmcy3bW03smZSR2GW50uPj#0000005");
    Original_Footage = KeyMix(Color1, Color2, RotoShape1, 1, "A",
    100, 0);
    ColorSpace1 = ColorSpace(Original_Footage, "rgb", "yuv", 0.3,
    0.59, 0.11);
    Blur1 = Blur(ColorSpace1, 4, 0, 0, "default", "default", "gb");
    ColorSpace2 = ColorSpace(Blur1, "yuv", "rgb", 0.3, 0.59, 0.11);
    Keylight1 = Keylight(ColorSpace2, 0, 0, 0, "1.4", "unpremultiplied",
    0, 1, 0, 0.058631923, 0.9, 0.9, 0.9, (bScreen > gScreen) ? 0.9 : 0.5,
    (bScreen > gScreen) ? 0.9 : 0.5, (bScreen > gScreen) ? 0.9 : 0.5,
    0, 0, 0, 0.5, 0.5, 0.5, 0.5, 1, rExposure, rExposure, 1,
    rGamma, rGamma, 1, "linear", 1, "A", 1, "A", 0, 0);
    SpillSuppress1 = SpillSuppress(ColorSpace2, 1, 1, 0, 1);
    ColorMatch1 = ColorMatch(SpillSuppress1, 0, 0, 0, 0, rLowS, gLowS,
    bLowS, aLowS, 0.5, 0.5, 0.5, 0.5, rMidS, gMidS, bMidS, aMidS,
    1, 1, 1, 1, rHighS, gHighS, bHighS, aHighS, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1);
    KeyMix1 = KeyMix(Background, ColorMatch1, Keylight1, 1, "A",
    100, 0);
    // User Interface settings
    SetKey(
    "nodeView.Background.t", "1",
    "nodeView.Background.tnChannel", "0",
    "nodeView.Background.tnTime", "1",
    "nodeView.Background.tnVisible", "1",
    "nodeView.Background.x", "170.380127",
    "nodeView.Background.y", "-46.8631",
    "nodeView.Blur1.t", "0",
    "nodeView.Blur1.x", "511.630127",
    "nodeView.Blur1.y", "154.8869",
    "nodeView.Color1.t", "1",
    "nodeView.Color1.tnChannel", "0",
    "nodeView.Color1.tnTime", "1",
    "nodeView.Color1.tnVisible", "1",
    "nodeView.Color1.x", "390.296875",
    "nodeView.Color1.y", "367.8869",
    "nodeView.Color2.t", "1",
    "nodeView.Color2.tnChannel", "0",
    "nodeView.Color2.tnTime", "1",
    "nodeView.Color2.tnVisible", "1",
    "nodeView.Color2.x", "505.296875",
    "nodeView.Color2.y", "367.8869",
    "nodeView.ColorMatch1.t", "0",
    "nodeView.ColorMatch1.x", "349.630127",
    "nodeView.ColorMatch1.y", "-41.8631",
    "nodeView.ColorSpace1.t", "0",
    "nodeView.ColorSpace1.x", "471.630127",
    "nodeView.ColorSpace1.y", "225.8869",
    "nodeView.ColorSpace2.t", "0",
    "nodeView.ColorSpace2.x", "471.630127",
    "nodeView.ColorSpace2.y", "83.8869",
    "nodeView.KeyMix1.t", "0",
    "nodeView.KeyMix1.x", "356.880127",
    "nodeView.KeyMix1.y", "-164.1131",
    "nodeView.Keylight1.t", "0",
    "nodeView.Keylight1.x", "574.1301",
    "nodeView.Keylight1.y", "-34.3631",
    "nodeView.Original_Footage.t", "0",
    "nodeView.Original_Footage.x", "474.630127",
    "nodeView.Original_Footage.y", "296.8869",
    "nodeView.RotoShape1.t", "1",
    "nodeView.RotoShape1.tnChannel", "0",
    "nodeView.RotoShape1.tnTime", "1",
    "nodeView.RotoShape1.tnVisible", "1",
    "nodeView.RotoShape1.x", "620.2969",
    "nodeView.RotoShape1.y", "367.8869",
    "nodeView.SpillSuppress1.t", "0",
    "nodeView.SpillSuppress1.x", "348.25",
    "nodeView.SpillSuppress1.y", "3.25"
    );

  • Rename node tree name

    HI All
    I am working with alv tree (CL_GUI_ALV_TREE)and i want to rename a node name (via ON_NODE_CONTEXT_MENU_SELECT i provide  the option to rename node)
    in the tree and i found the method set_name but i dont have there
    a place when can i put the key of node
    there is diffrent way to update the node tree name  ?
    fior instance change node name from node_x to node_y  on the node view , i have node_x key
    Best regards
    Alex
    Edited by: Alex Dean on Sep 6, 2010 9:56 PM

    Hello,
    Please check this code.
       DATA: k_node_layout TYPE lvc_s_lacn.
       CONSTANTS: c_checked VALUE 'X'.
       FIELD-SYMBOLS: <leaves>  TYPE table,
                      <leaf>    TYPE ANY.
    Set the icon based on the parameter.
       k_node_layout-u_n_image  = c_checked.
       k_node_layout-u_exp_imag = c_checked.
    Set the icon value based on the parameter.
       k_node_layout-n_image   = new_icon.
       k_node_layout-exp_image = new_icon.
    Build the dynamic values for table and line.
       ASSIGN leaves->* TO <leaves>.
       CREATE DATA leaf LIKE LINE OF <leaves>.
       ASSIGN leaf->* TO <leaf>.
    Get the associated line item for the selected node.
       tree->get_outtab_line( EXPORTING  i_node_key     = node_key
                              IMPORTING  e_outtab_line  = <leaf>
                              EXCEPTIONS node_not_found = 1
                                         OTHERS         = 2 ).
    Update the icon of the node.
       tree->change_node( EXPORTING  i_node_key     = node_key
                                     i_outtab_line  = <leaf>
                                     is_node_layout = k_node_layout
                          EXCEPTIONS node_not_found = 1
                                     OTHERS         = 2 ).
    Thanks.
    Ramya.

  • Print empty nodes in a Huffman binary Tree

    Hi,
    I have constructed a binary huffman tree, and I need to print the empty nodes as a character '-'. As I am using the array structure to build the huffman tree, I am very confused how I can go about it. This is my code. Any help will be appreciated:
    import java.util.*;
    import java.io.*;
    import java.lang.*;
    public class Huffman
        static char letters;
        static int frequency;
        static char frequency1;
        static int alphabet;
        static char frqtable [][];
        static char treetable[][];
        static TreeNode myTree[];
        static int i = 0;
        static int j = 0;
        static Scanner in = new Scanner(System.in);
        static int index = 0;
        static Vector temp = new Vector();
        static String finalarray[];
        public static void main (String args[])throws IOException{
            setFrequencyTable();
            treetable = frqtable;
            sortArray(treetable);
            buildHuffmanTree(treetable, alphabet);
           // printGeneralTree();
         public static void setFrequencyTable() throws IOException{
            System.out.println ("Please enter number of distinct alphabet");
            alphabet = in.nextInt();
            frqtable = new char[alphabet][2];
           for (int count = 0; count<alphabet; count++){
                System.out.println ("Enter the character");
                letters = (char) System.in.read();
                frqtable[i][j] = letters;
                System.out.println ("Enter frequency");
                frequency = in.nextInt();
                frequency1 = Integer.toString(frequency).charAt(0); ;
                frqtable[i][j+1] = frequency1;
                i = i+1;
                j = 0;
        public static void sortArray (char[][]treetable){
            char templetter;
            char tempfrq;
          for (int j=0; j < frqtable.length; j++) {
            for (int i=0; i < frqtable.length-1; i++) {
                  if((treetable[1]) < (treetable[i+1][1])){
    tempfrq = (treetable[i][1]);
    templetter = (treetable[i][0]);
    (treetable[i][1]) = (treetable[i+1][1]);
    (treetable[i][0]) = (treetable[i+1][0]);
    (treetable[i+1][1]) = tempfrq;
    (treetable[i+1][0]) =templetter;
    public static void levelorderTraversal(TreeNode root) {
    levelorderHelper( root);
    System.out.println();
    private static void levelorderHelper( TreeNode node ) {
    if( node == null )
    return;
    queue( node ); // queues root
    qLeftqRight( index ); // queues Left/Right node of the node at 'index'
    printIt(); // prints contents of queue
    private static boolean queue( TreeNode n ) {
    if( n != null ){ // if child exists, queue it
    temp.addElement( n );
    return true;
    }else{
    return false;
    private static void qLeftqRight( int i ) { // for each queued node, queue its children
    while( i < temp.size() ) {
    TreeNode tmp = (TreeNode) temp.elementAt( i );
    if (tmp.leaf == false){
    queue( tmp.left );
    queue( tmp.right );
    i++;
    private static void printIt() {
    finalarray = new String[temp.size()];
    for( int x = 0; x < temp.size(); x++ ) {
    TreeNode t = (TreeNode) temp.elementAt( x );
    if(t.ch == '\0'){
    finalarray[x] = Integer.toString(t.count);
    }else{
    finalarray[x]=Character.toString(t.ch);
    public static void buildHuffmanTree(char [][] treetable, int alphabet){
    myTree = new TreeNode [alphabet];
    TreeNode leftNode, rightNode;
    TreeNode newNode = null;
    for ( int i = 0; i < alphabet; i++ ){
    myTree[i] = new TreeNode (treetable[i][0], Character.getNumericValue(treetable[i][1]));
    for (int j =((myTree.length)-1); j>0; j--){
    newNode = new TreeNode(myTree[j], myTree[j-1]);
    myTree[j] = null;
    myTree[j-1] =null;
    if(j!=1){
    for(int c = 0; c<(j-1); c++){
    if(myTree[c].count <= newNode.count){
    for(int x = alphabet-1; x>c; x--){
    myTree[x] = myTree[x-1];
    myTree[c] = newNode;
    c= j-1;
    }else{
    myTree[0] = newNode;
    levelorderTraversal(myTree[0]);
    for(int i = 0; i < finalarray.length; i++){
    System.out.println(finalarray[i]);
    public class TreeNode{ 
    final boolean leaf;
    int count;
    final char ch;
    final TreeNode left,
    right;
    public TreeNode ( char ch, int count )
    {  this.leaf  = true;
    this.count = count;
    this.ch = ch;
    this.left = null;
    this.right = null;
    public char getChar(){
    return ch;
    public TreeNode ( TreeNode left, TreeNode right)
    {  this.leaf  = false;
    this.count = left.count + right.count;
    this.left = left;
    this.right = right;
    this.ch ='\0';

    doobybug wrote:
    The finalarray actually prints the array.No, finalarray IS and array. It doesn't print anything.
    The problem I think is with the TreeNode class where a leaf states the left and right nodes as null, but if I instantiate them to '-' they will continue to assign empty nodes until the program runs out of memory!!I don't know what you're saying here, but it sounds like you think that you have to set the Node to '-' in order to be able to print '-'. Really all you have to do is
    for each node {
      if the node is empty {
        print -
      else {
        print whatever you print for non-empty nodes
    }Or if an "empty" node is still a Node object, just with certain attribute values, then just create a toString method in the Node class that returns "-" when the Node is empty.
    Really, if you know how to iterate over your nodes, and you know how to determine whether a node is empty, then your problem is solved, there's nothing else to it.

  • How to Pretty Print a Binary Tree?

    I'm trying to display a Binary Tree in such a way:
    ________26
    ___13_________2
    1_______4 3_________1
    (without the underscores)
    however I cannot figure out the display method.
    class BinaryNode
              //Constructors
              BinaryNode leftChild, rightChild;
    Object data;
         BinaryNode()
    leftChild = null;
    data = null;
    rightChild = null;
              BinaryNode( Object d, BinaryNode left, BinaryNode right)
    leftChild = left;
    data = d;
    rightChild = right;
              //Height
              public static int Height(BinaryNode root)
    if (root == null)
    return 0;
    if ((Height(root.leftChild)) > Height(root.rightChild))
    return 1 + Height(root.leftChild);
    return 1 + Height(root.rightChild);
              //Count
    public static int Count(BinaryNode root)
    if(root==null)
    return 0;
    return 1 + Count(root.leftChild) + Count(root.rightChild);
              //Display
              public static void Display(BinaryNode root)
              int level = 2^(Level(root)-1)
              for (int i = 1; i<Height(root)+1; i++)
              System.out.printf("%-4s%
              Display(root, i);
              System.out.println();
              public static void Display(BinaryNode root, int level)
              if (root!=null)
              if(level==1)
              System.out.print(root.data + " ");
              else
              Display(root.leftChild, level-1);
              Display(root.rightChild, level-1);
              //Level
              public static int Level(BinaryNode root)
              if(root==null)
              return 0;
              if(root.leftChild == null && root.rightChild == null)
              return 1;
              return Level(root.leftChild) + Level(root.rightChild);
    Edited by: 815035 on Nov 23, 2010 12:27 PM

    The example of what the OP wants it to look like I thought was quite plain. Its right at the top of the post.
    Unfortunately it is also quite difficult to accomplish using System.out.print statements.
    You have to print out the root of the tree first (its at the top)
    However you don't know how far along to the right you need to print it without traversing the child nodes already (you need to know how deep the tree is, and how far to the left the tree extends from the root)
    So you will need to traverse the tree at least twice.
    Once to work out the offsets, and again to print out the values.
    The working out of offsets would have to be a depth search traversal I think
    The printing of the values in this fashion would be a breadth first traversal.
    I remember (ages ago) doing a similar assignment, except we printed the tree sideways.
    ie the root was on the left, the leaves of the tree on the right of the screen.
    That meant you could do an inorder depth traversal of the tree to just print it once.
    hope this helps,
    evnafets

  • Help with a node tree

    hi guys here's the problem i'm having:
    I have a class called Node that I am building a tree out of. Node is a very simple structure, has three parts: element, left and right, with element being the top. Then I have a class called converterTree. This class will take in a postfix (polish notation) string and convert it into a tree through tokenizing etc. for an ultimate calculator class. The code I will post below uses a stack implementation to do so. It should: add all operands to the stack until it hits an operator, then make a new node with the operator as the element, and the left and right are the top and second stack objects respectively. then it pushes this entire tree back onto the stack and keeps going, at each step creating a new tree and linking it to the old one. The problem is that for some reason when I get the top node back in the return, it comes back as only that node, as if all the things it referenced are gone. You wont be able to run the code below since it needs some other classes, but in my main method where all those printlns are know that the return comes back as -, null, null, null, null, null, null with - being the thing on the stack that is SUPPOSED to link to the rest of them, yet for some reason they all come back null? any suggestions? heres the code:
    import java.util.StringTokenizer;
    public class ConverterTree
         String stringToConvert;
         static QueueLi returnQueue = new QueueLi();
         public ConverterTree (String toConvert)
              stringToConvert = toConvert;
         public static boolean isOperator(String op)
              char c = op.charAt(0);
              return (c == '*'|| c =='/' || c == '+' || c =='-');
         public static boolean isLParen (String op )
              char c = op.charAt(0);
              return c== '(';
         public static boolean isRParen (String op)
              char c = op.charAt(0);
              return c == ')';
         public static boolean isSpace(String op)
              char c = op.charAt(0);
              return c == ' ';
         public static boolean isOperand (String op)
              return (!( isOperator(op) || isLParen(op) || isRParen(op) || isSpace(op)));
         public Node toTree (String toConvert)
              String delims = new String("+-/* ");
              StringTokenizer tokenizer = new StringTokenizer(stringToConvert, delims, true);
              String token = new String();
              StackLi stack = new StackLi();
              while (tokenizer.hasMoreTokens())
                   token = tokenizer.nextToken();
                   System.out.println("token: " + token);
                   if (isOperand(token))
                        ListNode node1 = new ListNode(token);
                        System.out.println("This operand is being pushed: " + token);
                        stack.push(token);
                   else if (isOperator(token))
                        Node op2 = new Node(stack.topAndPop());
                        Node op1 = new Node(stack.topAndPop());
                        Node opTree = new Node(token, op1, op2);
                        System.out.println("node and left and right: " + opTree.element + opTree.left + opTree.right);
                        stack.push(opTree);
                        System.out.println("node and left and right: " + opTree.element + opTree.left + opTree.right);
              Node returnNode = new Node(stack.topAndPop());
              return returnNode;
         public static void main (String [] args)
              String toConvert1 = "2 5 + 6 8 + -";
              ConverterTree treeTest = new ConverterTree(toConvert1);
              Node testNode = treeTest.toTree(toConvert1);
              Node right = new Node(testNode.right);
              Node left = new Node(testNode.left);
              System.out.println(testNode);
              System.out.println(left);
              System.out.println(right);
              System.out.println(left.left);
              System.out.println(left.right);
              System.out.println(right.left);
              System.out.println(right.right);
    }

    hi guys here's the problem i'm having:
    I have a class called Node that I am building a tree out of. Node is a very simple structure, has three parts: element, left and right, with element being the top. Then I have a class called converterTree. This class will take in a postfix (polish notation) string and convert it into a tree through tokenizing etc. for an ultimate calculator class. The code I will post below uses a stack implementation to do so. It should: add all operands to the stack until it hits an operator, then make a new node with the operator as the element, and the left and right are the top and second stack objects respectively. then it pushes this entire tree back onto the stack and keeps going, at each step creating a new tree and linking it to the old one. The problem is that for some reason when I get the top node back in the return, it comes back as only that node, as if all the things it referenced are gone. You wont be able to run the code below since it needs some other classes, but in my main method where all those printlns are know that the return comes back as -, null, null, null, null, null, null with - being the thing on the stack that is SUPPOSED to link to the rest of them, yet for some reason they all come back null? any suggestions? heres the code:
    import java.util.StringTokenizer;
    public class ConverterTree
         String stringToConvert;
         static QueueLi returnQueue = new QueueLi();
         public ConverterTree (String toConvert)
              stringToConvert = toConvert;
         public static boolean isOperator(String op)
              char c = op.charAt(0);
              return (c == '*'|| c =='/' || c == '+' || c =='-');
         public static boolean isLParen (String op )
              char c = op.charAt(0);
              return c== '(';
         public static boolean isRParen (String op)
              char c = op.charAt(0);
              return c == ')';
         public static boolean isSpace(String op)
              char c = op.charAt(0);
              return c == ' ';
         public static boolean isOperand (String op)
              return (!( isOperator(op) || isLParen(op) || isRParen(op) || isSpace(op)));
         public Node toTree (String toConvert)
              String delims = new String("+-/* ");
              StringTokenizer tokenizer = new StringTokenizer(stringToConvert, delims, true);
              String token = new String();
              StackLi stack = new StackLi();
              while (tokenizer.hasMoreTokens())
                   token = tokenizer.nextToken();
                   System.out.println("token: " + token);
                   if (isOperand(token))
                        ListNode node1 = new ListNode(token);
                        System.out.println("This operand is being pushed: " + token);
                        stack.push(token);
                   else if (isOperator(token))
                        Node op2 = new Node(stack.topAndPop());
                        Node op1 = new Node(stack.topAndPop());
                        Node opTree = new Node(token, op1, op2);
                        System.out.println("node and left and right: " + opTree.element + opTree.left + opTree.right);
                        stack.push(opTree);
                        System.out.println("node and left and right: " + opTree.element + opTree.left + opTree.right);
              Node returnNode = new Node(stack.topAndPop());
              return returnNode;
         public static void main (String [] args)
              String toConvert1 = "2 5 + 6 8 + -";
              ConverterTree treeTest = new ConverterTree(toConvert1);
              Node testNode = treeTest.toTree(toConvert1);
              Node right = new Node(testNode.right);
              Node left = new Node(testNode.left);
              System.out.println(testNode);
              System.out.println(left);
              System.out.println(right);
              System.out.println(left.left);
              System.out.println(left.right);
              System.out.println(right.left);
              System.out.println(right.right);
    }

  • Current node tree with tooltip_text

    Hello,
    How can i display a tooltip_text for the current node from a tree ?
    I tried with
    :Ctrl.Node_Selected     := Ftree.Get_Tree_Node_Property('BL_TREE.MENU',
    :SYSTEM.TRIGGER_NODE,
    Ftree.NODE_VALUE);
    set_item_property('BL_TREE.MENU',
    tooltip_text,
    :Ctrl.Node_Selected);
    I didn't find something with the build_in set_Tree_Node_Property
    There is a possibility to display an icon for each node ? I build the tree with a record group. How can I do it ?
    Thanks
    Bye

    hi,
    you can set the tooltip-text of the whole treebean according to the currently selected "active" node.
    Try to use the code you already used in a WHEN-TREE-NODE-SELECTED-Trigger.
    It's not possible to have a tooltip-text for each node separately.
    Yes, you can assign an icon to each node. Whn you use a recordgroup to fill the tree, one of the columns of the recordgroup has to be the name of the icon
    If i remember correctly the columns are
    NODE_STATE
    NODE_DEPTH
    NODE_LABEL
    NODE_ICON
    NODE_VALUE

  • Printing Address Node in International Format

    Hi,
    I am working on Adobe Form. Could some one provide me a best solution for the following question ?
    How could i display an Address Node with Internationalized country specific format instead of the default local format ?
    Cases:
    1. Sending Country is US then the Address Node should print in English.
    2. Sending Country is JP then the Address Node should print in Japanese.
    For Instance,
    The following are the Address Node parameters that is passed through interface
    Address Type      -> Organization, Company
    Address Number  -> A variable that holds a specific Address Number
    Sending Country  -> A variable that holds a specific Sending Country
    Note:
    1. By default the address Node itself picks up the local format. ( I don't find a property that specifys to pick Internationalized format)
    2. For single Address number there are multiple languages maintained in the Address table.
    Thanx in Advance.

    Hi,
    Can you check with the Different Recipient Language field in the addree node details.
    Regards,
    sasi

  • Move recursive nodes (tree branches)

    Hi experts.
    I have a table with a nested tree and therefore a context structure with recursive nodes.
    Is there a convenient way to move whole sub-branches including child nodes (and their child nodes).
    When I just move the selected element by create & remove, all child nodes are lost.
    Any idea to solve this in a good way?
    Regards, Karsten

    Hi,
    I'm unsure how long this post will be on the forums, but here it goes.
    Yes, customizing ADF in any way requires a lot of time.
    ADF is build with the concept of less coding and more drag and drop. The framework tailored specifically to this requirement.
    This means that if you use ADF, you must be willing to change business requirements if ADF does not easily allow you to implement them.
    This is of course true for almost any Framework, but for ADF it is really extreme.
    I need to go back to the business a lot when working with ADF, explaining that if we change this requirement development is a lot easier and that sometimes I'm even unsure if I can make it work in ADF.
    But that said, most of the screen WILL work with basic drag and drop and minimal backing beans, ADF is worth it then.
    If people try to convince you, you do not need to code at all with ADF, just ignore them.
    They have never work on a real commercial project with real customers, simple as that.
    On your question, I believe I did something similar in ADF 10.1.3, but I cannot find the code atm.
    But yes, use the native Trinidad components, forget about the bindings for now, bindings will only make your time a lot harder.
    Work with the underlying app module and the view objects directly.
    There is no reason this should not work, but yes you will bypass the binding layer.
    When I have to customize something, I start by checking if the ADF components allow me todo something declarative, this is hardly ever the case.
    I changed to backing beans really fast, then I try to use the bindings, but I never spend much time on this and go directly to the underlying app module.
    -Anton

Maybe you are looking for