Sometime back I posted similar post on the above topic - Customizing the af:query component display by overriding CriteriaItemAttributeHints
Its time for me to revisit the same topic with slightly different use case :)
The use case requirement was to override the ViewCrtieria hints of a base view object from a child view object. Well, its easy. You can hook your code by overriding ViewObjectImpl::getCriteriaItemAttributeHints(ViewCriteriaItem vci), and optionally return your own AttributeHints implementation. In the following code sample, I'm demonstrating this by changing some properties of a ViewCriteriaItem for specific items.
Before winding up today's post, let me teach you one more useful tip on the same context. An interesting enhancement available with 11.1.2.0.0 release is the ability specify 'Display Width' for each view criteria item while defining a view criteria. This property decides the width of the UI control (displayed inside the query component) at run time. Please note that in previous releases the af:query component was using display width from the view object's attribute definition (by default) to render controls.
Download
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11.1.2.0.0 (11g R2) + HR Schema]
A glance at the implementation
This sample uses 2 view object
1. A base view object - EmployeesView
2. A child view object extended from EmployeesView - EmpDeptView. Child view object inherits 'EmployeesViewCriteria' defined on base view object.
The EmpDeptViewImpl overrides certain properties of 'EmployeesViewCriteria' from the base view object by using getCriteriaItemAttributeHints(...) method. Take a look at the below shown scree shot to understand this example better. The screen shot displays two query components one from EmployeesView and the other from EmpDeptView. Though both query components are derived from same ViewCriteria defined on the base view object (EmployeesView), the second component displays slightly modified version by hiding the DepartmentId field and marking the FirstName as 'optional'. This is achieved by the altering ViewCriteriaItem instance in the getCriteriaItemAttributeHints(...) method.
Its time for me to revisit the same topic with slightly different use case :)
The use case requirement was to override the ViewCrtieria hints of a base view object from a child view object. Well, its easy. You can hook your code by overriding ViewObjectImpl::getCriteriaItemAttributeHints(ViewCriteriaItem vci), and optionally return your own AttributeHints implementation. In the following code sample, I'm demonstrating this by changing some properties of a ViewCriteriaItem for specific items.
/**
* By default return null. Subclasses may override to return
* custom AttributeHints implementation for the given criteria item.
*/
@Override
public AttributeHints getCriteriaItemAttributeHints(ViewCriteriaItem vci) {
if (vci != null && vci.getViewCriteria().getName().equals("EmployeesViewCriteria")) {
if (vci.getAttributeDef().getName().equals("FirstName")) {
vci.setRequired(ViewCriteriaItem.VCITEM_OPTIONAL);
} else if (vci.getAttributeDef().getName().equals("DepartmentId")) {
vci.setProperty(ViewCriteriaItem.RENDERED_MODE, ViewCriteriaItem.CRITERIA_RENDERED_MODE_NEVER);
}
}
return super.getCriteriaItemAttributeHints(vci);
}
Before winding up today's post, let me teach you one more useful tip on the same context. An interesting enhancement available with 11.1.2.0.0 release is the ability specify 'Display Width' for each view criteria item while defining a view criteria. This property decides the width of the UI control (displayed inside the query component) at run time. Please note that in previous releases the af:query component was using display width from the view object's attribute definition (by default) to render controls.
Download
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11.1.2.0.0 (11g R2) + HR Schema]
A glance at the implementation
This sample uses 2 view object
1. A base view object - EmployeesView
2. A child view object extended from EmployeesView - EmpDeptView. Child view object inherits 'EmployeesViewCriteria' defined on base view object.
The EmpDeptViewImpl overrides certain properties of 'EmployeesViewCriteria' from the base view object by using getCriteriaItemAttributeHints(...) method. Take a look at the below shown scree shot to understand this example better. The screen shot displays two query components one from EmployeesView and the other from EmpDeptView. Though both query components are derived from same ViewCriteria defined on the base view object (EmployeesView), the second component displays slightly modified version by hiding the DepartmentId field and marking the FirstName as 'optional'. This is achieved by the altering ViewCriteriaItem instance in the getCriteriaItemAttributeHints(...) method.
1 comments:
Hi Jobinesh,
Based on your post of Dynamic LOV, I am trying to create a radio group in a dynamic form component. I created a ListBinding and setting the AttributeHints of the column as
"AttrDef[itr].setProperty(AttributeHints.ATTRIBUTE_CTL_TYPE, AttributeHints.CTLTYPE_RADIOGRP);"
But still I am not getting the radio group displayed on the page. Am I missing something?
I am trying to create the following components dynamically in a dynamic form and was not able to
SelectOneRadio
SelectManyCheckbox
SelectManyChoice
SelectManyListbox
Can you please point me in some direction?
Thanks in advance
Post a Comment