How to get the tree index of a child node

Hi, I am loading a tree object from an XML source file (via
an XMLListCollection)
I can find the children on the currently selected node, like:
var children:XMLList =
XMLList(myTree.selectedItem).children();
for(var i:Number=0; i < children.length(); i++) {
trace("Child Found: " + children
.@caption);
But how can I determine the tree index for each of the
children? I would like to be able to grab and save the tree index
for each child, so that I can later just to do
"myTree.selectedIndex = (saved child index) (based on some form
action the user performs). I can't find any method of determining
what the tree index for a child is, other than walking down the
tree from the parent node and counting the number of nodes till I
hit each child. Is there a simple method?

Tree is hierarchical, index is linear. I have never seen
anyone successfully use selectedIndex with Tree.
You best bet is to put an id on each node and use e4x
expression to find that node when you want.
Tracy

Similar Messages

  • How to get the column index inside a dataTable

    Hello,
    before I get staked, there are multiple threads handling familiar topics to the one I'm questioning about but none gives an anwer. If there is one, I'm propably to less skilled to see it.
    So here is my Problem: I've build a web-interface to a time-recording system. The hours worked on a certain project are displayed in a dataTable component which is generated out of a mySQL Query. Each entry (column/row) contains a inputText component to display and edit the specific value.
    Editing one of these inputText elements now fires a valueChangeEvent which reads the new value and stores it in the database. For that cause I need to know the row- and column-index of the inputText component that fired the event.
    Using the getClientId method from the valueChangeEvent I get some Information which makes it possible to calculate the row/column index. A typical clientID looks like "form_table:mainTable:0:_id14". "form_table" is the ID of the form the dataTable is in. "mainTable" is the id of the dataTable component. "0" is the row the component is in. And finally "_id14" stands for the id randomly given to the inputText component by JSF.
    My Problem is now, that though I can calculate the column out of the[i] "_id14", this calculation is hardcoded. So everytime I add a component in before the dataTable, the calculation needs to be adjusted in the code.
    The Questions:
    - How to force a sensefull id indicating a column-index for the inputText components inside the columns of a dataTable?
    - Nicer since no workaround: How to get the column-index inside the dataTable on a natural way? (e.g. out of the valueChangeEvent the specific inputText component fires)
    After some investigation here on the board and on the net I know multiple ways to get the row index, (Things like component-binding and so on) but I can't find a answer on how to get the column-index.
    Thanks to all answers and/or links to things my eyes missed while searching for one.

    ...then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
    As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
    You can manage this yourself using one of the following methods (I forget which one):
    table.convertColumnIndexToModel(int viewColumnIndex)
    table.convertColumnIndexToView(int modelColumnIndex)
    Or, you can get data from the data model directly:
    table.getModel().getValueAt(row, 0);

  • How to get the parent window in sub-child controller class in javafx?

    how to get the parent window in sub-child controller class in javafx?

    You can get the window in which a node is contained with
    Window window = node.getScene().getWindow();Depending when this is invoked, you might want to check the Scene is not null before calling getWindow().
    If the window is a stage that is owned by another window, you can get the "parent" or "owner" window with
    Window owner = null ;
    if (window instanceof Stage) {
      Stage stage = (Stage) window ;
      owner = stage.getOwner();
    }

  • How to get the column index of the selected column

    Hi All,
    I have a dynamically populated advanceddatagrid. Iam trying to edit any column of a particular row. In my as file im able to get the row index using selecteditem property. But I need to get the column Index and the updated value of the column to be passed from the as file to the java method.
    So that I can update the DB with the updated value. Can somebody help with a sample code.

    ...then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
    As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
    You can manage this yourself using one of the following methods (I forget which one):
    table.convertColumnIndexToModel(int viewColumnIndex)
    table.convertColumnIndexToView(int modelColumnIndex)
    Or, you can get data from the data model directly:
    table.getModel().getValueAt(row, 0);

  • How to get the icon type of a JTree node, very urgent

    hi,
    i need to get the type of a JTree node but don't know how. this is quite an emergency. please help. thank you all.
    -joey

    there are several icons defined in the DefaultTreeCellRenderer class, such as closedIcon, leafIcon, openIcon. i was wondering if there is any way to get the icon type of a node. thanks for your reply.
    -joey

  • How to Get the Parent Process ID from Child BPEL Process

    Hi All,
    We have a requirement to get the Parent BPEL Process ID from Child BPEL Process. One way is we can pass the Parent BPEL process ID from Parent BPEL Process to Child BPEL process. Is there any standard function available to get the Parent BPEL process ID from Child Process?
    P.S: We are using BPEL 10.1.3 Version.
    Please share any info on this.
    Thanks in Advance,
    Saravana

    Hi Saravana,
    The existing methods in 10.1.3x allow a following (a bit of a convoluted way):
    In a BPEL Java embedding activity, you can use the following code to get the parentProcessname:
    String parentInstanceId = getParentId();
    String parentProcessname = getLocator().locator.lookupInstance(parentInstanceId).getProcess().getProcessId().getProcessId();Hope this helps,
    Regards,
    Shanmu
    http://www.prshanmu.com/articles/

  • How to get the sorted Groups in Adminstration Portal

    after adding a Child Group to the parent Group the Child Groups are not sorted.So
    how to get the sorted list when any child group is added to a parent group.In
    which class we have to make the changes to get the sorted group.

    Hi  Manorama,
    1) If you have already created a portal system as mentioned in following blog
                  /people/marcel.salein/blog/2007/03/14/how-to-create-a-portal-system-for-using-it-in-visual-composer
    2) If not, then try to create the same. Do not forgot to give the Alias name .
    3) After creating a system, log on to the VC, Create one iView.
    4) Now Click on "Find Data" button from the list which you can view in right side to Visual composer screen.
    5) After clicking on "Find Data" button, it will ask for System. If you have created your system correctly and Alias name is given properly, then your mentioned Alias name is appeared in that list.
    6) Select your system Alias name and perform search.
    7) It will display all the BAPIs and RFCs in your systems.
    8) Select required BAPI and develop the VC application.
    Please let me know if you any further problems.
    Thanks,
    Prashant
    Do reward points for useful answers.

  • How to get the current tree element (node/childnode/childnode/...) ?

    Hello!
    I'm trying to create a kind of a navigation tree for my application.
    It should represent some elements of an XML structure and some other nodes for other options.
    The binding with the context is not a problem, I can create the tree up to all the levels I want to.
    The problem now is, that I don't know, how to get the "current tree element", when there is any action.
    For example:
    public void onActionSelect(...) {
    String test = wdContext.currentTreeNodeElement().getText();
    wdThis.wdGetContext().currentContextElement().setSelectedElement(test);
    With this method I can get the text of the "first level nodes". If I want to get the "second level node", I can do
    String test = wdContext.currentTreeNodeElement().currentChildElement.getText();
    ..and for the next levels so on.
    Isn't there any general method to get the information of the selected element without knowing before, whether it is a nodeElement or a nodeElement.currentChildElement or a nodeElement.currentChildElement.currentChildElement, ...?
    Greetings,
    Ramó

    Hi,
    if you following that pdf ,
    i think your not implemented the below code in DomodifyView method
    if (firstTime) {
          IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "selectedElement".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onAction event. Parameter "selectedElement" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onAction. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "element".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onLoadChildren event. Parameter "element" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onLoadChildren. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnLoadChildren().addSourceMapping("path", "element");
    please cross check once.
    Thanks,
    Ramesh

  • How to get the current slide Index or Id?

    I can get the selected slide of presentation use blow method.
    Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (asyncResult) {
    if (asyncResult.status == Office.AsyncResultStatus.Failed) {
    write('Action failed. Error: ' + asyncResult.error.message);
    else {
    write('Selected slides: ' + JSON.stringify(asyncResult.value.slides));
    But, How can I get the executor slide?

    ​Hi,
    >> How to get the current slide Index or Id?
    In my option, when you select a slide, it change to current slide. So, you could use the getSelectedDataAsync method to get the current slide, and then get the index or id by using the Slice object. You could refer the link below for Slice Object.
    # Slice.index property (JavaScript API for Office)https://msdn.microsoft.com/EN-US/library/office/jj715285.aspx?f=255&MSPPError=-2147217396
    Some key code as below:
    <script>
    function getText() {
    Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange,
    { valueFormat: "unformatted", filterType: "all" },
    function (asyncResult) {
    var error = asyncResult.error;
    if (asyncResult.status === Office.AsyncResultStatus.Failed) {
    write(error.name + ": " + error.message);
    else {
    // Get selected data.
    var dataValue = asyncResult.value;
    write('Selected data is ' + dataValue.slides[0].index);
    // Function that writes to a div with id='message' on the page.
    function write(message) {
    document.getElementById('message').innerText += message;
    </script>
    >> How can I get the executor slide?
    What do you mean by this? Is this a new issue which is different from the above issue? If so, I will recommend you post a new thread for this issue and share us more information about this.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the index of selected values in SelectManyChoice...

    How to get the index of selected values in SelectManyChoice... the value which i get is coming when i submit the value second time

    By using the given code i get the value of the selected indices, but problem here is i get the value when it get submits at the second time... First time the length of that int array is 0.
    Second time it shows the value two times (i.e) First time submitted value and the second time submitted value. After that it works fine.. I have problem while clicking first time only..
    The Following error also raises.. One multiselect is dependent on other multiselect.
    DF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase PROCESS_VALIDATIONS 3
    java.lang.ArrayIndexOutOfBoundsException: 6
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.findObjectFromIndex(FacesCtrlListBinding.java:334)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.getInputValue(FacesCtrlListBinding.java:199)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2416)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.internalGet(JUCtrlListBinding.java:3717)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.internalGet(FacesCtrlListBinding.java:500)
         at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
         at javax.el.MapELResolver.getValue(MapELResolver.java:164)
         at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
         at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
         at com.sun.el.parser.AstValue.getValue(Unknown Source)
         at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)

  • How to get the index of a h:column element?

    Hi!
    I'd like to know how to get the index of a <h:column> element.
    Here is the code of what I'm trying to do:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj}"
              action="#{homeAction.search(ROW_INDEX)}"
              reRender="rightAppPanel" />
    </h:column>When clicking a row, I'd like to make a "search" depending on the selected row.
    Does anybode know how to do that?
    Thanks a lot :)

    Thanks a lot for all your answers! :)
    I finally got to do something with my little knowledge =P
    I created a new class containing all the data needed for the dataTable (including a "String id").
    And that's what I get:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj.name}"
              action="#{homeAction.search(familyAction.familydocsByPrj.id)}"
              reRender="rightAppPanel" />
    </h:column>

  • How to get the TableRow from TableView with given row Index.

    Hi ,
    I want to retrieve the TableRow object or Cells of that row of the TableView, for the given row index. How i can get that.
    Here is the below code what i am actually looking for
    TableView table = new TableView();
    table.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
         @Override
         public void changed(ObservableValue<? extends Number> paramObservableValue,Number prevRowIndex, Number currentRowIndex) {
              System.out.println(":::::::::>  Previous Row : "+prevRowIndex+" Current Row : "+currentRowIndex);
              if(prevRowIndex.intValue()>-1){
                   // TODO: Get the TableRow object of prevRowIndex or the cells in that row.
    });Thanks in advance !!

    Jonathan, Thanks for the info !
    Actually my requirement is ,
    1) I have an editable table with four columns. Where the first three colums are editable and the last column is a delete button to delete the record.
    2) My requirement is such that, whenever the user edits a cell, it is not comitted on focus out but the whole row(all cells) is comitted at a time when the user hits "enter". If the validation is not successfull, the textfields are styled with error class and focuses on it.
    So based on the key event on the textfield in the editable cell, i am fetching all the cells in the same row, with the below code.. and doing the save/update operation.
    textBox.setOnKeyReleased(new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent t) {
              if (t.getCode() == KeyCode.ENTER) {
                          TableRowSkin<ContactPersonResponse> rowSkin = (TableRowSkin<ContactPersonResponse>) cell.getParent();
                    ObservableList<Node> cells = rowSkin.getChildren();
                    view.setCellAction(cells);
                          // The setCellAction(cells) will iterate through all the cells, validates the text field,
                          // if validation is success commits all the cells else styles the cells and focuses on the cell.
    });Till now everything is fine and working properly.
    Now I have new requirement that when the user edits a row (not yet comitted) and if he selects another row, the previous selected row should be automatically committed with validation.
    So my final action is to call the setCellAction(cells) by passing the cells of the previous selected row.
    table.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
         @Override
         public void changed(ObservableValue<? extends Number> paramObservableValue,Number prevRowIndex, Number currentRowIndex) {
              System.out.println(":::::::::>  Previous Row : "+prevRowIndex+" Current Row : "+currentRowIndex);
              if(prevRowIndex.intValue()>-1){
                   // TODO: Need to call the setCellAction method by passing the cells of previous selected row. (prevRowIndex)
                            // Here i am not getting how to get the cells of the previous row.          
    });In the selectedIndex listener , i am not getting how to get the cells/row from the index.
    Any solution or workaround for achieving this functionality is highly apprieciated .
    Thanks & Regards,
    Sai Pradeep Dandem.
    Edited by: Sai Pradeep Dandem on Jan 2, 2012 10:23 PM
    Edited by: Sai Pradeep Dandem on Jan 2, 2012 10:23 PM

  • How to get the root node of a tree?

    I wanna get all the leaf node of a tree.But JTree have no method about how to get the root TreeNode of a tree.Then how should I do?

    try this:
    http://javaalmanac.com/egs/javax.swing.tree/GetNodes.html?l=rel

  • How do i get the selected index in jsp from a select "in the same page!!!"

    i dont if it si possible but i want to get the selected index form a select implmenting javascript jsp an html something like this:
    html:select property="slcLocation" onchange="updateList(this.form)">
    <% for (int i=0; i< user.getNumLocaliza();i++)
    out.println("<option selected>" + user.getLocation(i,1));
    %>
    </html:select> </div></td>
    ...

    i try it in the same page but it fails, the code is:
    <html:select property="slcLocation" onchange="document.location.href='cajaApertura.jsp?slcLocation='+this.options[this.selectedIndex].value">
    <%
    for (int i=0; i< user.getNumLocaliza();i++)
    out.println("<option>" + user.getLocation(i,1));
    %>
    </html:select>
    </div></td>
    </tr>
    <tr>
    <td><div align="left"><font size="1"><strong><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Caja:</font></strong></font></div></td>
    <td bgcolor="#C4B4F3"><div align="center">
    <html:select property="slcCaja" onchange="document.location.href='cajaApertura.jsp?asdf='+this.options[this.selectedIndex].value">
    <%
    int caja;
    if (request.getParameter("slcLocation")!=null)
    //for (int i=0; i< cajaLocation.getNumCajas (request.getParameter("slcLocation"));i++)
    for (int i=0; i< 3;i++)
    caja = i+1;
    out.println("<option> Caja p " + caja + request.getParameter("slcLocation"));
    }else
    for (int i=0; i< cajaLocation.getNumCajas (user.getLocation(0,1));i++)
    caja = i+1;
    out.println("<option> Caja " + caja);
    %>
    </html:select>
    is this correct? what is my mistake?
    tnks for your help

  • How to get a tree item when my mouse moves

    I want to get the tree item which my cursor points to when my
    cursor moves over a tree.
    I can get a row index in itemRollOver event, but it seems
    useless.
    And I don't know how to use getObjectsUnderPoint method.
    Is there anyone who can help me?

    Take a look this example:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="srv.send()">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var selectedNode:Object;
    [Bindable]
    public var XLC:XML;
    public function initList(event:Event) : void
    XLC = event.target.lastResult;
    public function treeChanged(event:Event) : void
    selectedNode=Tree(event.target).selectedItem;
    ]]>
    </mx:Script>
    <mx:HTTPService id="srv" url="../assets/tree.xml"
    resultFormat="e4x"
    result="initList(event)"/>
    <mx:HDividedBox width="100%" height="100%">
    <mx:Tree id="myTree" width="50%" height="100%"
    labelField="@label"
    showRoot="false" dataProvider="{XLC}"
    change="treeChanged(event)"/>
    <mx:TextArea height="100%" width="50%"
    text="Selected Item: {selectedNode.@label}"/>
    </mx:HDividedBox>
    </mx:Application>
    "hybak" <[email protected]> wrote in message
    news:fd5gao$229$[email protected]..
    >I want to get the tree item which my cursor points to
    when my cursor moves
    >over
    > a tree.
    > I can get a row index in itemRollOver event, but it
    seems useless.
    > And I don't know how to use getObjectsUnderPoint method.
    > Is there anyone who can help me?
    >

Maybe you are looking for

  • Process flow ID

    Hi, I want to obtain (within a process flow) the process flow ID that is executing. Exists any function or variable with the ID? I'm executing this query: select max(execution_audit_id) from runtimes.all_rt_audit_executions where task_name = <PROCESS

  • Application loader error -19011

    i developed my application and tested it in real device now i am ready to send it to Apple Store. but i have a problem. when i try to send it over application loader it gives a warning and i cant send it. here is the warning code "The signature was i

  • Email Marketing, Mail Merge, Segmentation wizard documentation

    Hello folks, Pls. anyone knows where I can get any documentation on all or any of the 3 subjects above ? I tried metalink unsucessfully... Txs. for any hints. Antonio

  • How i met with SAP

    Hello to everybody! What do you think about to write here, how you met SAP? I think many ppl would be interesting to know it Well, at university I studied at the Department of Information Technology. On the 3rd course (it was 2008) I first met with S

  • Family Share - Apps

    I successfully enabled family share.  I am able to see the shared music, tv shows and movies. When I look at the app store to view shared purchases, I receive the following message. "This iTunes account is set up to use Family Sharing with a differen