How to delete an element in a tree?

how can i delete element in my tree?
after that to refresh the tree?

OK. You should have the rootNode and then your three other nodes added to the root (fiche, famille, etc)?
I'm currently creating an application that uses a tree with two branches. The code I posted works regardless of the branch the node I wish to remove belongs to.
It does depend as well how you are storing your nodes. I mean I'm just storing the node referenced by a string in a hashtable for easy reference. I gather that you want to click the node for it to disappear?

Similar Messages

  • How to delete an  element in an array...(simple way)

    hi,
    Newbie here... please help how to delete an element in an array list?
    there are alot of codes but they're complicated for a newbie like me..
    (simple codes would be better ..:) thank you...

    makk_88 wrote:
    since u want the simple method.....
    just overrite the position of the element that need to be deleted with the next element in the array..
    by doing this, element need to be deleted will not be accessibe..
    i think u got..what i'm saying.
    thnx..Mak,
    Say we wish to delete the second element of an array a[1]. Do you really believe that a[1] = a[2] somehow magically deletes a[1]? I really don't think so Tim.
    Two eggs, minus 1, equals two eggs? Interesting theory, but I think you're probably wrong.
    *@OP:* My advise is just use an ArrayList.
    Cheers. Keith.

  • Delete an Element in the Tree

    Hi,
    I would like to delete an element in the tree.
    but I was able to delete only the rootNode
    Could you help me. thanks
    IPrivateTreeView.ITreeNodeNode rootNode =
         wdContext.nodeTreeNode();
    IPrivateTreeView.ITreeNodeElement level2Delete = null;
    level2Delete = rootNode.currentTreeNodeElement( );
    // I would like to do somethink like that
    level2Delete.REMOVE_ELEMENT

    Hi Philippe,
    it's sooooo easy This is a snipped from the IWDNode API
       * Removes an element from the node collection. If an ICMIObservableList is
       * bound to the node, this list is modified!
       * @param element The element to be removed
       * @return <code>true</code> if the element was in.
      boolean removeElement(IWDNodeElement element);
    so you simply have to call
    wdContext.nodeTreeNode().removeElement(level2Delete);
    Hope that helps.
    Regards
    Stefan

  • HOW TO DELETE DUPLICATE ELEMENT IN A VECTOR

    Hi everybody!
    If I've a vector like this vectA={apple,orange,grape,apple,apple,banana}
    and I want final result be vectB={apple,orange,grape,banana}.
    How should I compare each element in vectA and delete duplicate element. Like here duplicated element is apple. Only one apple remain in the vectB.
    Any help,
    Thanks.

    Hello all. Good question and good answers, but I would like to elaborate.
    To begin with, you specifically asked to map the following:
    {apple,orange,grape,apple,apple,banana} ==> {apple,orange,grape,banana}
    Both of cotton.m's solutions do NOT do this, unfortunately. They are both useful in particular cases though, so think about what you're trying to do:
    cotton.m's first solution is best if order does not matter. In fact, as flounder first stated, whenever order doesn't matter, your most efficient bet is to use a Set instead of a List (or Vector) anyways.
    Set vectB = new HashSet(vectA);This code maps to {banana, orange, grape, apple}, because HashSets are "randomly" ordered.
    cotton.m's second solution is good if you want to impose NEW ordering on the List.
    Set vectB = new TreeSet(vectA);This code maps to {apple, banana, grape, orange}, because TreeSet uses alphabetical-order on Strings by default.
    java_2006, your solution is the most correct, but it's a little verbose for my taste :)
    more importantly, the runtime-efficiency is pretty bad (n-squared). calling Vector.contains performs (at worst) n comparisons; you're going to call it n times! Set.contains usually performs 2 comparisons (constant, much better), so I suggest you USE a Set to do the filtering, while still sticking with your good idea to use a List. When the ordering is "arbitrary" (so can't use TreeSet) but still relevant (so can't use HashSet), you're basically talking about a List.
    I think saving A LOT of time is worth using A LITTLE extra space, so here, let's save ourself some runtime, and some carpal-tunnel.
    import java.util.*;
    class Foo {
         public static void main(String[] args) {
              String[] fruits = {"apple","orange","grape","apple","apple","banana"};
              List     l = Arrays.asList(fruits),
                   m = filterDups(l);
              System.out.println(m);
         // remember, both of the following methods use O(n) space, but only O(n) time
         static List filterDups(List l) {
              List retVal = new ArrayList();
              Set s = new HashSet();
              for (Object o : l)
                   if (s.add(o))
                        retVal.add(o);     // Set.add returns true iff the item was NOT already present
              return retVal;
         static void killDups(List l) {
              Set s = new HashSet();
              for (Iterator i = l.iterator(); i.hasNext(); )
                   if (! s.add(i.next()))     
                        i.remove();
         // honestly, please don't use Vectors ever again... thanks!
         // if you're going to be a jerk about it, and claim you NEED a Vector result
         // then here's your code, whiner
         public static void mainx(String[] args) {
              String[] fruits = {"apple","orange","grape","apple","apple","banana"};
              List l = Arrays.asList(fruits);
              Vector v = new Vector(l);
              killDups(v);
              System.out.println(v);
    }

  • How to delete cost element name from group after deleting the cost element

    Hi,
    Please let me know how to delete the cost element number  from the Cost element group hierarchy.I have deleted cost element but still showing only the CE number---no valid master record.If I d not want this to be visible within hierarchy let me know what should I do.
    Thanks

    Hi
    Go to change cost element group select the cost element click on select tab (3rd Tab from Left) it will take u to new screen in that screen select remove tab (1st tab from left)
    Regards
    Sandesh

  • XMLBeans - how to delete an element?

    Guys,
    How do you delete an element within an xml data element?
    If there's more than one way what are they?
    Currently, I've generated XML java objects. I see a setNil() method and a couple removeXXX methods but neither appear to delete the element I'm trying to give the axe to.
    Thanks!
    -mark

    makk_88 wrote:
    since u want the simple method.....
    just overrite the position of the element that need to be deleted with the next element in the array..
    by doing this, element need to be deleted will not be accessibe..
    i think u got..what i'm saying.
    thnx..Mak,
    Say we wish to delete the second element of an array a[1]. Do you really believe that a[1] = a[2] somehow magically deletes a[1]? I really don't think so Tim.
    Two eggs, minus 1, equals two eggs? Interesting theory, but I think you're probably wrong.
    *@OP:* My advise is just use an ArrayList.
    Cheers. Keith.

  • How to delete an element in arraylist??

    here i have an array list which contain details of an address book
    I want to delete one element in the list
    but its not deleting
    Could anyone please take a look and help me
    tank u in advance!!
    else if (X.compareTo(F)==0)
       {System.out.println("Pour supprimer une fiche : saisir le NUM INDEX.");
        Integer c1 = new Integer(0);
        Z = clavier.readLine();
        c1=Integer.valueOf(Z);
        System.out.println("Vous allez supprimer la fiche "+c1);
        for( Iterator it= l.iterator(); it.hasNext();) {
          Object p =it.next();
          relations R=(relations)p;
            if (R.getnumero()==c1)
           l.remove(l.indexOf(p));}
          for( Iterator it1= l.iterator(); it1.hasNext();) {
             Object o =it1.next();
             if (o.getClass().getName()=="carnetadresses.contact")
               ((relations) (o)).affiche();
               }break;
      }

    It's a good thing you use code tags for posting here. Could you now consider using code conventions?
    - Why is the second loop nested in the first one? (this second loop looks weird anyway...)
    - The Iterator has a remove method. You should use it in such case.
    - Looks like you have a malpositioned/misused break statement (which is probably the reason why nothing happen, as it terminates the for loop after the first iteration.)

  • How to delete empty element in popup list

    I have a question about a suspicious behaviour in Forms Builder 10.1.2.0.2.
    When I have a list object (pop up list) I can define some values in the attribute palette of the object.
    So you can set a shown name and a value behind. In this little window to set the items of the popup list you get automatically a white empty item at the end of the list. When I click now on this empty item (you do so, when you want to add an item) Forms Builder automatically adds an new empty item at the end.
    When I click this new empty item, Forms Builder adss another empty one ... and so on.
    It´s very suspicious because, when I end this dialog with "OK", it will be saved and when I open the form (over web) I have at the end of the list one, two (or more) empty elements in list.
    But I can´t delete this empty ones from the list in Forms Builder.
    So my question:
    how can I delete empty items in a popup list??
    I try it with hit "del" button at keyboard or delete the set value for the item (I hope Forms Builder delete items without value). But all does not help.

    Thanks jwh for this great solution! :)
    On my german keyboard it is:
    ctrl+< for deleting a line
    ctrl+> (= ctrl+shift+<) for adding a new line
    Thanks! :)
    I have another question (you can maybe help me, too?).
    On this popup lists you can have several items. When you open a form (via web) and the list has more than x items (maybe 5 or 6) the form shows a scroll bar on the right side.
    Is there any poosibility to set how much items has to show and only show a scroll bar when there are more items in the list?
    Or other way: set the maximum of shown items so big, that there will be no scroll bar.
    Message was edited by:
    ulfk

  • How to delete su-elements in "System Preferences/Others"

    I'm trying to delete a doubled element (done by mistake) inside an application located in "Other" within "System Preferences"
    More precisely:
    - I've "USB overdrive" app control on this location: "Other"
    - By error, whoever it is, in "Status" window, there are two "USB Receiver" lines
    How can I delete one of those?

    In System Preferences, right-click on one of them and select Remove.
    I'm not sure how that will affect the other. If two status menus are still there, cmd+drag one off the status menu area.

  • How to delete form elements in Muse

    I followed the instructions I found on-line but am unable to remove an item from a form in Muse. There is no option for deleting elements, i.e.: a name or  phone field. Either, it's a hidden feature or I totally missed it.
    Christian

    Tanks for your reply. Unfortunately that doesn't work, that was the first thing I tried. I understand the field is selected once it shows the blue arrow in the top right corner, but hitting "delete" produces no action. And no right click will give me the "clear" or "delete" option. Even using the top menu bar has the actions"cut", "copy" and "clear" greyed out...
    Some on-line info suggested to click on the "trash can" in the top right corner and confirm "delete".... nothing like that in my version. I am using the most current version of Muse, could it be a bug?
    I know I can redo it by starting with the simple form and add extra fields (that works) but I should not have to do it the long way...
    Thanks,
    Christian

  • How to delete conext entries in JNDI tree after undeployment?

    Hi,
    When I deploy an EAR or JAR file with EJBs, they bind in the JNDI server.
    When I undeploy the application the beans are no longer bound to the JNDI
    tree, but the contexts they created remain.
    For example, I deploy a bean that binds its home object to the following
    entry in the JNDI:
    myapp/mymodule/MyBean
    When I undeploy MyBean, the context myapp/mymodule remain.
    Is there an utility to remove these entries or do I have to develop my own
    utility? I did not find anything in the administration console to do this.
    This has been a source of some trouble, because sometimes I get error
    messages when I want to redeploy the beans.
    Thanks in advance,
    Vegeta

    Please don't cross post. see my reply in the ejb newsgroup.
    Thanks,
    Michael
    Vegeta wrote:
    Hi,
    When I deploy an EAR or JAR file with EJBs, they bind in the JNDI server.
    When I undeploy the application the beans are no longer bound to the JNDI
    tree, but the contexts they created remain.
    For example, I deploy a bean that binds its home object to the following
    entry in the JNDI:
    myapp/mymodule/MyBean
    When I undeploy MyBean, the context myapp/mymodule remain.
    Is there an utility to remove these entries or do I have to develop my own
    utility? I did not find anything in the administration console to do this.
    This has been a source of some trouble, because sometimes I get error
    messages when I want to redeploy the beans.
    Thanks in advance,
    Vegeta--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • How to delete an element from a template??

    I bought a dreamweaver template and there's a menu that goes across the top of the screen but I don't know how to get rid of it?? I don't see any coding for it in dreamweaver it just kinda shows up. Link to page: http://ramclutches.com/newsite/index.html

    This is not a DW template child page, so all the code that is rendered on the screen is also editable by you. Add this rule to your CSS -
    #advanced .bg_pro {
         display:none;
    and that top menu will be gone.

  • Installed photoshop elements 12 and can't delete photoshop 8.  How to delete photoshop elements 8?

    Installed Photoshop Elements 12 and can't uninstall Photoshop Elements 8. Desktop gives error messages on startup, Windows 8.1.

    Try uninstalling in Safe Mode.

  • How to delete a UI element in a "safe" way?

    When I delete/cut/copy a UI element from a project.
    I cannot rebuild/archive the project due a "classpath" problem.
    The project's structure is damaged and a lot of errors are generated.
    1) How to delete UI elements from the layout without damage the project's structure?
    2) If the project's structure is damaged. Is there an easy way to fix it?
    (I tried the "repair" option from project name's context menu - didn't help).
    Also, I tried to "organize imports" - didn't help either.
    http://img67.imageshack.us/img67/4927/errors0ph.jpg
    Thanks, Omri

    Well, failing everything else, there is a way to do this if you have deleted an element and the project has become damaged.
    In your Windows file explorer, browse to the project directory, search for and delete all the ".class" and ".java" files. Now browse through all the project subdirectories, open every file in Notepad, and search for references to the object which you deleted, and delete those references.
    You need to be really careful when you do this, because you can totally ruin the Web Dynpro project. But if done correctly, it can revive a project which has run into the problem which you describe.
    Walter

  • How to delete particular child element

    hi
    i have one xml document like this;how to delete particular element ;i want to delete say playerid = 9;
    and also i want to update the particular element, IndianPlayer(child nodes(name,age)) say playerid = 5 with name=agarkar and age=27;
    <India>
    <IndianPlayer PlayerId="1">
    <Name>Sachin</Name>
    <Age>31</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="2">
    <Name>Saurav</Name>
    <Age>32</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="3">
    <Name>Yuvraj</Name>
    <Age>22</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="4">
    <Name>Dravid</Name>
    <Age>32</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="5">
    <Name>Kumble</Name>
    <Age>34</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="6">
    <Name>Sehwag</Name>
    <Age>24</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="7">
    <Name>Laxman</Name>
    <Age>32</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="8">
    <Name>parthiv</Name>
    <Age>18</Age>
    </IndianPlayer>
    <IndianPlayer PlayerId="9">
    <Name>Zaheerkhan</Name>
    <Age>26</Age>
    </IndianPlayer>
    </India>
    bye
    chaitanya

    Hi
    you can use the following code to delete a particular child based upon the given criteria
    Name the xml file as cricPlayer.xml(since i have used that name in the program)
    i hope this solves ur problem
    // Developed by ottran on 18/06/2004
    import java.io.*;
    import java.util.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.*;
    import javax.xml.parsers.*;
    import javax.xml.*;
    import javax.xml.transform.stream.StreamSource;
    public class CricDom
    public static void saveXML(Document doc, String str)
    try{
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT,"yes");
    transformer.transform(new DOMSource(doc),new StreamResult(str));
    catch(TransformerException e)
    System.out.println("Transformer Exception: "+e);
    public static void main(String args[]){
    try
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse("cricPlayer.xml");
    document.getDocumentElement().normalize();
    Node ParentNode = document.getDocumentElement();
    NodeList list = document.getElementsByTagName("IndianPlayer");
    for(Node child= ParentNode.getFirstChild(); child != null; child = child.getNextSibling())
    try{
    if(child.getNodeType()==Node.ELEMENT_NODE)
    NamedNodeMap tw = child.getAttributes();
    if(child.getAttributes().getNamedItem("PlayerId").getNodeValue().matches("9"))
    ParentNode.removeChild(child);
    saveXML(document,"cricPlayer.xml");
    catch (NullPointerException nex)
    System.out.println("Null Exception : "+nex);
    catch (Exception ex)
    System.out.println("Exception : "+ex);
    Bye
    ottran

Maybe you are looking for

  • How How can i install Mountain Lion with faulty firewire ports??

    Basically the firewire ports are fried on my MBP 3.1  (2007). My mac used to take hang on blue screen and take 10 mins to boot but I solved this problem by installing an ssd and deleting the following kext file... /System/Library/Extensions/IOFireWir

  • Change labels of af:query parameters

    Hello, I have a table with an af:query. I've set a viewcriteria on the base ViewObject. This criteria contains two parameters (one is a number, the other is an LOV based id). When running the page, the attributes labels in the af:query are the column

  • Tax Jurisdiction(TXJCD) of FI document

    Hi Experts, I need the Tax Jurisdiction(TXJCD) field for each line item of FI document. I wont be able to select from BSEG table since it is a cluster and it creates lot of performance issue. I couldn't find this field in any of the secondary index t

  • JFrame add and remove panel repaint issues

    I'm not really sure what is wrong with the code. I have tried different things. What I am trying to do is to remove a panel and then add a different panel that contains a table into a frame, so the frame displays the table panel instead of the origin

  • Better N performance on Airport Extreme

    I just bought an Airport Extreme dual band to use with my Windows machines. Through a post on another forum on here, I found out my N connections are actually using the 2.4ghz band and not the 5ghz band. I have a Zxyel wireless N card in the one desk