14.01.2013 Views

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.13.4. Creating a Button that Calls the Method With Percentage From Input Field<br />

Before we generate the button and the percentage input field into the page, we drag-anddrop<br />

it using the JDeveloper Visual Editor, including the relevant ADF Bindings. That<br />

way we can see what it is we need to generate.<br />

Before making any customizations, ensure that the names of the used generator<br />

templates are included in the sources, as explained in the section Finding Out Which<br />

Generator Templates Are Used.<br />

• Go to the page where you want to add the button and input field (for example<br />

Employees.jspx) in Design mode.<br />

• Go to the Data Control Palette, and find the new increaseSalary method of the<br />

Application Module.<br />

• Drag-and-drop the increaseSalary method just below the Employee fields.<br />

• Choose Create – Parameters – ADF Parameter Form. A Form Fields Editor dialog<br />

opens. Don't close it yet.<br />

We only want a Form Field for the percentage, as we will pass the current Employee Id<br />

to the increaseSalary method behind the scenes.<br />

• By default the empId row is highlighted, so you can click the Delete button right<br />

away.<br />

• Click OK on the Form Fields Editor.<br />

This creates a form with an input field and a button 'increaseSalary' in the page. In the<br />

Page Definition of the page it creates a variableIterator with a variable<br />

'increaseSalary_percentage', an attribute binding 'percentage', and a method binding<br />

'increaseSalary'.<br />

Now we still have to pass the Employee Id to the method call.<br />

• Go to the Page Definition of the Employees page.<br />

• In the Structure pane, open the bindings node and find the increaseSalary<br />

binding. Open that node too, and select the empId parameter.<br />

• Go to the properties of this parameter, and find the NDValue property. Click the<br />

Button with three dots (Edit), and choose ADF Bindings – bindings –<br />

EmployeesEmployeeId - inputValue. Click the button with the right arrow (>)<br />

and the expression ${bindings.EmployeesEmployeeId.inputValue} will<br />

appear. Click OK and Save.<br />

If you run the page, fill in a percentage, and click the button, you can see a higher value<br />

in the Salary field. If you like you can improve the layout by replacing the panelForm by<br />

a panelLabelAndMessage (which means that you have to set simple="true" on the<br />

inputText component).<br />

<strong>JHeadstart</strong> Developer’s <strong>Guide</strong> Generating User Interface Widgets 6- 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!