Editing in Tree....

Hi group,
In my tree I am setting in setCellRenderer method like
mytree.setCellRenderer(new CellRend());
In CellRend class:which extends DefaultTreeCellRenderer.
in that getTreeCellRendererComponent()... I write like..
public java.awt.Component getTreeCellRendererComponent(
     javax.swing.JTree tree,
     Object value,
     boolean sel,
     boolean expanded,
     boolean leaf,
     int w,
     boolean hasFocus) {
     setOpenIcon(new ImageIcon("open.gif"));
     setClosedIcon(new ImageIcon("closed.jpg"));
     java.awt.Component compo = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, w, hasFocus);
     javax.swing.tree.DefaultMutableTreeNode node = (javax.swing.tree.DefaultMutableTreeNode)value;
     if(node.toString().equalsIgnoreCase("House"))
          tree.setEditable(false);
     else
          tree.setEditable(true);
     return compo;
in my tree I have "House" node out of 10 nodes.
I don't want to edit that particular "House" node.
But as per my code it is editing why?
Is any possible solution not to edit that "House" node.?
Shalinipriya.

if you call tree.setEditable(true) (or false) this changes the editing option for the entire tree, not just the current node. And the tree cell renderer gets called for all the nodes... So here's what is happening in your code:
Let us assume that node 7 is your "House" node...
The tree starts to render the nodes... it calls getTreeCellRendererComponent() for nodes 1 to 6, and each time, the expression (node.toString().equalsIgnoreCase("House")) is false, so it does: tree.setEditable(true). OK - now it gets to node 7, and (node.toString().equalsIgnoreCase("House")) is now true, so it does tree.setEditable(false) - making the entire tree not editable. Finally, it renders nodes 8, 9 & 10, where (node.toString().equalsIgnoreCase("House")) is false again, so it does: tree.setEditable(true), so when it has finished rendering, the entire tree is editable.
That's why it doesn't work. Now, I don't know if you can directlly make only one single node editable or not editable (unless someone else knows different??) One workaround would be to add a listener, and if the user tries to edit your House node, pop up a message telling them not to, or just silently change its value back to House after they have finished (That'll frustrate the hell out of 'em ;-)

Similar Messages

  • Editable ALV Tree

    Hello All,
    I am trying to make an Editable ALV tree ..but cannot find the
    I have used fieldcat -edit = X but it only works for GRID ALV and not TREE ALV ...
    Please help me on this .....
    Edited by: Karan Chopra on Aug 2, 2010 1:11 PM

    Hi Karan
    CL_GUI_ALV_TREE is only a display tool.
    It has not a feature for editable data unfortunately.
    I was used a popup input screen on cell "double click" event to change the data in a cell
    in one of my projects.
    Maybe it can be a solution for u .

  • Add/Edit/Delete Tree Nodes using CL_GUI_ALV_TREE

    Hi All,
    I am looking for an example of program with CL_GUI_ALV_TREE that have a functionality of add a tree node, edit a tree node, and delete a tree node.
    I have already looked the BCALV_TREE* demo program but could not able to find a program to add/edit/delete node tree elements.
    Any info on this.
    Thanks
    aRs

    Hello aRs
    Here is a sample report showing how to delete nodes in an ALV tree. The report was copied from BCALV_TREE_01. Search for added code:
    *$ADDED: begin
    *$ADDED: end[/code]
    When you display the tree expand the first folder completely. When entering 'DELETE' into the command field directly the first flight date node will be deleted.
    REPORT ZUS_SDN_BCALV_TREE_01_DELNODE.
    based on: REPORT  bcalv_tree_01.
    Purpose:
    ~~~~~~~~
    This report shows the essential steps to build up a hierarchy
    using an ALV Tree Control (class CL_GUI_ALV_TREE).
    Note that it is not possible to build up this hierarchy
    using a simple ALV Tree Control (class CL_GUI_ALV_TREE_SIMPLE).
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Start this report. The hierarchy tree consists of nodes for each
    month on top level (this level can not be build by a simple ALV Tree
    because there is no field for months in our output table SFLIGHT.
    Thus, you can not define this hierarchy by sorting).
    Nor initial calculations neither a special layout has been applied
    (the lines on the right do not show anything).
    Note also that this example does not build up and change the
    fieldcatalog of the output table. For this reason, all fields
    of the output table are shown in the columns although the fields
    CARRID and FLDATE are already placed in the tree on the left.
    (Of course, this is not a good style. See BCALV_TREE_02 on how to
    hide columns).
    Essential steps (Search for '§')
    ~~~~~~~~~~~~~~~
    1.Usual steps when using control technology.
       1a. Define reference variables.
       1b. Create ALV Tree Control and corresponding container.
    2.Create Hierarchy-header
    3.Create empty Tree Control
    4.Create hierarchy (nodes and leaves)
       4a. Select data
       4b. Sort output table according to your conceived hierarchy
       4c. Add data to tree
    5.Send data to frontend.
    6.Call dispatch to process toolbar functions
    *$ADDED: begin
    DATA:
      gd_del_nkey      TYPE lvc_nkey.
    *$ADDED: end
    §1a. Define reference variables
    DATA: g_alv_tree         TYPE REF TO cl_gui_alv_tree,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: gt_sflight      TYPE sflight OCCURS 0,      "Output-Table
          ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm,           "OK-Code
          g_max TYPE i VALUE 255.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  PBO  OUTPUT
          process before output
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAINTITLE'.
      IF g_alv_tree IS INITIAL.
        PERFORM init_tree.
        CALL METHOD cl_gui_cfw=>flush
          EXCEPTIONS
            cntl_system_error = 1
            cntl_error        = 2.
        IF sy-subrc NE 0.
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = 'Automation Queue failure'(801)
              txt1  = 'Internal error:'(802)
              txt2  = 'A method in the automation queue'(803)
              txt3  = 'caused a failure.'(804).
        ENDIF.
      ENDIF.
    ENDMODULE.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
          process after input
    MODULE pai INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'EXIT' OR 'BACK' OR 'CANC'.
          PERFORM exit_program.
    *$ADDED: begin
        WHEN 'DELETE'.
          CALL METHOD g_alv_tree->delete_subtree
            EXPORTING
              i_node_key                = gd_del_nkey
             I_UPDATE_PARENTS_EXPANDER = SPACE
              i_update_parents_folder   = 'X'
            EXCEPTIONS
              node_key_not_in_model     = 1
              OTHERS                    = 2.
          IF sy-subrc <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CALL METHOD g_alv_tree->frontend_update.
    *$ADDED: end
        WHEN OTHERS.
    §6. Call dispatch to process toolbar functions
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      CALL METHOD cl_gui_cfw=>flush.
    ENDMODULE.                             " PAI  INPUT
    *&      Form  init_tree
          text
    -->  p1        text
    <--  p2        text
    FORM init_tree.
    §1b. Create ALV Tree Control and corresponding Container.
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c.
      l_tree_container_name = 'CCONTAINER1'.
      CREATE OBJECT g_custom_container
         EXPORTING
               container_name = l_tree_container_name
         EXCEPTIONS
               cntl_error                  = 1
               cntl_system_error           = 2
               create_error                = 3
               lifetime_error              = 4
               lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'(100).
      ENDIF.
    create tree control
      CREATE OBJECT g_alv_tree
        EXPORTING
            parent              = g_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = 'X'
            no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    §2. Create Hierarchy-header
    The simple ALV Tree uses the text of the fields which were used
    for sorting to define this header. When you use
    the 'normal' ALV Tree the hierarchy is build up freely
    by the programmer this is not possible, so he has to define it
    himself.
      DATA l_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
    §3. Create empty Tree Control
    IMPORTANT: Table 'gt_sflight' must be empty. Do not change this table
    (even after this method call). You can change data of your table
    by calling methods of CL_GUI_ALV_TREE.
    Furthermore, the output table 'gt_outtab' must be global and can
    only be used for one ALV Tree Control.
      CALL METHOD g_alv_tree->set_table_for_first_display
        EXPORTING
          i_structure_name    = 'SFLIGHT'
          is_hierarchy_header = l_hierarchy_header
        CHANGING
          it_outtab           = gt_sflight. "table must be empty !
    §4. Create hierarchy (nodes and leaves)
      PERFORM create_hierarchy.
    §5. Send data to frontend.
      CALL METHOD g_alv_tree->frontend_update.
    wait for automatic flush at end of pbo
    ENDFORM.                               " init_tree
    *&      Form  build_hierarchy_header
          build hierarchy-header-information
         -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Month/Carrier/Date'(300).
      p_hierarchy_header-tooltip = 'Flights in a month'(400).
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ' '.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  exit_program
          free object and leave program
    FORM exit_program.
      CALL METHOD g_custom_container->free.
      LEAVE PROGRAM.
    ENDFORM.                               " exit_program
    *&      Form  create_hierarchy
          text
    -->  p1        text
    <--  p2        text
    FORM create_hierarchy.
      DATA: ls_sflight TYPE sflight,
            lt_sflight TYPE sflight OCCURS 0,
            l_yyyymm(6) TYPE c,            "year and month of sflight-fldate
            l_yyyymm_last(6) TYPE c,
            l_carrid LIKE sflight-carrid,
            l_carrid_last LIKE sflight-carrid.
      DATA: l_month_key TYPE lvc_nkey,
            l_carrid_key TYPE lvc_nkey,
            l_last_key TYPE lvc_nkey.
    §4a. Select data
      SELECT * FROM sflight INTO TABLE lt_sflight UP TO g_max ROWS.
    §4b. Sort output table according to your conceived hierarchy
    We sort in this order:
       year and month (top level nodes, yyyymm of DATS)
         carrier id (next level)
            day of month (leaves, dd of DATS)
      SORT lt_sflight BY fldate0(6) carrid fldate6(2).
    Note: The top level nodes do not correspond to a field of the
    output table. Instead we use data of the table to invent another
    hierarchy level above the levels that can be build by sorting.
    §4c. Add data to tree
      LOOP AT lt_sflight INTO ls_sflight.
    Prerequesite: The table is sorted.
    You add a node everytime the values of a sorted field changes.
    Finally, the complete line is added as a leaf below the last
    node.
        l_yyyymm = ls_sflight-fldate+0(6).
        l_carrid = ls_sflight-carrid.
    Top level nodes:
        IF l_yyyymm <> l_yyyymm_last.      "on change of l_yyyymm
          l_yyyymm_last = l_yyyymm.
    *Providing no key means that the node is added on top level:
          PERFORM add_month USING    l_yyyymm
                                 CHANGING l_month_key.
    The month changed, thus, there is no predecessor carrier
          CLEAR l_carrid_last.
        ENDIF.
    Carrier nodes:
    (always inserted as child of the last month
    which is identified by 'l_month_key')
        IF l_carrid <> l_carrid_last.      "on change of l_carrid
          l_carrid_last = l_carrid.
          PERFORM add_carrid_line USING    ls_sflight
                                           l_month_key
                                  CHANGING l_carrid_key.
        ENDIF.
    Leaf:
    (always inserted as child of the last carrier
    which is identified by 'l_carrid_key')
        PERFORM add_complete_line USING  ls_sflight
                                         l_carrid_key
                                CHANGING l_last_key.
      ENDLOOP.
    ENDFORM.                               " create_hierarchy
    *&      Form  add_month
    FORM add_month  USING     p_yyyymm TYPE c
                              p_relat_key TYPE lvc_nkey
                    CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight,
            l_month(15) TYPE c.            "output string for month
    get month name for node text
      PERFORM get_month USING p_yyyymm
                        CHANGING l_month.
      l_node_text = l_month.
    add node:
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
    the leaf gets a child and thus ALV converts it to a folder
    automatically.
      CALL METHOD g_alv_tree->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_month
    FORM add_carrid_line USING     ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight.
    add node
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
    the leaf gets a child and thus ALV converts it to a folder
    automatically.
      l_node_text =  ps_sflight-carrid.
      CALL METHOD g_alv_tree->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_carrid_line
    *&      Form  add_complete_line
    FORM add_complete_line USING   ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
      WRITE ps_sflight-fldate TO l_node_text MM/DD/YYYY.
    add leaf:
    ALV Tree firstly inserts this node as a leaf if you do not provide
    IS_NODE_LAYOUT with field ISFOLDER set.
    Since these nodes will never get children they stay leaves
    (as intended).
      CALL METHOD g_alv_tree->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = ps_sflight
          i_node_text      = l_node_text
        IMPORTING
          e_new_node_key   = p_node_key.
    *$ADDED: begin
      IF ( ps_sflight-fldate = '20040522' ).  " first flight date
        IF ( gd_del_nkey IS INITIAL ).  " collect only first date
          gd_del_nkey = p_node_key.
        ENDIF.
      ENDIF.
    *$ADDED: end
    ENDFORM.                               " add_complete_line
    *&      Form  GET_MONTH
          text
         -->P_P_YYYYMM  text
         <--P_L_MONTH  text
    FORM get_month USING    p_yyyymm
                   CHANGING p_month.
    Returns the name of month according to the digits in p_yyyymm
      DATA: l_monthdigits(2) TYPE c.
      l_monthdigits = p_yyyymm+4(2).
      CASE l_monthdigits.
        WHEN '01'.
          p_month = 'January'(701).
        WHEN '02'.
          p_month = 'February'(702).
        WHEN '03'.
          p_month = 'March'(703).
        WHEN '04'.
          p_month = 'April'(704).
        WHEN '05'.
          p_month = 'May'(705).
        WHEN '06'.
          p_month = 'June'(706).
        WHEN '07'.
          p_month = 'July'(707).
        WHEN '08'.
          p_month = 'August'(708).
        WHEN '09'.
          p_month = 'September'(709).
        WHEN '10'.
          p_month = 'October'(710).
        WHEN '11'.
          p_month = 'November'(711).
        WHEN '12'.
          p_month = 'December'(712).
      ENDCASE.
      CONCATENATE p_yyyymm+0(4) '->' p_month INTO p_month.
    ENDFORM.                               " GET_MONTH
    /code
    Regards
      Uwe

  • Editable Recursive Tree

    hi evreyone
    I need to create an editable tree based on (one table called Locations)
    this is the structure of this table
    LocationNo
    LocationName
    ParentLocationNo
    LocationNo and ParentLocationNo are Forign keys
    according to what I've red I should use a recursive tree (Self-Reference forign key)
    using a view that represent the tree (nodes & branches)
    how can I create this tree (with Details Steps) ?
    I am using
    Jdeveloper 11.1.1.2.0
    JHeadstart 11.1.1.2.29
    thanks

    hi
    According to chapter 5 "Creating Tree Layouts", 5.7.4 "Variation: Recursive Tree"
    I've created a Recursive Tree based on table call (Location)
    but the problem is how can I refresh the data ... I mean .. How can I See the new record that I've
    created in the same tree without moving in it (to make a refresh)
    thanks

  • EDIT ALV TREE

    Hi all,
    I followed SAP example program to create 'COLUMN structure ALV tree' to diaplay and i have to make some of the fields as editable and get back the changed values in the internal table.Here i did not use field catalog at all.
    I used  gui_custom_container,cl_gui_custom_container,cl_gui_column_tree ...and added every column to the the tree object .Built the node with two internal table(like order header & order item ) to form a tree.How should i get the changed values in the internal table when user changes values in Colums of order item node.
    Any help is appreciated.
    thanks,
    dan.

    Hello all,
    Thanks for you reponses.I was actually referring  COLUMN_TREE_CONTROL_DEMOF01,now kind of changing the code like BCALV_TREE_DEMO, BCALV_TREE_SIMPLE_DEMO .Looks like i can make the field as editable by changing the edit field in layout object.But unlike  'GRID' object this tree object is not having any method like 'check_change_data' .
    How to get back the changed/values in iternal table or by any other means.
    Any idea of getting changed values from ALV tree object would be really helpful.
    thanks,
    dan

  • Editing non-tree cells problem in JTreeTable

    Hello all,
    I've been playing around with the JTreeTable for quite a while and have a fairly good grip on it. However, I've run into a problem that involves the display of cell data in the non-tree cells.
    Assume I have a JTreeTable with one node below the root (and the root node is not displayed). Also assume I've edited some information in one of the other cells in a 5-celled JTreeTable. The JTreeTable behaves normally with regard to editing/setting the values of the table cells.
    Now, with the click of a separate button, I programmatically create a new node in the JTree. I update the JTree model with a call to nodeChanged() and nodeStructureChanged() (or I could call reload() - both seem to work).
    This successfully adds a node, but in the process clears the entire remainder of the table's cell values. If I call fireTableDataChanged(), then the display of the JTree gets all screwed up (basically what happens to the display if you add/remove nodes, but don't update the display in a JTree). Not only that, but the fireTableDataChanged() method still does not redisplay my cell information for the remainder of the table.
    I'm at a loss to figure out what's responsible for this. The tableCellRenderer seems to work just fine until I add node. Even then, the tableCellRenderer for the JTree still works until I call fireTableDataChanged().
    Any ideas?
    Thank you,
    Brion Swanson

    I use a JTreeTable and in looking at my code, I've
    noticed that I make use of treeTable.repaint() fairly
    frequently (as whenever I update my stuff).Did the treeTable.updateUI do funky things to your JTree? It does on mine if I do a programmatic node addition or removal (basically any change to the tree structure will cause treeTable.updateUI() to completely destroy the display of the tree). This is a separate issue, but I thought I'd ask anyway since you seem to have run into at least a few of the same problems I'm experiencing.
    I don't fully understand your problem<snip/>
    do you mean
    it drops all edits you have done?Yes, it drops all the edits except the one currently being "edited" (that is, the selected editable cell will not lose it's value).
    I had a problem about it dropping the edits I had
    done and I resolved them by adding key listeners
    and played with the TableCellEditor.Could you elaborate on what you did to the TableCellEditor and which object you had listening to the keys (the table? or the tree? or something else?).
    You help is greatly appreciated!
    Brion Swanson

  • Start Editing an Tree-Node programmatically

    Hello there!
    I have a JTree which the user can edit by clicking on the nodes three times. This I did setting "tree.setEditable(true);". Now i want a selected node to switch to editing-mode when the user clicks on a menu.
    So how can I programmatically start editing?
    Thanks a lot, DreamiX.

    JTree has method
    startEditingAtPath(TreePath path)
    best regards
    Stas

  • Editing a Tree Cell

    Hi All,
    I know that many questions crop up in this area; I will try to be brief.
    My class extends JTextField and implements TreeCellEditor. I defined these methods:
    1. addCellEditorListener
    2. isCellEditable
    3. getTreeCellEditorComponent
    4. shouldSelectCell
    5. getCellEditorValue
    6. cancelCellEditing
    7. stopCellEditing
    8. removeCellEditorListener
    Numbers 2,3,4 make sense to me. They seem to say "if the cell is editable, then get its editor component, and decide if the whole cell should be selected when placed into edit." These work as I expected.
    But I also observe - and do not understand - this behavior:
    1. click inside a cell to edit it
    2. type something to change its content and hit the ENTER key
    When I do this, nothing happens. That is, the text cursor remains positioned within the cell. I found this strange because before I defined my own cell editor, I am fairly certain that the default editor responded to the enter key by removing the cell from edit mode.
    Stranger still is this: if, after editing a cell, I remove focus from it, e.g., I click on another cell, the first cell reverts to its former value. This is most frustrating. In this case, unlike the enter key case, I believe that getCellEditorValue is called. My understanding is that this method gets called when an edit is viewed as complete. Hence I return the current value of the cell. Some tracing shows that I am returning the proper value. Yet the cell reverts to its original, pre-edit value.
    So I guess I have two questions:
    1. what is "normative" in the "edit cycle", i.e., how is editing customarily terminated? Related to this is the disposition of the text cursor after edit. I prefer it not to remain in the edited field.
    2. Why does losing focus after edit cause my edited field to revert to its pre-edit value?
    As always, I am grateful for whatever light you can shed on these matters.
    Cordially,
    Paul

    It is a good thing you are learning how to use the TreeCellEditor interface but if you are doing something more than just learning then I would advice you use the DefaultCellEditor class instead. also if you desire to implement your own TreeCellEditor then, take time to take a look at the source code for your DefaultCellEditor class you should see what you are doing wrong and what they did right. The source code is in "JDKdir/src.zip"
    ICE

  • Edit node name in flex tree

    I want to edit a node in flex tree. Editable property of the
    tree makes all nodes editable based on "SELECT" action . But now
    based on my custom selection I want to edit a particular node. I
    thought of custom item renderer and item editor but that applies to
    all the nodes on "SELECT" action. Please let me know how to edit
    particular nodes based on particular action.
    Ex: On click of a button i want to edit the name of node
    (Node is just text with folder icon).
    Tx..
    Flextron

    Flextron,
    I was trying to find an answer to the same issue. After
    walking through the Tree and List class a bit I came up with this.
    Here is an example where the Tree is not editable and double
    clicking a node will allow you to rename it.
    tree.addEventListener( ListEvent.ITEM_DOUBLE_CLICK,
    itemDoubleClick );
    tree.addEventListener( ListEvent.ITEM_EDIT_END, itemEditEnd
    private function itemDoubleClick( event:ListEvent=null
    ):void
    tree.editable = true;
    tree.editedItemPosition = {rowIndex:tree.selectedIndex};
    private function itemEditEnd( event:ListEvent=null ):void
    tree.editable = false;
    - Jank

  • SetFocus - Tree edit mode

    Hello guys,
    I need (again) your help!!!
    How to I set focus (select text) when the Tree Item is in
    edit mode???
    I searched in web, but I could'nt find it.
    See my code:
    =====================================================================
    editTree.mxml
    =====================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.managers.CursorManager;
    import mx.core.UIComponent;
    import mx.controls.Tree;
    import mx.controls.listClasses.IListItemRenderer;
    import mx.events.ListEvent;
    import myComponents.TreeEditor;
    private function disableEditing(event:ListEvent):void {
    if (event.rowIndex==0) {
    event.preventDefault();
    public function processData(event:ListEvent):void {
    event.preventDefault();
    tree.editedItemRenderer.data.@label =
    TreeEditor(event.currentTarget.itemEditorInstance).playlistName.text;
    tree.destroyItemEditor();
    tree.dataProvider.notifyItemUpdate(tree.editedItemRenderer);
    ]]>
    </mx:Script>
    <mx:Style>
    Tree {
    backgroundAlpha: 0;
    borderStyle: none;
    indentation: 6;
    TextInput {
    borderStyle: none;
    backgroundAlpha: 0;
    focusThickness: 1;
    </mx:Style>
    <mx:XML id="treeData" xmlns="">
    <node label="PLAYLIST" type="lists" data="MA">
    <node label="Musics" type="list" />
    <node label="My Top Musics" type="list" />
    <node label="Recently Added" type="list" />
    </node>
    </mx:XML>
    <mx:Panel width="350" height="350" title="Edit">
    <mx:Tree id="tree"
    width="200"
    height="220"
    dataProvider="{treeData}"
    labelField="@label"
    editable="true"
    itemEditor="myComponents.TreeEditor"
    itemEditBeginning="disableEditing(event);"
    itemEditEnd="processData(event);" >
    </mx:Tree>
    </mx:Panel>
    </mx:Application>
    =====================================================================
    and...
    =====================================================================
    TreeEditor.mxml
    =====================================================================
    <?xml version="1.0" encoding="iso-8859-1"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    implements="mx.managers.IFocusManagerComponent">
    <mx:Script>
    <![CDATA[
    public var newName:String;
    override public function drawFocus(isFocused:Boolean):void {
    // This method can be empty, or you can use it
    // to make a visual change to the component.
    ]]>
    </mx:Script>
    <mx:TextInput id="playlistName"
    text="{data.@label}"
    backgroundAlpha="1"
    height="18"
    change="newName=playlistName.text;" />
    </mx:VBox>
    =====================================================================
    Thanks!!!
    Kleber

    Hi there,
    You can set the navigable and mouse-navigate property to no.
    Then create a visual-attribute which you want to show when the user can't change the item.
    When you want to change the visual_attribute for the item use:
    set_item_property('<block>.<item>', VISUAL_ATTRIBUTE, '<name of attribute>'.
    when you use enabled, the field is simply grey, but with the visual attribute you can show any color you like!
    Hope this helps...

  • Editable Tree ALV

    Hi friends,
    How can I edit ALV tree .please give me inputs
    correct Inputs are rewarded
    Regards
    Rasheed

    You can implement it as below:
    FORM frm_assign_budget.
      DATA: lt_selected_nodes TYPE lvc_t_nkey,
            ls_selected_node LIKE LINE OF lt_selected_nodes.
      DATA: ls_tree LIKE LINE OF gt_tree.
    ======================================================================
    *先取得选中的预算行
    ======================================================================
      CALL METHOD g_tree->get_selected_nodes
        CHANGING
          ct_selected_nodes = lt_selected_nodes
        EXCEPTIONS
          cntl_system_error = 1
          dp_error          = 2
          failed            = 3
          OTHERS            = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      READ TABLE lt_selected_nodes INTO ls_selected_node INDEX 1.
      IF sy-subrc NE 0.
        MESSAGE 'You have not select any row'(011) TYPE 'I'.
        RETURN.
      ENDIF.
      CALL METHOD g_tree->get_outtab_line
        EXPORTING
          i_node_key     = ls_selected_node
        IMPORTING
          e_outtab_line  = ls_tree
        EXCEPTIONS
          node_not_found = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ======================================================================
    *检测选择的数据是否可进行预算分配
    ======================================================================
      IF ls_tree IS INITIAL.
        MESSAGE 'You have not select any row'(011) TYPE 'I'.
        RETURN.
      ENDIF.
      IF ls_tree-asset_class EQ ''.
        MESSAGE 'You have not select any row'(011) TYPE 'I'.
        RETURN.
      ENDIF.
      IF ls_tree-aufnr NE ''.
        MESSAGE 'The budget had been assigned cannot be edited'(012) TYPE 'I'.
        RETURN.
      ENDIF.
    ======================================================================
    *弹出输入框让用户输入预算
    ======================================================================
      DATA: lt_sval TYPE STANDARD TABLE OF sval INITIAL SIZE 0,
            ls_sval TYPE sval,
            l_returncode TYPE c,
            l_budget TYPE z01fis4111-budget.
      MOVE 'Z01FIS4111' TO ls_sval-tabname.
      MOVE 'WAERS' TO ls_sval-fieldname.
      MOVE g_waers TO ls_sval-value.
      MOVE '02' TO ls_sval-field_attr.
      APPEND ls_sval TO lt_sval.
      CLEAR ls_sval.
      MOVE 'Z01FIS4111' TO ls_sval-tabname.
      MOVE 'BUDGET' TO ls_sval-fieldname.
      APPEND ls_sval TO lt_sval.
      CALL FUNCTION 'POPUP_GET_VALUES'
        EXPORTING
          popup_title     = 'Asset Budget Assignment'(008)
        IMPORTING
          returncode      = l_returncode
        TABLES
          fields          = lt_sval
        EXCEPTIONS
          error_in_fields = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CHECK l_returncode EQ ''.
      READ TABLE lt_sval INTO ls_sval INDEX 2.
      CHECK sy-subrc EQ 0.
      MOVE ls_sval-value TO l_budget.
      CHECK l_budget GT 0.
      CALL METHOD g_tree->change_item
        EXPORTING
          i_node_key     = ls_selected_node
          i_fieldname    = 'BUDGET'
          i_data         = l_budget
        EXCEPTIONS
          node_not_found = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL METHOD g_tree->update_calculations.
      CALL METHOD g_tree->frontend_update .
    ENDFORM.

  • JTreeTable problem editing tree node

    Hi,
    Iam using the swing JTreeTable component and facing a problem. Iam displaying hierarchical data in the JTreeTable. Now I would like to provide the facility to edit a tree node. I have a TreeSelectionListener registered on the tree and a TreeModelListener registered on the DefaultTreeModel. Wheneve, I start editing a node by double clicking it the valueChanged method is called but I do not see the new value the user types in this method. I have another method setValueAt which is where I can see the new value the user has entered.
    I can set this new value to the treenode using
        node.setUserObject(newValue);However, if I do this, the next time I try to edit the same node, the editor component is painted over the tree node thus displaying an empty textfield that occupies the entire cell.
    How can I make the editor appear above the tree node with the contents loaded in it always.
    Any help is appreciated.
    cheers,
    vidyut

    You bind a mouselistener to the tree, so it has to be handled there.
    When clicking once (method should be "mouseReleased" or something, treenodes name (toString) should be .setText("");
    regards
    marco

  • Edit tree structure online

    Is it possible through flex to edit a tree structure online. Such as creating a new model, adding a sub level or deleting a level. If not then is it possible to do this through asp.net?

    What you are looking for can be found at www.pectora.com. They have an online webeditor that can do the job. However it is part of a high-end solution and could turn out to be pricey :-)
    Pectora is also part of a solution called IMMIX. It involves a CMS system called Sitecore and communicates directly with InDesign/InDesign Server.
    keep smiling
    Thomas

  • Help for Activating Editing Mode on F2 Keyboard Click for a Tree Node

    I have a Jtree with several Nodes on the Left Pane. On the Right Pane I have a nodes corresponding Screen with many properties. There is a way to change the Node Name by editing the Name Field property on the Right.
    I want to Edit the tree Node name by Clicking F2 on the selected Node, Get it in the Editable Mode, Change the name and press enter. How Do I activate this editable Mode on Click of Keyboard F2 Button.

    tree.setEditable( true );

  • How can I edit the selected tree node immediately?

    I have completed a popup menu ,which appeares when I have a mouse rightclicked event
    over the selected tree node.when I selected the popup menu item,i can edit the tree node ,but
    I feel that the tree celleditor appear slowly ,what should i do? the following is my code:
    menuItemRenameNode.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    renameNode_ActionPerformed(ae);
    void renameNode_ActionPerformed(ActionEvent ae){
    setEditable(true);
    this.getCellEditor().addCellEditorListener(new CellEditorListener(){
    public void editingCanceled(ChangeEvent e){
    CellEditor cellEditor =(CellEditor)e.getSource();
    System.out.println("editing canceled:"+cellEditor.getCellEditorValue().toString());
    protected boolean canEditImmediately(EventObject e){
    return true;
    public void editingStopped(ChangeEvent e){
    CellEditor cellEditor =(CellEditor)e.getSource();
    System.out.println("editing stopped:"+cellEditor.getCellEditorValue().toString());

    Please check the suggestions in the thread: https://forums.adobe.com/thread/692020?tstart=0
    Regards,
    | T. Ravi Kumar

Maybe you are looking for

  • What are tables in Inventory Management in SAP-MM

    Hi all, i would like to know the nemes of tables in SAP-MM Inventory Management. Plz provide me ur help. Thanks.... Bandhan

  • How to find erroneous records in PSA in BI 7.0

    In BW 3.5 if load fails for some reason like lower case or unidentified character   data is edited in PSA n loaded from there. We have an option to check for only erroneous records  in PSA separately. How can that be possible in BI 7,0 because loadin

  • Permissions on folders damaged - Finder crashes on changing

    On two upgraded Macs I find that the user home folder and various sub-folders under it have permissions messed up. All folders except some of the special, pre-defined, folders such as 'Pictures', 'Music', 'Library' etc. What shows is: UserName (Me) -

  • Windows 8 wont reset

    one day I tries to go on my computer and wanted to Google something and when i got to the start page I only 5 programs had desktop, store, Microsoft office, hp room, and hp support assistance. i did go to the search box and i only had about half of m

  • ITunes folder content ...

    Hi, My iTunes folder has many items that I don't know about.  The only one I know for sure is the iTunes Media folder where all my iTunes items are stored.  Are all these necessary ... or should I ask, where can I have detailled information for what