Get All Nodes in a tree

Can somebody tell me how to get all the node objects (DefaultMutableTreeNode) that are there in JTree?
Suppose I have created a tree and added 4 nodes to the same, and if I want to get dynamically all the nodes that are there in the tree, what should I do?
Please help me..as it is urgent
Thanx in Advance
Novi

If you check the documentation to DefaultMutableTreeNode you see that some methods return enumerations, for example postorderEnumeration. You can use these to traverse the tree,
DefaultMutableTreeNode root = ....;         // start node.
Enumeration e = root.postorderEnumeration(); // get wanted enumeration
while (e.hasMoreElements()) {                // all nodes
   DefaultMutableTreeNode node =
      (DefaultMutableTreeNode)e.nextElement(); // get node
   // do something with the node
}PS. The code compiles but I havent actually run it :(

Similar Messages

  • JTree - How to Expand all Nodes in the Tree

    I have a tree that has one primary node, two sub-nodes, and multiple sub-sub-nodes under those. I want to expand (show) all these nodes in the tree when the tree first loads. I tried expandRow() but that only seems to expand one row at a time by entering a single integer for the row. Is there any way to expand all rows/nodes when loading the tree?

    see
    http://forum.java.sun.com/thread.jsp?forum=57&thread=148793

  • XSD get all node and all leaf of all node URGENT please!

    I am want write a java program that will parse an xml schema and obtain all nodes and all leaf of all nodes
    samebody can help me?

    i use this, but i can only can print this:
    /quotazione
    /quotazione/ORG_ID
    /quotazione/CUSTOMER_ID
    /quotazione/quot
    /quotazione/customer
    but the schema is:
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true">
         <xs:element name="quotazione" type="quotaioneType" xdb:defaultTable="QUOTAZIONE"/>
         <xs:complexType name="quotaioneType" xdb:SQLType="QUOTAZIONE_T">
              <xs:sequence>
                   <xs:element name="ORG_ID" type="xs:integer" xdb:SQLName="ORG_ID"/>
                   <xs:element name="CUSTOMER_ID" type="xs:integer" xdb:SQLName="CUSTOMER_ID"/>
                   <xs:element name="quot" type="quotType" xdb:SQLName="QUOT"/>
                   <xs:element name="customer" type="customerType" xdb:SQLName="CUTOMER"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="quotType" xdb:SQLType="QUOT_T">
              <xs:sequence>
                   <xs:element name="QUOTATION_ID" type="xs:integer" xdb:SQLName="QUOTATION_ID"/>
                   <xs:element name="STATUS" type="xs:string" xdb:SQLName="STATUS"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="customerType" xdb:SQLType="CUSTOMER_T">
              <xs:sequence>     
                   <xs:element name="TITLE_CODE" type="xs:string" xdb:SQLName="TITLE_CODE"/>
                   <xs:element name="CUSTOMER_NAME" type="xs:string" xdb:SQLName="CUSTOMER_NAME"/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>
    the java class is:
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              XMLSchema schemadoc=null;;
              XSDBuilder builder;
              URL url;
              int i=0;
              try{
                   builder = new XSDBuilder();          
                   url = new URL("file://c:\\quotazione.xsd");               
                   schemadoc = (XMLSchema)builder.build(url);
              }catch(Exception ex){
                   System.out.println("Errore file xsd--");
              //si prende lo schema
                   String[] NS = schemadoc.getAllTargetNS();
                   XMLSchemaNode Nodo = new XMLSchemaNode();//nodi schema
                   XSDNode[] uno;     
                   XSDNode[] childElements;
                   Nodo = schemadoc.getSchemaByTargetNS(NS[ i ]);
                   uno = Nodo.getElementSet();
                   XSDElement elem = schemadoc.getElement(NS, uno[0].getName());
                   childElements = elem.getChildElements();
                   System.out.println("/"+uno[0].getName());
                   for (i=0;i<childElements.length;i++){
                             System.out.println("/"+uno[0].getName()+"/"+childElements[i].getName());
    can somebody help me abount print the children of /quotazione/quot/ for example?

  • By default all nodes expanded  in tree table in jsff page in adf

    Hi All,
    I have a jsff page there is a table tree on it.I want it to be expanded on page load(or default behavior).
    How will I achieve it.
    This is to be noted that this jsff page so I can not use before phase or after phase.
    There is a property in tree table which is expandAllEnabled it does not expand nodes of tree.
    There is one more property in tree table which is Initially expanded it shows only first node of tree table expanded.
    Thanks & regards,
    Vikas
    Edited by: vikasadf on May 16, 2013 8:02 AM

    Hi,
    It means store the variable ps in pageflowscope variable calles expanedAllNodes and use the disclosed property of treetable.
    example:
                if (ps == null) {
                    ps = new RowKeySetImpl(true);
                    ps = new RowKeySetImpl(true);
                    ADFContext.getCurrent().getPageFlowScope().put("expanedAllNodes", ps);
                disclosedRowKeys="#{pageFlowScope.expanedAllNodes}"
    Thanks
    Raj Gopal K

  • Tree table-initially expand all nodes raises error when closing a node 11g

    Hello,
    Frank Nimphius posted a blog entry about how to initially display all the nodes in a tree or table here:
    [http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/|http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/]
    This works very well. However, when the user tries to close a node, a NullPointerException is thrown.
    Below is the stacktrace.
    Does anyone know how to work around that issue?
    java.lang.NullPointerException
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl$Search.find(RowKeySetTreeImpl.java:608)
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl._setContained(RowKeySetTreeImpl.java:496)
         at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.add(RowKeySetTreeImpl.java:97)
         at oracle.adfinternal.view.faces.renderkit.rich.TableRendererUtils.decodeDisclosedRowKeys(TableRendererUtils.java:774)
         at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeIncompatiblePropertyKey(BaseTableRenderer.java:198)
         at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:203)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1089)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:714)
         at org.apache.myfaces.trinidad.component.UIXTreeTable.decode(UIXTreeTable.java:133)
         at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:193)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1113)
         at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1030)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
         at oracle.adf.view.rich.component.fragment.UIXPageTemplate.invokeOnComponent(UIXPageTemplate.java:208)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:664)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:303)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at edu.wisc.csa.web.ApplicationSessionExpiryFilter.doFilter(ApplicationSessionExpiryFilter.java:66)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at edu.wisc.csa.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:36)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:85)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:257)
         at oracle.security.jps.wls.JpsWlsSubjectResolver.runJaasMode(JpsWlsSubjectResolver.java:250)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:100)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    OK I have tried Frank's suggestion about the 2 entries in the managed bean and it works but I cannot collapse my child node !
    I have a Master-Detail-Detail setup.
    In the Grandparent I have this :
    RowKeySet rks = new RowKeySet(true);
    table1.setDisclosureState(rks);
    this.grandParentTable = table1;
    and in my Parent table I have this :
    RowKeySet rks = new RowKeySet(true);
    table2.setDisclosureState(rks);
    this.parentTable = table2;
    ie the same.
    In my child I have nothing just the default accessors.
    The collapse works OK for the Grandparent but when I click Hide for the Parent it does not do anything - no error message either.
    cheers

  • Expanding and Collapsing All Nodes in a TreeByNestingTableColumn

    Hi Experts,
    I'm using NWDS 7.0.18.
    I have a table with TreeByNestingTableColumn (master column).
    The child nodes are recursive nodes and are loaded at runtime with an action onLoadChildren when clicking the master column. My question is, when the hierarchy is in its initial state, only the root node is loaded into the table. But I want to add functionality for expanding all nodes in the tree. Is there a way to achieve this, I'm a little confused because the Hierarchy children havent been loaded yet.
    Any suggestion will greatly help.
    Regards,
    Kunal.

    Hi Kunal,
    I got your problem.
    To expand & collpase all the child nodes please modify the code as below.
    Create two methods exapndAll &  collapseAll and call these two methods in existing button actions.
    as below.
    public void expandAll( com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogEntriesNode node )
        //@@begin expandAll()
           for (int i = 0; i < node.size(); i++) {
         node.getCatalogEntriesElementAt(i).setExpanded(true);
         if(node.getCatalogEntriesElementAt(i).getIsLeaf()==false)
              expandAll(node.getCatalogEntriesElementAt(i).nodeChildCatalogEntries());
        //@@end
    public void collapseAll( com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogEntriesNode node )
        //@@begin collapseAll()
         for (int i = 0; i < node.size(); i++) {
         node.getCatalogEntriesElementAt(i).setExpanded(false);
         if(node.getCatalogEntriesElementAt(i).getIsLeaf()==false)
              expandAll(node.getCatalogEntriesElementAt(i).nodeChildCatalogEntries());
        //@@end
    public void onActionCollapseAll(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCollapseAll(ServerEvent)
        collapseAll(wdContext.nodeCatalogEntries());
        //@@end
    public void onActionExpandAll(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExpandAll(ServerEvent)
        expandAll(wdContext.nodeCatalogEntries());
        //@@end
    We are invoking the methods recursively to expand/collapse all the child nodes.
    This works.
    Regards,
    Charan

  • How to get all tree node parents upon select

    I have a tree, and when user clicks an item in the tree, I want to get all the parents of the selectedItem node.
    So if I have this XML:
    <products>
        <item>
            <sku>1001</sku>
            <quantity value="100" />
        </item>
        <item>
            <sku>2001</sku>
            <quantity value="250" />
        </item>
        <item>
            <sku>3001</sku>
            <quantity value="300" />
        </item>
    </products>  
    If user clicks on the 1001 sku, I want to get something like this:
    <products><item><sku>
    Also if I have a custom component, perhaps based on tree or but maybe not, and if this custom component shows the actual XML and used can click on XML elements or XML attributes, how can I use the selected item to get the parent nodes, so if they click on the value="100", I want to get this:
    <products><item><sku><quantity>
    I need this because I have a set of fields, and users will drag their XML node elements or attributes to my fields, to define a mapping between their XML and my fields.
    The selectedItem is just a snippet of XML cut off from its source XMLListCollection, and I might be able to search the XMLListCollection, but what if there were say <sku> elements at more than one level in the XML? I'm guessing a search might return multiple hits for a selected element, when I want the actual parent nodes for the actual selected node.
    Thanks very much!

    var path:Array=[]
    var parent:XML = xxxx.selectedItem.parent()
    while(parent){
    path.push(parent.localName())
    parent = parent.parent()
    Or, i didn't get your question and xxxx.selectedItem is "detached" XML snippet ?

  • 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

  • ADF Tree Component Iterating through all nodes upon ONE node click...

    Hi to all !. My name is Agustin and I live far away... In Cordoba Argentina to be specific !. My doubt would be the following one: I wanted the other day to build a af:tree component and put in the NodeStamp an commandLink with a setActionListener... So as to get the selected Node... In this case, I have category of books... Let say DataBase, Cloud Computing, Web Development and so on... But the misterious thing happens when I click on one node, and the action method in my backing bean is executed one time per each node the Tree has... I notices this coz I made a System.out.println()... My idea would be to detect the user click event so as to update a Table... My code is as follows !...
    <af:tree value="#{backManager.listaCategoria}" var="cat"
    binding="#{backManager.tree1}" id="tree1">
    <f:facet name="nodeStamp">
    <h:commandLink binding="#{backManager.outputText1}" action="#{backManager.outputText1_action}" >
    <af:setActionListener from="#{cat}" to="#{backManager.selectedItem}" />
    <h:outputText value="#{cat.label}"
    binding="#{backManager.outputText2}"
    id="outputText2"/>
    </h:commandLink>
    </f:facet>
    </af:tree>
    and my backing bean is:
    public String ejecutarSeleccion()
    Categoria cat = (Categoria) this.selectedItem.getValue();
    System.out.println("Nombre: " + cat.getNombre());
    return null;
    This method is the action attribute from the command link !.
    the selectedItem is an attribute of the type SelectItem !.
    Where I would be making the mistake ?... Or should I implement the thing in a different way ?... Thankx ! :D

    Hi,
    its strange when you say it executes the action per each node in the tree. One thing tough I would change is to go from h:commandLink to af:commandLink as it allows you to set partialSubmit=true in which case a click on the tree doesn't refresh the whole tree. I then would add an f:attribute tag to the command link
    <f:attribute name="cat" value="#{cat.id}"/>
    On the command link I had the actionListener property pointing to a managed bean with a method like
    public void onTreeNodeAction(ActioneEvent actionEvent){
    RichCommandLink link = (RichCommandLink ) actionEvent.getUIComponent();
    Object catId = link.getAttributes().get("cat");
    // ... cast the catalog id to its type and you are ready to go
    Another option would be to use the SelectListener of the tree and don't use a command link at all. You respond to tree node selection similar to here
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/83-bidi-synchronization-tree-form-401841.pdf
    Frank

  • Getting Parent Node On tree Issue..

    Hi,
    I Have Constructed a Tree and i am Able to get the Details of the clicked Node on the Tree into the Backing Bean.
    But I'm unable to get the Parent Node of the Clicked Child Node.
    Ex:On Click of Employee(Child Node) in the Tree, I should get the Department (Parent Node) in Backing Bean.
    I'm able to get only the details in the same Level of Tree Node(ie All Employees in the Selected Employee Level).
    IDE: JDeveloper 10.1.3.2.
    Please Suggest me.
    Thanking You,
    Bandaru.

    Sounds like you are looking for something like this
    Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
    SQL> WITH table_1 AS
      2  (SELECT XMLTYPE('<sdi_header>
      3  <Person>
      4  <Customer_First_Name>ABC</Customer_First_Name>
      5  <Customer_Last_Name>DEF</Customer_Last_Name>
      6  </Person>
      7  <warehouse>
      8  <Person>
      9  <Customer_First_Name>XYZ</Customer_First_Name>
    10  <Customer_Last_Name>MNO</Customer_Last_Name>
    11  </Person>
    12  </warehouse>
    13  </sdi_header>') column_name
    14     FROM dual)  -- WITH simulates your table I do not have
    15  select t1.*
    16    from TABLE_1,
    17         XMLTABLE('for $i in /sdi_header//Person
    18                     return <root>
    19                           {$i/Customer_First_Name,
    20                           $i/Customer_Last_Name}
    21                           <parent>{$i/../name()}</parent>
    22                      </root>'
    23                  PASSING table_1.column_name
    24                  COLUMNS
    25                  fname   VARCHAR2(20) PATH 'Customer_First_Name',
    26                  lname   VARCHAR2(20) PATH 'Customer_Last_Name',
    27                  pnode   VARCHAR2(20) PATH 'parent') t1;
    FNAME                LNAME                PNODE
    ABC                  DEF                  sdi_header
    XYZ                  MNO                  warehouseYou can find out how formatted that message by looking in the FAQ in the upper right. It uses the { code } tag (without spaces).

  • How to get all items under a parent item in a tree control

    Hello,
    I have 2 questions regarding a tree control:
    1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
    2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
    Any ideas?
    Attachments:
    Tree example.vi ‏6 KB

    Mentos wrote:
    1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
     Did you try a search? There's no direct way of doing this. You have to navigate the tree and build up an array. You can find an example here: http://forums.ni.com/t5/LabVIEW/get-all-children-o​f-a-parent-in-tree/td-p/729548
    2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
    No. (It's called ActiveCell, not ActiveCells) Presumably you are trying to perform an operation on multiple items. Unfortunately, you need to use a loop. You should defer panel updates if you're doing this a lot.

  • How to get each node in tree?

    how to get each node in tree?
    Message was edited by:
    NikisinProblem

    how to get each node in tree?
    Since (as far as I know) treeNode is an interface, the real question to me is how are you implementing your treeNodes? Are you overriding the toString() method?

  • How can I get the previous clicked node in a Tree?

    I have a JTree. If a node is selected, before the user select another, I need to make a question if he have sure about the new selection.
    If the user answers not, I need to select the previous node.
    I have in my class a variable, type of DefaultMutableTreeNode, that makes reference to the last node selected.
    How can I turn this node selected again, if the user select "No"?
    Thanks for any help.
    Renato de Melo

    You don't want to maintain a reference to the last selected node, but to the last selected path. Nodes within a tree are addressed using a TreePath, with contains references to each node from the root, down to a specific node. Look at the JavaDocs of javax.swing.tree.TreePath for more info.
    Also, JTree has getter/setter methods for the selectionPath.

  • Scene Graph traversal. Getting all the children of a node recursively

    Hi,
    Requirement: To resize all the controls of a scene (including controls that contain text like label, button) as per the scene size
    Approach: To implement the above requirement (see code snippet below), I added Listeners for width and height properties of a Scene and whenever the scene size changes, I get all the children of the root node of the scene and invoked the setScaleX() and setScaleY() for the children.
    Problem: In my design, labels and buttons are wrapped inside VBox, HBox etc. Method getChildrenUnmodifiable() returns only the first level of children and hence my HBox and VBox are getting scaled as per the scene size but not the children of VBox and HBox. Is there a built-in function to get all the children of a node recursively ? Or what is the best way to resize text as the scene size changes ?
    Scene mainScene = new Scene(borderPane, PERMANENT_WIDTH,
                    PERMANENT_HEIGHT, Color.HONEYDEW);
    rootNode = mainScene.getRoot();
            mainScene.widthProperty().addListener(new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue,
                        Object newValue) {
                    Double widthScalingFactor = ((Double) newValue) / PERMANENT_WIDTH;
                     ObservableList<Node> children = rootNode.getChildrenUnmodifiable();
                    for (Node child : children) {
                        child.setScaleX(widthScalingFactor);
            mainScene.heightProperty().addListener(new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue,
                        Object newValue) {
                    Double heightScalingFactor = ((Double) newValue) / PERMANENT_HEIGHT;
                    ObservableList<Node> children = rootNode.getChildrenUnmodifiable();
                    for (Node child : children) {
                        child.setScaleY(heightScalingFactor);
            });Thanks.

    Added the following code to get all the children recursively. now the scaling is applied to all nodes of a scene.
        private static void getChildren(Parent parentNode) {
            if (parentNode.getChildrenUnmodifiable().size() != 0) {
                ObservableList<Node> tempChildren = parentNode
                        .getChildrenUnmodifiable();
                allChildren.addAll(tempChildren);
                for (Node n : tempChildren)
                    getChildren((Parent) n);
            } else
                allChildren.add(parentNode);
        }

  • Parse XML: how to get all the sub nodes of an element

    Hello, I am using org.w3c.dom to parse an XML file. I want to get all the information under an elements, including all the sub nodes and sub sub nodes, maybe output as a String or String[ ]. How should I do it with org.w3c.dom?
    e.g. I want to get all the text within<datafile></datafile>:
    <datafile>
    blablabla
    <id> bla <description>bla</description></id>
    </datafile>
    I write:
    Node element = InterfaceDOM.getElementsByTagName("datafile");
    how can I return all the sub content within this element?
    Thanks a lot!

    http://www.developerfusion.co.uk/show/2064/

Maybe you are looking for

  • BI 7.0 Analysis authorization creation issue

    Hi, We are prototyping the new analysis authorization concept have a question regarding the build. We've had the BI execute the pre-implementation tasks (activate the business related content and OTCT* and OTCTA* infocbues and and OCTA* infoCubes). T

  • I can't delete pictures in my "drop box" gallery... HELP!

    I recently found a "drop box" (2 words; not Dropbox) folder in my images on my S3. I didn't put this there and there are 3 pictures inside that I can't delete. I also can't delete the folder itself. These pictures are very old and I have no idea how

  • When I went to the apple store a worker said I could merge two apple ID's. How can I do this?

    My sister was the first person to get an apple product before anyone else so she created her own Apple ID. Then other members in my family including myself, received apple products and made a family Apple ID for all of us to use. My sister now uses t

  • Updating the G/L Accounts

    When Installing SAP B1 in Clients place, we would like to up date previous data into SAP B1. Client does not have any ERPsystem, How can I import the Existing Data Available in different books. At time of Importing what are the Basic factors to be co

  • FTP Website Offline, Not Sure How to Bring It Back Up

    Since you are open to alternative solutions, try SynaMan. It is a replacement for FTP. You can install it on your existing file server (Windows, Linux or Mac) and let your clients upload/download files. All you will have to do is configure your netwo