DefaultMutableTreeNode.getChildCount() in dynamic trees

My situation is the following:
i have written an applet, which displayes a forum-structure in a tree.
i create an instance of a DefaultTreeModel with a root-node without children. then i update this note via network. this way it gets new children. they're all added and displayed correctly in the gui.
in the main class, which owns the treeModel as public and the tree itself as a private element, i can access the getChildCount() method on nodes and the model correctly.
now the problem:
i have inherited my own class from DefaultMutableTreeNode, to easily perform the update. if i now temporary create an instance of it and call getChildCount (from the node or the model), it always returns 0, even if the node HAS children. i also tried to call getFirstChild and catch the exception, but this also doesn't work.
this way all postings for this node are downloaded and added (correctly), but the getChildCount in the main class (in a Tree-Selection-Listener) doesn't change. it returns the initially correct value, but not the current one.
please help me fast!
gratefully
Patric Schenke

yes, i call the super-methods! (the only super-methods i overwrite are the constructors)
i need the own implementation to let the nodes update theirselves, rather than updating them form the main class.

Similar Messages

  • Dynamic tree UI element in the view

    Dear All,
         Can anyone provide me with the code snippet for Dynamic Tree UI element in the view. I need to show the tree which should be generated dynamically.
    Thanks alot in advance!
    Points will be rewarded, Please its urgent!
    Cheers,
    Darshna.

    Hi ,
    sorry for the late reply... here is the code for onActionLoadchildren .. i am sure you wont understand this.. but lets try...
    DATA:
        element_parent  TYPE REF TO if_wd_context_element,
        lv_object_key1   type string,
        lv_object_type  type string.
    DATA:
           node_root_entry                     TYPE REF TO if_wd_context_node,
           elem_root_entry                     TYPE REF TO if_wd_context_element,
           stru_root_entry                     TYPE if_structure_view_new=>element_root_entry ,
           item_valid_from                     LIKE stru_root_entry-valid_from,
           item_plant                          LIKE stru_root_entry-plant,
           item_equi_key                       LIKE stru_root_entry-equi_key,
           item_object_key                     LIKE stru_root_entry-object_key,
           item_object_type                    TYPE string,
           item_path                           TYPE string,
           item_parent_path                    TYPE string,
          context_node                        TYPE REF TO if_wd_context_node,
           root_entry                          TYPE if_structure_view_new=>element_selected_entry.
          l_ref_componentcontroller           TYPE REF TO ig_componentcontroller.
    DATA:
         node_root_info                    TYPE REF TO if_wd_context_node,
         elem_root_info                    TYPE REF TO if_wd_context_element,
          stru_root_info                    TYPE if_structure_view_new=>element_root_info .
    DATA:
          element                            TYPE REF TO if_wd_context_element,
          node_selected_entry                TYPE REF TO if_wd_context_node,
          elem_selected_entry                TYPE REF TO if_wd_context_element.
    DATA:
          ls_hier_return      TYPE rplm_ts_struc_elements,
          lt_hier_return      TYPE TABLE OF rplm_ts_struc_elements,
          ls_hier_return_temp TYPE rplm_ts_struc_elements,
          lt_hier_return_temp TYPE TABLE OF rplm_ts_struc_elements,
          ls_hier_level       TYPE rplm_ts_hier_level,
          lt_hier_level       TYPE TABLE OF rplm_ts_hier_level,
          ls_hier_return_sort TYPE rplm_mt_ts_hier,
          lt_hier_return_sort TYPE TABLE OF rplm_mt_ts_hier.
      DATA:
           temp_hier_level TYPE if_structure_view_new=>element_hier_level,
           lt_hier_temp    TYPE TABLE OF if_structure_view_new=>element_hier_level,
           lt_temp         TYPE TABLE OF if_structure_view_new=>element_hier_level.
      DATA:
           lc_path       TYPE string,
           lv_object_key TYPE string.
      DATA:
           lv_hier_lines TYPE i.
      DATA:
          node_entries                        TYPE REF TO if_wd_context_node,
           node_sub_entries                    TYPE REF TO if_wd_context_node,
          elem_sub_entries                    TYPE REF TO if_wd_context_element,
           stru_sub_entries                    TYPE if_structure_view_new=>element_sub_entries .
      TYPES: BEGIN OF ls_hier_type,             "structure for Hierarchy table
          object(31)      TYPE c,         "Objectkey
          predecessor(31) TYPE c,         "Objectkey Predecessor
          data(2000)      TYPE c,         "Data container
          level           TYPE i,         "level of object in tree
          successors(1)   TYPE c,         "Object has successors: YES/NO/U
          display(1)      TYPE c,         "Object is displayed: YES/NO
          selected(1)     TYPE c,         "Object is selected/marked: YES/NO
          index_predec    LIKE sy-tabix,  "Index predecessor
          strno           TYPE ilom_strno,"External number for func. loc.
                                         "in BOMs used for top object
       END OF ls_hier_type.
      DATA:
           ls_hier     TYPE ls_hier_type,
           lt_hier     TYPE TABLE OF ls_hier_type WITH DEFAULT KEY,
           lt_mat_hier TYPE TABLE OF ls_hier_type WITH DEFAULT KEY.
      " For retrieving Material Data Heirarchy
      DATA:
           lh_stpo_tab     TYPE TABLE OF rihstpx ,
           lwa_stpo_tab    LIKE LINE OF lh_stpo_tab,
           check_menge     TYPE string ,
           check_meins     TYPE string ,
           lwa_mat_hier    LIKE LINE OF  lt_mat_hier ,
           lt_dup_mat_hier LIKE lt_mat_hier,
           lv_len          TYPE i,
           lv_len_temp     TYPE i .
      DATA:
           lv_equnr TYPE equi-equnr,
           lv_tplnr TYPE iflo-tplnr,
           lv_matnr TYPE mast-matnr.
      DATA:
           lv_cnt   TYPE i,
           lv_index TYPE i.
      DATA:
           lv_path        TYPE string,
           lv_parent_path TYPE string,
           pos            TYPE string,
           separator      TYPE c VALUE '.',
           max_level      TYPE i,
           temp_level     TYPE i,
           counter        TYPE i VALUE 1.
      TYPES: BEGIN OF ls_pred_type,             "structure for Hierarchy table
         parent(31)      TYPE c,         "Objectkey Predecessor
         path(2000)      TYPE c,         "Data container
         index_predec    LIKE sy-tabix,  "Index predecessor
      END OF ls_pred_type.
    DATA:
          ls_pred TYPE ls_pred_type,
          lt_pred TYPE TABLE OF ls_pred_type WITH DEFAULT KEY.
    DATA:
          lv_int_obj_key TYPE string,
          obj_len        TYPE i,
          lv_funcloc_ext TYPE ilom_strno,
          lv_funcloc     TYPE itob-tplnr.
    DATA:
          lv_level        TYPE i,
          lv_temp         TYPE i,
          lt_path_entries TYPE string_table.
    DATA:
          node_general                        TYPE REF TO if_wd_context_node,
          elem_general                        TYPE REF TO if_wd_context_element,
          stru_general                        TYPE if_structure_view_new=>element_general ,
          item_collapse_visibility            LIKE stru_general-collapse_visibility.
    DATA:
          elem_context                        TYPE REF TO if_wd_context_element,
          stru_context                        TYPE if_structure_view_new=>element_context ,
          item_expand_all                     LIKE stru_context-expand_all.
    lv_path = path.
    Get Element whose children shall be loaded
      element_parent = wd_context->path_get_element( lv_path ).
    element_parent->get_attribute(
          EXPORTING
            name =  `OBJECT_KEY`
          IMPORTING
            value = LV_object_key ).
    element_parent->get_attribute(
          EXPORTING
            name =  `OBJECT_TYPE`
          IMPORTING
            value = lv_object_type ).
    node_root_entry = wd_context->get_child_node( name = wd_this->wdctx_root_entry ).
    get element via lead selection
      elem_root_entry = node_root_entry->get_element(  ).
    get single attribute
      elem_root_entry->get_attribute(
        EXPORTING
          name =  `VALID_FROM`
        IMPORTING
          value = item_valid_from ).
      elem_root_entry->get_attribute(
          EXPORTING
            name =  `PLANT`
          IMPORTING
            value = item_plant ).
    item_object_type = lv_object_type.
    if lv_object_type eq 'EQUI'.
      item_object_key = ''.
      item_equi_key = lv_object_key.
    elseif lv_object_type eq 'FUNCLOC'.
      item_object_key = lv_object_key.
      item_equi_key = ''.
    ELSE.
      lv_matnr = lv_object_key.
    For BOM, material and Assembly
    endif.
      IF item_object_type EQ 'EQUI'.
        lv_equnr = lv_object_key.
      ELSEif item_object_type eq 'FUNCLOC'.
        lv_tplnr = lv_object_key.
      ELSE.
        LV_MATNR = lv_object_key.
        exit.
      ENDIF.
      CALL FUNCTION 'PM_HIERARCHY_CALL'
        EXPORTING
          datum             = item_valid_from
          equnr             = lv_equnr
          tplnr             = lv_tplnr
          matnr             = lv_matnr
          levdo             = '99'
          levup             = '00'
          sanin             = 'X'
          select_equi       = 'X'
          select_iflo       = 'X'
          select_stpo       = 'X'
          selmod            = 'D'
          stkkz             = ''
          werks             = item_plant
          with_equi         = 'X'
          with_equi_hier    = 'X'
          with_iflo_hier    = 'X'
          with_btyp         = 'X'
          with_mara         = 'X'
          with_ibase_hier   = ''
          capid             = ''
          emeng             = 0
        IMPORTING
          et_hier           = lt_hier
        EXCEPTIONS
          no_hierarchy      = 1
          no_object_defined = 2
          no_selection      = 3
          no_valid_equnr    = 4
          no_valid_matnr    = 5
          no_valid_selmod   = 6
          no_valid_tplnr    = 7
          OTHERS            = 8.
      LOOP AT lt_hier INTO ls_hier.
        ls_hier_return-object_key = ls_hier-object.
        ls_hier_level-object_key = ls_hier-object.
        ls_hier_level-predecessor = ls_hier-predecessor.
        lv_len = strlen( ls_hier-object ).
        IF lv_len GT 1.
          lv_len_temp = lv_len - 1.
        ELSEIF
        lv_len_temp = lv_len.
        ENDIF.
        ls_hier_level-level = ls_hier-level.
        IF ls_hier-object(1) = 'T'.
          ls_hier_return-icon = 'ICON_TECHNICAL_PLACE'.
          ls_hier_return-object_type = 'FUNCLOC'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_true.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object(1) = 'E'.
          ls_hier_return-icon = 'ICON_EQUIPMENT'.
          ls_hier_return-object_type = 'EQUI'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_true.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'M'.
          ls_hier_return-icon = 'ICON_MATERIAL'.
          ls_hier_return-object_type = 'MATERIAL'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'X'.
          ls_hier_return-icon = 'ICON_SUPPLY_AREA'.
          ls_hier_return-object_type = 'MATBOM'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'A'.
          ls_hier_return-icon = 'ICON_MATERIAL_REVISION'.
          ls_hier_return-object_type = 'MATERIAL'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ENDIF.
    *IF ls_hier-predecessor EQ item_object_key OR ls_hier-object EQ item_object_key.
        APPEND ls_hier_return TO lt_hier_return.
        APPEND ls_hier_level TO lt_hier_level.
    *ENDIF.
        CLEAR lv_len.
        CLEAR lv_len_temp.
      ENDLOOP.
    lt_hier_return_temp = lt_hier_return.
      DESCRIBE TABLE lt_hier LINES lv_hier_lines.
      IF lv_hier_lines EQ 0.
        elem_selected_entry = wd_context->path_get_element( '1.ENTRIES.1' ).
    Get children node
        elem_selected_entry->set_attribute(
        value = abap_true
        name = 'IS_LEAF' ).
      ENDIF.
    *************************************Deleting Now***********
    SORT lt_hier_level BY level DESCENDING.
      LOOP AT lt_hier_level INTO ls_hier_level.
        max_level = ls_hier_level-level.
        EXIT.
      ENDLOOP.
      SORT lt_hier_level BY level ASCENDING.
      LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 0.
        ls_hier_level-path = '1.ENTRIES.1'.
        ls_hier_level-parent_path = '1.ENTRIES.1'.
        MODIFY lt_hier_level FROM ls_hier_level.
      ENDLOOP.
    ************************New design to Generate Path and Parent path
    lv_cnt = 0.
    temp_level = 1.
    SORT lt_hier_level BY object_key ASCENDING.
    LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 1.
       lv_cnt = lv_cnt + 1.
       lv_parent_path = '1.ENTRIES.1'.
       ls_hier_level-parent_path = lv_parent_path.
       pos = lv_cnt.
       CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
       ls_hier_level-path = lv_path.
       MODIFY lt_hier_level FROM ls_hier_level.
    ENDLOOP.
    temp_level = 1.
    lv_cnt = 0.
    *********************Need to call this for each level ***************************
    WHILE temp_level LT max_level.
       CLEAR lt_pred.
       CLEAR ls_pred.
       LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ temp_level.
         ls_pred-parent = ls_hier_level-object_key.
         ls_pred-path = ls_hier_level-path.
         APPEND ls_pred TO lt_pred.
       ENDLOOP.
       SORT lt_pred BY parent.
       DELETE ADJACENT DUPLICATES FROM lt_pred.
       LOOP AT lt_pred INTO ls_pred.
         lv_cnt = 0.
         LOOP AT lt_hier_level INTO ls_hier_level WHERE predecessor EQ ls_pred-parent.
           lv_cnt = lv_cnt + 1.
           lv_parent_path = ls_pred-path.
           ls_hier_level-parent_path = lv_parent_path.
           lv_path = ''.
           pos = lv_cnt.
           CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
           ls_hier_level-path = lv_path.
           MODIFY lt_hier_level FROM ls_hier_level.
         ENDLOOP.
       ENDLOOP.
       temp_level = temp_level + 1.
    ENDWHILE.
    LOOP AT lt_hier_level INTO ls_hier_level.
       LOOP AT lt_hier_return INTO ls_hier_return.
         IF ls_hier_level-object_key = ls_hier_return-object_key.
           MOVE-CORRESPONDING ls_hier_level TO ls_hier_return.
           MODIFY lt_hier_return FROM ls_hier_return.
         ENDIF.
       ENDLOOP.
    ENDLOOP.
    SORT lt_hier_return BY path ASCENDING.
    **************************Delete the extra first character returned by PM_HIERARCHY_CALL******
      LOOP AT lt_hier_return INTO ls_hier_return.
        IF ls_hier_return-object_key(1) = 'T'.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          lv_funcloc_ext = lv_object_key.
          CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
            EXPORTING
              input  = lv_funcloc_ext
            IMPORTING
              output = lv_funcloc.
          lv_int_obj_key = lv_funcloc.
          ls_hier_return-object_key = lv_int_obj_key.
        ELSEIF ls_hier_return-object_key(1) = 'E'.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          obj_len = strlen( lv_object_key ).
          IF obj_len GE 18.
            lv_object_key = lv_object_key+0(18).
          ENDIF.
          wd_comp_controller->conv_ext_2_int(
           EXPORTING
             iv_object_key_ext =  lv_object_key            " String
             iv_object_type =   'EQUI'               " String
           IMPORTING
             ev_object_key =   lv_int_obj_key                " String
          SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
          ls_hier_return-object_key = lv_int_obj_key.
        ELSE.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          obj_len = strlen( lv_object_key ).
          IF obj_len GE 18.
            lv_object_key = lv_object_key+0(18).
          ENDIF.
          SHIFT lv_object_key LEFT DELETING LEADING '0'.
          ls_hier_return-object_key = lv_object_key.
        ENDIF.
        MODIFY lt_hier_return FROM ls_hier_return TRANSPORTING object_key object_key.
      ENDLOOP.
    LOOP AT lt_hier_level INTO ls_hier_level.
       IF ls_hier_level-object_key(1) = 'T'.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_object_key = ls_hier_level-object_key.
         lv_funcloc_ext = lv_object_key.
         CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
           EXPORTING
             input  = lv_funcloc_ext
           IMPORTING
             output = lv_funcloc.
         lv_int_obj_key = lv_funcloc.
         ls_hier_level-object_key = lv_int_obj_key.
       ELSEIF ls_hier_level-object_key(1) = 'E'.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_int_obj_key = ls_hier_level-object_key.
         obj_len = strlen( lv_int_obj_key ).
         IF obj_len GE 18.
           lv_int_obj_key = lv_int_obj_key+0(18).
         ENDIF.
         wd_comp_controller->conv_ext_2_int(
          EXPORTING
            iv_object_key_ext =  lv_int_obj_key            " String
            iv_object_type =   'EQUI'               " String
          IMPORTING
            ev_object_key =   lv_int_obj_key                " String
         SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
         ls_hier_level-object_key = lv_int_obj_key.
       ELSE.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_int_obj_key = ls_hier_level-object_key.
         obj_len = strlen( lv_int_obj_key ).
         IF obj_len GE 18.
           lv_int_obj_key = lv_int_obj_key+0(18).
         ENDIF.
         SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
         ls_hier_level-object_key = lv_int_obj_key.
       ENDIF.
       MODIFY lt_hier_level FROM ls_hier_level TRANSPORTING object_key object_key.
    ENDLOOP.
    *********************Getinfo if root node else call Get_Children_Info to generate the structure as well*******
      IF lv_path EQ '1.ENTRIES.1'.
        element = wd_context->path_get_element( lv_path ).
      navigate from <ENTRIES> to <SUB_ENTRIES> via lead selection
        node_sub_entries = element->get_child_node( name = 'SUB_ENTRIES' ).
        element->get_attribute( EXPORTING name = 'OBJECT_KEY'
                                 IMPORTING value = item_object_key ).
        element->get_attribute( EXPORTING name =  `OBJECT_TYPE`
                                IMPORTING value = item_object_type ).
    ****************Get Info of Technical Objects*************
        wd_comp_controller->get_children_info(
          EXPORTING
            iv_lt_list =     lt_hier_return           " Rplm_Tt_Mt_Struc
            iv_path = ''
            iv_hier_level  = lt_hier_level
          IMPORTING
            ev_lt_full =      lt_hier_return                   " Rplm_Tt_Mt_Struc
    Create the strcuture by binding the entries to Node which is bound to the table
    element = wd_context->path_get_element( lc_path ).
    Get children node
            node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
            CALL METHOD node_sub_entries->bind_table
              EXPORTING
                new_items            = lt_hier_return
                set_initial_elements = abap_true.
      @TODO handle not set lead selection
       IF ( node_entries IS INITIAL ).
       ENDIF.
       lv_temp = 1.
    ***************Sort the LT_HIER_TABLE appropriately ******
       LOOP AT lt_hier_return INTO ls_hier_return .
         MOVE-CORRESPONDING ls_hier_return TO ls_hier_return_sort.
         ls_hier_return_sort-path_length = strlen( ls_hier_return_sort-path ).
         APPEND ls_hier_return_sort TO lt_hier_return_sort.
       ENDLOOP.
       SORT lt_hier_return_sort BY path_length ASCENDING path ASCENDING.
       CLEAR lt_hier_return.
       LOOP AT lt_hier_return_sort INTO ls_hier_return_sort.
         MOVE-CORRESPONDING ls_hier_return_sort TO ls_hier_return.
         APPEND ls_hier_return TO lt_hier_return.
       ENDLOOP.
    *wd_comp_controller->gv_master_data = lt_hier_return.
       LOOP AT lt_hier_return INTO ls_hier_return.
         lv_path = ls_hier_return-path.
         lc_path = ls_hier_return-parent_path.
         IF lv_path NE '1.ENTRIES.1'.
           element = wd_context->path_get_element( lc_path ).
    Get children node
           node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
    Now, create the children elements
           element->get_attribute( EXPORTING name = 'OBJECT_KEY'
                                   IMPORTING value = ls_hier_level-predecessor ).
    Create the strcuture by binding the entries to Node which is bound to the table
           CALL METHOD node_sub_entries->bind_structure
             EXPORTING
               new_item             = ls_hier_return
               set_initial_elements = abap_false.
         ENDIF.
       ENDLOOP.
    Only when a new level is reached we create one more child node
    else we attach our elements to same child node
        element = wd_context->path_get_element( item_path ).
    Get children node
        element->set_attribute(
        value = abap_false
        name = 'IS_EXPANDED' ).
      ENDIF.
      navigate from <CONTEXT> to <GENERAL> via lead selection
      node_general = wd_context->get_child_node( name = wd_this->wdctx_general ).
      get element via lead selection
      elem_general = node_general->get_element(  ).
      get single attribute
      elem_general->set_attribute(
        name =  `COLLAPSE_VISIBILITY`
        value = abap_false ).
      node_selected_entry = wd_context->get_child_node( name = if_structure_view_new=>wdctx_selected_entry ).
      get element via lead selection
      elem_selected_entry = node_selected_entry->get_element(  ).
      get single attribute
      elem_selected_entry->set_attribute(
          name =  `OBJECT_KEY`
          value = '' ).
      elem_selected_entry->set_attribute(
            name =  `OBJECT_TYPE`
            value = '' ).
    get element via lead selection
      elem_context = wd_context->get_element(  ).
    get single attribute
      elem_context->set_attribute(
        name =  `EXPAND_ALL`
        value = abap_false ).
      wd_this->enable_buttons(
    endmethod.

  • How to Create a Dynamic Tree?

    Hi All.,
    Warm Greetings..!
    I am new to java. I want to create a DYNAMIC TREE to add , delete and rename nodes in it. I need to display Icon for parent nodes.
    Ex: Root Node containts Group and User. I need to display an Icon for node Group and User. and I need to add child nodes to these parent nodes. And also I want to add a new Parent node with Icon.
    Hope any body will help me. Please give some example codes.
    Thanks :)
    -s_p_s

    Class DefaultMutableTreeNode

  • How to create a dynamic tree report

    hi experts,
           i have a requirement to create a dynamic tree report in OM module.
      this report should show the number of people positions required in a org unit, and also the number of people available in a org unit.
      There is something called as qualification catalog to which qualifications are attached, to these qualifications org units are attached, these org units will have some positions attached to it, and each of this position might have a person attached to it.
    The user will enter the qualification catalog number in the selection screen for which he should be getting the result in a tree format which flows from qualification catalog to qualifications, from qualifications to org units, from orgunits to the total no of positions present in this orgunit and the no of positions occupied in the orgunit.
      This is a challenging job as far as i am concerned.
    Please suggest me a way to approach this,i promise to reward the answers.
    thanks in advance,
      santosh.

    Hi,
    Check the demo tree programs for yuor requirement?
    SAP List Tree:  SAPSIMPLE_TREE_CONTROL_DEMO
    SAP Column Tree : SAPCOLUMN_TREE_CONTROL_DEMO
    SAP Easy Tree : SAPSIMPLE_TREE_CONTROL_DEMO
    Thanks,
    Ramakrishna

  • Dynamic Tree Creation using JSP, Struts framework

    I urgently require tips/information/code snippet for creating a Dynamic Tree structure.
    Tree is the hierarchical folder structure that we see in windows operating system.
    Dynamic tree in the sense that all nodes shall be populated from database & a radio button shall be present at each node that can be selected & submitted to form.
    Tree should be done using JSP (& if required Javascript).
    I am using Struts framework .
    [email protected]

    u need to know quite a few java technologies to make archieve your dream.
    JDBC, dynamic array and JSP.
    after reading tutorial regarding to these 3 materials, you should be able to get your job done.

  • How to create dynamic tree based on BAPI

    Hi
    I am able to create dynamic tree based on flat file structure example given in SDN . But how to create the tree from BAPI directly.Also when I will be clicking on any leaf node of the tree some data related to the node will be passed to another view.
    Regards
    Ananda

    What i'm trying to do is create an organizational structure.
    Global>Region>Plant-->Corporation
    The output from the RFC is a structure containing every possible combination for orgazational hierarchy. Basically a flat table with record for every possible combinaton of Region-Plant-Corporation. This data needs to be bound to a tree structure so that we can call BW queries based on that level. For example: Give me aged inventory for the SAP corporation within the plant Berlin that is located in the Europe region.
    Now that you understand the business reason will the nodes that represent Region and Plant and corporation be non-singleton nodes or recursive? I was thinking a hierarchy of non-singleton nodes.
    I can bind these nodes to the Region - Plant - Corporation elements returned from in the flat table structure. I will probably get duplicates as a specific Region will be listed multiple times for every possible combination of the data beneath it. I'm not so concerned about that right now as I want to make sure I understand how in Web Dynpro to bind the data to the tree.
    Hopefully this makes some sense. Can you elaborate on how this may be constructed in context of the view?
    Would i create a model node for region (0..n), model node for plant (0..n), and a model node for Corporation (0..n)?
    Or does this sound totally incorrect?
    julian
    We have 3 regions over 50 plants and probably around 500 corporations.

  • Need Help Urgently ...regarding Dynamic Tree

    Hi Friends ,
    I want to display Dynamic Tree . Please see T code
    pposa . You can see Organization tree on click of Org str . I want replicate same over WebDynpro .
    I feel I have to use Dynamic programming for the same ? Am I correct ? Is there any other mean to replicate that tree over webDynpro ?
    Now I am refering WDR_TEST_EVENTS and View TREE_STATIC_DYNLOAD . I feel it addresses my requirement . Now ON_LOAD_CHILDREN I am writing following code
    data:
        new_node_name       type string,
        guid                type guid_32,
        lr_context_node     type ref to if_wd_context_node,
        lr_new_context_node type ref to if_wd_context_node,
        lr_node_info        type ref to if_wd_context_node_info,
        lt_attributes       type wdr_context_attr_info_map,
        attribute           like line of lt_attributes,
        lt_context_nodes    type wdr_context_child_map,
        data_source_path    type string,
        text_path           type string,
        expanded_path       type string,
        objid_path          type string,
        lr_tree_node_type   type ref to cl_wd_tree_node_type.
    check, if the context node has already a child node
      lt_context_nodes = context_element->get_child_nodes( ).
      if lt_context_nodes[] is initial.
        call function 'GUID_CREATE'
          importing
            ev_guid_32 = guid.
        new_node_name = guid.
        translate new_node_name to upper case.                "#EC SYNTCHAR
        concatenate 'G' new_node_name into new_node_name. "guids might start with a number
    attribute-name      = 'STEXT'.
        attribute-type_name = 'STRING'.
        insert attribute into table lt_attributes.
        attribute-name      = 'OBJID'.
        attribute-type_name = 'STRING'.
        insert attribute into table lt_attributes.
        attribute-name      = 'EXPANDED'.
        attribute-type_name = 'WDY_BOOLEAN'.
        insert attribute into table lt_attributes.
        lr_context_node  = context_element->get_node( ).
        lr_node_info     = lr_context_node->get_node_info( ).
        lr_node_info->add_new_child_node(
          supply_method                = 'SUPPLY_ORG'
          supply_object                = me
          name                         = new_node_name
          is_mandatory                 = abap_false
          is_mandatory_selection       = abap_false
          is_multiple                  = abap_true
          is_multiple_selection        = abap_true
          is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
          attributes                   = lt_attributes ).
        lr_new_context_node = context_element->get_child_node( new_node_name ).
        data_source_path = lr_new_context_node->get_meta_path( withoutcontroller = abap_true ).
        concatenate data_source_path '.STEXT' into text_path.
        concatenate data_source_path '.OBJID' into objid_path.
        concatenate data_source_path '.EXPANDED' into expanded_path.
        lr_tree_node_type = cl_wd_tree_node_type=>new_tree_node_type(
                              bind_data_source = data_source_path
                              bind_text        = text_path
                              bind_expanded    = expanded_path
                              on_load_children = 'ON_LOAD_CHILDREN'
                              view             = wd_this->m_tree->view ).
        wd_this->m_tree->add_node_type( lr_tree_node_type ).
      endif.
    Please note my context str is as follows .
    Org_tree (1..1  , lead initiallizatiion flag set )
    |-------Node_Org_Unit (0...n )  (  With supply function  )
                 |________________STEXT
                 |________________EXPANDED
                 |________________HROBJID
    Am I correct ?
    I am getting dump as
    The following error text was processed in the system DJA : Der Parameter PATH enthält einen ungültigen Wert .
    The error occurred on the application server q4inpusy007_DJA_01 and in the work process 1 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: ONACTIONON_LOAD_CHILDREN of program /1BCWDY/0V6J0XAP77D0N0LEA1QL==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/0V6J0XAP77D0N0LEA1QL==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
    Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP
    Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
    Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
    Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP
    Please help me .
    Points will awarded .
    Cheers
    Parry

    Another possible option is to show a dialog with no OK button. If you hold a reference to it, you can discard the dialog when the operation is complete.

  • Custom.xss and dynamic tree

    I am updating custom.xss in R12 OA_HTML/cabo/styles to change the colors and fonts for the configurator runtime look and feel. I am running into a problem .. oracle is using images ( and not colors ) for the bottom part and the border of dynamic tree / side menu .. how do I change these images ? is it possible to change these using styles ??
    urgent response would be really reappreciated. !!

    Images are in /OA_MEDIA directory. In jedv they are in your home directory under myhtml.

  • Create dynamic tree using swings

    how can i create dynamic tree ,the tree nodes are the folders in my c drive?
    thanks in advance

    to be honest, your question has been asked countless times already.
    use the 'search forums' box at left. some possible keywords
    JTree explorer files
    you should find plenty of sample code.

  • A dynamic tree question

    i have found some example about how to create dynamic trees... and also found and example wich is similiar to my case on how to Building a hierarchical tree from recursive tables(Frank Nimphius' Blogbuster)....
    i have a answer.... i want for the same example to hve on the right of the tree a form in wich i can add the eleemtn in the tree.... so i need a form to add element , and three buttons to add , delet, and save elements from the forms, in the moment they are deleted from forms are also deleted from tree....
    can anyone pls give me and idea how to do this :):) or there is any similiar example with this case..
    thanks in advance !

    i have found some example about how to create dynamic trees... and also found and example wich is similiar to my case on how to Building a hierarchical tree from recursive tables(Frank Nimphius' Blogbuster)....
    i have a answer.... i want for the same example to hve on the right of the tree a form in wich i can add the eleemtn in the tree.... so i need a form to add element , and three buttons to add , delet, and save elements from the forms, in the moment they are deleted from forms are also deleted from tree....
    can anyone pls give me and idea how to do this :):) or there is any similiar example with this case..
    thanks in advance !

  • Dynamic Tree and TreeNode Issue

    I am using JSC2 (060120) on Win2K pro, exporting the WAR and running in JBoss 4.0.3 running under JDK 1.5.0_04.
    I am trying to dynamically build a tree as the user clicks on nodes and am not having success following the example at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/sitemaptree.html
    When I attempt to add the child nodes directly to nodes via clickedNode.getChildren().add(myNewNode); I get an error as follows:
    10:17:29,260 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.el.ReferenceSyntaxException: AP-1030Child.id
    at com.sun.faces.application.ApplicationImpl.checkSyntax(ApplicationImpl.java:749)
    at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:291)
    The ID shown AP-1030Child.id does not exist, my to be parent node is named AP-1030 and my to be child is named AP-1030-Bottom.
    The only way I can get the Tree to build properly is to add the to be child (AP-1030-Bottom) to the Tree itself and then assign it's parent as the node (AP-1030). But, the problem I run into then is the next time the parent node (AP-1030) is clicked parent.getChildCount() or parent.getChildren().size() both evaluate to zero and I attempt to build the children for the node at which point the code blows up due to duplicate naming.
    Has anyone else experienced this? Am I doing something wrong?
    Here is the code I use to build my tree initially on the SessionBean...
    for(int i = 0; i < count; i++)
    TreeNode newNode = new TreeNode();
    newNode.setId("AP-" + pages.pageId);
    newNode.setText(pages[i].page);
    newNode.setImageURL("/resources/tree_document.gif");
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.treeNode_action}", null);
    newNode.setAction(nodeMethodBinding);
    this.applicationPagesTree.getChildren().add(newNode);
    Here is the code I am using to add the child nodes to the clicked node...
         for(int l = 0; l < locationsCount; l++) {                               
              TreeNode locationNode = new TreeNode();
    String sectionText = "";
              (populate sectionText with Top|Left|Center|Right|Bottom based on data)
              locationNode.setText(sectionText);
              // making unique name for this object in the tree: parentname + section
    locationNode.setId(searchID + "-" + sectionText);
    locationNode.setImageURL("/resources/tree_document.gif");
              // bind to method for the page sections click
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.locationNode_action}", null);           locationNode.setAction(nodeMethodBinding);
              // adding to the base tree object after the parent (why can I just not add to the node?)
              this.treeList.getChildren().add(insertIndex + l, locationNode);
              // this nudges the node over one, otherwise it is peer to the parent (again, why not just add to the parent?)
    locationNode.setParent(node);
    Why is it I can get the String ID from the tree and not the object? Wouldn't it make sense to give me the TreeNode instead of it's ID when calling getCookieSelectedTreeNode()? This would seem a more proper object orientated approach.
    Any help appreciated, thanks.

    Thanks,
    I have tried pretty much that exact same code and it does not work for some reason. That code is the same as the example I showed that I followed originally.
    The only way I can get it to work is as I showed. When I do the node creation and then add to the node in the tree it blows up while rendering with the message from the original post.

  • How to create dynamic tree component

    I am using netbeans 5.5 and visual web pack to develop my jsf application.
    I want to add a tree component that will be tied to a table with following columns:
    id,parent_id,name
    Actually the table stores data in tree structure with parent_id storing the parent of the row.
    So a row with parent_id = 0 will be the root nodes of the tree.
    When ever any root node is selected i want to fetch its children from the database and populate then as children of that parent node.
    The tree can go to any depth so i want to make my tree component dynamic enough to handle this requirement.
    How can i accomplish this.
    I just want to add listerner for the plus sign of every node so that when the plus sign of that node is clicked i just want to get the id of the corresponding node.

    What i'm trying to do is create an organizational structure.
    Global>Region>Plant-->Corporation
    The output from the RFC is a structure containing every possible combination for orgazational hierarchy. Basically a flat table with record for every possible combinaton of Region-Plant-Corporation. This data needs to be bound to a tree structure so that we can call BW queries based on that level. For example: Give me aged inventory for the SAP corporation within the plant Berlin that is located in the Europe region.
    Now that you understand the business reason will the nodes that represent Region and Plant and corporation be non-singleton nodes or recursive? I was thinking a hierarchy of non-singleton nodes.
    I can bind these nodes to the Region - Plant - Corporation elements returned from in the flat table structure. I will probably get duplicates as a specific Region will be listed multiple times for every possible combination of the data beneath it. I'm not so concerned about that right now as I want to make sure I understand how in Web Dynpro to bind the data to the tree.
    Hopefully this makes some sense. Can you elaborate on how this may be constructed in context of the view?
    Would i create a model node for region (0..n), model node for plant (0..n), and a model node for Corporation (0..n)?
    Or does this sound totally incorrect?
    julian
    We have 3 regions over 50 plants and probably around 500 corporations.

  • Dynamical Tree handling multiple requests

    Hi,
    I think I already explained well my need. I currently have an
    implementation of a tree control that is dynamic. So, when I click
    to open a node, it sends a request to server to ask for its
    children.
    Attached you have my tree code.
    And here is a sample feedback I have from server in XML:
    <response>
    <status>OK</status>
    <message/>
    <data>
    <item id="3" type="folder" label="Item 1.1"
    isBranch="true"/>
    <item id="4" type="folder" label="Item 1.2"
    isBranch="false"/>
    </data>
    </response>
    The problem is that if I the user clicks too fast to open two
    branches, only the last request is added. THe other request is
    lost, but its node keeps the down arrow. If I try to close it then,
    it crashes the app.
    My question is how do I make this code able to work with
    simultaneous requests? I already tried via AsyncToken without
    success. The main problem using tokens is how to pick the selected
    item then. =\
    Thanks in advance,
    Best regards,
    Guilherme Blanco

    Zoram wrote:
    So can u kindly advice me where should I use Servlets here in my application in order to overcome the problem.Dude, you need to study struts as well. There is an underlying servlet handling all the requests, and based on action name it decides which action class it needs to call. All this is done behind the scenes what you as a developer do is write your logic in the Action class (or may be call some services from it). So it would be easier for us, if you can share the code where you have written the logic as well your Action class code.

  • Dynamic tree selected node property id issue...

    hi -
    I'm successfully building a two-tier tree dynamically, but when a node is selected, it isn't consistently giving the correct property id for that node... sometimes it's correct, sometimes it's null, sometimes I have to select the node twice to get a value, or it shows the value from the previous selected node...
    I've tried tree1.getSelected() and tree1.getCookieSelectedTreeNode() but it's still the same result... it acts as though the cookie isn't getting updated each time... I've tried it with and without setting 'immediate' with the same result... below is the relevant part of my code... does anyone see why it's not getting the selected property id each time? help and suggestions welcome... Thanks
    try {
    java.util.List newNodeChildren = newNode.getChildren();
    while (srs.next()){
    TreeNode newNode2 = new TreeNode();
    newNode2.setTarget("_blank");
    newNode2.setText(srs.getString( "issue_title"));
    newNode2.setId("x" + issue_id);
    //Setup action event
    Hyperlink nodelink = new Hyperlink();
    nodelink.setText(newNode2.getText());
    nodelink.setId(newNode2.getId());
    Class[] signatures = {ActionEvent.class};
    MethodBinding mb1 = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page2.treeNodeActionListener}", signatures);
    nodelink.setActionListener(mb1);
    newNode2.getFacets().put(newNode2.CONTENT_FACET_KEY, nodelink);
    newNodeChildren.add(newNode2);
    srs.release();
    } catch(SQLException ex) {
    / error("SQL Error StatusTree Retrieval: " + ex);
    public void treeNodeActionListener(ActionEvent event) {
    String id = tree1.getCookieSelectedTreeNode();
    String actualId = id.substring(id.lastIndexOf(":")+2);
    info("treeNodeActionListener actualId = " + actualId);
    }

    Hi,
    1 I dropped Tree component from Palette. I deleted TreeNode1.
    <ui:tree binding="#{Navigator.tree1}" expandOnSelect="false" id="tree1" immediate="true" style="left: 0px; top: 0px; position: absolute" text="Sometext"/>
    2 In the init() method I called paintTree()
    It works fine.
    I use action method because I need only the id of selected node but I tested also listener method and it works
    Here is my code
    public void paintTree(){
    ArrayList conturi=new ArrayList();
    TreeNode nodN1 = new TreeNode();
    TreeNode nodN2 = new TreeNode();
    TreeNode nodN3 = new TreeNode();
    TreeNode nodN9 = new TreeNode();
    String Id;
    int lga=0;
    int lgc=0;
    try {
    conturi=getSessionBean1().getSes01FacadeRemoteClient1().getMyEjbMethod();
    } catch (Exception ex) {
    log(".....", ex);
    Iterator iterator=conturi.iterator();
    while (iterator.hasNext()) {
    detalii.Conturi cont=(detalii.Conturi)iterator.next();
    lgc=cont.getConts().length();
    if (lga < lgc) {
    if (lgc == 1) {
    nodN1=new TreeNode();
    Id= "Node_"+cont.getId();
    nodN1.setId(Id);
    nodN1.setText(cont.getDenumire());
    tree1.getChildren().add(nodN1);
    if (lgc == 2){
    nodN2=new TreeNode();
    Id= "Node_"+cont.getId();
    nodN2.setId(Id);
    nodN2.setText(cont.getConts()+"-"+cont.getDenumire());
    nodN2.setStyleClass("leftAligned");
    nodN1.getChildren().add(nodN2);
    if (lgc == 3){
    nodN3=new TreeNode();
    Id= "Node_"+cont.getId();
    nodN3.setId(Id);
    nodN3.setText(cont.getConts());
    nodN3.setStyleClass("leftAligned");
    FacesContext context=FacesContext.getCurrentInstance();
    MethodBinding mb1 = context.getApplication().createMethodBinding("#{Navigator.treeNode_action}", null);
    nodN3.setAction(mb1);
    nodN2.getChildren().add(nodN3);
    } //end-if
    } //end while
    public String treeNode_action() {
    try {
    clientId=tree1.getCookieSelectedTreeNode();
    String id =clientId.substring(clientId.lastIndexOf("_")+1);
    getSessionBean1().setContId(id);
    info("clientId = "+ clientId);
    } catch (Exception ex) {
    log("Error Description", ex);
    return null;
    }

  • To Create a Dynamic Tree

    Grant,
    How to generate a Tree in Oracle 11g Dynamically.
    Thanks & Regards,
    Srikanth Reddy

    What do you mean with 11g of Oracle. There is no 11g of Oracle Forms (which is the forum you posted this question in). Do you mean Oracle Forms 9 or 10?
    If so have a search in this forum and in the help files. You will find examples and hints and tips on how to do it.
    A general advice about using a forum like this is to show at least a little effort before you post a question. Very few people will take the time to show you from scratch how to do something that is described in the general documentation if you have not even read it and tried yourself first.

Maybe you are looking for

  • Anchored frame that is run-around AND protrudes into margin?

    Hi, FM 8.04, Win XP. Is it in any way possible to create a small anchored frame (let's say 10 x 10 mm) that is run-around AND protrudes 1 or 2 mm into the left margin? I need it for drop caps and have managed everything except the protrusion into the

  • Playing not selected music in iTunes 9

    Hi all! I imported complete albums in iTunes. Because I do not want to hear the complete album on the go I selected/acitvated some title. The sync parameters for the iPhone are set to "only selected/activated titles". At home I'd like to hear the com

  • Contact form randomly appears out of position

    Every once and a while, my contact form appears out of position. It is placed over a rectangle and yes, it is grouped with that rectangle. Every so often, I will load the live page in my browser and the contact form appears not where I placed it but

  • Project info setting vs. preference setting--which wins?

    I just noticed for the first time after burning hundreds and hundreds of discs that my project info setting was on best performance not best quality. As this project is more that 65 minutes plus menus, I chose best quality in preferences. But my proj

  • Does HP Office Jet Pro 8610 Support Adobe .PDF Files?

    Greetings, I'm thinking of upgrading from an HP Photosmart Premium C309g-m All-In-One to an HP Office Jet Pro 8610 All-in-One.  I was able to create and use .pdf files on the C309g-m.  I have Adobe Reader on my computer.  Will I be able to do the sam