I got a question, based on my previous post - CRUD Operations in Oracle ADF 11g Table Using PopUp Component. Blog reader was asking, if its possible to identify ADF button component in Backing Bean without checking component Id. Answer is yes, it is possible - just need to use JSF attribute component. You can declare JSF attribute for ADF button and pass button key through this attribute:
It will be possible to access value passed through JSF attribute in Backing Bean. You just need to specify JSF attribute name and value. In this example, I will use insert value in order to identify Insert button:
In Backing Bean, you will need to access UI Component (ADF button in this case) object, and use getAttributes() function to get a map of available attributes. Retrieve defined JSF attribute using its name:
In a case, if Insert button will be pressed, we will check attribute and will invoke CreateInsert operation:
In other case - row will be opened for editing:
Download sample application - TableDialogEdit3.zip.