This topic contains the following sections:
A rich client User Interface (UI) may have by default, a component or part of a page that is set to a disabled state until a user action. An example of a user action might be changing the state of a different component which triggers the disabled component or part of a page to become enabled. Presently, ADF does not provide a general "out of the box" approach for achieving this behavior.
This pattern demonstrates how to create typical rich client UI behavior, which by default sets components or part of a page to a disabled state unless or until a user action, such as changing the state of a component, triggers a component or part of a page to enabled. For example, many rich client UIs keep the Save button disabled until the user makes changes that requires persistence. At that point the Save button enables. The reverse scenario from enabled to disabled is also applicable. That is, elements on the page can disable based on user actions.
ADF technologies used in this pattern include an inputNumberSpinbox and a selectBooleanCheckbox along with various layout components. The implementation is achieved with a combination of an autoSubmit, partialTriggers, and an EL binding to a disabled attribute.
In this Functional UI Pattern autosubmit and partialTriggers respond to user entered values. In the illustrated UI, the collate checkbox is enabled or disabled based on the number of copies the user selects to make. If the number of copies is 1, the collate checkbox is disabled. If the number of copies requested by the user is greater than 1, the collate checkbox is enabled.


User Interface Elements
ADF Input Number Spinbox: The af:inputNumberSpinbox is an input component that presents the user with an input field for numerical values and a set of up and down arrow keys to increment or decrement the current value in the input field.
ADF Select Boolean Checkbox: The af:selectBooleanCheckbox component allows more flexibility in how the checkbox components are laid out on the page. For example, selectBooleanCheckbox components can be laid out in a grid by using h:panelGrid. The value attribute should be set to a boolean. The required attribute whether a non-null, non-empty value must be entered. If false, validators will not be executed when the value is null or empty. Having the required attribute set to true, does not mean that the user must check the checkbox before submitting. False is a valid value, even if the required attribute is true.
Code Snippet
Number of copies: To the af:inputNumberSpinbox add the EL binding, #{test.copies}, to the Value property of the Common section of the Property Inspector. Ensure that the AutoSubmit property within the Behavior section of the Property Inspector is set to true.
Collate: To the af:selectBooleanCheckbox add the EL binding, #{test.collateDisabled} to the Disabled property in the Behavior section of the Property Inspector. Ensure that the PartialTriggers property is set to copies within the Behavior section of the Property Inspector.
This sample implementation of the UI pattern is divided into 5 major steps.
Create the application workspace, project, and a simple jspx page
The Model project is not used in this sample app.
enableDisable or other appropriate name for the Application Name.enableDisableModel and enableDisable for the Model and ViewController respectively, or other appropriate names.enabledisable.EnableDisable.jspx).Add ADF components to construct the UI
scroll and the halign to center.100.horizontal.copies.Number of copies in the Label property.1.true.collate in the Text property.Create a managed bean
enableDisable.EnableDisable.enabledisable.java.lang.Object.session.copies.int.Add the required EL bindings within the ADF UI components
This inserts the following EL Binding, #{enableDisable.copies}, into the Expression field of the Expression Builder dialog.
#{enableDisable.collateDisabled} into the Disabled property.
package enabledisable;
public class EnableDisable{
private int copies = 1;
public EnableDisable() {
}
public void setCopies(int copies) {
this.copies = copies;
}
public int getCopies() {
return copies;
}
public boolean getCollateDisabled() {
return copies < 2;
}
} Run the application
Instead of completing these step, an ADF sample application on OTN called enabledisable is available at https://www.oracle.com/docs/tech/developer-tools/enabledisable.zip can be unzipped into the designated JDeveloper work area. Open enableDisablePattern.jws with JDeveloper.