Yikes!  set selection in an explorer tree is hard!

Okay,
So I wrote an explorer-style tree (aren't you happy I'm not asking how to write one?) However- coming back in to this tree and re-selecting a directory, say from a history list, is hard!!!
This tree uses a custom node that basically wraps a java.io.File object. The problem is mostly on Windows since the Linux root concept is more of a programmers friend. Say I build a tree with getRoots(), so I show "C:\", "D:\", etc.
Now say later I need to tokenize a path and try to rebuild a tree path. Well it is hard to reconsuct an array of java.io.File-backed objects! The reason is that 'new File("A:")' doesn't equal 'new File("A:\\")' however some paths can be equal even if the path delimiter is different.
So since I don't know (and shouldn't count on) how a File object was initially created when I call listRoots()- it is very hard to know how to properly re-create a new File object to stick in a TreePath that will be equal enough for setSelectionPath() to work.
Any ideas on this??? Thanks

Well the fix was ugly but I see no way around it. I have to force 'A:' to be 'A:\' wherever I see it or else the file objects created off of that string won't be equal to one another.
I don't understand it- new File("A:") should .equal new File("A:\") but it doesn't.

Similar Messages

  • How do I get the tag of a selected line in a tree control ?

    I am running LabVIEW 7.1.
    I want to be able to add a parent or sibling to a tree to a selected item in a tree.

    The tag of the selected item is actually the output of the tree control itself. If you create an indicator from the tree control, you will get a duplicate tree control (indicator), but if you wire the output into a string indicator, the tag of the selected item will show up. You can an item to the tree by wiring the tree reference into an invoke node, calling the method "Edit Tree Items: Add Item", and wiring the output of the tree control (which will be the tag of the selected item) into the "Parent Tag" terminal. This method will only let you add a child to an item, you cannot add a parent or sibling. Items cannot have multiple parents, so it wouldn't make sense to add a parent; and to add a sibling for the selected item, you could call the method "Navigate Tree: Get Parent" and pass the tag of the parent into the "Edit Tree Items: Add Item" method.
    Robert Mortensen
    Software Engineer
    National Instruments

  • Select new row in tree after add

    In quite a few of our pages in our application we have trees and tree tables that can have rows added through separate popup windows. After the user successfully adds the record and closes the popup the tree/treetable is refreshed properly, however we also want the new node/row to be selected, and also make sure that it's parent is expanded. We've found a variety of examples of logic that does something close or sort of close, but we're having difficulties. Is there any easy or even moderate way to find a node/row in a tree based on the VO's primary key or some other value? I think I know how to make the found node/row selected and it's parent expanded, but how do I find the node/row? I keep running into issues because the tree isn't necessarily completely expanded or because the range of rows in the iterator isn't huge and the new row isn't in the initial range of rows pulled back.

    Hi,
    I just posted a demo and source code on my blog: Auto select New Item in Tree component
    In above example i use loopAndFind() custom function.
    Hope it helps!
    Mariush T.
    Blog: http://mariusht.com/blog/

  • How to set selected file in FileChooser showSaveDialog to default file name

    Hi,
    How do I set selected file in JavaFX 2.0 FileChooser showSaveDialog, so I can prompt the user with a suggested default file name?
    I am converting a Java Swing application I wrote a few years ago to JavaFX 2.0.
    In the Swing application, I use setSelectedFile() as follows:
    JFileChooser jFileChooser = new JFileChooser();
    jFileChooser.setSelectedFile(new File(backupfile));
    jFileChooser.setCurrentDirectory(new File(outputDirectory));
    FileFilter filter = new FileNameExtensionFilter("Comma Delimited (*.csv)", "csv");
    jFileChooser.addChoosableFileFilter(filter);
    jFileChooser.setFileFilter(filter);
    filter = new FileNameExtensionFilter("XML Document (*.xml)", "xml");
    jFileChooser.addChoosableFileFilter(filter);
    jFileChooser.setAcceptAllFileFilterUsed(false);
    jFileChooser.setDialogTitle("Export File");
    int returnVal = jFileChooser.showDialog(jFrame, "Export");
    This would show a file chooser with the file name text field pre-populated with a default backup file name.
    I can't find an equivalent in JavaFX.
    Also, in the Swing application, I was able to determine which extension filter was selected at run time using getFileFilter().getDescription() as follows:
    String extension = jFileChooser.getFileFilter().getDescription();
    if (extension.equals("XML Document (*.xml)")) { ...
    I can't find an equivalent in JavaFX.
    Thanks,
    Barry

    You can use the open sequence file method on the application manager (then you only need to wire the file path)
    Rodéric L
    Certified LabVIEW Architect

  • How to add "select all" to explorer context menu

    In Windows 7 and  8 I was able to add "select all" to explorer right click context menu using a .vbs script file and a .reg file.  The same .vbs and  .reg files worked for both OS.  However, it does not work in Windows
    10.  Does anyone know how I can accomplish this in Windows 10?  Using Ctrl+A is awkward for me since I've used the context menu for so long.  Besides,  I guess I'm lazy.  Searching the net I've found other context menu adds but
    not this.

    Hi Glasskuter,
    Win 10 is preview version and the purpose is to collection feedback. We've not started to support it yet. I would recommend you use feedback tool in Win 10 desktop to submit issues about it. Thank you for using Win 10.
    Regards,
    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.

  • Auto select new item in tree

    Hi
    I have a tree that i allow user to drag and drop items to it - what is the easiest way so the new item is automatically selected? ie, tree.selectedIndex should point to the new item's index.
    Unfortunately it thought this was easy apparently it was not - like if the nodes in the tree control are collapsed, the selectedIndex is different than when all the nodes are expanded.
    Do note that the way i populate my tree is through a data provider - so i populate a class that would become the tree's data provider, so when the tree refreshes, i simply do this:
    myTree.dataProvider = project.p;   
    I can track where my new item was inserted in my "project" instance - but like i said earlier, the tree itself have different selectedIndex when the nodes are collapsed and when they are not.
    THanks

    Hi,
    I just posted a demo and source code on my blog: Auto select New Item in Tree component
    In above example i use loopAndFind() custom function.
    Hope it helps!
    Mariush T.
    Blog: http://mariusht.com/blog/

  • How can we show selected values of a tree in a selectmanylistbox

    how can we show selected values of a tree in a selectmanylistbox??

    Hi,
    you can use a reference to a RichTree component instance and call  getSelectedRowKeys on it. The selected rowKey then allow you to look-uo the nodes in the tree. You can use a custom selection listener on the tree to be notified about each selection. There also is an API for the de-selected row keys, which you need to remove nodes from the select many list. The select many list will get its data from a managed bean in view scope (so the values survive subsequent requests)
    Frank

  • How to set multiple styles on a tree component?

    Hi. I really need help...i wanted to know hot do i set multiple styles on e tree component using actionscript2.0...i need to change color, font size and font weight...Thanks for the help in advance

    You can use treeInstanceName.setStyle("stylename",value) to set individual properties, or you can create a CSSStyleDeclaration object and incorporate each of the new style values into this one object and then apply the object to the component.

  • How to set selected all checkboxes in all dataTable's rows?

    Hi there,
    I'm trying to perform this simple task: having a dataTable with a column containing checkboxes, how can I allow (with a button, a "super" checkbox or so) to simultaneously set selected all checkboxes in all rows?
    And - is it possible to do so without calling the submit of the page?
    Thanks to everyone!

    Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
    Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
    thanks

  • Why only gets one node when select many nodes of tree in DWCS4 on Mac OS

    I use tag <mm:treecontrol> to create tree in DWCS4 on Mac OS.
    When I select many nodes in tree, but I only get one node by method: selectedNodes.
    codes of created tree as following:
    <mm:treecontrol name='tree' size='20' multiple noheaders>
         <mm:treecolumn state='hidden'>
              <mm:treenode value='A' state='expanded'></mm:treenode>
              <mm:treenode value='B' state='expanded'></mm:treenode>
              <mm:treenode value='C' state='expanded'></mm:treenode>
    </mm:treecontrol>
    Who can  tell me reasons?
    Thanks!
    comments: if don't use tag <mm:treecolumn>, tree will not show on Mac OS.

    Hi macbig,
    I finally got to look at my sister's computer. The HDD "Repair Disk" found missing threads, missing directory records, etc. and ended with:
    Error: Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-
    up files.
    Then, I tried "Verify Disk" and it found invalid volume file count and ended with:
    The volume Macintosh HD was found corrupted and needs to be repaired.
    Error: This disk needs to be repaired. Click Repair Disk
    I guess running Apple Hardware Test is not going to happen. :/
    I've ordered online a new 2.5 disk, make a Maverick boot USB, and start from scratch. Do you have any other suggestions?
    As for the corrupted old hard drive, do you have any suggestions of how to get out the data somehow?
    Thank you so much!

  • Set selection range in Inbox of Interaction Center Winclient

    Hi Gurus,
    Does anybody know how to change the set selection range (dates) of the Planned Activities in the Inbox nail of the Interaction Center Win Client.
    Thanks.
    Message was edited by:
            TPT TPT

    Hello,
    I would like to add a side-question to this topic. My client is using CIC0 on CRM 4.0 to create sales orders, complaints and some customers. The functinality is limited (low number of orders & customers created like this, most are created in R/3 directly) but still it is there: customer-specifc IC WinClient profile, workspace, class etc...
    My client wants to upgrade to CRM 5.2 and then CRM 2007 (SAP recommends ot do it in 2 steps), would that mean that the transactions wil not function anymore? Or would that mean that the transactions will function but will not be changeable anymore?
    Thanks a lot.
    S.Chantzis

  • How to set selected radioButton

    Hi,
    There are tons of examples on the websites to show you how to detect selected radioButton or click event. But It is not easy to find aone example to show you how to set selected radioButton.
    Here is my code, but not working, Is it not well handle on it for Flex?
    [Bindable]       
    private var selectedRadioButton:RadioButton;
    private function initSelect(): void {
            selectedRadioButton = rb1;
    <mx:RadioButtonGroup id="rbg" selection="{selectedRadioButton}"
                       change="rbg_change(event);" />
                    <mx:HBox>
                  <mx:RadioButton id="rb1"
                          label="Active" group="{rbg}" />
                  <mx:RadioButton id="rb2"
                          label="Lock" group="{rbg}" />
    </mx:HBox>
    Thanks

    it's simple set its selected property true. For instance
    myRadioButtonSelectedOnStart.selected="true"
    Sincerely,
    Michael
    El 14/05/2009, a las 10:32, "master.card" <[email protected]> escribió:
    >
    Hi,
    >
    There are tons of examples on the websites to show you how to detect 
    selected radioButton or click event. But It is not easy to find aone 
    example to show you how to set selected radioButton.
    >
    Here is my code, but not working, Is it not well handle on it for 
    Flex?
    >
    private var selectedRadioButton:RadioButton;
    private function initSelect(): void {
            selectedRadioButton = rb1;
    <mx:RadioButtonGroup id="rbg" selection=""
                       change="rbg_change(event);" />
                    <mx:HBox>
                  <mx:RadioButton id="rb1"
                          label="Active" group="" />
    >               <mx:RadioButton id="rb2"
    >                       label="Lock" group="" />
    </mx:HBox>
    >
    >
    >
    Thanks
    >

  • Help to set selected row in adf table!

    Hello,
    I have a problem with adf table, when I select one row in table, I want to set selecte to next row or first row , or end row . . .
    How can I do that.
    If anyone know it, please help me
    Thanks in advance.

    <af:table value="#{bindings.BuddyView1.collectionModel}" var="row" partialTriggers="id"
    rows="#{bindings.BuddyView1.rangeSize}"
    emptyText="#{bindings.BuddyView1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.BuddyView1.rangeSize}"
    rowBandingInterval="0"
    selectedRowKeys="#{bindings.BuddyView1.collectionModel.selectedRow}"
    *selectionListener="#{bindings.BuddyView1.collectionModel.makeCurrent}"*
    rowSelection="single" binding="#{backing_untitled1.t1}"
    id="t1">
    You will have to create your own selection listener method.
    Cheers
    Venkat
    Edited by: Venkat81 on Jun 10, 2010 11:12 AM

  • How to set Tool Tip Text to Tree Node?

    Hi,
    How to set Tool Tip Text to Tree Node in JTree?
    Pls somebody help me to solve it.

    bsampeieri,
    Been here a long time myself. I don't agree with the one post is enough per se. That is to say, sometimes, it helps to post in several groups so that more eyes may see it. A number of forum posters linger in specific forum topics and may not see the post in another forum.
    Now, if in the previous post you/others answered the question and then the OP posted here later, I could see the complaint.
    For the OP, the better way to cross-post is to have one "main" post, then have all the other posts refer back to that one (link to it) so that people aren't duplicating the effort to answer your question(s). A simple "I have cross-posted this to get more eyes on it. Please reply to this question at this post <link here>"

  • Selected node in a tree table (via Data Controls and not managed bean)

    I am facing some problems in getting the selected row in a tree table.I have used data controls for creating the tree on the page.
    I have 3 POJO's,ex; Class AB which has a list of Class CD.And Class CD has a list of class EF. (Used for the tree table)
    Now i have a java class, called MyDelegate.java which has a list of AB.I generated data controls off this MyDelegate class and have dropped the ABlist as a tree table (also displaying CD and EF in the tree table).
    It displays fine with nodes of AB,CD (child of AB)and EF(child of CD)
    The tree table is not bound to any managed bean.
    For performing actions on the tree, i create a method - "doSomething() in the delegate class",generate data controls and drop it as a button.
    Inside doSomething(), i need acess to the selected node in the tree (it can be a node of type AB or CD or EF).
    The problem: I always get access to the node of type AB, and not the child nodes no matter what i click in the tree table.
    doSomething(){
    DCBindingContainer dcBindingContainer = (DCBindingContainer)ADFUtil.evaluateEL("#{bindings}");
    DCIteratorBinding dcTreeIteratorBinding = dcBindingContainer.findIteratorBinding("lstABIterator");
    RowSetIterator rowTreeSetIterator = dcTreeIteratorBinding.getRowSetIterator();
    DCDataRow rowTree = (DCDataRow)rowTreeSetIterator.getCurrentRow();
    if (rowTree.getDataProvider() instanceof AB) {
              //do something
              AB selectedAB = (AB)row.getDataProvider();
    } else if (rowTree.getDataProvider() instanceof CD){
              //do something
    } else if (rowTree.getDataProvider() instanceof EF) {
              // do something
    How do i access the "selected child node of the tree table" here in the delegate class method? Pls help.

    Hi Frank,
    Thanks for the response. In my case, i dont have a managed bean, so i am slightly unsure how to do it.
    There is a mention "Note that another way to access the treeTable component at runtime is to search for it in JavaServer Faces UIViewRoot. This latter option allows you to write more generic code and does not require to create a page dependency to a managed bean"
    How do i use this adf view root (without a managed bean) to get hold of the selected row in the tree table. Pls help.
    Thanks.

Maybe you are looking for

  • Having problems installing Ovi player.

    This problem would not happen if I did not format my PC. After format using Vista SP2, I can't install my  Ovi Player but before the format it was fine. The installation starts normally but until half way the downloading process the status turns to f

  • Sound Card Trouble After -Syu

    Hello, I'm really not sure what I've done, but my sound is no longer working, and alsamixer does not detect my sound card anymore. I upgraded to kernel26 2.6.30.5-1 earlier today and so I suppose that could be to blame. I rebooted into the fallback k

  • Mailbox limit

    Hi All, Hope ur all doing very well..I have one general question regarding Mailbox Size Limit, let say I have mailbox Database DB1 it has no size limit defined. In this DB1 I have mailbox MB1, now let say MB1 is 5 GB in size and it has individually d

  • Division wise Separate numbering range required for invoices

    Hi Gurus, The requirement is Division wise Separate numbering range required for invoices. For e.g  like 11 Steel Fabrication, 12 Aluminum Fab, 13 Carpentry & Join, 14 GRP/GRC, 15 Stone & Marble Already a table ZSD_NUM_RANGE with fields like Client,

  • WDA - Workflow Integration Problem...

    Hi pple, Is there any standard SAP ABAP Web Dynpro Application which is integrated with Workflows? I mean, is there any Standard Workflow that calls ABAP Web Dynpro Application? Actually, I am able to call the ABAP WD Application using SWFVISU applic