Sorting of JTreeTable

Hi,
I am using JXTreeTable component of swingx api. I created a treetable using FilesystemModel. The application is displaying the filename, size, filetype and properties in treetable component.
I have two questions.
1. How can I get the tree sorted on treetable header click ?
2. How to get new files/folders loaded into the tree ?
Any help and suggestion will be appreciated.
Thanks

Jtreetable does also not have getLastSelectedPathComponent() method. How can I get the selected node of the tree ?
Thanks

Similar Messages

  • Sorting of nodes in a treeTable

    hi,
    i got a problem like that how to make sorting in JtreeTable model.the problem is i am passing i am constructin the JtreeTable model by passing DefaultMutableTreeNode object.which contains Nodename and value.I need to sort only by name.
    for example DefaultmutableTreeNode object contains nodename as B,D,F,T and nodevalue is 8,8,6,5
    i am displaying this in table as a two columns.
    nodename value
    --A               8
    B 8
    C 6
    +D               5
    I need sorting by nodenames.
    one importent thing is am constructing a wholedata in to a DefaultMutableTreeNode and i am passing to a TreeTable model.Any java swing expert please help me with a solution.
    samplecode:
    for example i am constructing the DefaulrmutableTreeNodeobject like this.
    data = new MainData(nodeName,nodevalue);
    l_childNode = new DefaultMutableTreeNode(data);
    l_childNode.setUserObject(data)
    l_rootNode.add(l_childNode);
    finally i am constructing a treeTable Model by using this l_rootNode.
    Please help me how can make soritng in the treeTable model.
    please post any similar examples..
    waiting for replay.

    Moin David,
    ja, die Sortierung wird tatsächlich z.Zt. nicht unterstützt:
    Hello @all,
    The SAP support has confirmed that sorting in grid with collapseLevel is not supported at this time.
    I've opened a new thread in the "SAP Business One Product Development Collaboration "-area.
    As I understand the chance of impementing this feature raises the more users support this request there.
    So I would like to invite you to answer this thread if you agree that the sorting feature should be implemented:
    Thanks!
    As a workaround I have added a new column in the SELECT (and DataTable and Grid). This column contains a "composite key" of the CollapseLevel-Cols PLUS(!) the failed sorting column and is named "Collapse4" in this example.
    U_Col04 was the column of the grid leafes where the sorting has failed before.
    The CollapseLevel must be incremented by 1:
    SELECT
    U_Col01 AS 'Collapse1',
    U_Col02 AS 'Collapse2',
    U_Col03 AS 'Collapse3',
    U_Col01 + '-' + U_Col02 + '-' + U_Col03 + '-' + U_Col04 AS 'Collapse4'
    FROM
    etc....
    There is nothing to expand in Collapse4 than always ONE row. But Collapse4 is sorted now.
    Roland
    Edited by: Roland Toschek on Sep 3, 2008 12:32 PM

  • Custom Renderers in JTreeTable (or extending JTable)?

    I am wondering about what the best approach is to display a table in a Swing component. My table will by default have all rows collapsed (occupying a single line), but someone may click on a row to expand it (so it occupies multiple lines and displays more information). Nothing in the table should be editable.
    Example:
    (collapsed) 1. data     data     data
    (expanded) 2. data     data     data
    ...more data that wouldn't fit on on one line...
    ... still more data (additional data doesn't have same column format as collapsed rows)...
    (collapsed) 3. data     data     dataSo the additional data displayed when a row is expanded aren't conceptually `children' of the data in the collapsed display. I've looked at JTreeTable, but I'm not sure it's right for this purpose, and it seems complicated.
    For one thing, I need some of my columns to have custom renderers--for example, renderers that display a button with text or an image instead of just a label. However, it looks like the JTreeTable approach forces you to declare the JTree (extension) as the renderer of everything in a row, so would that prevent me from specifying custom renderers for other columns, or am I misunderstanding?
    Another feature I need is to be able to filter out entire rows from the view (so they don't show up at all). I will also want to add custom sort buttons that can apply four different sorts to each column.
    Would I be better off using a JTreeTable for this or somehow using custom renderers or otherwise extending an ordinary JTable to make the column larger and display additional information when the user clicks the expand icon?
    Also, how do I specify a different renderer for header rows than for other rows?
    Message was edited by:
    The.Joy.of.Java

    Check how editingStopped is being done. For a ComboBox there is no common operation that one can assume means that the user is done with the editing component. By default JTable leaves it active until the mouse clicks somewhere outside it, then does, essentially, fireEditingStopped() to give the cell back to the renderer. Then a second mouse click is required to start a new cell editor.
    If you're using ComboBox as a custom editor, you have to decide what event you want to be final and call fireEditingStopped() yourself. For instance, in your TableCellEditor:
        @Override
        public Component getTableCellEditorComponent(final JTable table,
                                                     final Object value,
                                                     final boolean isSelected,
                                                     final int row,
                                                     final int column) {
    ...             if( editor.supportsCustomEditor() )  {
                        JComboBox c = (JComboBox)editor.getCustomEditor();
                        c.removeActionListener( this );
                        c.addActionListener( this );
                        return c;
        @Override
        public void actionPerformed ( final ActionEvent ev ) {
            else if( "comboBoxChanged".equals( ev.getActionCommand() ) )  {
                fireEditingStopped();
        }The actionEvent is fired when just about anything happens in the ComboBox, including selection of the currently selected item. But unless you have a more specific requirement, it should be good enough.

  • Sorting of Treenodes in a treeTable

    Here goes. I downloaded src.zip from the treetable example from here
    http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html#source_code
    I extracted it to c:\treetable
    Then I downloaded TableMap.java and TableSorter.java from here and put them in a the same directory
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting
    I changed these lines in JTreeTable.java
         // Install a tableModel representing the visible rows in the tree.
         super.setModel(new TreeTableModelAdapter(treeTableModel, tree));
    to this
         // Install a tableModel representing the visible rows in the tree with a JSorttable wrapper.
         TableSorter sorter = new TableSorter(new TreeTableModelAdapter(treeTableModel, tree));
         super.setModel(sorter);
         sorter.setTableHeader(getTableHeader());
    but this is not working for Treenodes but its working for other columns.
    but i need to sort treenodes..
    please helpme some java experts regaridng this..please.

    Moin David,
    ja, die Sortierung wird tatsächlich z.Zt. nicht unterstützt:
    Hello @all,
    The SAP support has confirmed that sorting in grid with collapseLevel is not supported at this time.
    I've opened a new thread in the "SAP Business One Product Development Collaboration "-area.
    As I understand the chance of impementing this feature raises the more users support this request there.
    So I would like to invite you to answer this thread if you agree that the sorting feature should be implemented:
    Thanks!
    As a workaround I have added a new column in the SELECT (and DataTable and Grid). This column contains a "composite key" of the CollapseLevel-Cols PLUS(!) the failed sorting column and is named "Collapse4" in this example.
    U_Col04 was the column of the grid leafes where the sorting has failed before.
    The CollapseLevel must be incremented by 1:
    SELECT
    U_Col01 AS 'Collapse1',
    U_Col02 AS 'Collapse2',
    U_Col03 AS 'Collapse3',
    U_Col01 + '-' + U_Col02 + '-' + U_Col03 + '-' + U_Col04 AS 'Collapse4'
    FROM
    etc....
    There is nothing to expand in Collapse4 than always ONE row. But Collapse4 is sorted now.
    Roland
    Edited by: Roland Toschek on Sep 3, 2008 12:32 PM

  • JTreeTable

    If you remove a tree node from the JTree what events do you have to fire to update the JTreeTable?

    Thanks nodeChanged does sort of work?
    If I swap two tree nodes (my problem), do I need to both a nodeStructuredChanged and nodeChange on the AbstractTreeTableModel?
    Do I have to fire an event on the JTreeTable as well?
    I'am updating two columns and off course first column is a JTree
    For JTreeTable an outside call to update the JTable as:
    AbstractTableModel tModel =
         (AbstractTableModel) treeTable.getModel();        
    tModel.fireTableChanged(new TableModelEvent(tModel, row));In my UpdateAccountTreeTableModel which inherits AbstractTreeTableModel their's these two methods to update the tree in the JTreeTable
    public void nodeChanged(TreePath treePath) {
       fireTreeNodesChange(UpdateAccountTreeTableModel.this,
                           treePath.getPath(), null, null);
    public void nodeStructureChanged(TreePath treePath) {
      fireTreeStructureChanged(UpdateAccountTreeTableModel.this,
                               treePath.getPath(), null, null);
    }Now If I update two tree nodes. I need to fire both events for the JTable as well as its JTable.getTree()? It's confusing on what events
    to fire and does the order matter? When I update two nodes, its actually
    a swap, one is blank and the other shown. Know the row numbers and
    treePaths are correct.
    Also the tree root node disappears from the JTreeTable?
    The event fires does half the job and half the damage? :(
    Wonder if my nodeStructureChaged is incorrect or something?
    Thanks

  • In Photoshop Express, cannot sort images in album by filename in thumbnail view (for slideshow)l.

    In Photoshop Express, I want images to appear sorted by filename.  In the "view as a table" it sorts fine.  When I revert to the thumbnail view, the arrangement is random.  The dropdown "show" list does not offer an option for showing by filename.  If I select the"custom" option, it means I would need to sort 300 images by filename MANUALLY (!!!), a job that a computer does in milliseconds.  Anyone with a solution?  Thanks.

    fwiw, with my images in the 'Folder Location' view the photos are in order by their Windows filename. That is the same order as the hardcopy album the photos came from. So I then created a PSE Album. I selected all my photos and moved them into that album. The order of the pictures was retained in the Album. That worked out great. I wanted my PSE images to be in the same order. I thought I would do it with tags. But creating an album seems to work just fine.

  • Unable to capture the adf table column sort icons using open script tool

    Hi All,
    I am new to OATS and I am trying to create script for testing ADF application using open script tool. I face issues in recording two events.
    1. I am unable to record the event of clicking adf table column sort icons that exist on the column header. I tried to use the capture tool, but that couldn't help me.
    2. The second issue is I am unable to capture the panel header text. The component can be identified but I was not able to identify the supporting attribute for the header text.

    Hi keerthi,
    1. I have pasted the code for the first issue
    web
                             .button(
                                       122,
                                       "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1824fhkchs_6']/web:form[@id='pt1:_UISform1' or @name='pt1:_UISform1' or @index='0']/web:button[@id='pt1:MA:0:n1:1:pt1:qryId1::search' or @value='Search' or @index='3']")
                             .click();
                        adf
                        .table(
                                  "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1c9nk1ryzv_6']/web:ADFTable[@absoluteLocator='pt1:MA:n1:pt1:pnlcltn:resId1']")
                        .columnSort("Ascending", "Name" );
         }

  • How to sort out different issues on Satellite A505-S6973

    Can anyone tell me, if the warranty period on my laptop has not passed, can i return my laptop to toshiba and have all my issues sorted out. Would there be a cost to do whatever repairs software related needs be done and how i am supposed to go about it because my laptop is beginning to have all sorts of little errors, i noticed that my harddrive has 156gb used although i have about 60 gigs in use.
    A couple multimedia buttons aren't working but i touch them, my touchpad doesn't turn off with the hard button unless i turn it off using the FN key and my processor runs low but when i use a program i see it's reaching between 85 to 100% utilization.
    I really like this laptop, but the issues i'm having i highly doubt it should operate this way.

    Hi mate
    Software issues are not covered by warranty!
    This means that you will have to pay for everything if the ASP technician would not find any problems!
    This is why you should recover the notebook in order to check if its only a software related issue.
    >A couple multimedia buttons aren't working but i touch them, my touchpad doesn't turn off with the hard button unless i turn it off using the FN key
    Reinstall the VAP (value added package) and flash cards utility
    >my processor runs low but when i use a program i see it's reaching between 85 to 100% utilization.
    This is not a bug or hardware problem. You will notice this CPU behavior because the CPU supports an feature which helps to save the power and reduce the heat dissipation

  • Issue With Page Break When Sorting is also applied on group

    Hi
    I am facing an issue with Page break only when I have sorting applied on the grouping that I have in the template.
    The following is the sample XML
    <ROWSET>
    <ROW>
    <GRE>org1</GRE>
    <ORGANIZATION>Accounts</ORGANIZATION>
    <FULL_NAME>test1,</FULL_NAME>
    <ELEMENT_NAME>TEST BONUS</ELEMENT_NAME>
    <CLASSIFICATION>Supplemental Earnings</CLASSIFICATION>
    <RUN_VALUE>250</RUN_VALUE>
    <MONTH_VALUE>500</MONTH_VALUE>
    <QUARTER_VALUE>500</QUARTER_VALUE>
    <YEAR_VALUE>500</YEAR_VALUE>
    </ROW>
    <ROW>
    <GRE>org1</GRE>
    <ORGANIZATION>Finance</ORGANIZATION>
    <FULL_NAME>test2</FULL_NAME>
    <ELEMENT_NAME>VOLUNTARY AD AND D</ELEMENT_NAME>
    <CLASSIFICATION>Voluntary Deductions</CLASSIFICATION>
    <RUN_VALUE>5.19</RUN_VALUE>
    <MONTH_VALUE>10.38</MONTH_VALUE>
    <QUARTER_VALUE>10.38</QUARTER_VALUE>
    <YEAR_VALUE>10.38</YEAR_VALUE>
    </ROW>
    <ROW>
    <GRE>org1</GRE>
    <ORGANIZATION>Finance</ORGANIZATION>
    <FULL_NAME>test3</FULL_NAME>
    <ELEMENT_NAME>HMO MEDICAL</ELEMENT_NAME>
    <CLASSIFICATION>Pre-Tax Deductions</CLASSIFICATION>
    <RUN_VALUE>19.67</RUN_VALUE>
    <MONTH_VALUE>39.34</MONTH_VALUE>
    <QUARTER_VALUE>39.34</QUARTER_VALUE>
    <YEAR_VALUE>39.34</YEAR_VALUE>
    </ROW>
    <ROW>
    <GRE>org1</GRE>
    <ORGANIZATION>Finance</ORGANIZATION>
    <FULL_NAME>test4</FULL_NAME>
    <ELEMENT_NAME>PENSION NR DC</ELEMENT_NAME>
    <CLASSIFICATION>Pre-Tax Deductions</CLASSIFICATION>
    <RUN_VALUE>0</RUN_VALUE>
    <MONTH_VALUE>360</MONTH_VALUE>
    <QUARTER_VALUE>360</QUARTER_VALUE>
    <YEAR_VALUE>360</YEAR_VALUE>
    </ROW>
    </ROWSET>
    In the template I group the data based on CLASSIFICATION and then sort on the same column CLASSIFICATION. I have a page-break applied for every group.
    When I generate the PDF, I am not getting the page-breaks for every group. Instead some of them are displayed in the same page.
    But when I remove the sorting that I had in the template on the column CLASSIFICATION, I am getting the output in the desired way but not in a sorted order.
    kumar

    Hi All,
    I am using MS-WORD 2007 and BI Publisher desktop 10.1.3.3.3.
    When I use split-by-page-break, splitting is performed for every line .. but not for group of lines.
    Can anybody throw some light on this?
    FYI...
    I am using this code:
    ?if: position() mod 6= 0?
    ?split-by-page-break:?
    ?end if?
    (Of course with in tags)
    in G_LINES loop.
    Can anybody help me out :-(
    --Saritha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • ALV .  How to remove the sort buttons on toolbar in ALV report?

    Hi,experts
      As you know, in default case , the alv report will display two sort buttons(ascending ,descending) on its toolbar , So How to remove the sort buttons on toolbar in ALV report?
      Thanks for your help .

    Hi guixin,
    1. Before calling REUSE_ALV_LIST_DISPLAY
    2. Write this code :
    data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.
    exclwa = '&OUP'.
    append exclwa to excl.
    exclwa = '&ODN'.
    append exclwa to excl.
    3. Then while calling the FM,
       pass this parameter also .
    IT_EXCLUDING     = excl
    It will work fantastic.
    regards,
    amit m.

  • Field should not display in the subtotal row in ALV report after sorting .

    we have a requirement, after sorting and subtotaling, the output in ALV is -
    vbeln        amount1  amount2  amount3
    123           11              12            13
    123           12             13             14
    123           23             25             27 
    133           11              12            13
    133           12             13             14
    133           23             25             27
    Now the customer wants the ALV outpput in this fashion -
    123           11              12            13
    123           12             13             14
                     23             25             27    --->123 (vbeln) should not come in subtotaling row
    133           11              12            13
    133           12             13             14
                      23             25             27--->133(vbeln) should not come in subtotaling row

    Hi,
    if it helps you could create a hierachy. In this way you can define the field catalog for the lines and for the subtotal columns. The only thing is that you would always show the subtotal rows.
    You have references of hierachy alvs in
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
    ALV Hierarchy
    alv hierarchy
    In this case it also sorts
    Sorting for ALV hierarchy
    I hope it helps.
    Edited by: Oscar Pecharroman on Aug 2, 2010 1:13 PM

  • Sorting not working correctly for date field in alv report

    Hi All,
    My report displays many rows also containing date type fields of bldat,budat .
    When I sort the report selecting field of type bldat budat the sorting is not correct for the year.
    Ex:
    Invoice doc dat
    01-25-2011
    01-21-2011
    02-02-2011
    10-25-2010
    11-20-2010
    If I use ascending then it is sorted as :
    Invoice doc dat
    01-21-2011
    01-25-2011
    02-02-2011
    10-20-2010
    10-25-2010
    Why the sorting is not working correct for year.(2010 records should have been first).
    The field wa_tab-bldat is of type char10.
    It is populated as wa_tab-bldat = bsak-bldat.
    Kindly suggest what can be done.

    The field wa_tab-bldat is of type char10
    Then what it does is correct.
    Refer to type datum...it will work

  • Sort field in ALV report

    Hi Expert,
    IN  ALV report using RESUE_ALV_GRID_DISPLAY . I want to sort the second field of ALV output . In this function module  RESUE_ALV_GRID_DISPLAY  using event PF_STATUS . so can u tell me how sort the second field .
    Regards
    Bhabani

    Hi,
    check the fallowing code
    IT_SORT TYPE SLIS_T_SORTINFO_ALV,
    WA_SORT TYPE slis_sortinfo_alv,
    ****SORT LABELS AT RUN TIME
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'BUDAT'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM               = SY-REPID
          I_CALLBACK_TOP_OF_PAGE           = 'TOP_OF_PAGE'
          IS_LAYOUT                        =  LAYOUT
          IT_FIELDCAT                      = IT_FIELDCAT
          IT_SORT                          = IT_SORT
          I_DEFAULT                        = 'X'
          I_SAVE                           = 'U'
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         TABLES
           T_OUTTAB                        = IT_FINAL1
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Regards
    Nandan.N

  • Sorting in 6i and 10g reports

    Hello All,
    I am running 6i and 10g reports against a 10g database.
    I ran one of the 6i report and it generated a report in one sorting ordear
    and when i ran the same report on 10g ,it generated the report in ddifferent order.
    Both the reports r run against the same 10g database.
    The order by clause on the columns of the records r identical.
    Now i wanted to understand how it is sorting in different orders in both 6i and 10g reports?
    Thanks,
    Ranz

    Hi,
    Please note the fact that 6i Reports is not certified to work with 10g Database. Hence it becomes impossible to address the sorting behavior of 6i Reports, though there is nothing different in the way it works. I would suggest you to use 10gR2 version of Reports services with 10g Database which is certified and supported. Thanks for your understanding.
    Regards,
    Anand

  • Is there a way of making my iPod's "cover flow" sort in the same way the software can . Artist -- Album by Year . It only seems to do Artist -- by Alphabetical Album . I want it look like it does on the PC .

    Is there a way to make the "cover flow" on the iPod match the sort style that I use on the software . I go with Artist -- Album by Release Year . But the ipod seems to only do Artist -- Alphabetical by Album , and then there are a handful of albums oddly out of place . Can it be done ?

    Ottonomy, here's what to do.
    Connect your iPhone to your computer and open the iPhone's playlist in an iTunes window. Copy/Paste the entire playlist into a new(!) playlist in iTunes, not on your iPhone. Then resort the playlist. After you sort it, Copy/Paste it to a new(!) playlist on your iPhone. Now delete the old playlist on your iPhone and rename the new playlist the name you want it to be (probably the same name as the old playlist).
    The downside to this method is that you have to do it every time you add a song to the playlist. Unfortunately, I don't think there's another way.

Maybe you are looking for

  • Verizon data is ripping me off....

    So I made the switch from TMobile to Verizon because I got tired of waiting for Tmobile to get the Iphone.  Now in order to do this I paid a $200.00 cancellation fee. However, since I had an unlimited data with Tmobile and they had a data tracker, I

  • Trapped With Fusion Order Demo Deployment Problems.

    I have the impression that this FusionOrderDemo_R1PS1 is not sufficiently tested for deployment in different types of environment. Prove it wrong by advising whats wrong on my configuration based on the build output below: pino Buildfile: C:\JDevelop

  • Problems Accessing iPhone Photo Library - Wild

    Having some issues accessing or even finding the photos stored on my device. iPhone 4S iOS 5.1 Image Capture only sees the "Camera Roll" (500 or so pictures in there) but I can't access anything else. Here's how my Photo Library is structured on my d

  • Using ACR smart filter on 32 bit images

    After combining 3 images in HDR pro then opening in Photoshop CC using the ACR smart filter, how do I keep the edits I made when I then flatten the image and convert to 16 bit? I seem to loose all the edits I made and it just brings up the HDR Pro op

  • Data Pump Import

    I am having trouble using the data pump import tool. I am working with Oracle 10.2.4.0 on Windows Server 2008. I am trying to import a lot of data (several schemas, thousands of tables, hundreds of GB of data) from the same version of Oracle on Linux