How to remove all nodes (except root node)from a Jtree?

How to remove all nodes (except the root node)from a Jtree?

Either:
- remove all children of root.
- save the root node, throws away the tree model, build a new TreeModel with the saved root, set the new TreeModel in the JTree.
- implement your own TreeModel, which would support an emptyExceptRoot() method.
IMHO, using the DefautlTreeModel and DefaultMutableTreeNode does lead to all sorts of small problems when the app evolves, and implementing your own TreeNode and TreeModel is not that hard and much more efficient.

Similar Messages

  • How to remove a node from  a Jtree?

    I tried giving this to move a node from one parent node to other parent node.
    IconNodeClass userObject = (IconNodeClass)tr.getTransferData(TransferableDataItem.Image_Tree_Node_Flavor);
    IconNodeClass node = (IconNodeClass)path.getLastPathComponent();
    IconNodeClass newNode = new IconNodeClass(userObject);
    DefaultTreeModel model = (DefaultTreeModel)getModel();
    IconNodeClass oldParentNode = (IconNodeClass)userObject.getParent();
    Object oldParent = oldParentNode.getUserObject();
    Object newParent = node.getUserObject();
    if(oldParent.equals(newParent)) {
    model.insertNodeInto(newNode, node, 0);
    if(oldParentNode != null) {
    oldParentNode.remove(newNode);
    model.reload(oldParentNode);
    }

    what happened next ?????

  • How to remove a node from nlb at runtime?

    hello,
    i need to temporally exclude a node from an nlb.
    May happen that a server is up and working but the web application i'm balancing is out of sinch with the same application in the others nodes.
    Eg. some static variables are not the same of the same static variables of other nodes, because of a timeout, a write error and so on but the server is still working.
    in this case i need to stop the server from nlb because the information in the web application is not in sinch with other nodes.
    I need to prevent users from being serverd from this out to date server, untill it will became updated, but i need to do this programmatically
    how can i do it?

    "DuoMi" <[email protected]> wrote in message
    news:gnojbf$2sg$[email protected]..
    > How to remove a node from XMLList
    >
    > I want remove the first node from XMLList
    >
    >
    > and how to get the combobox all values string:
    >
    > <data>
    > <value>2</value>
    > </date>
    > <data>
    > <value>5</value>
    > </date>
    > <data>
    > <value>8</value>
    > </date>
    >
    > I need a string whit value "2,5,8"
    >
    > thkan you.~
    I think something like
    comboBox.dataProvider..value.toString()
    will work.

  • How to remove a node from XMLList

    How to remove a node from XMLList
    I want remove the first node from XMLList
    and how to get the combobox all values string:
    <data>
    <value>2</value>
    </date>
    <data>
    <value>5</value>
    </date>
    <data>
    <value>8</value>
    </date>
    I need a string whit value "2,5,8"
    thkan you.~

    "DuoMi" <[email protected]> wrote in message
    news:gnojbf$2sg$[email protected]..
    > How to remove a node from XMLList
    >
    > I want remove the first node from XMLList
    >
    >
    > and how to get the combobox all values string:
    >
    > <data>
    > <value>2</value>
    > </date>
    > <data>
    > <value>5</value>
    > </date>
    > <data>
    > <value>8</value>
    > </date>
    >
    > I need a string whit value "2,5,8"
    >
    > thkan you.~
    I think something like
    comboBox.dataProvider..value.toString()
    will work.

  • How to Remove a Node from JTree?

    I want to remove a node from a JTree but the node may or maynot be visible.
    My method takes a String which is the name of the node.
    The nodes im using are DefaultMutableTreeNode
    This is my code so far but it doesnt work.
    public void removePerson(String pName)
              TreePath node = tree.getNextMatch(pName,0,Position.Bias.Forward);
              tree.expandPath(node);
              tree.removeSelectionPath(node);
    }Any Suggestions or ways which i could achive this?
    Thank you,

    I don't think removeSelectionPath is what you want to use.
    These should help:
    [http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/tree/DefaultTreeModel.html#removeNodeFromParent(javax.swing.tree.MutableTreeNode)|http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/tree/DefaultTreeModel.html#removeNodeFromParent(javax.swing.tree.MutableTreeNode)]
    [http://www.roseindia.net/java/example/java/swing/RemoveNodes.shtml|http://www.roseindia.net/java/example/java/swing/RemoveNodes.shtml]

  • How to remove a node from a xml

    Hi All,
    I want to remove a node from my xml output. Can anyone suggest me how to get that? I want to implement this by using the ASSIGN activity.
    My sample output is
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
         <env:Header>
              <wsa:MessageID>urn:4EF1A350677C11E1BFA7794ED76B03EF</wsa:MessageID>
              <wsa:ReplyTo>
                   <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
              </wsa:ReplyTo>
         </env:Header>
         <env:Body>
              <SiebelOrderQueryByExample_Output xmlns="http://siebel.com/asi/">
                   <ListOfOrderInterface xmlns="http://www.siebel.com/xml/Siebel%20Order">
                        <Orders>
                             <Id>1-15IXJ</Id>
                             <AccountId>1-2EE</AccountId>
                             <OrderNumber>1012-1234</OrderNumber>
                             <ListOfLineItems>
                                  <LineItems>
                                       <Id>1-15IYN</Id>
                                       <LineNumber>303</LineNumber>
                                       <OrderNumber>1012-1234</OrderNumber>
                                       <OrderHeaderId>1-15IXJ</OrderHeaderId>
                             </LineItems>
                                  </ListOfLineItems>
                             </Orders>
    </ListOfOrderInterface>
              </SiebelOrderQueryByExample_Output>
         </env:Body>
    </env:Envelope>
    I want to delete the <ListOfLineItems>node from the xml above so that my resultant would be,
         <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
         <env:Header>
              <wsa:MessageID>urn:4EF1A350677C11E1BFA7794ED76B03EF</wsa:MessageID>
              <wsa:ReplyTo>
                   <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
              </wsa:ReplyTo>
         </env:Header>
         <env:Body>
              <SiebelOrderQueryByExample_Output xmlns="http://siebel.com/asi/">
                   <ListOfOrderInterface xmlns="http://www.siebel.com/xml/Siebel%20Order">
                        <Orders>
                             <Id>1-15IXJ</Id>
                             <AccountId>1-2EE</AccountId>
                             <OrderNumber>1012-1234</OrderNumber>
         </Orders>
    </ListOfOrderInterface>
              </SiebelOrderQueryByExample_Output>
         </env:Body>
    </env:Envelope>     
    Please suggest something Its urgent.
    Thanks in Advance.

    It goes something like this, taken from the above blog entry:
    Removing a node from node-list
    With the bpelx: extensions in BPEL you are able to insert and update nodes in a node list. A node-list is an XML message that contains a set of records. In this article I use the following example:
    <BookList xmlns="http://message.vijfhuizen.com">
    <Book>
    <title>The Lord Of The Rings</title>
    <author>J.R.R. Tolkien</author>
    </Book>
    <Book>
    <title>Harry Potter</title>
    <author>J.R.R. Tolkien</author>
    </Book>
    <Book>
    <title>The Hobbit</title>
    <author>J.R.R. Tolkien</author>
    </Book>
    <Book>
    <title>Storm; Chronicals of Pandarve</title>
    <author>Don Lawrence</author>
    </Book>
    </BookList>
    For creating and updating node lists the bpelx: functions are enough to handle this. But when you want to remove a particular node, you can use the bpelx:remove function. But this function can only remove a node from a particular position. For example removing the second node you code:
    <bpel:assign>
    <bpelx:remove>
    <bpelx:target variable="VarBookList" query="/Booklist/Book[2]" />
    </bpelx:append>
    </bpel:assign>
    It is hard to code the bpelx:remove to create a xpath to dynamicly remove node. You would like to remove the second node based on the xpath:
    /Booklist/Book[title="Harry Potter" and author="J.R.R. Tolkien"]
    You can add the above xpath in the bpelx:remove, but you are not able to make this dynamically.
    There is a solution. The trick is to create a stylesheet that copies the data into a new message, but removing that particular records. Create a stylesheet that does the normal copy of the XML message. Then add a <choose> element in the stylsheet to filter that particular record.
    <xsl:template match="/">
    <BookList>
    <xsl:for-each select="/BookList/Book">
    <xsl:choose>
    <xsl:when test="title='Harry Potter' and author='J.R.R. Tolkien'"/>
    <xsl:otherwise>
    <Book>
    <title>
    <xsl:value-of select="title"/>
    </title>
    <author>
    <xsl:value-of select="author"/>
    </author>
    </Book>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:for-each>
    </BookList>
    Now we have a XSL stylesheet that removes a particular record, but this is not variable. This can be done via XSLT parameters.
    <xsl:param name="pTitle"/>
    <xsl:param name="pAuthor"/>
    <xsl:template match="/">
    <BookList>
    <xsl:for-each select="/BookList/Book">
    <xsl:choose>
    <xsl:when test="title=$pTitle and author=$pAuthor"/>
    <xsl:otherwise>
    <Book>
    <title>
    <xsl:value-of select="title"/>
    </title>
    <author>
    <xsl:value-of select="author"/>
    </author>
    </Book>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:for-each>
    </BookList>
    </xsl:template>
    Now we are able to use this stylesheet in BPEL. In general BPEL create the following code:
    <assign name="Transform">
    <bpelx:annotation>
    <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
    <from expression="ora:processXSLT('RemoveNode.xsl'
    , bpws:getVariableData('Variable_BookList','payload')" />
    <to variable="Variable_BookListTemp" part="payload"/>
    </copy>
    </assign>
    But this code does not pass parameters to the stylesheet. The ora:processXSLT() can do this it has an additional parameter in this function:
    <assign name="Transform">
    <bpelx:annotation>
    <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
    <from expression="ora:processXSLT('RemoveNode.xsl'
    , bpws:getVariableData('Variable_BookList','payload')" />
    , bpws:getVariableData('BPELxslparameters'))"/>
    <to variable="Variable_BookListTemp" part="payload"/>
    </copy>
    </assign>
    Now only you have to create the BPELxslparameters variable and assign it with the correct name/value pairs. The structure of the this variable is as follows:
    <?xml version="1.0" encoding="windows-1252" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.oracle.com/service/bpel/common"
    targetNamespace="http://schemas.oracle.com/service/bpel/common"
    elementFormDefault="qualified">
    <xsd:element name="parameters">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="value" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    Create in BPEL the variable BPELxslparameters and let it point to this strucure:
    <process ....
    xmlns:common="http://schemas.oracle.com/service/bpel/common"
    .../>
    <variable name="BPELparameters" element="common:parameters"/>
    Now we can in BPEL create an empty XML message, based on this strcuture and assign the values to these parameters and then call the processXSLT function.
    <bpelx:assign name="Assign_GenerateEmptyParameterSet">
    <copy>
    <from>
    <parameters xmlns="http://schemas.oracle.com/service/bpel/common">
    <item>
    <name>pTitle</name>
    <value/>
    </item>
    <item>
    <name>pAutor</name>
    <value/>
    </item>
    </parameters>
    </from>
    <to variable="BPELparameters" query="/common:parameters"/>
    </copy>
    </bpelx:assign>
    <assign name="Assign_setXSLTParameters">
    <copy>
    <from expression="'Harry Potter'"/>
    <to variable="BPELparameters" query="/common:parameters/common:item[1]/common:value"/>
    </copy>
    <copy>
    <from expression="'J.R.R. Tolkien'"/>
    <to variable="BPELparameters" query="/common:parameters/common:item[1]/common:value"/>
    </copy>
    </assign>
    Posted by Marc Kelderman SOA Blog at 1/16/2008 09:20:00 PM

  • How to remove a node from 4 node sun cluster 3.1

    Dear All,
    We are having a four nodes in a cluster.
    Could any one please guide me, how to remove a single node from a 4 node cluster.
    what are the procedure and step's I have to follow.
    Thanks in advance.
    Veera.

    Google is pretty good at finding the right pages in our docs quickly. I tried >how to remove a node Solaris Cluster< and it came up with
    http://docs.sun.com/app/docs/doc/819-2971/gcfso?a=view
    Tim
    ---

  • How to remove a node from a target xml payload in reciever file channel

    i have a scenario where i have to remove a node from my target xml file in receiver file channel and want xml as the output file. I don't want a fixed length file. How to do that in receiver channel? Do we need to use file content conversion for that?

    that will result in giving you a fixed file or a separator defined file.
    it will not give you an XML file.
    In case you want a XML file, instead of using variable substitution, use Dynamic configuration and adapter specific properties.
    Some ref:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

  • How To Remove Empty Node From Source XML

    Hi,
    How can I remove an empty node from the source xml in a XSLT mapping.
    For e.g. If the source xml is like:
    <SRC>
    <Node1>SAP</Node2>
    <Node2/>
    <Node3>XI</Node3>
    </SRC>
    Then the xml should become:
    <SRC>
    <Node1>SAP</Node2>
    <Node3>XI</Node3>
    </SRC>
    I need to do this because the output of my XSLT mapping is showing blank spaces for each blank node.
    Thanks,
    Abhishek.

    Use <xsl:if>
    Or else you may find different options here
    http://www.dpawson.co.uk/xsl/sect2/N3328.html#d4804e304
    Regards,
    Prateek

  • How to reduce the pdf version & how to remove all the pre-delivered field from a pdf file.

    Hi Team,
    1) Please help me to reduce the version of a pdf file which is v1.7 as my BI Publisher support only pdf version  upto Version1.5.
    2)This pdf file 1.7 contains some pre-delivered fields, i want to remove all the pre-delivered fields. Please suggest.
    PFA link:-
    http://www.uscis.gov/files/form/i-539.pdf
    Please guide to remove the pre-delivered fields from this pdf & how to reduce the version.

    A lot depends on what you want to do with the file. The encryption has limited most options on the form. If you are wanting to simply post a view of the form, then you might try a screen capture. Of course there is always the question of what you want to do with the form and any legal aspects related to that use. Other than answering potential legal questions of your use, we might be able to help more if we were aware of the desired use. At the moment, the screen capture is my only suggestion. There may be other work arounds, but probably not appropriate for discussion on this forum.
    If you are wanting the form for publication as an example in some document, I would strongly suggest you contact the gov't agency and discuss your intent and try to get a version you can use with their approval. Overall, that is the cleanest way to do whatever you are after for a legit purpose. Even a graphic version should have the permission of the government agency.

  • How to remove all in and out points from extendscript code?

    Hi,
         I am creating a sequence from a clip from extendscript code to automateToSequence function.
         But if there are some in and out points in the clip only the select clip part is converted as a sequence, what is the solution to remove all those in and out points from extendscript code, or to get the full clip to sequence even there are some in and out points.
    I am using the function like this; qe.project.getItemAt(i).automateToSequence(seq,0,0,1,1);
    Please suggest,
    Thanks and Regards,
    Anoop NR

    Double click the pre-comp or nested comp, open comp settings from the menu or by using the keyboard shortcut Ctrl/Cmnd + k.
    Note, changing the length of the comp will not extent the length of footage or layers inside the comp. You have to do that manually and it depends on your footage type.

  • How to remove all remnants of Mountain Lion from an early 09 Mac Mini?

    I have a 1 TB hard drive that was formaly in a late model 2012 Mac Mini that the Geinus's thought was faulty. So they R & R'd the drive, but I thought otherwise. I R & R'd the drive in a early 2009 Mac Mini and all was well until I decided to removed Litle Snitch 3.0 Using Back in Time 2. Well everything went south real quick! I've since tried my best reinstalling Snow leopard. For some reason either Mountain Lion remains somewhere in the computer. I've formatted many times, no good. Everytime the computer boots if I should hold down the option key I get Mountain Lion featutes! I can't get into target mode, I can't boot applejack, I can't boot off of DISKWARRIOR! I don't know what to do! Suggestions Please.

    First, that cannot be an iBook G4 as that machine cannot run Snow Leopard let alone Mountain Lion.  To run Snow Leopard it has to be an Intel processor, not a G4.  What does it show as the Model Identifier in About This Mac, More Info, System Report, Hardware, Model Identifier?
    Second, if you have erased the hard drive there should not be remnants of any prior content.  Even though Disk Warrior is saying nothing is wrong with the hard drive, it sounds as though there are problems.  You may want to consider simply replacing the hard drive so there are no questions about faults.  A good source is OWC, http://www.macsales.com where they also have on-line videos showing how to do the replacement.
    Third, you could also try again to restart using the Snow Leopard DVD/CD and use Disk Utility on that install disk to erase again, and do it a couple times, then try to install.  If it continues to refuse, then it sounds as though there is a fault with the hard drive.

  • How to remove target node if source field value is empty SAP PI Mapping

    Hello,
    how to remove target node if source field value is empty in graphical Mapping.
    Like if
    MIddle name in source filed is empty, I would like to eliminate target field from out put XML.
    Thank you
    John

    Hi Jhon,
    If you want to remove all empty tags and you dont to complicate your message mapping, you can use a XSL, after the message mapping,  to remove all the empty tags:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="node()|@*">
            <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="*[not(@*|*|comment()|processing-instruction())
         and normalize-space()='' ]"/>
    </xsl:stylesheet>
    Regards

  • How do I remove a node from Always on Availability Group in SQL 2012

    Hello I was wondering if anyone could tell me to remove a node from an AOG group in SQL 2012.  We currently have a two node Always on availability group and I need to replace one of the servers.  My plan is to bring the
    new server on to the group then remove the old server and I am having issues finding documentation on this.  Could someone explain how to do this or if it is even possible.
    Thanks

    After the new server is added to the cluster and the AG, remove the old one by first
    ALTER AVAILABILITY GROUP [YourAG]
    REMOVE REPLICA ON N'OldServer';
    Remove a Secondary Replica from an Availability Group
    Then evict the old server from the cluster with the cluster administrator or
    Remove-ClusterNode OldServer
    Remember to verify the quorum configuration after adding the new server and removing the old server.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How to make all nodes in a detailed navigation tree open automatically??

    Dear All,
    I have added some iViews to two folders and add these two folders to a workset "Time" and then add "Time" to the role of Employee portal user.
    How to make all nodes expanded automatically when this workset is clicked in EP??
    thanks,
    Zita

    Not surprising...it does not work even if you follow the exact way...
    Role ->
             Workset 1
                          -> Page 1
                          -> Workset 2
                                           -> Page 2
                          -> Workset 3
                                           -> Page 3
    When the user clicks on Role which is the Entry Point, I want the user to see Page1 (works alright) and want the tree node Workset 2 open (doesn't work)...I want tree node Workset 3 closed (which is what happens...)
    The thing is Workset 2 has to be open...
    This is what I've done...I've made the Initial State of Navigation Panel set to "Open"...
    What else is to be done????
    Thanks a lot.
    JP

Maybe you are looking for

  • JSF-EL expansion inside of object using ADF in a JSP

    JSF-EF will not convert to text inside of <object><param> I have an existing JSP application that uses an Applet. There is a lot of <% %> code that is passed to the Applet using the <param> tag. My code goes as follows: <%@ page stuff%> <%@taglib stu

  • F-32 screen changes urgent

    hello guru, how i m able to disable the filds cash discount and cash% in second screen of t-code f-32. let ,e give urs helping hends. regards amit.

  • HANDLING UNIT DETAILS

    Dear All,                    Pl guide me that  is there any  t. code by which details of all  handling units made  for a sales order or  for a Project or for a WBS element can be made to display . Regards, SAP11

  • Contents of InfoObjects

    Dear Experts, I would like to know what an info object contains. for ex infoobject 0TAX_Amount, what is it made up of? (Also I need to find the contents of other infoobjects and to do so what link, document I need to refer?) Does it make up of all ta

  • Available in Mac App Store, Image?

    Hi, I write reviews on my blog (vardox.com) and was wondering if there was an image similar to the "Available on app store" image for the mobile app store. I am looking for this to have an easy way to link users to the product on the app store, after