Custom add/remove row button in tree

I have one requirement to add/remove row in tree model.For this i am using back-end java coding to implement the logic.
And implementation logic is like…
For each row in tree I have one select row check-box and corresponding command button[Add/Delete].And at page load status of the button will be set as disabled.
When user select on any select row check-box corresponding button will get enabled.For this I need to set each button with some unique id like rowID. But.But in treeProvider I can’t see any variable like rowID.
Can any one please help me in this case.

Here Provider class is using as
private loanDataProvider = null;

Attaching is the details available with treeProvider.

Any help is appreciated.


In general if you are clicking a command button that is inside of a table row, then the framework will position the tree content provider on that row before calling your action handler.

So calling something like this should give you the id of the row that contained the button that was clicked:

String rowId = getLoanDataProvider().getRowId();

Thanks Eric.
In this way I am bale to get Row ID.
But my problem is with different point.

I have two asyncButton(Add/Delete) attached with each row and they contains inside two hidable panel.
Now dispaly properrty of the hidable property is set as
#{test.widgetQuantity==null} dispaly panel with Add button
#{test.widgetQuantity!=null} Dispaly panel with Delete Button

Initial loading of the page is displaying correct display of the button.
Now if I click on any of the button(Add/Delete) then page only dispaly that button only.

I have attached the screen Shot for reference.

Initially I was thinking this may be due to same ID to the same panel in all row.But this is not the case.
Any advise how this can be resolved.