Saving expanded paths

I've noticed that JTree keeps the expanded paths in some kind of cache. For example, if you expand a bunch of nodes under a certain parent, then collapse this parent and re-expand it again, all the previous expanded paths under this parent show up expanded again.
This means JTree (or maybe each node) keeps a memory of its expanded state. Is there a way to retrieve all the expanded paths at once? What I would like to do is have my application save these expanded paths (we have to deal with very large trees) to restore them later (for example when the user reloads the application.
Thanks for you thoughts :)

I know that...
My question is more, I want to make an algorythm that saves ALL paths that are expanded, so that I can later re-open the same paths when my application opens up again (after it was closed). What's the best way to do this?
My idea was :
-Put a tree expansion listener on my tree
-In this listener, when the path is expanded save it in some kind of list or Set. This will be a path of tree nodes, so I'll have to retrieve the path of my objects instead.
-Before my application closes, I save this path in some kind of user preferences (in file or in a datastore).
-When my application re-opens, at the time I build my tree, I need to replace my path of objects with their respective path of nodes.
-Then for each path of nodes, call the method
makeVisible(path) of JTree.

Similar Messages

  • Photoshop CC 2014 - The file can not be saved in path because an error has occurred

    Hello,
    I need again help regarding this issue. Sometimes but very often I receive an error, trying to save a PSD file, the error is: "The file can not be saved in <path> because an error has occurred". After that it is not possible to save the file in any format, using save or save in dialog. The only way to rescue the result is, to save for web as an jpeg. This error occours often using Topaz or NIK filter and until now only in PS-CC 2014. My workflow looks like this:
    - Open NEF RAW file in Brdige
    - Settings in ACR and give it into PS by clicking OK in ACR
    - In PS doing a adjust some levels
    - press SHIFT+STRG+ALT+E for a new summary layer
    - Uing Topaz Adjust on the new level with 65% opacity
    - press SHIFT+STRG+ALT+E for a new summary layer
    - Using Topaz DeNoise on the new layer
    - pres STRG+i and resize the image to 1200x797
    - Using Topaz InFocus on the same layer as DeNoise
    - create a vignette with brightness adjustlayer
    After this workflow in nearly 90% it is not possible to save the file as PSD or something else, only to save for web as JPG. If I save the file after opening the RAW in PS and after every layer with Topaz Filter, I can save the file when I am done. Same issue occurs using NIK Filters in that way.
    I tried to optimize the performance by using this guide: http://helpx.adobe.com/photoshop/kb/optimize-performance-photoshop-cs4-cs5.html doesn’t solve the issue.
    I re- and installed all Adobe Products more than three times, doesn't solve the issu.
    After that I ordered a new SSD drive and insall Windows 7 64bit inkl. All latest hotfixes, patches and drivers. I downloaded the newest Adobe Versions and the newest filter sets from Topaz and NIK. Doesn’t solve the issue.
    This is my rig:
    Gigabyte Z87X-UD4H mainboard
    Intel Core i7 4770k
    32GB Corsair RAM
    250GB Samsung 840 Evo SSD Drive
    nVidia Geforce GTX770
    During my tests I took the same RAW File and created nearly 20 adjustment layers and summary layers, without using Topaz or NIK filters. No problem, I was able to save the file as PSD file. 
    From my point of view, actually, the error occurs only when I am using Topaz or NIK filters. Both supports doesn’t know the issue and if I search the web, I can’t find more then me. It seemed to depend on my settings, my rig or something else, perhaps a cache is overflowed or something like this. Adobe telephone support can’t help because I said I use a third party filter. But it occurs with two different manufactures…
    So please guys, help me to figure out why this error occurs in my system.
    Thanks in Advance and best regards,
      Michael

    Update: I tried several times to reproduce the error, actually it dosen't occur. I changed nothing on my system, without reboot it twice. This is what I said in my beginning times: it occurs sometimes but often. I will keep you up to date.

  • JTree corruption problem when expanding paths (sometimes)

    Sometimes when adding nodes or expanding paths in my JTree I get a really weird corruption. Here's screenshots of the problem:
    http://linuxhelp.homeunix.com/screen1.png
    http://linuxhelp.homeunix.com/screen2.png
    How can I stop this from happening?
    Adam

    Hi!
    I also had this problem but it works fine using SwingUtilities.invokeLater
    /Malin
    private class ExpandListener implements TreeWillExpandListener {
    TreePath path = null;
    public void treeWillCollapse(TreeExpansionEvent e) {   
    public void treeWillExpand(TreeExpansionEvent e) {
    path = e.getPath();
    collapseAll();
    if (path != null) {
    // If we don't scroll later it doesn't work correctly in some cases
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    scrollPathToVisible(path);
    * Collapses the tree.
    public void collapseAll() {
    for (int i = root.getChildCount(); i > 0; i--) {
    collapseRow(i);

  • Error while saving full path in Console properties

    Hi All,
    to open the mounted servers automatically from .mcs file i tried to change the target field in the console properties by R clicking and selecting properties from the console shortcut Icon from desktop
    i mentioned the full path with _f as prefix
    Eg: -F C:\documents and settings\SAP MDM Servers.mcs
    Error : "Name -f specified in the target box is not valid. make sure the path and file name are correct."
    Please help
    Regards,
    Sharma

    Hello Deepak
    I tried putting it as _F insted of  -f but i am getting the same error. i have saved it on the desktop and i am mentioning the complete path of the .mcs file.
    i am still getting the same error
    Regards,
    Sharma

  • Expanding path on JTree

    Hi.
    I add a node to the default tree model and an event gets fired back to the listener (in this case the JTree itself). I then expand the path so as to show the new node to the user. A gap appears between the new node and the node in another branch below the new node. If I force a re-render (like with updateUI - erk!) the tree is drawn fine, otherwise its now. See the diagram below. If this a common problem and how do you fix it? Many thanks!
    A +
    |
    +----B
    |
    +----C
    Now I insert a node D, and I get:
    A +
    |
    +----B
    | |
    | +----D
    | <------- big gap :-(
    |
    +----C                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    public class Test extends JFrame {
      JTree jt = new JTree();
      JButton jb = new JButton("Add");
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        content.add(new JScrollPane(jt),BorderLayout.CENTER);
        jt.setExpandsSelectedPaths(true);
        JButton jb = new JButton("Add");
        content.add(jb, BorderLayout.SOUTH);
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            TreePath tp = jt.getSelectionPath();
            if (tp!=null) {
              DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode)tp.getLastPathComponent();
              DefaultMutableTreeNode newDmtn = new DefaultMutableTreeNode("Something");
              dmtn.add(newDmtn);
              ((javax.swing.tree.DefaultTreeModel)jt.getModel()).nodeStructureChanged(dmtn);
              jt.setSelectionPath(new TreePath(newDmtn.getPath()));
        setSize(200, 300);
        show();
      public static void main(String args[]) { new Test(); }
    }

  • Can you expand an enveloped object without expanding paths?

    Is there a way to expand an enveloped object without expanding the paths of the object? For example, if I use Envelope Distort>Make With Mesh to distort a group of objects. Can I expand the object after it has been distorted without having to expand the paths of the individual objects that make up the disorted group?

    I've attached some very simple example images to, hopefully, further clarify. The first image is a circle with a thick stroke applied. The second is the circle with distortion applied via a simple mesh. The third is the expanded distorted image. In the third image, the stroke has also been expanded to a filled shape.   The grouped objects that I'm dealing with were created with a Wacom tablet using a 6D brush, and I want to be able to expand the envelope without expanding the strokes into filled objects. While it's certainly possible to just delete the expanding strokes and then reapply the brush to each object, I have some illustrations that I'd like to distort that are made up of a considerable number of objects, so manually going through and deleting the filled expanded strokes and then reapply the brush to each shape would be somewhat time-consuming.

  • Shrinking and expanding Paths

    Hi again
    I am wondering what can be wrong with my approach to closed paths etc.
    I have been working on a new logo as part of a new site later down the line and the text I have created outlines and then 3d. I obviously have lots of paths which when ungrouped I can add the gradients etc that I want.
    The problem is when creating the 3d version it doesn't seem to be an exact science and many of the paths are distorted and need looking at...
    In the beginning - I just fixed the bad ones and started creating gradients etc and when done I have tried to reduce the text to the size I might want to use and have found that many of the letters are distorted; the paths are all misshaped?
    The only way I have got around this is to create new paths for all the parts of my 3d text and then I don't have problems shrinking and expanding them?
    The same is happening with an icon in 3d? It is a hell of a lot of work to rebuild something from the ground up....
    Am I missing something here?
    I thought the idea behind illustrator was that one works with vectors that can be shrunk or grown to almost any size because of mathimatical constraints.
    If this is the case - which I am sure it is, then why am I having problems and what can remedy the situation?
    Thanks as always for your help with my problems...
    bookie56

    Besides the infernal ill-conceived Snap To Pixel Grid feature (fiasco), you should still not always expect rendering perfection from 3D Effect:
    I thought the idea behind illustrator was that one works with vectors that can be shrunk or grown to almost any size...
    Essentially, that's true. The scaleability advantage of vector-based graphics is that they consist of mathematical descriptions of shapes. But quality results assume quality descriptions.
    Whenever those mathematical descriptions are *automatically* generated,--rather than intelligently and deliberately defined--potential exists for caveats which human shape-recognition perceives as error and ugliness.
    As 3D modeling goes, Illustrator's 3D effect is quite rudimentary. This is tolerated because of what it ultimately renders: fairly "normal" vector paths, rather than just a raster image. But with 3D Effect you have to always watch out for occasional artifacts usually resulting from self-intersecting geometry; most commonly from outer bevels, but also from other geometric glitches.
    So 3D Effect should often be treated as an intermediary means toward an end. For final vector artwork, it is quite often advantageous to use 3D Effect as a "rough out" tool, then expand the effect and start cleaning up and optimizing the result. For final raster images (as for use on web pages), it is similarly often required to export (or simply screen capture) the automatically-generated image and do a little touch up in a raster imaging program.
    JET

  • Saving file paths (like a bookmark gets saved?)

    i seem to be doing a lot of restoring of data (for instance i had to restore my notes recently) and i am realizing that it would be uber helpful to be able to save file paths. right now i highlight the folder that i need, then i hightlight the one above it and then again the one above that until i get to the library level where i will see it easily.
    is there some utility of function that would let me save all my important file paths instead of having to do this/
    TIA

    You would want to create aliases for your file paths. right click the folder choose create alias, then drag all the aliases into a new folder you titled Paths. drag the paths folder into your sidebar.
    Another option is to keep your file paths in notes or whatever text editor you choose.
    then copy and paste them into the "go" field
    when in finder hit shift+cmd+G and the GO menu should pop up.
    paste the file path from your notes into that field and you're there instantly.

  • How to not show only visible expanded paths in tree?

    Hi!
    Let's have a tree with next nodes:
    R - root
    N1.0
    N1.1 - child of N1.0
    N1.1.1 - child of N1.1
    The node N1.1 is expand, but node N1.0 is not expand. How show tree when node N1.1 is expand but it's not visible, because it parent is not expand?
    Thank you.

    The correct way to do this is to create a separate account for each of you and disable automatic login when prompted. Under Accounts I would also activate Fast User Switching if the two of you use it at the same time. Then each of you will have your own user directory and this will segregate all of your user data into two separate user folders and you can act separately.
    If it is just a convenience thing then download another email program, like Thunderbird, and each of you can simply use a separate program and neither will be bothered with the others email.
    Also unchecking the "enable this account" in the Mail > Account preferences will cause an account to "disappear" from the Inbox view until the box is rechecked. But this is only a solution if one of you uses the account occasionally like on long weekends or something.
    I think the separate accounts option is what you want from your description but there a few less drastic options.
    HTH,
    =Tod

  • I made a path and saved it and when I try to select it, it turns my stage completely black? Can anyone help me?

    As my question says, I am cropping out a figure exactly how I usually do it and for some reason this time it is not working. I made points with the pen tool and then moved it around with the direct selection tool (light grey pointer) and everything worked fine. I then saved the path and usually you just hold down control and click on the picture of the path next to the name and it selects it for you (marching ants) and then I select the inverse and delete the background. This time for some reason when I control and click on the image of the path, it just turns the stage completely black. When I undo it goes back to normal but everytime I try, the same thing happens. I am using Adobe Photoshop CS6 (64-Bit) By the way
    Can anyone help me?? Thanks in advance

    Can you show some screen captures. Ctrl+Click on a Path in the path palette should make a section from the combined path. Have your tried resetting you Photoshop preferences.

  • Expanding a JTree Node on selection

    Hi,
    I have a need to expand the node on selection in a JTree. I would like all the children to be recursively expanded and selected.
    I believe the code lies somewhere with in JTree's TreeSelectionListener.
    The code I have is as follows
    tree.addTreeSelectionListener(new TreeSelectionListener()
    public void valueChanged(TreeSelectionEvent evt)
    TreePath[] paths = evt.getPaths();
    for (int i=0; i<paths.length; i++)
    if (evt.isAddedPath(i))
    DataNode node = (DataNode)paths.getLastPathComponent();
    ArrayList aList = node.children();
    if( !aList.isEmpty() )
    for(int j = 0; j<aList.size(); j++)
    TreePath tp = paths[i].pathByAddingChild(aList.get(j));
    System.out.println(tp);
    tree.expandPath(tp);
    }//for
    }//public void ValueChanged
    This does not seem to solve the problem..
    Your comments or help is very much appreciated..
    thanks
    S

    it does work for me (i do it in an action). what doesn't work for you?
    thomas
      public RecursiveExpander() {
        menu = new JPopupMenu();
        JMenuItem expand = new JMenuItem("Expand Recursive");
        expand.addActionListener(this);
        menu.add(expand);
      public void mousePressed(MouseEvent e) {
        theTree = (JTree)e.getSource();
        currentPath = theTree.getPathForLocation(e.getX(), e.getY());
        if ((currentPath != null) &&
            !((TreeNode)currentPath.getLastPathComponent()).isLeaf() &&
            (e.getModifiers() == InputEvent.BUTTON3_MASK)) {
          menu.show(theTree, e.getX(), e.getY());
      public void actionPerformed(ActionEvent ae) {
        new Thread(this).start();
      public void run() {
        theTree.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        try { expand(currentPath); }
        catch (OutOfMemoryError oom) {
          System.gc();
          System.err.println("RecursiveExpander: " + oom);
          JOptionPane.showMessageDialog(null, "RecursiveExpander: " + oom, "Error", JOptionPane.ERROR_MESSAGE);
        theTree.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      private void expand(TreePath path) {
        theTree.expandPath(path);
        TreeNode start = (TreeNode)path.getLastPathComponent();
        for (int i = 0; i < start.getChildCount(); i++) {
          TreeNode node = start.getChildAt(i);
          if (!node.isLeaf()) {
            expand(path.pathByAddingChild(node));
    }

  • Saving image to a folder not working on azure

    I am saving image
    files to a folder in my application and saving its path in database . Image uploads working fine when I am running locally
    and its path is also storing.When I deployed it on azure it
    gives an error that " An error occurred while processing your request ". I have two tables in my database . First one where text is saved is working fine on azure but image upload thrown this error.
    I am using this code
    to upload
    image and its works fine when I am running locally. Need help ?

    Hi,
    Have you made any progress ?
    May I ask what application is it that you are running ? You mentioned that it works locally but not when deploying to Azure. Have you checked the connections strings?
    If you are still having any difficulty in understanding the code, perhaps you could post it on the below blog.
    http://blogs.msdn.com/b/onecode/archive/2014/08/28/sample-of-aug-28-how-to-store-the-images-in-sql-azure.aspx
    Regards,
    Mekh.

  • Excel 2010 changes relative link paths to absolute in files synced with Offline Files in Windows 7

    Hello! I'm wondering if anyone else has seen this problem: I have a large number of Excel 2010 and 2003 files in a folder on my file server. This whole folder is also synced to my computer using Offline Files in Windows 7. I have a lot of references between
    cells in different Excel files, and all referenced workbooks are physically in the same folder. This all works nicely when I create these files at work - all file paths referenced in the cells are created as relative paths and the documents open correctly.
    This is, I understand, the expected and default behavior when Excel creates links. When I edit these files at home, nothing seems odd until I get back to work and sync these files back to the file server. At this point, I discovered that Excel 2010 has, when
    I saved the files while away from the corporate network, changed /all/ the cell references in any offline-edited Excel files to point at absolute paths, and that these absolute paths point to somewhere in my %APPDATA% structure. So whenever I come to work
    and I try to open an Excel file that I have recently worked with offline, I get a bunch of error messages about referenced files that are missing, although clearly they exist in the same folder as the file I've opened, and I must edit all the file references
    again, whereupon they are again created correctly as relative paths (since all files exist in the same folder), which are promptly mangled into absolute C:\....\Offline Files\.....\..... paths whenever I save them at home (and since that works too, I don't
    notice it again until I come back to work and the offline files are synced back to the real network location). This seems to be a case of Windows 7's Offline Files not being able to fool Excel 2010 into believing it is working on a file server - apparently
    Excel 2010 can see through the fakery and decides on it's own to "fix" the problem (which obviously isn't a problem since the paths are relative to begin with) by saving the paths as absolute paths instead. Yes, really clever, Excel. The exepected behavior
    according to MSKB is that links are created as relative paths, so why does it change to absolute whenever Offline Files are involved? I know Offline Files only syncs, it doesn't actually change the files, so I can conclude that Excel is the program at fault
    here. Is there a fix for this, or a known workaround? Because frankly, this bug makes it impossible for me to work in any advanced manner with linked Excel files. The sad thing is that this worked perfectly fine with Office 2003 and Windows XP. Is there a
    patch for this problem that I might have missed (I am running the latest Service Pack and I get Office updates from Microsoft Update). If not, is there a workaround I can use to prevent Excel from corrupting my links when I edit the files offline?

    Hello danceswithwindows,
    Thank you for your post.
    This is a quick note to let you know that we are performing research on this issue.
    Sincerely
    Rex Zhang
    Rex Zhang
    TechNet Community Support

  • Clipping paths not recognized (in InDesign)

    Some of my coworkers brought me some files that don't allow the clipping path to be selected in InDesign. These images are saved as PSD format, have a good path drawn and saved. When placed in InDesign, the option to use the clipping path or not is not even available, and the image is not clipped by default. If I place a file showing the import options, I can turn on the path, and it places on the page properly. But invoking the Clipping options in InDesign still shows Photoshop Path as unselectable, but it is checked as it is turned on.
    Saving the path as simply a regular path, or as defined as a clipping path, in an EPS file gives me the correct options to use the path in InDesign. Simply resaving the PSD file to another file on my desktop does not fix it.
    Is there any way to see what is going on in the file? Though it manifests itself as an InDesigns option problem, the error is inside of the Photoshop file. There is no way to resave the same image document and have it work properly.
    The only way for me to "fix" the file is to make a new doc the same size, copy the image, paste into new document, copy path, paste into new doc, and save as a new name. Then the "started from scratch" file works properly.
    Anyone have any suggestions?

    @WasDYP: It's only a couple of files so it's not something I'd think anyone could recreate really easily.
    Here are the files that are having this problem:
    ftp://ftp.clippermag.com/PhotoshopFiles/DAV44462.psd
    ftp://ftp.clippermag.com/PhotoshopFiles/DAV44463.psd
    ftp://ftp.clippermag.com/PhotoshopFiles/DAV44464.psd

  • Issues with file path in java.io.File

    I am getting file path in eclipse plugin using org.eclipse.swt.widgets.FileDialog and saving the path in XML files.
    In web.xml , path is stored as below (I can't change backsladh to forwardslash or escape backslash since the value is coming from SWT FileDialog)
    <init-param>
    <param-name>filePath</param-name>
    <param-value>c:\new\demo\next\version.txt</param-value>
    </init-param>
    In my filter , i have below code in init() method but am not able to get File reference due to special characters
    String filePath = filterConfig.getInitParameter("filePath");
    // Tried filePath.replace('\\','/') --> Didnot work since \n is a single character
    File f = new File(path)

    No it does not. You need to escape file paths properly. You can check this with simple code and that the problem i am facing now
         public static void main(String[] args) {
              String path = Messages.getString("filePath"); //in messages.properties put filePath=c:\new\next\verison.txt
              System.out.println(path);
              File f = new File(path);
              System.out.println(f.exists());
         }

Maybe you are looking for

  • Playlist song order

    when i use itunes to create a play list my songs never come out in the order i want. this happens even when i use "sort by manuel order" have tried everything can't fix it help

  • Importing/external drive/consolidate problems

    This is strange one, that I can't figure out. This all started when I tried to import a couple of CD's into iTunes, and when I would go back to play the imported songs, each song would only play for about 30 seconds and then skip to the next track (t

  • How do I fix this problem with my iTunes?

    I've been having problems with my iTunes for over a week now - since I tried to update to iOS 5 - and I've tried everything. I've had to uninstall iTunes multiple times and each time I have reinstalled it, there has been some form of error, the list

  • S540 critical process died

    Hy, I have upgraded my S540 to Windows 8.1. I installed all drivers and updates and have now sometimes bluescreens with the message "critical process died". I know this is not much information but I have no idea how to examne or solve the problem.

  • Why has the last update screwed everything up

    ...Now, important site I use no longer functions like it should. It should remember what I've looked at, this is the way it use to function. this might sound vague but I got no input on my last question!-maybe too long? It's a music site I use for bu