JTreeTable - finding node's row

Hi
I am using sun tree table.
I would like to find the row of a specific node in a tree table - this should be the opsite of
treeTableModelAdapter.nodeForRow();
I tried this function but it doesnt work good since there is no correlation beween the location in the tree regarding the root and the location at the table.....does anyone knows how do i find the relathionship between these two?
protected int getNodeRow(TreeTableNode node) {
      TreePath treePath = node.getPathToRoot();
        if(treePath!=null){
        return treePath.getPathCount();
       return -1;
   }thanks,
Liat

With a little help of my friends i found the solution:
i did it by looking up the paths for the selected rows and after redrawing the table, looking up the rows for the paths again.
here is the needed code in "TreeTableModelAdaptor". Replace everything between 'delayFireTableDataChanged' and 'updateTreeTable' with this code.
=====
protected void delayedFireTableDataChanged() {
delayedFireTableDataChanged(new TreePath[] {}); }
* Invokes fireTableDataChanged after all the pending events have been
* processed. SwingUtilities.invokeLater is used to handle this.
protected void delayedFireTableDataChanged(TreePath[] selected) {
SwingUtilities.invokeLater(new DelayChange(selected)); }
private class DelayChange implements Runnable {
private TreePath[] selected;
public DelayChange(TreePath[] selected) {
this.selected = selected;
/* (non-Javadoc)
* @see java.lang.Runnable#run()
public void run() {
fireTableDataChanged();
if(selected!= null && selected.length > 0) {
for(int i=0;i<selected.length;i++) {
int row = tree.getRowForPath(selected);
treeTable.getSelectionModel().addSelectionInterval(row,row);
public void updateTreeTable() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Vector pathState = getExpandedPaths();
int selectedRowNums[] = treeTable.getSelectedRows();
TreePath selectedPaths[] = new TreePath[selectedRowNums.length];
for(int i=0;i<selectedRowNums.length;i++) {
selectedPaths[i] = tree.getPathForRow(selectedRowNums[i]);
treeTableModel.fireTreeStructureChanged(this, ((TreeTableNode) treeTableModel.getRoot()).getPath(), null, null);
restoreExpandedPaths(pathState);
treeTable.getTableHeader().repaint();
delayedFireTableDataChanged(selectedPaths);

Similar Messages

  • ALV event ON_CLICK - find out selected row?

    I have an ALV table and in one of the columns I display a linkToAction in each cell.
    When the link is clicked, i go to the ON_CLICK event handler and try to find out, which row is selected.
    For this, I can take the attribute "INDEX" of the parameter "R_PARAM", and read the context with the given index.
    METHOD alv_event_on_click .
       DATA lo_nd_my_node    TYPE REF TO if_wd_context_node.
       DATA lt_my_table          TYPE wd_this->elements_my_table.
       DATA ls_my_structure    TYPE wd_this->element_my_struture.
    *  click on prduct standard name link
       IF r_param->attribute = 'NAME_OF_THE_COLUMN'.
           lo_nd_my_node = wd_context->get_child_node( name = wd_this->wdctx_my_node ).
           lo_nd_my_node->get_static_attributes_table( IMPORTING table = lt_my_table ). "this is not sorted!!!!
           lo_nd_my_node->set_lead_selection_index( index = r_param->index ).
           READ TABLE lt_my_table INTO ls_my_structure INDEX r_param->index. "lt_my_table table might be sorted differently!!!!
           IF sy-subrc = 0.
             wd_this->do_something_with( ls_my_strcture ).
           ENDIF.
       ENDIF.
    ENDMETHOD.
    However, this does not work when I sort the ALV before!
    For a strange reason, the table that I get from the context is not sorted the same way as the data in the ALV.
    What can I do?

    Hi Daniel,
    I don't know if the external mapping messes things up.
    Perhaps you could try the following:
    lo_nd_my_node->get_static_attributes(
      EXPORTING
        index                = r_param->index
      IMPORTING
        static_attributes = ls_my_structure ).
    It could be that passing the data towards your internal table doesn't take over the sort.
    If you try debugging and check out the contents of the node, are they sorted correctly or not?
    Regards and good luck.
    Jos

  • "Unable to find node..." error

    Does anyone have any idea what the error below is trying to tell me???
    I'm getting these every time I try to sync this same package file called "personal notebook.ntx".
    1) When I look inside the package file there is no such file. There is a file called "req_of.gif", but no file with a "._" preceeding. On top of that this is a standard AFP based home directory (not CIFS, or NFS).
    2) Every time the sync runs, the file that gets the error CHANGES! So one time it'll be the file I just mentioned, the next time it'll be this file:
    "Documents/NoteTaker-NoteShare/Personal/personal notebook.ntx/Attachments/._s117018.jpg"
    The next time I'll be this file:
    "Documents/NoteTaker-NoteShare/Personal/personal notebook.ntx/Attachments/.smlogo2.gif"
    And so on. There are about 84 files in that directory and if the automatic syncs are let run enough times, it will eventually generate an error on most of the files in that directory (but not all
    1:: <GO> local: PACKAGE MODIFY "Documents/NoteTaker-NoteShare/Personal/personal notebook.ntx" {(Priority=1, EXECUTING)}
    1:: <OK> local: CHILD UNCHANGED ./.DS_Store
    1:: <OK> local: CHILD UNCHANGED ./AppletData
    0:: \[2007/12/15 08:52:07.288] EXCEPTION: -\[SStore myNodeForNode:isDestNode:]: Unable to find node for "Documents/NoteTaker-NoteShare/Personal/personal notebook.ntx/Attachments/.reqof.gif" in store "HomeSync_Mirror-L-yvUOtsqmAt7-ramos-m" <-\[SStore myNodeForNode:isDestNode:] (Store.m:840): "'(node)' is nil">
    0:: \[2007/12/15 08:52:07.288] BACKTRACE: {
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x4a1eb
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x90340
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x904c2
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x53d76
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x4804f
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x47ace
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x53929
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x3132e
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x30c65
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x47a6a
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x478d6
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x155d3
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x9001704d
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x90016bf4
    0:: \[2007/12/15 08:52:07.288] ??| |?| 0x92d0a075
    0:: \[2007/12/15 08:52:07.288] }
    0:: \[2007/12/15 08:52:07.288] <ERROR> local: CHILD UNCHANGED ./Attachments (-\[SStore myNodeForNode:isDestNode:] (Store.m:840): "'(node)' is nil")
    0:: \[2007/12/15 08:52:07.290] <ERROR> local: PACKAGE MODIFY "Documents/NoteTaker-NoteShare/Personal/personal notebook.ntx" {(Priority=1, EXECUTING)} (-\[SStore myNodeForNode:isDestNode:] (Store.m:840): "'(node)' is nil")

    Hmmm, Ok, this is helpful, however we're now in an area I'm rather unfamiliar with so need some more help (thanks for this by the way).
    First what I know...
    * Everything below the directory "personal notebook.ntx" is part of a package and not directly under my control but under control of an application called Notetaker. I have however, been having to look into the packages a lot recently due to the fact that the modification dates don't seem to work the same in Leopard as they did in Tiger (I mentioned this in another thread, but no one seem to have any insight on it http://discussions.apple.com/thread.jspa?threadID=1244035&tstart=0). By looking into the package seemed to be the only way to be able to verify whether or not my files were being sync'ed correctly as I could no longer rely on modification dates.
    * Checking the rest of the files in the package shows that a lot but not all of the files have that attribute set. All the files in that directory have that attribute set.
    * I don't consistently get the same file to error out every time. If I run the sync two times in a row with no changes what-so-ever a different file will generate the error.
    So questions that come to mind since I haven't dealt with extended attributes very much....
    * Are you saying that the extended attributes could only have been set by a Leopard client? A Tiger client would not have been able to set them? (I'm syncing these files between Leopard and Tiger clients).
    * what is the "com.apple.FinderInfo" attribute? Can I delete it? What would I lose? The fact that not all files in the package have this makes me wonder whether or not it's necessary.
    * why would FileSyncAgent have a problem with extended attributes?
    Thanks for any help.
    -Rich

  • ADF table: How to find out which rows were modified by the user

    Hi,
    I am using ADF table to display data that can be modified by the user (ReadOnly = false in the input text). I need to find out which rows were modified by the user, and only update (persist) those rows in the database.
    Is there an easy way to find out which rows were modified by the user.
    I am NOT particularly concerned with which columns were modified as I would update the entire row (if any data in that row is modified).
    I am using Oracle JDeveloper version 11.1.1.3.
    Thanks,
    Ash K

    Thanks Timo.
    I am using ADF Data Control (which are created from Web Service proxy) to display/update the data.
    In the backing bean, the operation that is invoked at the time persisting data is as follows:
    public void commitOperation {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("operationA");
    DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("someIterator");
    for(int i=0; i<dciter.getViewObject().getEstimatedRowCount(); i++)
    Row row=dciter.getRowAtRangeIndex(i);
    SomeObject someObject= new SomeObject ();
    someObject.setAttr1(row.getAttribute("Attrbute1").toString());
    someObject.setAttr2(row.getAttribute("Attribute2").toString());
    objectList.add(someObject);
    operationBinding.getParamsMap().put("param1", objectList);
    ResultObject result = (ResultObject) operationBinding.execute();
    Inside the for loop (or any other place in the backing bean), I would like to figure out if the row was modified by the user. Please let me know if how to get that. If ADF provides this automatically, that would be GREAT.
    Thanks,
    Ash K

  • How to find status of rows (changed or not)

    Hi,
    Is there any way to find if a row status is changed (but not commited) and which user has made the change?
    we need to avoid lock so we want to check if there is a row in our select statement that may cause the lock.
    your answer is so appreciated

    esmid2 wrote:
    sybrand_b
    your comments is nonsensical Not really. What is, is your complete and utter nonsensical understanding of Oracle.
    You said:
    "<i>Is there any way to find if a row status is changed (but not commited) and which user has made the change?
    we need to avoid lock so we want to check if there is a row in our select statement that may cause the lock.</i>
    Avoid what locking? Writers of data in Oracle does not block readers of data in Oracle.
    So an +UPDATE+ or +INSERT+ or +DELETE+ does not block or lock a +SELECT+ from happening. That simple..
    If you use a +SELECT FOR UPDATE+, then yes - it needs to lock rows for updating. And a writer will only be blocking another writer when both want to write (change) the very same rows. In which case it is sensible and logic that these two need to be serialised and only one at a time can change the data. Easy enough to understand without having to have pointy ears and attended the Vulcan School of Logic.

  • How to find out the rows inserted between a time period.

    Hi,
    Please help me to solve this.
    Table - emp.
    Colmns - empno(Primary Key),ename, mgr
    How to find out the rows inserted between a time period.
    For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
    regards,
    Mathew.

    Hi,
    Maybe work:
    For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
    e.g.:
    SGMS@ORACLE10> create table test(cod number);
    Table created.
    SGMS@ORACLE10> insert into test values (1);
    1 row created.
    SGMS@ORACLE10> insert into test values (2);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> insert into test values (3);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
    SCN_TO_TIMESTAMP(ORA_ROWSCN)       ORA_ROWSCN        COD
    06/11/06 08:56:56,000000000         727707205          1
    06/11/06 08:56:56,000000000         727707205          2
    06/11/06 08:57:05,000000000         727707210          3Cheers

  • Issue in finding the current row

    I am rendering rows of a VO using an iterator component. One of the component I am rendering is a declarative component created by me.
    In this component there is a clickable link on which i can write any method to achieve desired functionality.
    Since, iterator is used so the current row is set to the last row. Now on clicking the link in the declarative component i need to do some operation based on the current row (pk of that row). So, how to find the current row id?
    Note: If it would be a simple adf component like a commandLink i could have inserted a setServerListener inside it and could have put the id in to requestScope to access it. But as this is the declarative component in which i cannot create a serverListener so I am looking for some other solution.

    Hi john,
    My table have the selection listener.
    Thanks in advance

  • How to find the LOCKED ROWS in a table?

    Not locked objects, but for a table the locked rows.

    Check below links :
    http://www.jlcomp.demon.co.uk/faq/locked_rows.html
    How to find the locked row.
    who are waiting for same record?
    HTH
    Girish Sharma

  • Find number of rows in  a cursor

    How can i find how many rows are in a cursor. I have a situation if my cursor only retruns one row i return the data if it returns more then one row i will need to do additional select.

    If you have logic like this
    SELECT COUNT(*)
      INTO l_cnt
      FROM emp
    WHERE deptno = p_deptno;
    IF( l_cnt > 1 )
    THEN
      FOR x IN (SELECT * FROM emp WHERE deptno = p_deptno)
      LOOP
        ..where you are counting the rows and then later fetching them, getting the count and then getting the rows will force Oracle to do the work of the query twice. It will also potentially cause logic errors because the number of rows returned by the COUNT(*) won't necessarily match the number of rows fetched from the cursor because some other session may have committed changes between your session executing those two statements.
    Can you describe the logic you are trying to implement in a bit more detail? There are potentially a number of different approaches depending on exactly what you are trying to do. Sometimes it may make sense to do a COUNT(*), sometimes it may make sense to fetch the data into a collection, count the collection elements, and then operate on the collection, sometimes it may make sense to do a SELECT INTO and handle the exception if the wrong number of rows are returned, etc.
    Justin

  • How to find  latest updating row in a table

    Hi
    How to find latest updating row in a table

    ADF 7 wrote:
    SELECT *  FROM Table WHERE lastupdTimestamp = (SELECT MAX(lastupdTimestamp) FROM Table)lastupdtimestamp - holds and date an time of an records when it last updation takes place in table.
    lastupdtimestamp is a column in my table.And how will this make sense in the scenario I've described, where UserA does an update before UserB, but commits the update after UserB's commited update? And add UserC and UserD and a 1000 more users to this scenario where concurrent updates happen.
    What actual time does this lastupdtimestamp contain and represent? And why? How is that lastupdtimestamp used in business logic and processing? Or is it just a silly-bugger-let's-add-somekind-of-time column to that table that essentially meaningless?
    Not saying that one should never add such a timestamp based column. Simply that one needs to understand WHAT it contains and it needs to be SENSIBLY used within the data model.
    However, in my experience such columns are often slapped on afterwards, never featured in the actual data model designed, and is then used without a second though that the database and its data is a multi-user and multi-process system. And things happen at the same time. And things overlap (serialisation is the exception - not the rule).

  • How to Finding the Last Row Value in Datagrid?

    Hi Everyone,
    Thanks in Advance.
    I need your help, to find the last row data in Datagrid.
    Actually i am using Datagrid to display my Data in flex. In my data i stored the gender value of employees. So if the last row in my datagrid is "female" i need to be highlight that particular row. So please help me to solve this issue.
    Thanks,
    Charles. J

    datagrid.selectedIndex = datagrid.dataprovider.length;
    ^ something like this will select the last row in the datagrid.
    if you need to check it's value, you might need to cast an object here, based on the index value, and check it's gender value.
    datagrid.selectedIndex = datagrid.dataprovider.length;
    if (datagrid.selectedItem["gender"] == "female") {
    //handle here

  • How to write the query to find the duplicate rows?

    Hi,
    How will I find the duplicate rows in the table?
    I have a table called ITEM
    Select item_no,mfg_id from item
    Item Mfg_ID
    178 06278
    178 06589
    238 5489
    289 7895
    289 7596
    Now I want to find only the duplicate rows i.e.,178 & 289 is coming twice.
    How will get the all duplicate rows in the table?

    nihar2 wrote:
    Convert to
    SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description
    FROM (SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description,
         count(it.item) over(partition by it.item order by it.item) cnt
         FROM item it,item_mfg im
         WHERE it.u##item=im.u##item)
    WHERE cnt > 1
    But I tried It show not valid identifier.You can't use the table aliases from the sub-query...
    SELECT item,
           mfg_item,
           manufacturer,
           description 
    FROM (SELECT it.item,
           im.mfg_item,
           im.manufacturer,
           im.description,
           count(it.item) over(partition by it.item order by it.item) cnt
      FROM item it,item_mfg im
      WHERE it.u##item=im.u##item)
    WHERE cnt > 1

  • Finding node failed in IDM console

    Hi ,
    When we do a Find in Identity store with "Find tasks or jobs only" checked , getting this error "Finding node failed , Error: Dh , Description :Type mismatch " , This used to work normally before.
    Please advise.
    Version :7.2 ,SP8 P3
    Thanks

    Hi Per,
    We have DB2 database .
    However I observed that this happens ,when I try to search the task id of the ordered/unordered group . The search opens any other job whose jobid matches with the taskid (of the ord/unord group )in the search field. Else I get the error mentioned.
    On the other hand , as you have quoted , when I try to search the same ordered/unordered group with the task name,it gives the right result.
    Thanks
    Sri

  • Scripting Agent - Cannot find node xml

    Hi all,
    I am just learning about Scripting Agent, and in doing so I am having some difficulties.
    Basically I want to set the default work hours for all new users to be different than microsoft default, and I think I have the scripting right, but the problem is that I cannot get any command to run at all when the Scripting Agent is enabled.  Even
    if the command is not one that is listed in the xml.
    I get the following error (note that this is not even the command listed below in the xml, but it does the same for any "set" or "enable" type cmdlet):
    [PS] C:\Windows\system32>Set-MailboxCalendarConfiguration nicholasa
    Provisioning layer initialization failed: '"Scripting Agent initialization failed: "Invalid configuration file C:\Program Files\Microsoft\Exchange Server\V14\Bin\CmdletExtensionAgents\ScriptingAgentConfig.xml: cannot find node xml.""'
        + CategoryInfo          : NotSpecified: (:) [], ProvisioningBrokerException
        + FullyQualifiedErrorId : C136A4D5
    My xml is below. I have tried a bunch of other sample ones from online, and they all do the same, even when the cmdlet is not the one specified in the xml.:
    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="MailboxProvisioning" Cmdlets="Enable-Mailbox">
    <ApiCall Name="OnComplete">
    if($succeeded) {
    $mailbox = $provisioningHandler.UserSpecifiedParameters["Identity"]
    Set-MailboxCalendarConfiguration -identity $mailbox -WorkingHoursStartTime 09:00 -WorkingHoursEndTime 16:30
    </ApiCall>
    </Feature>
    </Configuration>

    So - I just took your code into my lab SP2 Ru3
    I changed to New-Mailbox as I'm not enabling existing accounts,   you can add another section.
    When I changed to the Name parameter this works.
    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="MailboxProvisioning" Cmdlets="New-Mailbox">
    <ApiCall Name="OnComplete">
    if($succeeded) {
    $mailbox = $provisioningHandler.UserSpecifiedParameters["Name"]
    Set-MailboxCalendarConfiguration -identity $mailbox -WorkingHoursStartTime 09:00 -WorkingHoursEndTime 16:30
    </ApiCall>
    </Feature>
    </Configuration>
    Cheers,
    Rhoderick
    Microsoft Senior Exchange PFE
    Blog:
    http://blogs.technet.com/rmilne 
    Twitter:   LinkedIn:
      Facebook:
      XING:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • Help needed with finding node in JTree

    Hi,
    In my application i will be entering some string data in a text box for search criteria.
    When I click on search, I will get data from database which will be shown as a JTree.
    This Jtree will have some nodes in which, node with string entered in the search text box exists.
    I need to focus on this node and I have only a string to find this node.
    How can I do this?How can I find a node in JTree using string value?
    Is there any alternate option by which I can achive my need?
    Please suggest.
    Thanks.

    @OP: please assign your dukes.
    @Andre_Uhres: if you don't get rewarded in the next couple of days, please let me know here to get at least one duke for your effort.
    Bye.

Maybe you are looking for

  • Business partner balance does not match journal entries message

    Dear All, The error message "Business partner balance does not match journal entries" appears in customer receivable report print preview. This is happened While generating the Customer Receivables Aging report by sales documents. What is the main ca

  • Doubt on Sync-Async  bridge using BPM

    Hi Experts,                  I had a doubt on Sync-Async  bridge using BPM,    1. If sender system is SAP system and receiver system is non-sap system then while configuring in Integration Directory how many  Receiver Determinations should be done ?

  • Connection of java and oracle 10g express edition

    hello!!!!! I'm new to databases as well as JDBC. I want to know how to connect to oracle 10g express edition with java to create a desktop application. Let me know step by step procedure if possible..... Also tell me which softwares or drivers other

  • AC Adapter for 802.11n Base Station.

    Hi all, Does anyone know where I can get a replacement AC adapter for a 802.11n Base Station?

  • Cannot receive art work "after" Cd's installed on I TUNES

    Hello! XP user here. 1) Installed entire library of CD's on ITUNES (very time consuming). 2) Then set up my account. 3) Then permitted the automatic updates. No album covers. Seems that the only way I can get it is through down-loading the CD's "all