Monday, 30 April 2018

Step 6: Refine the dashboard and display data

You enhance the user interface by adding a table of employees and including the ability to do column selection, by reordering the fields in one of the panels, and by binding the business components to a chart . You do this with simple drag and drop operations - behind the scenes the ADF Model layer handles the data binding for you.
  1. Back in the Structure window of JDeveloper, select the af:panelBox - PanelBox1.
    Set the Text property to Employees. Save your work.
    This screenshot shows the Structure window with the first Panel Box selected and also the Properties window of the Panel Box. The Properties window displays the expanded Common section with the text modified.
  2. Next, add some data from the Data Controls window.
    Expand the AppModuleDataControl > DepartmentView1 nodes to expose EmployeesView4. Note that these are the "detail" employees for the "master" departments - they are linked and therefore at runtime, the employees you see in this view object are the ones who belong to the selected (or viewable) department.
    Drag the EmployeesView4 onto the Structure window and drop it on the af:panelBox - Employees node. In the popup menu, select Table/List View > ADF Table.
    This screenshot shows two windows and a popup menu. The first is the Data Controls window where a data control is dragged and dropped to the first Panel Box of the Structure window, which is the second window. When dropped, a popup menu displays from where the Table/ListView - ADF Table layout for the panel box is selected.
  3. In the Create Table pane, allow for Single Row selection.
    Enable SortingFiltering and set the table to be Read-Only.
    Delete all the columns except FirstNameLastName and Email. Then click OK.
    This screenshot shows the Create Table pane where the specific attributes as mentioned in the above paragraph are selected.
  4. Save all your work
    Since you've added new data to the page, it must be deployed again. Right click on the page and select Run. This will compile your project, build it, and launch the integrated WebLogic Server to run it. The default web browser opens to display the page. You can follow the progress of these steps in the Log window in JDeveloper.
    This screenshot shows the visual editor in the background and the menu command to deploy the page to Web Logic Server.
  5. Now you see employee records in the first panel.
    By default the first department's (Administration) employees populate the panel.
    This screenshot shows a browser page that displays the data on the left side and all the panel boxes on the right side. The first panel box displays the data as added in the previous steps in a tabular format.
    Click an different department and the employee records automatically update.
    This screenshot shows the browser page that displays a different data selected on the left side and the first panel box displaying the corresponding data and the other panel boxes on the right side.
  6. Select the Shipping department.
    Then, move the mouse over the FirstName heading to reveal two sorting icons. Move the mouse over the upward triangle and a Sort Ascending tool-tip displays.
    You may sort on any item by selecting the ascending or descending icons.
    This screenshot shows the browser page with different data selected on the left side and the first panel box displayng the corresponding data and other empty panel boxes on the right side. The first column in the first panel box displays the two sorting icons.
  7. Click and hold the LastName column prompt. Then, drag it to the left and reposition it before the FirstName column.
    This screenshot shows the browser page that displays how to rearrange the columns in the first panel box by drag and drop.
    This screenshot shows the browser page that shows the rearranged columns in the first panel box.
  8. Place the cursor in the field above the LastName column. Then, type "M" and press the Enter key to filer only those employees who's last name begins with "M"
    This screenshot shows the browser page where the data in the first panel box is filtered by the specified criterion.
  9. Back in JDeveloper, lets work on the second panel box.
    Select the second panel box and set the Text property to Details.
    This screenshot shows the Structure window with the second panel box selected and the corresponding Properties window. The Common section of the Properties window is expanded with the Text attribute modified as specified in the paragraph above.
  10. From the Data Control window, drag the same EmployeesView4 collection, as you did earlier, and drop it on the Details panel box.
    In the popup menu, select ADF Form.
    This screenshot shows the Data Controls window where a data control is dragged and dropped to the second Panel Box of the Structure window. When dropped, a popup menu displays from where the Form layout for the second panel box is selected.
  11. In the Create Form pane, keep the FirstNameLastNameEmailPhoneNumberHireDateJobId and Salary and remove the rest of the fields.
    Then click OK and Save your work.
    This screenshot shows the Create Form pane where the specific attributes as mentioned in the above paragraph are selected.
  12. You can click the recompile button, just below the menu bar of JDeveloper, to move these changes forward .
    This screenshot shows the JDeveloper toolbar that highlights the recompile button.
    Then, reload the browser page to see the second panel contains detail data of the selected employee.
    This screenshot shows the reloaded browser page that displays data in the left pane, first, and second panel boxes. The second panel box displays the data as included in the previous steps in a form format.
  13. Select a different employee and notice how the detail refresh with new values for the selected employee.
    This screenshot shows the browser page with different details in the second panel box when a different record is selected in the first panel box.
  14. If you input an invalid value for the date filed, you automatically receive an error.
    This screenshot shows the browser page that displays an error message when an invalid value is entered in one of the fields in second panel box. The error message also displays the valid format.
    You also get a calendar icon, to the right of the field, to pick the correct date.
    This screenshot displays the browser page that displays a Calendar icon for the field that has the datatype as Date.
  15. Next let's work on the third box. Select it and set the Text property to Salaries.
    This screenshot shows the Structure window with the thirds panel box selected and the corresponding Properties window. The Common section of the Properties window is expanded with the Text attribute modified as specified in the praragraph above.
  16. From the Data Controls, drag the EmployeesView4 to the Structure window and drop it on the Salaries panel box.
    In the popup menu, select Chart....
    this screenshot shows the Data Controls panel from where a data control is dragged and dropped to the third panel box, and a Chart layout is selected from the popup menu.
  17. When creating a chart, the same data control can be used to make a variety of different charts.
    For our purposes, select the Bar category, ensure the Chart Type is set to Bar and use the second Quick Start Layout.
    Then click OK.
    This screenshot shows the Component Gallery. The left pane shows the Categories pane that lists different chart categories. When a category is selected, the top center pane displays the Chart Types and the top right pane displays the description. The bottom pane displays the corresponding Quick Start Layouts for the selected chart type. In this screenshot, Bar is selected under Categories and Bar is selected under Chart Types.
  18. Once you decide on a chart, you then you determine the bars and X axis fields to use.
    From the Available column, drag the Salary to the Bars field and drop it. Then, drag the LastName to the X Axis and drop it.
    Then click OK.
    This screenshot shows the Create Bar Chart window where you can drag and drop the fields for x and y axis. In this screenshot, Salary is dropped for Bars and Lastname is dropped for X azis. A sample chart is also displayed.
  19. Like earlier, Save your work, recompile and reload the browser to see the changes.
    This screenshot shows the JDeveloper toolbar with recompile button highlighted to recompile the page.
    Now the Salaries panel shows all the employees in a department and their salaries.
    This screenshot shows the browser page where a table is displayed in the first panel box, corresponding details in a form layout in the second panel box, and a chart in the third panel box.
  20. If you remove the filter in the Employees panel box, then the bar chart updates to include all the shipping employees salaries.
    This screeshot shows the browser page without any filters.
  21. Next, modify the chart.
    Select the dvt:barChart and then in the Properties, put the cursor next to the magnifying glass and enter Zoom. This allows you to filter and find properties easier
    The ZoomAndScroll property should be shown. Change the value to live.
    Save your work.
    This screenshot shows the Structure window with the barChart selected in the third panel box and the corresponding Properties window and displays the ZoomAndScroll property.
  22. Recompile the application and then reload the browser.
    In the Shipping department, with no filter on the Employees, there are many salaries to show and you are not able to see all the names.
    Place the cursor over the X axis and you get a cross hair cursor. Drag the cursor to highlight a portion of the chart (The highlighted portion is a lighter shade). Then release the cursor.
    This screenshot shows the browser page that displays only the third panel box with a portion of the chart highlighted.
    When you release the mouse, the selected records zoom to fill the whole panel box and you have a scrolling bar on the bottom to see all the other records that are hidden from view.
    This screenshot shows the browser page that displays only the third panel box with the portion of chart that was highlighted earlier, zoomed in and other records hidden.
    Scroll the bar to the left to see the other employee salaries.
    This screenshot shows the browser page that displays only the third panel as in the previous image and scrolled to left to view other records that were hidden from the view earlier.