2 JTrees with the same nodes - is it posible?

hi
I have two trees that use the same user objecs is it possible to create one tree and then get the nodes and add the to the second tree?
If I do that - did reload(node) of one tree will effect the other tree?

I have two trees that use the same user objecs is it
possible to create one tree and then get the nodes and
add the to the second tree?sure
If the treenodes in your tree are DefaultTreeNodes then these can't be shared between JTrees without the two trees being the same afaik..
If you want to share userObjects (which are stored inside the DefaultTreeNodes) then you could write a short routine to clone part of a tree structure
e.g. TreeNode cloneDMTN(DefaultMutableTreeNode node) {
   DefaultMutableTreeNode result = new DefaultMutableTreeNode(node.getUserObject());
   // iterate over children of "node", adding each one to the result
   // make result.parent = node.parent
   return result;
}> If I do that - did reload(node) of one tree will
effect the other tree?only if you are sharing DefaultMutableTreeNodes (or a similar class that stores a TreeModel distributed through objects)
asjf

Similar Messages

  • JTree Nodes with the same name

    What do I have to do to get the JTree to render nodes with the same name? These Nodes user objects are completely different object types and each has a unique hashcode.
    + Root Node
    +-- node1 (this is a folder)
    +-- node1 (this is a file)
    The problem is I have n folders in my tree but if a parent folder contains a folder and a file with the same name then no other subfolders are displayed.
    The nodes exist in memory because I enumerate the tree and display its contents in System.out.
    Thanks in advance!
    Matt

    Thank you to everyone that responded. I solved the issue. It was a timing issue...here's my original method:
    private void renderProductFolder(SubFolder sf){
    try{
    WTPart part = QueryHelper.service.findWTPart("number", sf.getNam());
    WTTreeNode node = buildWTTreeNode(part);
    super.getTreeModel().setRoot(node);
    renderTree(node, sf); // This is the problem call
    super.getSelectionModel().
    setSelectionPath(new TreePath(node.getPath()));
    super.expandPath(new TreePath(node.getPath()));
    }catch(Exception ex){
    ex.printStackTrace();
    Here is the fix:
    private void renderProductFolder(SubFolder sf){
    try{
    WTPart part = QueryHelper.service.findWTPart("number", sf.getNam());
    WTTreeNode node = buildWTTreeNode(part);
    renderTree(node, sf); // This was the problem call
    super.getTreeModel().setRoot(node);
    super.getSelectionModel().
    setSelectionPath(new TreePath(node.getPath()));
    super.expandPath(new TreePath(node.getPath()));
    }catch(Exception ex){
    ex.printStackTrace();
    I was originally building the root node, then setting it as the root, then adding additional nodes to the root in the call to renderTree(). So the fix was to build the complete tree structure and then call setRoot(). Otherwise the tree doesn't automatically paint the nodes when they're added via node.add(nodeChild).
    It was just a coincidence that I discovered this problem with nodes having the same name.
    Thanks for all your great input!
    Matt

  • Having multiple nodes with the same name in JTree!!!???

    Hi!
    I want to be able to have folders or files with the same name in different locations in my JTree. But if I do so the last one always overwrites the previous one.
    I have a vector with strings like root\aaa\bbb\ccc\ddd.doc, root\aaa\bbb\eee.doc, root\aaa\ccc\fff.doc etc. In this case ccc\ddd.doc out of the first string would disapear.
    In this post you can see how I add the nodes:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=54920
    Is this because it adds everything in the same level or what? A solution/workaround would be much appreciated.
    Tobias

    Use this example...
    public class TreeDemo {
    private JFrame frame;
    private JTree tree;
    public TreeDemo (JTree tr) throws Exception {
    frame=new JFrame();
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    edit=new JEditorPane();
    frame.getContentPane().add frame.getContentPane().add(tr,BorderLayout.CENTER);
    frame.getContentPane().add(new JButton("ok"),BorderLayout.SOUTH);
    frame.pack();
    frame.show();
    public static void main(String[] argv)
    throws Exception
    Vector v=new Vector();
    v.add(0,"c:\\first\\abc");
    v.add(1,"c:\\first\\abc\\word1.doc");
    v.add(2,"c:\\first\\abc\\description.doc");
    v.add(3,"c:\\first\\def ");
    v.add(4,"c:\\first\\der\\tor1.doc");
    TreeDemo html = new TreeDemo (createTree(v));
    private static JTree createTree(Vector v) {
    JTree tree = null;
    DefaultMutableTreeNode root = null;
    Iterator i = v.iterator();
    String subStr;
    DefaultMutableTreeNode parent=null;
    root = new DefaultMutableTreeNode("ROOT");
    tree = new JTree(root);
    parent=root;
    while (i.hasNext()) {
    String path = (String)i.next();
    StringTokenizer st = new StringTokenizer(path,"\\");
    while (st.hasMoreTokens()) {
    subStr = st.nextToken();
    DefaultMutableTreeNode current=findObject(parent,subStr);
    if (current==null) {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode(subStr);
    parent.add(node);
    parent=node;
    else {
    parent=current;
    parent=root;
    return tree;
    private static DefaultMutableTreeNode findObject(DefaultMutableTreeNode parent,String value) {
    for (int i=0; i<parent.getChildCount(); i++) {
    DefaultMutableTreeNode node=(DefaultMutableTreeNode)parent.getChildAt(i);
    if (node.getUserObject().equals(value)) {
    return node;
    return null;
    best regards
    Stas

  • How to create reports servers with the same name in two nodes in Reports

    Greetings
    We are migrating Oracle Application Server 10g (9.0.4) to a better hardware infrastructure with high availability. We want to provide 2 new Oracle Application Server 10g (9.0.4) in High availability and we want to avoid modify the existing forms and reports code, but the code is looking for a specific reports server name when calling reports, but I couldn't create the same reports server name in the both oas machines, I could create the reports server in only one node. I want to create a reports server with the same name in both nodes but it is not possible. I know that there is a procedure to do that in 10.1,2 (Note 437228.1, How to Create Two Reports Servers With the Same Name in the Same Subnet) but I couldn't find the equivalent procedure in 9.0.4.
    Anybody kwows how to create a reports server with the same name in two nodes using 10g (9.0.4)
    Thanks
    Ramiro Ortiz.

    Hello.
    I applied the patch 4092150 on my oas 9.0.4.2 and I modified my rwnetwork.conf file changing the port to 14022 by following the note "How to Create Two Reports Servers With the Same Name in the Same Subnet? [ID 437228.1]" but I am facing the same error rep-56040 "server already exists in the network".
    When I run osfind command I get the following information (My reports server is senarep and I want to create it on SNMMBOGOAS10):
    osfind: Found 2 agents at port 14000
    HOST: SNMVBOGOAS10.sena.red
    HOST: SNMVBOGOAS09.sena.red
    osfind: There are no OADs running on in your domain.
    osfind: There are no Object Implementations registered with OADs.
    osfind: Following are the list of Implementations started manually.
    HOST: SNMVBOGOAS10.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep2
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep2
    HOST: SNMVBOGOAS09.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep
    Any Ideas?

  • How to apply different keyboard shortcuts to an actions with the same name but in different menus within one application?

    Hi,
    Hopefully someone can help. I have the application "djay" and in two different menus there is the action "Eject". I was wondering if it's possible to apply different keyboard shortcuts to those actions with the same name? I can't see how to do it as it seems you can only write the action but as there are two it doesn't seem to work for me.
    For example:
    djay>Table-1>Eject - ⌘⇧1
    djay>Table-2>Eject - ⌘⇧0
    Thanks in advance for any help!!

    A NodeList doesn't only contain 1 element. In your example it contains ALL <Data> elements inside the document.
    NodeList nodes = document.getElementsByTagName("Data");
    System.out.println(nodes.getLength() + " \"Data\"-elements found");
    for(int i=0; i<nodes.getLength(); i++) {
       Node node = nodes.item(i);
    }

  • 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.

  • 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....

  • Is it possible to call a function with the same name from 2 different dll's at the same time.

    I'm trying to call a function ( F ) form 2 different libraries ( A.dll and B.dll ) at the same time. The first lib loaded determines the function F. A->F and B->F have same interface and name but different implementation.

    Hi,
    I tried it with two dll's, both with the same interface, and at the same
    time, in the same VI. The popups even appear at the same time.
    But now I understand the problem... Both dll's are created by LabVIEW! If
    they are not (or one is not, and the other is), this is no problem.
    And VI's in memory cannot have the same name. LabVIEW doesn't care if VI's
    are in a dll or not.
    This might not help, but if you want to make some sort of "plug in" system,
    you might consider using llb's. By loading VI's dynamically, you can select
    the path from which they are loaded. You must unload (close all references)
    one before the loading the other, or the same problem will occur. If you go
    this way, I consider a different approach. Make on
    e library (or even a dll)
    that has the interface you like, this is the "loader". Now make several
    "plug in"'s, with the same interfaces. The name of each function in a plug
    in is a concatenation of the library name and the function name. The loader
    has one extra function, that loads (and unloads, when done) references to
    all desired libraries to use (the names of the functions can be figured out
    easily). All that the loader functions do is dynamically call the library
    functions. You can use a call by reference node for this (you can use the
    connector pane or the loader vi, since the interface must be the same!).
    If you go this way, I guess the loader library can be converted to a dll...
    Hope this helps.
    Wiebe.
    "rsam" wrote in message
    news:[email protected]..
    > Thx Wiebe,
    >
    > did you load both dll at the same time? For example in 1 vi. Somehow
    > the first loaded function keeps to overrule the second. Notice that
    > the interface is
    exactly the same.
    >
    > I loaded 2 dll created in Labview with results described above.
    >
    > Regards Ruud

  • Nested-Generic Type with the same parameter as enclosing type?

    Greetings. I want to write a nested generic type with the same type parameter as the enclosing type. For example, consider:
    public interface BinaryTree<Type> {
         Node<Type> getRoot();
         interface Node<Type> {
              Type getValue();
              void setValue(Type value);
              Node<Type> getLeft();
              void setLeft(Node<Type> node);
              Node<Type> getRight();
              void setRight(Node<Type> node);
    }In this example, I want Node to be specified to the same type as the binary tree's parameter specification. Does anyone know how to do that? I have tried several methods and am at a loss.
    TIA

    Is there any way to declare that? Essentially I want
    the nested type to parameterize the enclosing type.I understand that but I don't think it's possible because of how java generics works.
    This ,
    SomeClass< SomeNestedClass<Type> >is wrong because you're supposed to give a formal type parameter within <> not an already defined type (like SomeNestedClass).
    If you instead do
    public class SomeClass<Type > {
        public static class SomeNestedClass<Type> {
    }To think of the two Type as the same formal type parameter is semantically incorrect. Both the outer type and the inner type must be able to participate in variable declarations "on their own". Say you do
    SomeClass<Integer> sc;Just because you did the above in which context is now SomeNestedClass supposed to be bound as SomeNestedClass<Integer>? To me this shows that SomeClass and SomeNestedClass cannot share the same formal type parameter.

  • How do i create more than one account in Mail with the same isp?

    I am using suddenlink and have set up one account for Mail. It seems to work ok. I want to set up two others with the same provider but can't.
    Let's call the first account, account1
    It works.
    I set up another and call it account2.
    It is using the same provider which already has the account set up on their end, but how do I set it up to work on my end? Does it need to use the same username as account1 or can it use the user name for account2? I hope this makes sense.
    I just want to use three email addresses from the same provider with mail. I need some help. Please?

    Initially you need to configure via the provider's own web based control panel multiple e-mail accounts. If they don't have one, work it out with their customer support to have three distinct mail accounts. Then you can setup multiple logins by adding new accounts to mail. Since mail checks all accounts per Mac OS X user account simultaneously, it probably is best to use different usernames on the same internet provider. If you don't want mail to show all the information from all three mail accounts simultaneously, configure Apple menu -> System Preferences -> Accounts to have multiple users on your computer, and configure each of the internet service provider accounts for each separaet user on Mac OS X.
    Message was edited by: a brody

  • How can I see My Photo Stream from two Macs associated with the same Apple ID?

    I have a MacBook Pro (my personal machine) and an iMac (our family computer).
    The iPhoto library housing all of our family photos lives on the iMac.
    The iPhoto library on my MacBook Pro is currently empty.
    I have an account on both machines.  I have associated the same Apple ID with both machines.
    When I launch iPhoto on my MacBook Pro and attempt to turn on photo sharing (so that I can see My Photo Stream, as well as other shared streams), iPhoto informs me that "iCloud Photos for xxx@xxx is being used with another library named 'iPhoto Library'."
    My iPhone, which is also affiliated with the same Apple ID, shows the streams just fine.
    What can I do to remedy this situation?  I'd like to be able to view my shared streams on my MacBook Pro, while leaving the actual massive photo library on the iMac.

    I found out about this issue when I created a new library with some photo's I wanted to sync to my iCloud account.  I found the following on the Fat Cat Software page and thought it might be helpful to others:
    Using Photo Stream with multiple libraries
    Starting in iPhoto 9.2, Apple introduced a new feature called Photo Stream, which lets you automatically transfer photos via their iCloud service between your iPhoto library and your other devices such as an iPhone, iPad, or another Mac. This feature works when you have multiple iPhoto libraries set up, but there are a couple things to be aware of.
    First, iPhoto will only allow Photo Stream to be active in one iPhoto library at any given time. If you've already enabled Photo Stream in one library, but then open a second library and enable Photo Stream there, this will cause Photo Stream to be turned off in the first library.
    Any photos downloaded by Photo Stream are actually stored in an entirely separate location from any of your iPhoto libraries. This means that, even if you do switch Photo Stream from one library to another, you will not need to go through redownloading all the photos you already have in Photo Stream back from the iCloud servers. So, switching Photo Stream from one library to another is a relatively inexpensive operation, so you can do it as often as needed without it being much of a hassle.

  • There are multiple users with the same display name

    Hi,
    We have a user and when she get an item assigned to her she sees the following alert:
    "There are multiple users with the same display name USERNAME and at least one of them does not have read permissions to some of the files"
    Now I looked in the database and when I run the following query with the username:
     SELECT     
         [ProviderDisplayName]  
        ,[DisplayName]  
        ,[HasDisplayName]  
        ,[Domain]  
        ,[AccountName]  
        ,[UniqueUserId]  
        ,[LastSync]  
      FROM [Tfs_Configuration].[dbo].[tbl_Identity] where displayname like '%USERNAME%'  
    Then I get 2 same usernames back, How can I get rid of one of them ? When I access TFS trough the portal I only find 1 occurence of this user.
    We use VS2013 and TFS2013 update 4
    Best regards

    Hi DSW,  
    Thanks for your post.
    In your query result, please check if these two users have the same Account Name. if they are two different Account Name in result, it indicate there’s two users have the same display name in your AD, please check that two users’ information in
    your AD. We suggest change one user’s display name in AD.  
    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.

  • Use two VIs with the same name, different functionality on a single Project

    Hi, I'm working with vision builder al labview, I need to integrate the vision builder migration Vis into my main program, (Is not an option), but I have multiple Vis autogenerated with the same name, how can i integrate them in the same project without dependency problems
    Thanks in advance

    Hi,
    Unless you really need tight integration between the Vision code and the rest of your LabVIEW application, or would rather not have to pay for a Vision Builder AI runtime license on the targets on which you want to deploy your final application, I would recommend you look into using the Vision Builder AI LabVIEW API instead of migrating the inspection to LabVIEW.
    The API allows to control Vision Builder AI by launching a Vision Builder AI engine, running the inspection and retrieving resulting images and results.
    The advantage of the API is that it allows for easier modification and debugging of the Vision Inspection that you designed in Vision Builder, if you need to make changes later. (i.e. all you need to do is open the inspection in Vision Builder AI, modify parameters, add steps etc).
    You won't have to change your LabVIEW application, unless you want to output additional results.
    When you build and deploy your application, you will need to install Vision Builder AI on the target machine and get a runtime license for it.
    Migrating the inspection to LabVIEW is a one way deal. If you need to make changes to the inspection, you will have to migrate the inspection again, or modify the code outside of the Vision Builder AI environment.
    As you might have noticed, the code generated is quite complex, and it is recommended to go this route only if you need really tight integration/synchronization between the vision code and the rest or your LabVIEW code, or if you would rather pay for a cheaper Vision runtime license rather than a VBAI runtime license for the deployment machine (in case of deploying multiple systems where cost is a big consideration).
    Vision Builder AI API examples are located in this folder:
    C:\Program Files (x86)\National Instruments\Vision Builder AI\API Examples\LabVIEW Examples
    Hope this helps clarify the use cases and help you make the right decision for your design.
    Best regards,
    Christophe

  • Can I use multiple computers with the same iPod?

    Hello all, I own a desktop computer, and just recently bought my first laptop. I have iTunes already installed and my iPod synced on the desktop. Now I just installed iTunes on the laptop, and want to sync the iPod on the laptop also, so I can have two computers synced with the same iPod. Can that be done? Any info is greatly appeciated, thank you.
    Tim H.

    what Niel said is correct.
    however, there might be a (semi) workaround. check this thread for pointers: http://discussions.apple.com/message.jspa?messageID=11524444#11524444.
    JGG

  • If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    Actually, everyone missed one point, when a device is priced, the cost of icloud storage space for that device is also included in it that is why they are able to give you 5gb each for each user ID, in nutshell there is nothing free coming with apple device purchase, it is paid for.  What they are trying by giving only 5gb per user ID irrespective of the number of devices used is pure broadlight looting, they take money from you when you buy each device and give you nothing, This is a case of goods and services bought but not fully deliverd ie apple can be suied for discreminatory treatment towards it's users. I wonder why no one tried this yet in America where everyone sue everyone for petty things..... there is no one to take up this issue? . if tim got any love for the guys who shell out money for the devices his company makes, he should be implimenting this as priority before someone wake up from sleep and sue him.

Maybe you are looking for

  • Portal and Internet Explorer problem

    Hi everyone. My problem is that I'm using Portal through the WEB AS Java stack SP09 and i can't update to the newer stacks since I'm on IDES system, so it has to be SP09. Well, my operating system Win 2003 x64 comes with Internet explorer 8 by defaul

  • PO creation wrt PR only

    I want to make PR creation madatory for PO creation; PO shall always be created when a PR exists for it. Is there any std functionality or development is required. Thanx, Suz

  • Airport Express and Lexmark P6200 printer

    I get 'error message 9672' When I try to add my printer (a Lexmark P6250) through the Airport Express USB connector. The printer is fine when coupled to the iBook via wire. Could there be a compatibility problem & if so is there a way around it.

  • Screen exit for VL02N

    Hi, I want to add 2 fields on each line item of the delivery note prior to processing and Shipping which should be positioned in u201CLoading and Shipmentu201D tab of Delivery Note line item.  This data to be stored in LIPS table.  Can any one sugges

  • Mail crashing after OS update when some images are attached- Spamsieve user

    Mail program crashes when I attempt to open some emails with attachments. Spinning colored wheel and then crash. What portion of crash report is needed to assess problem?