What Happens When You Create an Input Table

Creating ADF Databound Tables 4-15 4. In the Edit Property dialog, expand the toolbar facet for the panelCollection component and then expand the toolbar that contains the Create command component. Select that component and shuttle it to the Selected panel. Click OK. This sets that component to be the trigger that will cause the table to refresh. 5. Create a button that allows the user to merge the new objects into the collection. From the Data Controls panel, drag the merge method associated with the collection used to create the table, and drop it as a toolbar button or link into the toolbar. Figure 4–8 shows merge method for the Suppliers collection. Figure 4–8 Merge Methods in the Data Controls Panel

4.4.2 What Happens When You Create an Input Table

When you use the create operation to create an input table, JDeveloper: ■ Creates an iterator binding for the collection, an action binding for the create operation, and attribute bindings for the table. The create operation is responsible for creating the new row in the row set. If you created command buttons or links using the merge method, JDeveloper also creates an action binding for that method. ■ Inserts code in the JSF page for the table for the ADF Faces components. Example 4–5 shows the page definition file for an input table created from the Supplier collection some attributes were deleted in the Edit Columns dialog when the collection was dropped. Example 4–5 Page Definition Code for an Input Table executables variableIterator id=variables iterator Binds=root RangeSize=25 DataControl=SessionEJBLocal id=SessionEJBLocalIterator Tip: If you will want the user to be able to continue updating the row after it is persisted, then you should create the button using the persist method instead. For more information, see Section 3.6.3, What You May Need to Know About the Difference Between the Merge and Persist Methods. 4-16 Java EE Developers Guide for Oracle Application Development Framework accessorIterator MasterBinding=SessionEJBLocalIterator Binds=suppliersFindAll RangeSize=25 DataControl=SessionEJBLocal BeanClass=model.Suppliers id=suppliersFindAllIterator executables bindings action IterBinding=suppliersFindAllIterator id=Create RequiresUpdateModel=true Action=createRow methodAction id=mergeSuppliers RequiresUpdateModel=true Action=invokeMethod MethodName=mergeSuppliers IsViewObjectMethod=false DataControl=SessionEJBLocal InstanceName=SessionEJBLocal.dataProvider ReturnName=SessionEJBLocal.methodResults.mergeSuppliers_ SessionEJBLocal_dataProvider_mergeSuppliers_result NamedData NDName=suppliers NDValue={bindings.Create.currentRow.dataProvider} NDType=model.Suppliers methodAction tree IterBinding=suppliersFindAllIterator id=suppliersFindAll nodeDefinition DefName=model.Suppliers AttrNames Item Value=email Item Value=phoneNumber Item Value=supplierId Item Value=supplierName Item Value=supplierStatus AttrNames nodeDefinition tree bindings Example 4–6 shows the code added to the JSF page that provides partial page rendering, using the Create Supplier and Commit New Suppliers command toolbar button as the triggers to refresh the table. Example 4–6 Partial Page Trigger Set on a Command Button for a Table af:form id=f1 af:panelCollection id=pc1 f:facet name=menus f:facet name=toolbar af:toolbar id=t2 af:commandToolbarButton actionListener={bindings.Create.execute} text=Create New Supplier disabled={bindings.Create.enabled} id=ctb1 af:commandToolbarButton actionListener={bindings.mergeSuppliers.execute} text=Commit New Suppliers disabled={bindings.mergeSuppliers.enabled} id=ctb2 af:toolbar f:facet f:facet name=statusbar af:table value={bindings.suppliersFindAll.collectionModel} var=row rows={bindings.suppliersFindAll.rangeSize} emptyText={bindings.suppliersFindAll.viewable ? No data to display. : Access Denied.} fetchSize={bindings.suppliersFindAll.rangeSize} rowBandingInterval=0 Creating ADF Databound Tables 4-17 selectedRowKeys= {bindings.suppliersFindAll.collectionModel.selectedRow} selectionListener= {bindings.suppliersFindAll.collectionModel.makeCurrent} rowSelection=single id=t1 partialTriggers=::ctb1 ::ctb2 af:column sortProperty=supplierId sortable=false headerText= {bindings.suppliersFindAll.hints.supplierId.label} id=c6 af:inputText value={row.bindings.supplierId.inputValue} label={bindings.suppliersFindAll.hints.supplierId.label} required={bindings.suppliersFindAll.hints.supplierId.mandatory} columns={bindings.suppliersFindAll.hints.supplierId.displayWidth} maximumLength={bindings.suppliersFindAll.hints.supplierId.precision} shortDesc={bindings.suppliersFindAll.hints.supplierId.tooltip} id=it4 f:validator binding={row.bindings.supplierId.validator} af:convertNumber groupingUsed=false pattern={bindings.suppliersFindAll.hints.supplierId.format} af:inputText af:column . . . af:table af:panelCollection af:form

4.4.3 What Happens at Runtime: How Create and Partial Page Refresh Work