JTree same nodes

Hy,
I have a problem with the treeselectionlistener.
I want to show data from a database using a JTree but the problem is that some nodes have the same name. So the methode
public void valueChanged(TreeSelectionEvent event){
                              TreePath path = tree.getSelectionPath();
     String test = path.getLastPathComponent().toString();
gives a lot of times the same value.
Is there a possibility to identify the selected node like an array that shows the number of the selected node.
Like [2,5,1] this would than mean node 2 of first row node 5 of second row and first node of 3th row?
Thx Mette

you could extend DefaultTreeNode and add a variable which will correspond to Key Field in your table like:
public class MyCustomTreeNode extends DefaultTreeNode {
private int nodeId;
//code if needed
or you could play with TreePath object... more on:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/tree/TreePath.html

Similar Messages

  • CRS Install hostname being used by more than once for the same node.

    Hi, we're installing The Oracle Clusterware and on the Cluster Configuration screen of the universal Installer (the one were you specify the clustername and clusternodes) we get the following error message in a dialog box when the next button is clicked:
    "You must enter unique values for the public node name, the private node name and the virtual hostname for all nodes in the cluster. The name, node1, that you entered is being used by more than once for the same node."
    Has anyone experienced this error message before and know what the cause is?
    Could it be a problem with the /etc/hosts file?
    Thanks in advance,
    M

    Make sure you allocate separate IP addresses on your network for the VIP addresses on each RAC node (this is not the same as the machine IP already configured on the OS).
    Also, the installer may complain if your private and public IPs are configured under the same subnet.
    Finally, as mentioned before, check that name resolution for all the IPs to be used. On all RAC nodes, your /etc/hosts file should be configured with:
    - public name and IP addresses of ALL nodes
    - private name and IP addresses of ALL nodes
    - VIP name and IP addresses of ALL nodes
    Hope that helps
    B.

  • Logical and Physical Standby on same Node

    Is it possible to have a logical and physical standby database for a primary database on the same node (i.e. primary on NodeA, logical and physical database of primary on NodeB)?
    Will there be any conflicts with data guard broker with this configuration or any problems I may encounter?

    From a technical point of view this is possible. Your standby node should be powerful enough to handle 2 instances. For even higher availability 3 dedicated nodes would be better. When Node B is down, both physical and logical standby are also down.
    Werner

  • Can we have Multiple Instance on same Node in Oracle 10g RAC

    Hi All,
    I am planning to implement the RAC in Oracle 10g.Before that i have one doubt regarding RAC.
    My question is "Can we create multiple Instance on Same node(Server) ?"
    is it possible.
    Any ideas or thoughts would be apperciable.
    Thanks in Advance.
    Anwar

    This is where it is important to keep the separation between 'database' and 'instance'.
    A database is the set of files that contains the data (and the redo, control files, etc). A database does nothing by itself, other than take up lots of disk space.
    An instance is theCPU cycles (running software) and the memory to control the database.
    In Oracle RAC, you can have as many instances controlling one database [at the same time] as you want (within reason). Each instance must be able to access the disk(s) that contains the database.
    These multiple instances can be on the same computer (effectively taking up a lot of server memory and CPU for nothing) or they can be on separate computers.
    If they are on separate computers, the disk subsystems must be able to be shared across computers - this is occasionally done using operating system clusterware and is the main reason why clusterware is required at all. (This is also the toughest part of the pre-requisites in setting up a RAC and is very vendor dependent unless you use ASM.)
    These instances need a communication connection to coordinate their work (usually a separate network card for each computer) so they do not corrupt the disk when they are trying to access the same file, and possibly the same block, at the same time.
    In a RAC configuration, instances can be added, started, running, stopped and removed independent of each other (allowing a lot of high availability) or can be started and stopped as a group.
    Each instance gets it's own SID, which is in no way any different than a non-RAC SID. It's just the name of a service that can be invoked. The neat thing is that the SID
    a) helps the DBA keep things straight by lettiung us talk about 'instance A' (the Oracle software to be running over on computer A) vs 'instance B' when starting, stopping and managing;
    b) helps the application by providing targets that can be listed in the TNSNAMES.ORA [against one service alias], which is used by ORacle Networking to provide automated load balance or failover (instance/SID a is not available, I guess I'll try the next in the list)
    Hope that helps the concept level a bit.

  • Server 2012 Failover cluster. Make two VMs stay on the same node

    We have a unique situation where i need two machines to stay on the same node. Its a 4 node cluster with 30+ resources but i want to make sure two boxes are ALWAYS on the same now. If one migrates to another node the second needs to follow. Is there
    a way to do this? 

    How an this KB help to stay the two vm's on the same node.
    With all do respect @justinv how could this helped you to your problem , your question was "We have a unique situation where i need two machines to stay on the same node. Its a 4 node cluster with 30+ resources but i want to make sure two boxes are ALWAYS
    on the same now"
    and the KB that elden showed you is for : "Failover clusters that are running inside of virtual machines (sometimes referred to as “guest clusters”) may have problems with nodes joining the cluster."
    @justinv cloud you tell us more about this did I misunderstand your question ?
    Greetings, Robert Smit Follow me @clustermvp http://robertsmit.wordpress.com/ “Please click "Vote As Helpful" if it is helpful for you and Proposed As Answer” Please remember to click “Mark as Answer” on the post that helps you
    I explained in one of my replies that my underlying issue was this exactly what the KB fixed..... A guest cluster failing when moved to different nodes. Thats the only reason why i wanted them on the same node to begin with. While this post didn't solve me
    original question is solved what my real problem was....

  • Stand by database at same node

    Hi,
    I tried to configure a Data Guard. both primery and Standby databases are configured at same node but i am facing problems when trying to open standby database in read only mode i get the following error
    ERROR at line 1:
    ORA-16004: backup database requires recovery
    ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
    ORA-01110: data file 1: 'D:\D:\ORACLE\ORADATA\CHILDDB\SYSTEM01.DBF'
    i am using version 9.2.01
    Zaka

    Hi,
    There is error in the datafile location it shows D:\D:\, check your control file.
    Regards
    Anurag

  • 9i and 10g in the same nodes

    Hi.
    I would like to know if it's possible to have two database in different versions (9i and 10g) in the same nodes.
    In this case, I suppose that I have to install the tow clusterware, one for 9i and another one for 10g, haven't I?
    Thanks!

    Hi,
    both your assumptions are correct.
    You can have a 9i RAC database and a 10g one both in the same cluster. However, you would need to have 10g Clusterware and another cluster software for the 9i RAC. On Linux and Windows Oracle would use the Oracle Cluster Manager (CM) for the 9i RAC, on all other platforms you would need to get a third party cluster software for the 9i RAC database, since the 10g Clusterware cannot serve as the underlying cluster software for the 9i RAC database. Nevertheless, the 10g Clusterware GSD would be used to manage the 9i RAC database in those combinations.
    Thanks.

  • Can we run Internet and intranet application on same node?

    Hi,
    Could we run Internet and Intranet applications on same node?
    Regards,

    Hi,
    You can run both sites on the same server. You should just set the site security on the intranet site to only allow access from internal IP addresses. But for security reason, it's not adviceable to do that.
    Regards,
    Hamdy

  • Same nodes in multiple sceners

    I am having trouble using the same nodes in multiple scenes. The nodes are grabbed from separate classes (nodes like ImageView).
    When I change scenes, the controls that are common to both scenes disappear.
    Thoughts?
    TIA

    A control/node cannot be simultaneously in two scenes: it is either in one or in the other. You have to transfer them explicitly in the new scene if you want to display them there. See also [Weird problem when adding items to JavaFX sequence|http://forums.sun.com/thread.jspa?threadID=5443763] with a good answer by Surikov.

  • 2 Instances, Same node

    Hello all.
    Is it possible to user DBConsole (10g) to control 2 instances on a same node? I don't need to manage them simultaneously, I mean, if I can access then one at a time it's ok.
    How could I do this?
    Thanks in advance
    Carlos Inglez

    If you have two sepereate instances, that is if they are not RAC instances, you cant control those 2 instances with the same DBconsole.Every instance will be controled from their own console You could do that with grid control.
    And then, if you had RAC instances , you could control those 2 instances with their common DBconsole.

  • Add database to same node

    Hi,
    I just migrate from oracle 8.1.7 to 9.2 running on Win2k server.
    I have 3 databases on the same server. Currently I can only use the OEM to admin. one database.
    I can see all databases when launch the console in standalone mode, but only one through Oracle Management server mode.
    1)Is there a way to add additional db to the same node?
    2)If each node only allow one DB, How do I add additional node to the same repository, on the same server?
    Your help greatly appreciated.
    Thanks

    This is what you need to do in addition to what the other guys told you.
    1. If DB has same name and port then you can not add
    2. To force discoverery go to $HOME/network/admin and there are two files like this "snmp_rw" one is input and another is output.
    3. Edit the input file and include your missing database entries.

  • Same node names for 2 nodes

    Assuming the two nodes have different parent nodes, can they have the same node name?

    No no, I want the technical name to be identical. My question is, is it possible to have the same node under 2 different parent nodes?
    For example:
    East1 -
                 NY
                 ATL
                 MIA
    East2 -
                ORL
                PHI
                MIA
    Miami is both in East1 and East2. Is this possbile technically?

  • Graph drawing - drawing an arc to and from the same node, how??

    Hey everyone
    This is probably going to have an easy solution but I really cant figure it out!! The problem is drawing a loop in a state machine, ie a path to and from the same node therefore a loop!
    Is there a way to actually do this?
    Thanks in advance!

    Graphics.drawArc(left, top, width, height, start, span) where start is the start angle in degrees, and span is the number of degrees of arc. Assuming you're like me, you're probably putting in the end angle rather than the span.
    Here's one I made earlier- http://www.metamodelling.net/files/ReflexiveArc.java - steps through nine common placements for a circular reflexive arc.
    Pete

  • Remove background in JTree's node

    How to remove colored background in JTree's node?
    http://www.builder.cz/images/client-tree.gif - here is example how it looks like...

    from reading understand white would be best...
    You may have misunderstood.
    In the image you posted there seems to be a problem with a part that strongly reflects the background for example.
    The »ideal« color for efficient clipping depends on the object being photographed, even a green screen would be problematic with an object of a similar green.
    What is the file format you need anyway? psd with transparency or eps with Clipping Path or …?
    Like Silkrooster pointed out Actions and Image Processor, but also Scripts, can help with automising the task with Photoshop – but quite frankly I expect results so bad that each image would likely have to be checked and improved manually.

  • JTree delete node

    Have a problem with JTree
    A node I call folderNode will normally contain sub-nodes with names lik subnode1,subnode2,subnode3 etc. (Just examples)
    The folder node will then represent the range, so for one with the mentioned subnodes, name would be "subnode1- subnode3".
    To update this foldername after I have deleted say nr 3, I use "theFolderNode.setUserObject("new name here")), and then treeModel.nodeChanged(theFolderNode); I would then expect "subnode1- subnode2". (Don't mind the method of finding the correct label..)
    If I then try to get the new userObject and checking by typing:
    System.out.println(theFolderNode.getUserObject().toString()); - I actually get out what I want, but the label of the FolderNode is still not updated..
    What am I missing here??

    Here is an excert from an article from javaworld
    "The Java programmer must keep in mind that it is the garbage collector that runs finalizers on objects. Because it is not generally possible to predict exactly when unreferenced objects will be garbage collected, it is not possible to predict when object finalizers will be run. Java programmers, therefore, should avoid writing code for which program correctness depends upon the timely finalization of objects. For example, if a finalizer of an unreferenced object releases a resource that is needed again later by the program, the resource will not be made available until after the garbage collector has run the object finalizer. If the program needs the resource before the garbage collector has gotten around to finalizing the unreferenced object, the program is out of luck."
    http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
    Generally without any tweaking the GC only runs when it has to, so your memory with be recycled then.
    You can call System.gc() but that doesn't cause garbage recycling, but rather tells the JVM that you would like to do it, and then it will do it sometime after that.

Maybe you are looking for