Microsoft Word - docloader _3_ by jontymagicman

VIEWS: 33 PAGES: 115

									        training




Amdocs Smart Client
Framework
Verion 7.5
© 2008 Amdocs
This document contains proprietary and confidential information of Amdocs and shall not be reproduced or
transferred to other documents, disclosed to others, or used for any purpose other than that for which it is furnished,
without the prior written consent of Amdocs. It shall be returned to the respective Amdocs companies upon
request.
The trademark and service marks of Amdocs, including the Amdocs mark and logo, are the exclusive property of
Amdocs, and may not be used without permission. All other marks mentioned in this material are the property of
their respective owners.

Document Information
Software Version:
Publication Date:
Catalog Number:                 document_center\886318 Version0.9
Security Level:                 Level 2 - Sensitive
Creation Date:                  15 July, 2008
Account/FOP:
Author:                         Zahi Gigi, David Braddy
Editor:                         Zahi Gigi
Last Edit Date:                 29 July, 2008
File Name:                      ascf75_Labs_SDK_final
Template:                       Universal1Side.dot
                                                Contents
Introduction ..................................................................................................... 1
1.     Lab A – Project Setup ............................................................................ 2
       1.1. Purpose ................................................................................................... 2
       1.2. Getting Started ........................................................................................ 2
       1.3. Eclipse Environment ................................................................................ 3
       1.4. Setup Eclipse Preferences....................................................................... 4
       1.5. Login to Server in Design Time ................................................................ 5
       1.6. Create a New Project and UIF Application Desktop ................................ 5
       1.7. Edit workspace.xml To Point to the New Application Desktop File and
       Login to CRM..................................................................................................... 8
       1.8. Create a Runtime Configuration With Which to Launch the Application . 10
       1.9. Run the Application................................................................................ 11
       1.10.    Global Forms ..................................................................................... 12
              1.10.1.    Create a Global form ................................................................................ 12
              1.10.2.    Register the Global Form with the Application ......................................... 13

2.     Lab B – Forms ...................................................................................... 15
       2.1.     Purpose ................................................................................................. 15
       2.2.     Review of Forms .................................................................................... 15
       2.3.     Review of Controls................................................................................. 16
       2.4.     Creating a Form ..................................................................................... 16

3.     Lab C- Data Models and Bindings ...................................................... 20
       3.1. Purpose ................................................................................................. 20
       3.2. Review of Data Models .......................................................................... 20
       3.3. Create a DM .......................................................................................... 20
       3.4. Create Simple Bindings to First and Last Name Text Fields .................. 21
       3.5. Use Trigger Fields to Bind Two DM Fields Into One Text Box ............... 22
       3.6. Bind the ‘chkIsEmployee’ Control .......................................................... 22
       3.7. Bind ‘txtEmployeeID’ and Make It Visible Only if
       contactDM:isEmployee is True ........................................................................ 23
       3.8. Create Menu Item to Launch Form ........................................................ 23
       3.9. Run the Form......................................................................................... 24
       3.10.   Review of Value Map ......................................................................... 24
              3.10.1.    Add UI to Demonstrate Value maps ......................................................... 24
              3.10.2.    Create Value Map TDM and Edit contactDM. ......................................... 25
              3.10.3.    Bind the TDM to cmbStatusList. ............................................................... 26
              3.10.4.    Bind the contactDM’s Status Field to txtStatusText. ............................ 26


                                                     Information Security Level 2 - Sensitive
                                                                                                                              iii
                                         Proprietary and Confidential Information of Amdocs
                                                           Amdocs Smart Client Framework Verion 7.5
                                                                                          Contents

            3.10.5.     Run the Form ............................................................................................ 27
     3.11.         Review of Virtual Data Models ........................................................... 27
            3.11.1.     Move Value Map TDM to a Global Form and Create a Virtual TDM ........ 28
            3.11.2.     Rebind to the Virtual Data Model .............................................................. 29
            3.11.3.     Run the Form ............................................................................................ 29

4.   Lab D – Card Panes .............................................................................. 30
     4.1. Purpose ................................................................................................. 30
     .4.2 Review of Card Pane................................................................................. 30
            4.2.1.     Create New Card Pane Sample Form ........................................................ 30
            4.2.2.     Add UI to Demonstrate the Use of Value mMaps with Card Pane ............. 30
            4.2.3.     Create Value Map TDM and Edit contactDM. ........................................... 32
            4.2.4.     Bind the TDM to cmbStatusList. ............................................................... 33
            4.2.5. Make the Selected Value in the cmbCardOptions Combo Box Change
            Which Card Will Be Displayed ................................................................................. 33
            4.2.6.     Add Launch Action to Launch Validation Form.......................................... 34
            4.2.7.     Add Menu Item to Launch the CardPane Sample Form ............................ 34
            4.2.8.     Run Application ........................................................................................... 34

5.   Lab E – Validations .............................................................................. 35
     5.1.      Purpose ................................................................................................. 35
     5.2.      Review of Action- Level Validation ......................................................... 35
            5.2.1.     Create a Validation Sample Form .............................................................. 35
            5.2.2.     Create Action with Validation Statements .................................................. 35
            5.2.3.     Add Launch Action to Launch Validation Form.......................................... 36
            5.2.4.     Run application ........................................................................................... 37

6.   Lab F – Data Communications ............................................................ 39
     6.1.      Purpose ................................................................................................. 39
     6.2.      Review of DCE ...................................................................................... 39
            6.2.1.     Create New DCE Form ............................................................................... 40
            6.2.2.     Create a DCE ............................................................................................. 40
            6.2.3.     Create a DCI ............................................................................................... 41
            6.2.4.     Add New DCE Launch Action to Global Form ........................................... 41
            6.2.5.     Add Menu Item in Application.................................................................... 41
            6.2.6.     Run Application ........................................................................................... 42

7.   Lab G – Actions .................................................................................... 43
     7.1.      Purpose ................................................................................................. 43
     7.2.      Review of Actions .................................................................................. 43
     7.3.      Review of ASCF Backend Simulator ...................................................... 44
     7.4.      Action Lab Detailed Instructions............................................................. 44
            7.4.1.     Create “Contact Details” Form .................................................................... 44
            7.4.2.     Create Data Models .................................................................................... 46


                                                      Information Security Level 2 - Sensitive
                                                                                                                                 iv
                                          Proprietary and Confidential Information of Amdocs
                                                              Amdocs Smart Client Framework Verion 7.5
                                                                                             Contents

      7.5.      Review of Submit Action ........................................................................ 47
             7.5.1.      Create Actions ............................................................................................ 47
      7.6.      Review of Subscribing Action ................................................................ 48
             7.6.1.      Create a Subscribing Action (With the Name LoginAction) ....................... 48
      7.7.      Review of Sequence action ................................................................... 49
             7.7.1.  Create a Sequence Action ......................................................................... 49
             7.7.2. Setup Menu Item to Launch Contact Details Form.................................. 50
             7.7.3.      Configure the Simulator and Execute the Application ................................ 50
             7.7.4.      Create Address Details Form ..................................................................... 53
      7.8.      Review of Bulk Action ............................................................................ 56
             7.8.1. Create Launch Action in Contact Details Form to Post Address
             Details Subform ....................................................................................................... 57
             7.8.2.      Run the Application ..................................................................................... 57

8.    Lab H – Action Configuration Wizard ................................................. 58
      8.1. Purpose ................................................................................................. 58
      8.2. Create a CreateSite form Using New Base Form Wizard ....................... 58
      8.3. Create a SearchSite Form in Designer Using the New Search Form
      Wizard ............................................................................................................. 61
      8.4. Configure Menu Items (Application Desktop) ......................................... 63
      8.5. Run the Application................................................................................ 63

9.    Lab I – Search Grid ............................................................................... 64
      9.1.      Purpose ................................................................................................. 64
      9.2.      Review of Grid ....................................................................................... 64
      9.3.      Exercises ............................................................................................... 65
             9.3.1.      Exercise 1 ................................................................................................... 65
             9.3.2.      Exercise 2 ................................................................................................... 82

10.   Lab J – Lookup Control ....................................................................... 87
      10.1.         Purpose ............................................................................................. 87
      10.2.         Review of Lookup Control .................................................................. 87
      10.3.         Starting the Lab ................................................................................. 88
             10.3.1.      Create a Details Form............................................................................... 94
             10.3.2.      Create a Lookup Form .............................................................................. 97

11.   Lab K – Customs Controls Support .................................................. 107
      11.1.         Purpose ........................................................................................... 107
      11.2.         Registering a Custom Control .......................................................... 107
      11.3.         Using a Custom Control ................................................................... 108




                                                        Information Security Level 2 - Sensitive
                                                                                                                                      v
                                            Proprietary and Confidential Information of Amdocs
INTRODUCTION
  This course describes the Amdocs Smart Client Framework, a Java Swing-
  based environment and tool kit for building application GUI front ends for
  enterprise application software packages. The hands-on exercises will
  familiarize you with the technical ASCF capabilities and give you the
  technical background and skills required to build application front ends.
  Upon completion of this course, you will know what GUI and front-end
  services the ASCF provides, know how to use them to build simple
  applications, and be adequately prepared for follow-up CRM or Ordering
  Smart Client application technical customization courses.




                             Information Security Level 2 - Sensitive
                                                                               1
                 Proprietary and Confidential Information of Amdocs
1.     LAB A – PROJECT SETUP
1.1.   Purpose
       In Lab A, you will learn how to:
       ■   Create a new ASCF project
       ■   Create a new application desktop
       ■   Configure the workspace
       ■   Create new Global Form


       Lab Scenario ( WHAT to do )    In this lab you'll create a new ASCF project, a new
                                      application desktop, configure the workspace.xml
                                      and create a global form
       Implementation Steps           Follow the click-stream instructions. For now, it
       ( HOW to do it )               pretty much describes every step. Later on, as you
                                      learn the system, the instructions become somewhat
                                      more high-level



1.2.   Getting Started
       1. Using Citrix or your remote desktop, connect to the environment image.
           This may vary, depending on the class setup. Additional instructions will
           be provided by the instructor.
       2. Open the desktop folder of links to CRM tools.




                                   Information Security Level 2 - Sensitive
                                                                                            2
                       Proprietary and Confidential Information of Amdocs
                                     Amdocs Smart Client Framework Verion 7.5
                                              Chapter 1. Lab A – Project Setup

           This directory contains shortcuts to:
           a. The application server (1)
           b. The ASFC designer (based on Eclipse plug-in)(2)
           Later on, you will use these shortcuts to open the designer and to start the
           server. This server will be used to retrieve data both during the time of
           design time and in runtime.

1.3.   Eclipse Environment
       1. Check the following:
          a. The environment is preconfigured as follows; in your own
             environment, however, the parameters should be checked.
          b. Eclipse must be running under 5.0 JRE.
           c. Check that the desktop shortcut that starts the ASCF designer/Eclipse,
              Amdocs Smart Client Designer 7.5.1 and make certain that
              that it:
               i.   Runs: C:\AmdocsCRM7.5.1\Eclipse321\eclipse.exe
               ii. Starts in: C:\AmdocsCRM7.5.1\Eclipse321
               iii. Includes the parameters:
                    -vm –clean
                    C:\AmdocsCRM7.5.1\Eclipse321\plugins\com.amdocs.
                    uif.tools.designer_1.0.0\Java\bin\java.exe -
                    vmargs -XX:MaxPermSize=128m -Xms1024m -Xmx1024m
       2. Start Eclipse using the Desktop shortcut. ( 2, above ).
           Use the workspace C:\_work\workspace
       3. Check Eclipse version: Help > About.
           The about must indicate the following: “Eclipse 3.2.1”
       4. Make sure that you have the 5.0 JRE installed inside of Eclipse.
           a. Use the following to check this:
               Window > Preferences > Java > Installed JREs.
           b. If it is not installed, you will need to install it as follows:
               Add… > JRE Home Directory > Browse… to
               C:\AmdocsCRM7.5.1\Eclipse321\plugins\com.amdocs.uif
               .tools.designer_1.0.0\Java
           c. Make certain that the tick box for this JRE is ticked.
       5. Set the Eclipse option to Build Automatically, as follows:
           Project > Build Automatically
       6. Set the option for Package Explorer, as follows:
           Window > Show View > Package Explorer



                                    Information Security Level 2 - Sensitive
                                                                                          3
                        Proprietary and Confidential Information of Amdocs
                                   Amdocs Smart Client Framework Verion 7.5
                                            Chapter 1. Lab A – Project Setup


1.4.   Setup Eclipse Preferences
       1. Set up design-time login preferences, as follows:
           a. Go to Windows > Preferences to open the preference dialog




           b. Select Amdocs Designer in the left hand tree (1)
           c. In the ASCF Server field, type the URL to the UifServer (2):
              http://localhost:7001/crm.
               It's already there for you…




           d. Click OK to close Preferences dialog.



                                  Information Security Level 2 - Sensitive
                                                                             4
                      Proprietary and Confidential Information of Amdocs
                                    Amdocs Smart Client Framework Verion 7.5
                                             Chapter 1. Lab A – Project Setup


1.5.   Login to Server in Design Time
       1. Start the backend server by clicking the desktop icon
                                    .
          Wait until it is up and running.




       2. Select Amdocs > Login to bring up login dialog




       3. Enter the following :
           a. user name = sa
           b. password = sa
       4. Click Login.
           Note that “Logged in” appears in the title bar.

1.6.   Create a New Project and UIF Application
       Desktop
       To create a new ASCF project:
       1. Go to File > New > Project .
       2. Select Project under Amdocs Smart Client Designer




                                   Information Security Level 2 - Sensitive
                                                                              5
                       Proprietary and Confidential Information of Amdocs
                             Amdocs Smart Client Framework Verion 7.5
                                      Chapter 1. Lab A – Project Setup




3. Click Next.
4. Name the project UIFSamples.
5. Click Finish.


To create an application desktop:
1. Go to File > New > Other.




                            Information Security Level 2 - Sensitive
                                                                       6
                Proprietary and Confidential Information of Amdocs
                            Amdocs Smart Client Framework Verion 7.5
                                     Chapter 1. Lab A – Project Setup


2. Under Amdocs Smart Client Designer select Application
   Desktop.
3. Click Next.

4. Select the Source folder (use the             Button) .
   The Source folder should be your new project/forms.




5. Leave package field empty.
6. Set Name and Title as UIFSamples
7. Click Finish.
8. In the Outline, expand UIFSamples and select Menubar.




                           Information Security Level 2 - Sensitive
                                                                      7
               Proprietary and Confidential Information of Amdocs
                                   Amdocs Smart Client Framework Verion 7.5
                                            Chapter 1. Lab A – Project Setup


       9. In the Designer central pane ( the UIFSamples.uifad tab), right click
          on Menubar and select addMenu.




       10. In the property sheet, set name as BindingMenu and text as
           Binding Samples.




       11. Go to File > Save.



1.7.   Edit workspace.xml To Point to the New
       Application Desktop File and Login to CRM
       1. In the tree on the left, double click to open workspace.xml.
       2. Modify the section <Applications> and set the name attribute to
          UIFSamples.uifad




       3. Find the <Server /> tag and enter the following ( copy server details
          from C:\_work\ascf\900_ascf75_Labs.doc )
       <Server url="http://localhost:7001/crm" protocol="HTTP"
       loginFormName="com.amdocs.crm.common.desktop.Login"
       reloginFormName="com.amdocs.crm.common.desktop.ReloginPop
       up"/>




                                  Information Security Level 2 - Sensitive
                                                                                  8
                      Proprietary and Confidential Information of Amdocs
                              Amdocs Smart Client Framework Verion 7.5
                                       Chapter 1. Lab A – Project Setup

4. In order to enable the log Browser, add the following line to the
   workspace.xml right before the <Logging /> tag
    <ShowStackTrace>true</ShowStackTrace>




            At a later point the log browser will assist you in debugging your forms.


5. Go to File > Save.




                            Information Security Level 2 - Sensitive
                                                                                        9
                Proprietary and Confidential Information of Amdocs
                                   Amdocs Smart Client Framework Verion 7.5
                                            Chapter 1. Lab A – Project Setup


1.8.   Create a Runtime Configuration With Which
       to Launch the Application
       1. Right click UIFSamples project on the left side of the package and
          select RunAs > Run.




       2. In the Run dialog, right click Java Application and select New.




          a. Set the Name to: UIFSamples
          b. Notice that the project is already set to the project you have just
             created (UIFSamples)
          c. Specify Main Class as com.amdocs.uif.workspace.Main




                                  Information Security Level 2 - Sensitive
                                                                                   10
                      Proprietary and Confidential Information of Amdocs
                                    Amdocs Smart Client Framework Verion 7.5
                                             Chapter 1. Lab A – Project Setup




1.9.   Run the Application
       1. Click Run.
          Wait a few minutes.
       2. When prompted, login to CRM server:
          a. user = sa
          b. password = sa




                                   Information Security Level 2 - Sensitive
                                                                              11
                       Proprietary and Confidential Information of Amdocs
                                           Amdocs Smart Client Framework Verion 7.5
                                                    Chapter 1. Lab A – Project Setup



             3. See the application run with one (empty) menu.
             4. There! You’ve created a Smart Client application!!
                  It doesn’t do much yet; for now just close the application.

1.10.        Global Forms
             You can define global forms to hold global data shared throughout an
             application. Global forms are not displayed when instantiated and have no
             input parameters.
              A global form with a given name is loaded only once per application.
             In general, you can use a global form to share:
             ■ Arbitrary data.
             ■    Action definitions.
             You can access a global form by name by calling
             UifWorkspace.findForms.
             To access the global form data , you can call UifForm.getDataSet

        1.10.1.       Create a Global form
             1. Select File > New > Other.
             2. Under Amdocs Smart Client Designer select Base Form.
             3. Click Next.
                  The Source Folder should be UIFSamples/form.




             4. Name the package com.amdocs.UIFSamples

                                          Information Security Level 2 - Sensitive
                                                                                         12
                              Proprietary and Confidential Information of Amdocs
                                     Amdocs Smart Client Framework Verion 7.5
                                              Chapter 1. Lab A – Project Setup

     5. Name the form GlobalForm




     6. Click Finish.

1.10.2.        Register the Global Form with the Application
     1. Bring up UIFSamples.uifad in the designer.
     2. Add the newly created GlobalForm to GlobalForms by doing the
        following:
          a.   In the outline pane, right click GlobalForms and select New
               Form Reference.




          b. In the logicalFormName property, click in the value cell to bring up
             the form search window.
               i.   Select Search.

                                   Information Security Level 2 - Sensitive
                                                                               13
                       Proprietary and Confidential Information of Amdocs
                             Amdocs Smart Client Framework Verion 7.5
                                      Chapter 1. Lab A – Project Setup


        ii. Select GlobalForm.
        iii. Click OK.




3. Click Save.




4. Run the application.
Although it looks the same as before, the global form is needed to share data
and action definitions that will be used at a later time.




                            Information Security Level 2 - Sensitive
                                                                                14
                Proprietary and Confidential Information of Amdocs
2.     LAB B – FORMS
2.1.   Purpose
       In this lab you will create your first ASCF sample form. You will learn to:
       ■   Create a form
       ■   Add controls
       ■   Use simple actions
       Later on you will be adding bindings and other elements.
       Lab Scenario ( WHAT to do )     Use the ASCF Eclipse design tool in order to create
                                       your first SmartClient form
       Implementation Steps            You are going to create a new base form in which
       ( HOW to do it )                you will be adding different kinds of controls (for
                                       example label, text field, check box, etc.)

       This lab continues with Eclipse project UIFSamples previously
       created. When you’re done, it will look something like the following:




2.2.   Review of Forms
       A form is a user interface element that organizes the information that a
       user sees in an application.
       A form typically has the following components:
       ■   Controls
       ■   Layout
       ■   A data set
       ■   Actions
       ■   A data communication set
       ■   Application code


                                    Information Security Level 2 - Sensitive
                                                                                             15
                        Proprietary and Confidential Information of Amdocs
                                    Amdocs Smart Client Framework Verion 7.5
                                                     Chapter 2. Lab B – Forms

       ■   A version selection map
       ■   One or more resource bundle files
       You build a form using the Form Editor.

2.3.   Review of Controls
       Controls are graphic objects that represent properties or operations. Not
       all controls are the same; some
       ■   Display data which the user can edit (for example, text fields)
       ■   Perform actions (for example, buttons)
       ■   Are static with which the user cannot interact (for example, labels)
       You enter controls in the root panel of a form, or in a container.
       A container is a grouping of controls. You put containers in the root
       panel of a form and, in some cases, inside another container. The root
       panel itself is a special type of container found in every form.
       In the properties for a control or container, you specify metadata for
       binding, validation, actions, and other properties.

2.4.   Creating a Form
       1. Select File > New > Other.
       2. Under Amdocs Smart Client Designer, select Base Form
       3. Set the Source Folder as be UIFSamples/form.


                   For all subsequent labs, whenever you're asked to enter a Source
                   Folder, please specify that folder to be UIFSamples/form, unless told
                   otherwise.


       4. Provide a name for the package (e.g., com.amdocs.UIFSamples)
           TIP: you can select an existing package in the package explorer window,
           right click and select New > Other to create a form. The package
           name will be pre-populated in the wizard dialog.




                                   Information Security Level 2 - Sensitive
                                                                                       16
                       Proprietary and Confidential Information of Amdocs
                             Amdocs Smart Client Framework Verion 7.5
                                              Chapter 2. Lab B – Forms

5. Name the form BindingSampleForm




6. Click Finish.
7. In the form editor’s outline view, select the Form node in the Controls
   tab.
8. In the property sheet, set the title property as BindingSample
   Form.




TIP: To display an outline view that is hidden, click on the Outline bar
at the right hand side of the designer page.

9. Click root (1).
10. Click on Label in the palette. (2)


                            Information Security Level 2 - Sensitive
                                                                         17
                Proprietary and Confidential Information of Amdocs
                             Amdocs Smart Client Framework Verion 7.5
                                              Chapter 2. Lab B – Forms




11. Click on the cell (1,1) in the form to drop the label there.
    Change the text property in property sheet to be First Name.
    TIP: you can select the control in the layout view and press F2. This will
    allow you to change the title using in-place editing.
12. Select and drop a Text Field from the palette into the form next to
    First Name and change the name property to txtFirstName.

            When naming form elements, it is recommended to follow the general
            java standard, which is to start the name in lower case, for example:
            o    btnSave
            o    accountDM
            o    returnUserDCE
            o    billingEditLaunch


    a. Select and drop another Label from the palette into the form just
       below the First Name and change the text property to be Last
       Name.
    b. Select and drop another Text Field from the palette into the form
       next to Last Name and change the name property to
       txtLastName.
    c. Select and drop a Label from the palette into the form just below the
       Last Name and change the text property to be
       FirstName,LastName.
    d. Select and drop another Text Field from the palette into the form
       next to the label and change the name property to
       txtFirstLastName.
    e. Add a CheckBox named chkIsEmployee
       and set the text property as Is Employee
    f. Next to it add a TextField with the name property set to
       txtEmployeeID.
13. Save the form.



                            Information Security Level 2 - Sensitive
                                                                                    18
                Proprietary and Confidential Information of Amdocs
                            Amdocs Smart Client Framework Verion 7.5
                                             Chapter 2. Lab B – Forms




This form still does not do much. Soon, you will be adding Data Models ,
Bindings, Actions, etc, which will make the form more interesting.




                           Information Security Level 2 - Sensitive
                                                                           19
               Proprietary and Confidential Information of Amdocs
3.     LAB C- DATA MODELS AND
       BINDINGS
3.1.   Purpose
       In this lab you will learn how to create a new Data Model and how to
       manipulate the data by using property binding.
       Lab Scenario ( WHAT to do )     You will add a data model to the previous form, and
                                       bind controls to that data model fields
       Implementation Steps            You are going to create a new data model
       ( HOW to do it )                (contactDM) and then bind the different controls
                                       properties to that DM fields. We'll also learn how to
                                       use value maps and how to use virtual data models


3.2.   Review of Data Models
       Each form has a dataset that manages the data models in the form. Each data
       model contains a set of fields.
       There are two types of data models:
       ■ A singular data model that contains one field or row of data.
       ■   A tabular data model that contains one or more rows.
       You can use the following types of data sources:
       ■ Manual - the fields are defined on the client side, either statically at
          design time; or
           Dynamically at runtime; or
           Some combination of both
           A manual data source does not have to correspond to server-side data
       ■   Database.
       ■   Java value object
       A user interface control binds to a field in a data model. Data is transferred
       between a control and a data model, in both directions, automatically.

3.3.   Create a DM
       1. Click on the Data tab in the outline.
       2. Add a new Data Model by right clicking on Data Set .
           Select New
       3. Name the data model contactDM and add the fields as shown below.


                                    Information Security Level 2 - Sensitive
                                                                                           20
                        Proprietary and Confidential Information of Amdocs
                                    Amdocs Smart Client Framework Verion 7.5
                                    Chapter 3. Lab C- Data Models and Bindings




3.4.   Create Simple Bindings to First and Last
       Name Text Fields
       1. Select txtFirstName.
       2. In the property sheet add a binding for the property text.
           a. Right click the text property label.
           b. Select Add Property Binding.




       3. Expand the text property tree.



                                   Information Security Level 2 - Sensitive
                                                                              21
                       Proprietary and Confidential Information of Amdocs
                                   Amdocs Smart Client Framework Verion 7.5
                                   Chapter 3. Lab C- Data Models and Bindings


       4. In the dataModel property, click on the value cell to open up Path
          Builder .
       5. Double click contactDM and click OK.
       6. In the fieldName property, select fname .
       7. Select txtLastName.
       8. Create a binding for the text property and set the dataModel and
          fieldName properties to contactDM and lname, respectively.

3.5.   Use Trigger Fields to Bind Two DM Fields
       Into One Text Box
       1. For txtFirstLastName, create a binding for text property.
       2. Set dataModel and fieldName properties to contactDM and fname
       3. Add a trigger field for contactDM.lname.
          Adding a trigger field tells the form to notify this binding if the lname
          field also changes.
       4. Select the lookup in the Trigger Fields property.
          a.   For the Data Model text box, click on the browse button and
               select contactDM.
          b. In the Field dropdown, select lname.
          c. Select the Add button to add it to the grid.
          d. Select OK to close the dialog.
       5. Set the formatString property as {0},{1}
          This will format the data as FirstName,LastName.




3.6.   Bind the ‘chkIsEmployee’ Control
       1. Find the selected property for chkIsEmployee.



                                  Information Security Level 2 - Sensitive
                                                                                      22
                      Proprietary and Confidential Information of Amdocs
                                    Amdocs Smart Client Framework Verion 7.5
                                    Chapter 3. Lab C- Data Models and Bindings


       2. Add a binding to the selected property and set it to
           contactDM.isEmployee

3.7.   Bind ‘txtEmployeeID’ and Make It Visible
       Only if contactDM:isEmployee is True
       1. For txtEmployeeID, add binding for the text property.
           Set its binding to contactDM.employeeID.
       2. In order to hide this field in case the contact is not an employee, bind the
          visible property of txtEmployeeID to contactDM.isEmployee
       3. Save the form.

3.8.   Create Menu Item to Launch Form
       1. Bring up the previously created GlobalForm in the designer.
       2. Drop a LaunchAction on the Actions node in the outline.
       3. Set the Action name property to
          BindingSampleFormLaunchAction
       4. Select the logicalFormName property as
          com.amdocs.UIFSamples.BindingSampleForm
       5. Set the publishedName property to
          BindingSampleFormLaunchAction
       6. Save the Form.
       7. Bring up UIFSamples.uifad in the designer.
       8. In the outline pane, click Menubar.
       9. Add a menuItem named Binding Samples Form to the previously
          added menu BindingSamples.
           a. In the central pane, expand Menubar .
           b. Right click BindingSamples.
           c. Select AddMenuItem
       10. In the menuItem properties, set name and text to Binding
           Samples Form.
       11. Set the action property.
           a. Open the Action Selection dialog (click in the value cell of action
              property)(1).
           b.   Click Search to list all the forms.
           c. Select GobalForm.

                                   Information Security Level 2 - Sensitive
                                                                                     23
                       Proprietary and Confidential Information of Amdocs
                                          Amdocs Smart Client Framework Verion 7.5
                                          Chapter 3. Lab C- Data Models and Bindings


                  d. Select BindingSampleFormLaunchAction from the action list.
                  e. Click OK (2).




             12. Save the application.

3.9.         Run the Form
             1. Run the application and click on the menu to see the new form.
             2. Check and uncheck the IsEmployee check box.
                  The EmployeeID text field will be appear and disappear as the visible
                  property is bound to the same field.
             3. Change First Name and Last Name fields and see how the formatted
                text field changes the values.
             4. Close the application.

3.10.        Review of Value Map
             A value map lets you display one value in a control when another value is
             actually stored in the data model. You create value maps by creating a tabular
             data model with a field for the key (value as stored in the data model) and a
             field for the corresponding value that you want to display in the user
             interface.

        3.10.1.      Add UI to Demonstrate Value maps
             1. Add a Combo Box (just below the chkIsEmployee control) to the
                Binding Samples form, and set the name as cmbStatusList.



                                         Information Security Level 2 - Sensitive
                                                                                          24
                             Proprietary and Confidential Information of Amdocs
                                     Amdocs Smart Client Framework Verion 7.5
                                     Chapter 3. Lab C- Data Models and Bindings


     2. Add Text Field next to the combo box, and set the name as
        txtStatusText.

3.10.2.        Create Value Map TDM and Edit contactDM.
     1. Go to the Data Set and create a Data Model.
     2. Set:
          a.   type as Tabular (TDM)
          b. Source as Manual
          c. set name as statusValueMapTDM
     3. Add the two fields and data rows as show below.




              When you set the Externalize to true for the displayValue field, any
     values that you specify for this field will be externalized in to the properties file.


     4. Click OK.
     5. Select contactDM. In the property sheet.
     6. Click the lookup button in the value cell for the fields property to edit
        the data model’s field definitions.



                                   Information Security Level 2 - Sensitive
                                                                                              25
                       Proprietary and Confidential Information of Amdocs
                                   Amdocs Smart Client Framework Verion 7.5
                                   Chapter 3. Lab C- Data Models and Bindings




     7. Add a new Integer field called status.

3.10.3.       Bind the TDM to cmbStatusList.
     1. In the combo box, set the listTDM property to statusValueMapTDM.
     2. Set the displayFieldName property to displayValue.
     3. Set the valueFieldName property to id.
     4. Create a property binding for the selectedValue property.
     5. Set the dataModel and fieldName properties to contactDM and
        status.
          This will save the selected value of the combo box into the status field
          of the contactDM

3.10.4.       Bind the contactDM’s Status Field to
              txtStatusText.
     Here, we want to display the displayValue field of the value map instead of
     the id field in the text box.
     1. Create a property binding for the text property of txtStatusText.
     2. Set dataModel and fieldName properties to contactDM and status.
     3. Set valueMapTDM property to statusValueMapTDM.
     4. Set valueMapKeyFieldName property to id.

                                  Information Security Level 2 - Sensitive
                                                                                     26
                      Proprietary and Confidential Information of Amdocs
                                          Amdocs Smart Client Framework Verion 7.5
                                          Chapter 3. Lab C- Data Models and Bindings


             5. Set valueMapValueFieldName property to displayValue.




             6. Save the form.

        3.10.5.      Run the Form
             1. When you select a dropdown item, the text box text is changed.
             2. Changing the test in the text box will affect the value in the combo box.
                  Enter in the text Active or Inactive.
                  The combo box changes accordingly.




3.11.        Review of Virtual Data Models
             Many applications use dependent forms, such as a sub form on a tab or a child
             form, by clicking a button in its parent. Rather than declaring the same data
             model over and over in each form, virtual data models let you share data
             between a parent and its children.
             Changes to data in a virtual data model are reflected in referenced data model
             and vice versa. Data change events happen in both child and parent forms.
             A virtual data model has a name to which you can refer in application code.



                                         Information Security Level 2 - Sensitive
                                                                                            27
                             Proprietary and Confidential Information of Amdocs
                                  Amdocs Smart Client Framework Verion 7.5
                                  Chapter 3. Lab C- Data Models and Bindings

     The referenced data model path in a virtual data model can explicit or it can
     be implicit, where it is matched to the same type of data model in the
     containing form.

3.11.1.       Move Value Map TDM to a Global Form and
              Create a Virtual TDM
     1. Select statusValueMapTDM in the Data Set.
          Right click and select Copy.
     2. Go to the GlobalForm.
     3. Select the Data tab.
     4. Select the Data Set node.
          Right click and select Paste.
          This will create a copy of statusValueMapTDM. In the property sheet,
          remove “CopyOf_” by renaming the TDM.
     5. Save the GlobalForm.
     6. Return to the Binding Samples Form.
     7. In the Dataset, delete statusValueMapTDM.
     8. Create a new data model set name to statusValueMapVTDM.
     9. Check Virtual Data Model checkbox and click on […] button to
        invoke Path Builder.
     10. In Path Builder, select the TDM (statusValueMapTDM) defined in the
         global form by selecting $WorkspaceForm, then […] button and select
         GlobalForm.




                                 Information Security Level 2 - Sensitive
                                                                                     28
                     Proprietary and Confidential Information of Amdocs
                                  Amdocs Smart Client Framework Verion 7.5
                                  Chapter 3. Lab C- Data Models and Bindings




     11. Set the data model’s Type to Tabular and the Source to Manual.
          This is an important step that allows the Designer knows what type of
          data model this is.

3.11.2.       Rebind to the Virtual Data Model
     1. In cmbStatusList, change the listTDM property to point to
        statusValueMapVTDM.
          You do not need to change the properties displayFieldName and
          valueFieldName since the field names have not changed.
     2. In txtStatusText, change the text property binding so
        valueMapTDM points to statusValueMapVTDM.
          You do not need to change the properties valueMapKeyFieldName and
          valueMapValueFieldName since the field names have not changed.
         If the design tool does not let you choose the TDM, enter it manually.
     Notice when you click on the dropdown for the property
     valueMapValueFieldName, it shows no values. This is because the design
     tool does not read the fields from the data model in the GlobalForm. If this
     virtual TDM pointed to a database table, then you would see the list of fields.
     Leave the existing displayValue as is.

3.11.3.       Run the Form
     1. You will see the functionality has not changed.




                                 Information Security Level 2 - Sensitive
                                                                                   29
                     Proprietary and Confidential Information of Amdocs
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 4. Lab D – Card Panes




4.                 LAB D – CARD PANES
4.1.               Purpose
                   In this lab you will learn how to use a card pane and value maps in order to determine
                   which card is going to be shown in run-time.
                   Lab Scenario ( WHAT to do )    You will derive a new form from the Binding
                                                  Sample Form and add to it a new card pane. Then
                                                  you will use value maps in order to determine which
                                                  card is going to be shown in run time
                   Implementation Steps           Derive from the Binding Sample Form and add two
                   ( HOW to do it )               controls (combo box and card pane with different
                                                  cards) to the derived form.
                                                  Create a new data model (cardTDM) which will be
                                                  used for the value maps.
                                                  Since both the selectedValue of the combo box and
                                                  the selectedCard of the card pane are going to be
                                                  bound to the same data model field, the value in the
                                                  combo box will determine which card will be shown
                                                  at runtime


4.2.               Review of Card Pane
                   This container is a collection of controls that are stacked on top of each other with
                   only one control visible, or active, at a time. Each control is treated as a card in a
                   stack.
                   This container is used for flexible data fields. Bind the flexible data field to the
                   selectedCard property.
                   A card pane can contain a panel (upon which you can drop multiple controls) or
                   another card pane.

         4.2.1.            Create New Card Pane Sample Form
                   1. Bring up BindingSampleForm in the designer.
                   2. Click on the Derive Form icon on the Eclipse toolbar.


                   3. Name the form CardPaneSampleForm.
                   4. In the property sheet of the Form object, set the title property to:
                        Card Pane Sample Form.

         4.2.2.            Add UI to Demonstrate the Use of Value mMaps
                           with Card Pane
                   Here, you will add a combo box that will enable the user to choose which card to
                   show in run-time.


ASCF v7.5 Labs – v0.9                                                                            Page 30 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 4. Lab D – Card Panes


                   1. Add a Combo Box to the form.
                   2. Set name to cmbCardOptions.
                      The design tool will display a message that this will override the layout
                      inheritance. Click OK.
                   3. Add a Card Pane (from the Palette, under Containers) next to the combo
                      box and set name to CardPanel.




                   4. Add four cards to the card pane.
                        To do this, choose the appropriate control in the palette and drop it under the
                        Card Pane in the outline:
                        a. Add Label control and set name to CardLabelEmpty.
                           Set the text property of the label to be without value (empty).
                        b. Add Label control and set name to CardLabel.
                           Set the text property of the label to be your first name (e.g. Zahi).
                        c. Add Text control and set name to CardText.
                           Set the text property of the Text control to be your last name (e.g. 'Gigi').
                        d. Add Button control and set name to CardButton.
                           Set the text property of the Text control to be button.




ASCF v7.5 Labs – v0.9                                                                          Page 31 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 4. Lab D – Card Panes




         4.2.3.             Create Value Map TDM and Edit contactDM.
                   1. Go to the Data Set and create a new manual TDM and set name to cardTDM.
                        Note the three fields and data rows as shown below.




                   2. Add the fields and rows shown above.
                   3. Click OK
                   4. Select contactDM.
                        In the property sheet, select the lookup for the fields property.
                   5. Add a new Integer field called cardNumber and set 0 (zero) as the default
                      value.


ASCF v7.5 Labs – v0.9                                                                       Page 32 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 4. Lab D – Card Panes


         4.2.4.            Bind the TDM to cmbStatusList.
                   1. In the cmbCardOptions combo box and set the listTDM property to
                        cardTDM
                   2. Set the displayFieldName property to displayValue
                   3. Set the valueFieldName property to id
                   4. Create a property binding for the selectedValue property.
                   5. Set the dataModel and fieldName properties to contactDM and
                      cardNumber.
                        This will save the selected value of the combo box into the cardNumber field
                        of contactDM.

         4.2.5.            Make the Selected Value in the cmbCardOptions
                           Combo Box Change Which Card Will Be Displayed
                   1. Create a property binding for the selectedCard property of CardPane1.
                   2. Set dataModel and fieldName properties to contactDM and cardNumber.
                   3. Set valueMapTDM property to cardTDM.
                   4. Set valueMapKeyFieldName property to id.
                   5. Set valueMapValueFieldName property to cardName.




                   6. Save the form.




ASCF v7.5 Labs – v0.9                                                                     Page 33 of 115
                                                    Amdocs Smart Client Framework Verion 7.5
                                                               Chapter 4. Lab D – Card Panes


         4.2.6.            Add Launch Action to Launch Validation Form
                   1. Bring up the previously created GlobalForm in the designer.
                   2. Drop a LaunchAction on the Actions node in the outline.
                   3. Set name to CardSampleFormLaunchAction and set the
                      logicalFormName property to
                      com.amdocs.uifsamples.CardPaneSampleForm .
                   4. Set the publishedName property as CardSampleFormLaunchAction .
                   5. Save the Form.

         4.2.7.            Add Menu Item to Launch the CardPane Sample Form
                   1. Bring up UIFSamples.uifad in the designer.
                   2. Select BindingSamples menu.
                   3. Add a Menu Item and set both name and text to Card Sample Form.
                   4. Set the action property to CardSampleFormLaunchAction from the
                        GlobalForm.
                   5. Save the application.

         4.2.8.            Run Application
                   1. Run the application.
                   2. Click on the menu to see the new form.
                   3. You will see that the selected option in the cmbCardOptions combo box
                      affects the shown card.




ASCF v7.5 Labs – v0.9                                                                 Page 34 of 115
5.              LAB E – VALIDATIONS
5.1.            Purpose
                In this lab you will learn how to add validation statements to an action
                Lab Scenario ( WHAT to do )    You will derive from the bindingSample form and
                                               add validations conditions to its launching action
                Implementation Steps           Create a Validation form with a Launch Binding
                ( HOW to do it )               Sample button that invokes a Launch Action to
                                               launch the previous BindingSampleForm.
                                               The launch action has validation info to which you
                                               will add some validation statements.
                                               The launch action will launch its target form only if
                                               all the validation statements evaluate to true.


5.2.            Review of Action- Level Validation
                Action-level validation, which is performed before any Action, provides the ability to
                perform cross-control validation, such as when both a first name and a last name
                must be provided. Action-level validation, however, is not limited to cross-control
                validation; it can also be used for single-control validation.
                You specify action-level validation through statements in the validation Statement
                sub-property of the validationInfo property of actions:
                ■   You may specify one or more statements per Action.
                ■   The statements evaluate to true or false, such as employee_dm:badge_number >
                    0.

       5.2.1.           Create a Validation Sample Form
                1. Bring up the BindingSampleForm in the designer.
                2. Click on the Derive Form icon on the Eclipse toolbar.


                3. Set name to ValidationSampleForm.
                4. In the property sheet of the Form object,
                   set the title property to Validation Sample Form

       5.2.2.           Create Action with Validation Statements
                1. Drop a LaunchAction into the Actions node.
                2. Set the name of the LaunchAction to LaunchBindingForm.
                3. Choose BindingSampleForm as the logical form name.




                                            Information Security Level 2 - Sensitive
                                                                                                    35
                                Proprietary and Confidential Information of Amdocs
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 5. Lab E – Validations


                   4. In the LaunchAction, expand ValidationInfo and add validation statements as
                      shown below:




                   5. Drop a button and set the text to Launch Binding Sample.
                        Confirm by pressing OK that the layout inheritance can be overridden.
                   6. In the button’s action property, select the name of the Action that you just
                      dropped.
                   7. Save the form.


         5.2.3.             Add Launch Action to Launch Validation Form
                   1. Bring up the previously created GlobalForm in the designer.
                   2. Drop a LaunchAction on the Actions node in the outline, set name to
                      ValidationSampleFormLaunchAction.
                   3. Set the logicalFormName property to
                        com.amdocs.uifsamples.ValidationSampleForm
                   4. Set publishedName property to
                      ValidationSampleFormLaunchAction
                   5. Save the Form.

                   5.2.3.1.         Add Menu Item to Launch Validation Form
                   1. Bring up UIFSamples.uifad in the designer.
                   2. Add a Menu and set name and text to Validation Samples.
                   3. Add a Menu Item, set name to Validation Sample Form and set the
                      action property as ValidationSampleFormLaunchAction from the
                        GlobalForm
                   4. Save application.


ASCF v7.5 Labs – v0.9                                                                       Page 36 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 5. Lab E – Validations


         5.2.4.             Run application
                   1. Run the application.
                   2. Click on the menu to see the new form.
                   3. You will see that First Name field is yellow because of the required validation
                      for that field.
                   4. Click on the "Launch Binding Sample" Button, and you will see that it launches
                      the Binding Sample Form.
                        The reason for that is that ASCF 7.5 validation does not apply to hidden fields
                        (because how is a customer supposed to fix them if they cannot see them, right?)
                   5. Check IsEmployee and then click on the Launch Binding Form button.
                        You will see a validation error pop up saying that the EmployeeID is too large.




                   1. Change EmployeeID to 100 and click on the button again.
                        Since there are no errors this time, it will post BindingSampleForm
                   2. Now we want to improve the validation error message (we don't want the user to
                      see " txtEmployeeID " in the message).
                        a. Return to the Validation form in the designer, and click on the
                           txtEmployeeID text field.
                        b. Change the displayName property to "Employee ID".
                        c. Click on the "First Name" Label and set its labelFor property to
                           "txtFirstName".




ASCF v7.5 Labs – v0.9                                                                         Page 37 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 5. Lab E – Validations


                   3. Run the application again and open the validation form.
                   4. Delete the value from the First Name text field (leave it empty)
                   5. Check IsEmployee and then click on the Launch Binding Form button. You
                      will see a validation error pop-up.
                        The message is not much clearer for the user.




ASCF v7.5 Labs – v0.9                                                                    Page 38 of 115
6.     LAB F – DATA COMMUNICATIONS
6.1.   Purpose
       In this lab you will learn to create sample forms that communicate data among them
       and will create a DCE Sample Form to copy the data from the launched form when
       the form is closed.
       Lab Scenario ( WHAT to do )    You will create DCESampleForm.
                                      This form will launch the previous
                                      BindingSampleForm.
                                      When you close the launched form, all the ( possibly
                                      changed ) data will be copied from Bindingsample
                                      form back to DCESampleForm
       Implementation Steps           Create a new DCE in DCESampleForm.
       ( HOW to do it )               This DCE will copy the data in contactDM from the
                                      open Bindingsample form to DCESampleForm
                                      (“self”).
                                      The trigger event that invokes the copy is the
                                      preclose event on Bindingsample (the “opened”
                                      form)


6.2.   Review of DCE
       You use a data communication set to specify how to transfer data between forms.
       There is one data communication set per form and it contains and manages one or
       more data communications elements.
       You specify the data transfer by defining metadata at design time. You transfer from
       a source data model to a target data model upon a trigger event. The data is copied by
       value.
       You can transfer at the object-level and at the field-level.
       DCE
       A data communication element (DCE) can be defined in the source or target. The
       source and target can be a singular data model or a tabular data model. A data
       communication element contains one or more data communication items (DCIs).
       The sourceFormLocation and targetFormLocation properties specify the logical
       relationship to the current form:
       ■   PARENT, OPENER, OPENED, SELECTED, SELF, SPECIFIED
       ■   SPECIFIED: form name property contains logical form name
       ■   OPENED: associated with a Launch action
       The properties triggerEvent, triggerEventLocation, and triggerSource, together,
       defines the trigger event of when to copy the data. For the triggerSource property,
       you must enter a data path
       You can set the enabled property to false to disable the data transfer specified by the
       DCE (data communications element).

                                   Information Security Level 2 - Sensitive
                                                                                        39
                       Proprietary and Confidential Information of Amdocs
                                                       Amdocs Smart Client Framework Verion 7.5
                                                         Chapter 6. Lab F – Data Communications

                   DCI
                   A data communication item describes a mapping from the source to the target. The
                   source can be a static value.
                   You can set up multiple data communications items for the same event.
                   You can only set up simple field mappings. You cannot use expressions and you
                   cannot combine fields.

         6.2.1.             Create New DCE Form
                   1. Bring up BindingSampleForm in the designer.
                   2. Click on Derive Form icon on the Eclipse toolbar.
                   3. Set name to DCESampleForm and title to DCE Sample Form
                   4. Drop a LaunchAction into Actions node and set logcial form name to
                      BindingSampleForm.
                   5. Drop a button and set text to Launch Binding Sample.
                   6. Set the button’s action property to the previously created launch action.




         6.2.2.          Create a DCE
                   1. Select Data tab in the Outline
                   2. Right click on Data Communication Set and select Add Element
                   3. Set the launchAction property as the Launch Action associated with the button
                      you just added.
                        Since there could be multiple launch actions in a form, the keyword ‘OPENED’
                        needs a LaunchAction to resolve the form.
                   4. Select OPENED for the sourceFormLocation property.
                        This defines where the data needs to be copied from, in this case from the opened
                        form.



ASCF v7.5 Labs – v0.9                                                                        Page 40 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                          Chapter 6. Lab F – Data Communications


                   5. Select SELF for the targetFormLocation property.
                        This defines where the data needs to be copied to, in this case it is the same form
                        where DCE is defined.
                   6. Select SOURCE for triggerEventLocation property.
                        This tells where the event is happening on the source form.
                   7. Select $Form for triggerSource property.
                        We are handling a Form event.
                   8. Type in preClose for the triggerEvent property.
                        Tells when – this will copy the data when the launched form closes.

         6.2.3.             Create a DCI
                   1. Right click on the DCE and select Add an item .
                   2. Select the Item.
                   3. Type in contactDM for the sourceDMPath property.
                        This will copy the entire DM.


                                 Sometimes the design tool does supply metadata; in such cases you can enter
                                the data manually.

                   4. Select contactDM for the targetDMPath property.
                        You could have left the targetDMPath empty and then it would try find a DM
                        in target form with the same name.
                   5. Save the form.

         6.2.4.             Add New DCE Launch Action to Global Form
                   1. Bring up the previously created GlobalForm in the designer.
                   2. Drop a LaunchAction on the Actions node in the outline.
                   3. Set name to DCESampleFormLaunchAction and the logicalFormName
                      property as com.amdocs.uifsamples.DCESampleForm
                   4. Set the publishedName as DCESampleFormLaunchAction
                   5. Save the Form.

         6.2.5.             Add Menu Item in Application
                   1. Bring up UIFSamples.uifad in the designer.
                   2. Add a Menu and set name to DCE Samples
                   3. Add a Menu Item.
                   4. Set name to DCE Sample Form and the action property to
                      DCESampleFormLaunchAction from the GlobalForm
                   5. Save application



ASCF v7.5 Labs – v0.9                                                                            Page 41 of 115
                                                    Amdocs Smart Client Framework Verion 7.5
                                                      Chapter 6. Lab F – Data Communications


         6.2.6.           Run Application
                   1. Run the application.
                   2. Click on the menu to see the new form.
                   3. Click on the Launch Binding Form button and change first name and last
                      name text fields in the launched form, and close the launched form.
                   4. The parent form’s first name and last name fields will be updated.




ASCF v7.5 Labs – v0.9                                                                  Page 42 of 115
7.             LAB G – ACTIONS
7.1.           Purpose
               This lab demonstrates the use of different kinds of Actions and the ASCF simulator
       Lab Scenario ( WHAT to do )                           Create a Contact Details form which will
                                                             includet two tabs: Site Details & Address
                                                             Details.
                                                             You will use Actions to get data to populate the form.
                                                             Note: In this lab you use a simulator, instead of the
                                                             real CRM/Ordering backend
       Implementation Steps                                  Create Contact Details form, with two tabs Site
       ( HOW to do it )                                      Details and Address Details.
                                                             Add controls to the main form and to the Site Details
                                                             tab. Use Actions to get data from the simulator to
                                                             populate fields. Add menu item to Application
                                                             Desktop to launch the new form and test this part
                                                             first.
                                                             Create Address Details sub-form, with controls and
                                                             Actions. The completed form will something like
                                                             this:




7.2.                Review of Actions
               An Action performs an operation. The behavior of an Action is defined by its type
               and by the metadata that you set at design time.
               You create an instance of an Action by dropping it onto the Actions section of the
               Controls tab and then setting its properties.



                                           Information Security Level 2 - Sensitive
                                                                                                 43
                               Proprietary and Confidential Information of Amdocs
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions

                   You can then refer to these Actions in the action property of action controls (such as
                   Button, Hyperlink, Combo Box, etc.)
                   You can also refer to actions in a menu item or a toolbar item in an application
                   desktop.

7.3.               Review of ASCF Backend Simulator
                   With the ASCF backend simulator, you can run ASCF applications without
                   connecting to a server application and without running a Web server (see the ASCF
                   Programmers Guide for details).
                   For this lab, the simulator data is already configured. You only need to changes
                   several parameters so that your application can access it.

7.4.               Action Lab Detailed Instructions
         7.4.1.              Create “Contact Details” Form
                   1. Select File > New > Other > Amdocs Smart Client Designer > Base
                        Form
                   2. Set the following:
                        a.   Source Folder = UIFSamples/form
                        b. package = com.amdocs.ActionForms
                        c. name = "ContactDetailsForm"
                   3. In the Outline, under Form select root.
                   4. Click on the Palette.
                   5. Select the required Label and Text controls as shown in the top portion of
                      image above (you can also see the design time definitions below…) and drop
                      them in the appropriate cells.
                   6. Extend the width/height of the cells by highlighting and dragging the column/row
                      header outside the Form layout.
                   7. Provide the name and title property for all the controls.
                   8. Create two tabs:
                        a. One as Site Details (with name siteTab)
                        b. The other as Address Details (with name addressTab)
                   9. From the Containers Palette, select Tabbed Pane and drop it on the first
                      cell in the required row.
                   10. Extend the height of that cell by highlighting and dragging the row header
                       outside the Form layout.
                   11. Extract the cell constraints property and change the grid width to 2.




ASCF v7.5 Labs – v0.9                                                                          Page 44 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                       Chapter 7. Lab G – Actions




                   12. From the Controls Palette, select Tab Page and in the Outline drop it on the
                       Tabbed Pane.
                        The tab page will now be displayed and you can set its name and title
                        properties.
                   13. Drag and drop (again, in the Outline) the appropriate controls on to the first tab.
                   14. Add the second Tab and set its name and title properties.
                   15. Make sure you have two tabs.
                        a. Leave the address tab empty for now.
                        b. Use the hierarchical Controls tree in the Outline to work with tab pages.
                        c. Clicking on the tab in the form layout will not select the tab with its content.




ASCF v7.5 Labs – v0.9                                                                          Page 45 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                     Chapter 7. Lab G – Actions


         7.4.2.             Create Data Models
                   1. Click on the Data tab in the Outline and create two singular data models –
                      contactDM and siteDM:
                   2. Create contactDM fields manually, as shown below:




                        Be sure to set contact_id.Default Value = c1. This value will be used later
                        as a request parameter for the submit request to the server.
                   3. Create siteDM fields with two string fields: site_id and sitename




                   4. Bind all the form text fields’ text property with the appropriate DMs fields.




ASCF v7.5 Labs – v0.9                                                                       Page 46 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions



7.5.               Review of Submit Action
                   This Action sends a request to the server:
                   ■    Data is mapped between the form’s data models and the operation’s input and
                        outputs.
                   ■    The form is updated with the response data.
                   The backendId property is the backend system that executes the operation. You
                   must set the backendId before you can select the operationName and
                   operationType.
                   The requestDataMap property specifies input to the operation and the
                   responseDataMap specifies output from the operation. As you might guess, you
                   need to specify the operationName before you can set upthe requestDataMap
                   and responseDataMap properties.

         7.5.1.             Create Actions
                   Be sure to use the given operation parameter details exactly as they are spelled here.
                   They must match the data preconfigured in the simulator XML file provided for the
                   lab. Later in the lab, you will specify the config file and other XML files as part of
                   the run configuration, as the VM arguments details. Currently just type manually the
                   following submit action parameters.
                   1. Create a SubmitAction and drop it on Actions list.
                      It will fetch contact and site data.
                   2. Specify the following properties (type them manually):
                        a. name = ContactLoadAction
                        b. backendId = testapp.uif.backend
                        c. operationType = XBean
                        d. operationName = ContactLoadXB
                   3. Click on requestDataMap and create a new row as shown below:




                        The simulator-supplied service is expecting contact_id from the request as
                        input to select which contact data to return. Therefore, the DM default value c1.
                        If this form were later to be integrated with some listing form, the value of

ASCF v7.5 Labs – v0.9                                                                         Page 47 of 115
                                                          Amdocs Smart Client Framework Verion 7.5
                                                                         Chapter 7. Lab G – Actions


                        contact_id would probably come as dynamic data from that form, not as a DM
                        default value.
                   4. Click on responseDataMap and create two new rows as shown below:




7.6.               Review of Subscribing Action
                   A Subscribing Action can delegate its functionality to another action (a target
                   action). The delegation can change at runtime. A subscribing action can connect to or
                   disconnect from its target. One or more Subscribing Actions can delegate to the same
                   action (such as both a menu item and its corresponding toolbar button).
                   A Subscribing Action has only one unique property: targetAction. A Subscribing
                   Action subscribes to the enable and visible property of its targetAction.
                   You can set up chained Subscribing Actions where one action point to another which
                   points to another and so on.
                   A Null Action is a Subscribing Action with an empty targetAction. Such an Action
                   has the standard events (*_action, *_actionStart, *_actionDone, and
                   *_actionFailed). The event handlers completely define the behavior.

         7.6.1.             Create a Subscribing Action (With the Name
                            LoginAction)
                   This Action will invoke LoginAction_actionStart() to login to the backend
                   simulator. The Subscribing Action will have an null targetAction ( leave it empty)
                   with a actionStart event handler.


                                Normally, login would be needed as you login to the application and not when
                                you launch a form. This is just for the lab exercise to demonstrate Subscribing
                                Action.

                   1. Go to Events tab and click on the actionStart event. This will create a handler
                      and open the Application Code Editor ( see tab along the bottom).
                   2. Enter (or copy the code from C:\_work\ascf\900_ascf75_Labs.doc)
                      the event handler code below.
                      At runtime, this will login to the InProc processes, where the server simulator
                      runs locally. Also Add the following import line :
                   import com.amdocs.uif.client.connection.RequestResponseMgr;


                               public void
                   LoginAction_actionStart(UifCancellableActionEvent event){
                                    int nProtocol = RequestResponseMgr.INPROC ;
                   String strURL = "rmi://localhost/UifRMIServer";


ASCF v7.5 Labs – v0.9                                                                               Page 48 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions



                                  try {
                                RequestResponseMgr.initialize( nProtocol, strURL);
                                getWorkspace().login("root", "Root00", null);
                                          }
                                          catch (Throwable ex) {
                                                    System.out.println("ERROR: " +
                   ex.getCause());
                        }
                   }



7.7.               Review of Sequence action
                   This action executes multiple actions one after another. The next action is executed
                   only if the previous one was successful and the application code does not cancel any
                   further execution of the sequence. If an action fails, the sequence action stops but it
                   can be resumed by setting the exception to null in the application code.
                   The application code can add to or change the sequence of actions in the sequence
                   action’s *_actionStart event handler or before the action starts its execution.
                   An example of using a sequence action is a main form that makes a sequence action
                   its initial load Action. If a subform depends on data in the main form, this sequence
                   action can contain a Submit Action (to get the main form’s data) followed by a
                   Launch Action (to launch the subform).

         7.7.1.                Create a Sequence Action
                   1. Set properties as follows:
                            a. Name = SeqLoadAction
                            b. Actions = LoginAction, ContactLoadAction             in this exact sequence
                   2. In Form properties set initialLoadAction = SeqLoadAction




ASCF v7.5 Labs – v0.9                                                                         Page 49 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                     Chapter 7. Lab G – Actions




         7.7.2.            Setup Menu Item to Launch Contact Details Form
                   1. Define a Launch Action to launch Contact Details, as follows:
                        a. Open GlobalForm
                        b. Add a launch action with properties as follows:
                           i.   Name = LaunchContactDetails
                           ii. PublishedName = LaunchContactDetails
                           iii. Logical form name = Contact Details
                   2. Create Menu and Menu Item to invoke the form:
                        a. Bring up UIFSamples.uifad in the designer.
                        b. Create a new Menu
                        c. Set name and text = Actions
                        d. Add a Menu Item , set name and text = Action Form
                        e. Set the action property to LaunchContactDetails from the
                           GlobalForm
                   3. Save application.

         7.7.3.            Configure the Simulator and Execute the
                           Application
                   1. Replace the server tag in workspace.xml. with an empty one (i.e., <Server
                      />, or just enter the server tag as a remark ).
                        This tells ASCF runtime not to contact the real CRM backend (see below).



ASCF v7.5 Labs – v0.9                                                                      Page 50 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions




                   2. Save the workspace.xml file.
                   3. Click eclipse menu Project > Properties > Java Build Path > Libraries.
                   4. If weblogic.jar is not already present, add it to the Java Build Path Libraries Tab:
                      click Add External JARs > Browse to C:\bea\weblogic92\server\lib) and add
                      weblogic.jar.
                   5. Update the VM arguments in Eclipse run configuration. To open the
                      configuration, click Run > Run…




                   6. Add VM arguments as specified below to your run configuration.
                      A better approach would be to copy them from
                      C:\_work\ascf\ActionLab\readme_sim_param.txt

                        -
                        Dcom.amdocs.uif.server.UifConfigReader=com.amdocs.uif.serve
                        r.UifConfigFileReader
                        -
                        Damdocs.config.path=C:\_work\ascf\ActionLab\config\root.con
                        f
                        -
                        DSimulatorConfig=C:\_work\ascf\ActionLab\UifBackendSimulati
                        onDefinition.xml
                        -Damdocs.uams.config.resource=res/gen/file
                        -Damdocs.system.home=C:\_work\ascf\ActionLab\asm_home



ASCF v7.5 Labs – v0.9                                                                         Page 51 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                       Chapter 7. Lab G – Actions




                        The simulator is preconfigured for this lab -- notes for future reference:
                        a. The config file should have an entry for the backend id specified in the
                           submit action in the form
                        b. UifBackendSimulationDefinition.xml should have the simulator xml
                           definition that defines the data to be fetched by the service request.
                      c. asm_home is a server directory with uams properties file. Make sure it is
                         available locally.
                   7. The following should be the result:




ASCF v7.5 Labs – v0.9                                                                           Page 52 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                     Chapter 7. Lab G – Actions


         7.7.4.            Create Address Details Form
                   This form, shown below, gets posted as a sub-form in the tab.




                   1. Create the Address Details form with UI controls as shown above.

                   2. Create three Data Models:
                        a. siteDM (Singular, Manual) – receives site_id input from the launching
                           form, enabling the address for this site to be fetched from server.
                           Add the same fields to the DM, with datatype java.lang.String,
                           as in the ContactDetails form.
                           i.   site_id
                           ii. sitename
                        b. addressDM (Singular, Manual) – output from the service populates form.
                           Add the following fields to the DM, with datatype java.lang.String:
                           i.   address
                           ii. city
                           iii. state
                        c. stateTDM (Tabular, Manual) – to populate the list of states in the combo
                           box.
                           Add the following two java.lang.String fields to the DM:
                           i.   id
                           ii. title



ASCF v7.5 Labs – v0.9                                                                     Page 53 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions


                   3. Create bindings for all the text controls (address and city text fields).
                        a. address.text.dataModel = addressDM.address
                        b. city.text.dataModel = addressDM.city
                   4. Create bindings and set other properties for the state combo box, as follows:
                        a. listTDM = stateTDM
                        b. displayFieldName = title
                        c. valueFieldName = id
                        Create binding for selectedValue property
                        a. dataModel = addressDM
                        b. fieldname = state
                           This makes sure that, when the list is populated with all the states, the current
                           value selected in the list is based on the value of state field in addressDM,
                           rather than the value of id field in the stateTDM.
                   5. Create Actions:
                        a. Add a Submit Action – name = addressLoad
                           i.   backendId = testapp.uif.backend
                           ii. operationType = XBean
                           iii. operationName = AddressLoadXB
                           iv. requestDataMap =
                                •   source = siteDM
                                •   field = site_id
                                •   target (service input parameter) = site_id
                           v. responseDataMap =
                                •   source (service output parameter) = Address
                                •   target = addressDM




ASCF v7.5 Labs – v0.9                                                                          Page 54 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions


                        b. Add a Submit Action – name = stateListLoad
                           i.   backendId = testapp.uif.backend
                           ii. operationType = XBean
                           iii. operationName = StateListLoadXB
                           iv. requestDataMap = NONE (leave blank).
                           v. responseDataMap =
                                •   source (service output) = States
                                •   target = stateTDM
                           vi. cacheable = true
                                Normally such choice list requests can be cached, as the data will not
                                change frequently.




                           The above service names, inputs, outputs, etc should match those in
                           UifBackendSimulationDefinition.xml, so make sure you entered them
                           correctly.




ASCF v7.5 Labs – v0.9                                                                         Page 55 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                      Chapter 7. Lab G – Actions



7.8.               Review of Bulk Action
                   This Action submits multiple requests to the server in a single round trip.
                   1. Add a Bulk Action – name = InitBulkAddresStateLoad
                        a. Actions – addressLoad, stateListLoad
                           Select these values from dialog (the order does not matter).




                   2. Set Address Details.Form.InitialLoadAction =
                        InitBulkAddresStateLoad




ASCF v7.5 Labs – v0.9                                                                            Page 56 of 115
                                                          Amdocs Smart Client Framework Verion 7.5
                                                                         Chapter 7. Lab G – Actions


         7.8.1.             Create Launch Action in Contact Details Form to Post
                            Address Details Subform


                   1. Re-open the ContactDetails form.
                   2. Create LaunchAction – name = LaunchAddressDetailsTab
                   3. Set autoLaunchOnInitialShow = true.
                        The autoLaunchOnInitialShow property tells ASCF to automatically launch
                        the subform when targetPanel is shown for first time.
                        It is used for sub-forms that are initially hidden, as it is here.
                   4. Set the LaunchDataMap as follows:
                        a. source = siteDM
                        b. target = siteDM
                   5. Set logicalFormName = AddressDetails
                   6. Set targetPanel = AddressTab (name of the tab from where to launch the
                      subform).


                                If the drop down list does not display the tab panes, please enter this manually.

         7.8.2.             Run the Application
                   Launch the Contact Details form and click on the tab to show the Address
                   Details form.




ASCF v7.5 Labs – v0.9                                                                                Page 57 of 115
8.     LAB H – ACTION CONFIGURATION
       WIZARD
8.1.   Purpose
       In this lab you will learn about the Action Configuration Wizard, which is used to
       simplify the Action setup.
       Lab Scenario ( WHAT to do )    Use the Action Configuration Wizard to generate
                                      controls and data models for a Create Site
                                      form.
                                       Run the form to create a Site object, and then use a
                                      Search Site form to view the newly created Site
                                      object
       Implementation Steps           Detailed instruction in the following sections
       ( HOW to do it )
        This lab uses the real CRM backend and not the simulator. The initial step, therefore,
       is to reconfigure workspace.xml to use the complete <Server/> tag, as before.




8.2.   Create a CreateSite form Using New Base Form
       Wizard




                                   Information Security Level 2 - Sensitive
                                                                                          58
                       Proprietary and Confidential Information of Amdocs
                                                     Amdocs Smart Client Framework Verion 7.5
                                                  Chapter 8. Lab H – Action Configuration Wizard

                   1. Login to the ASCF server.
                   2. Drop a Submit Action onto the form.
                   3. Set name property of the action to createSiteAction
                   4. Right click on the action and select Configure Operation from the context menu.




                   5. Set:
                        a.   backendId property to “crm”
                        b. “operationType” to “XBean”
                        c. For “operationName,” use operation lookup to search for SiteCreate and
                           select “com.clarify.isupport.site.savebean.SiteCreateSaveXB”.




                   6. Click Next to bring up Input Parameters page.
                   7. Select all input parameters (SiteVo in this case).
                        a. Accept default names for generated data models.
                      b. Leave Ignore Primitive Parameters checkbox unchecked.
                   8. Click Next to bring up the Output Parameters page.
                   9. Leave all parameters (SiteObjid in this case) checked and Ignore Parameters
                      checkbox unchecked.
                        Accept default names for generated data models
                   10. Click Next to go to the Configure Data Models page


ASCF v7.5 Labs – v0.9                                                                     Page 59 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                   Chapter 8. Lab H – Action Configuration Wizard

                   11. From the Data Model tree view at the top, select siteVo_xxx data mode.
                        The bottom grid must display the field names for the selected data model.
                   12. Check the checkboxes for the following data model fields:
                        a. Address1, Address2, City, Zipcode
                        b. Accept default control type (TextField) for each of these fields




                   13. Click Finish.
                   14. Check the action properties in the property sheet.
                       The following properties are set: backendId, operationType, operationName,
                       requestDataMap and responseDataMap.
                   15. In the outline view, select the Data tab.
                   16. Two data models are generated - siteVo_xxx and siteObjid_xxx.




                   17. Check the Controls Tab.
                        The Unused Controls section will have the generated controls.
                   18. Individually, move these controls on to the form using the context menu.
                        Notice that property bindings for the text property for these controls have been
                        created.




ASCF v7.5 Labs – v0.9                                                                         Page 60 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                   Chapter 8. Lab H – Action Configuration Wizard




                   19. Add Label controls from the palette for each of these controls and set their “text”
                       properties appropriately.
                   20. Add a button to the form.
                   21. Name the button, “saveButton” and set its “text” property to “Save”.
                   22. Set “action” property to the submit action, “createSite”.
                   Later, when this form runs, upon clicking Save on the form, a new Site object with
                   the specified address should be created.
                   Validations, such as checking for unique site name, have not been added. Clicking
                   Save repeatedly, therefore, would result in duplicate Sites with the same site name
                   and address.

8.3.               Create a SearchSite Form in Designer Using the
                   New Search Form Wizard




                   1. On the Search Grid Details page of the wizard:
                        a. Specify a name for the search grid (“searchGrid”).
                        b. Set selection type as “No Selection”
                        c. Editable to “False”
                        Click Next.




ASCF v7.5 Labs – v0.9                                                                         Page 61 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                   Chapter 8. Lab H – Action Configuration Wizard




                   2. On the Add Tabular Datamodel to Form page:
                      a. Specify a name for the tabular data model.
                        b. Set backend id to “crm” and Data type to “Database”
                   3. In the search ad-hoc query row, enter the site and click Search.
                   4. Select “$table:site_view_more_billing” and click Next.
                   5. On the Data Models Column Definitions page, check and unckeck the checkbox
                      column header to unselect all rows in the grid.
                   6. Select the following fields: address, address2, city, site_name, zipcode
                   7. Click Finish
                   8. Check the Actions node in the outline view.
                   9. Select the generated search action and set its properties as follows:
                        a. backendId = “crm”
                        b. operationType=” SearchWB”,
                        c. operationName = “com.clarify.common.filter.SearchFilterBaseWB”
                   10. In the Data tab of the outline view, select <xxx>SearchInfoDM.
                   11. Edit the “fields” property of the SearchInfoDM.
                   12. Click on the lookup button to bring up the data model definition dialog.
                   13. Set metadataID to “site_view_more_billing” and click Ok to close the dialog.




ASCF v7.5 Labs – v0.9                                                                         Page 62 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                   Chapter 8. Lab H – Action Configuration Wizard




8.4.               Configure Menu Items (Application Desktop)
                   1. Open the application desktop file in the Application Editor.
                   2. Open a global form, if one already exists, or create a new one.
                   3. In the global form, add two launch actions: one to launch CreateSite form and
                      one to launch SearchSite form
                        a. Launch action to launch create site form:
                            i.   Set name property to LaunchCreateSiteAction,
                            ii. Set logicalFormName to CreateSite.
                            iii. Set publishedName property for the action with the same value as the
                                 name.
                        b. Launch action to launch search site form:
                           i. Set name property to LaunchSearchSiteAction.
                            ii. Set logicalFormName to SearchSite.
                            iii. Set publishedName property for the action with the same value as the
                                 name
                   4. Add a new menu, Site.
                        a. Add two menu items, Search and Create.
                        b. Set action property of these menu items to the newly created actions in the
                           global form (using action lookup dialog).

8.5.               Run the Application
                   1. Build the project and run the application.
                   2. In the login screen of the application, login to the ASCF server.
                   3. From the menu, select Site->Search to bring up site listing form.
                      Click Search to view the list of sites.
                   4. Click on the Site->Create menu to bring up SiteCreate form.
                   5. Enter values into the TextField controls and click Save.
                   6. Return to the Search Site form and click Search.
                        Notice that the newly added Site shows up on the SearchSite form.




ASCF v7.5 Labs – v0.9                                                                        Page 63 of 115
9.     LAB I – SEARCH GRID
9.1.   Purpose
       In this lab you will learn how to use the ASCF Search control.
       Lab Scenario ( WHAT to do )     You will create a search grid
       Implementation Steps            Use the ASCF Search Grid wizard to initially
       ( HOW to do it )                configure the grid. The grid will then be manipulated
                                       to add additional columns


9.2.   Review of Grid
       This control displays data in a series of rows and columns. Each element in a grid is
       called a “cell”.
       To add a control to a grid column
       1. Select the control in the Palette.
       2. Drop the control on the grid in the Controls tab.
       3. To set the individual control’s properties for a grid column, select the control in
          the Controls tab and expand the “control” property in the Property tab.
       To delete a control from a grid column
       1. Select the control under the grid control in the Controls tab.
       2. Select Delete from the context menu
       To rearrange columns in a grid
       1. Select and drag a control under the grid control in the Controls tab.
          As you drag, a visual indicator shows the target where the control will be
          dropped.
       The Grid's displayTDM property specifies the data model that the grid displays. You
       must set displayTDM before you can bind the controls in the grid.
       You can set the activationAction property to an action that executes when a user
       doubleclicks the grid. The cell where the user clicks must not be editable and must
       not contain an action control.
       ■   If the selectionMode is MULTIPLE, then you configure selectionCheckBox.
       ■   If the selectionMode is SINGLE, then you configure selectionRadioButton.
       ■   If the selectionMode is NONE, a user cannot make a selection.
       To support sorting, you must create a tabular data model that holds the sort criteria
       and specify that data model name in the sortCriteriaTDM property. You can easily
       create this data model in the Data Model Definition Dialog, described on page [???].
       When a user clicks a column header in a grid, it is recorded in the sortCriteriaTDM.
       You can write a data model change event handler for the sortCriteriaTDM and sort
       the grid’s data on the client or execute an action that asks the server to sort the data.




                                    Information Security Level 2 - Sensitive
                                                                                          64
                        Proprietary and Confidential Information of Amdocs
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 9. Lab I – Search Grid

                   A GridColumn object defines the behavior of a column in Grid. Binding the Grid
                   column is done with a field in the displayTDM of the Grid. For this reason the DM in
                   the binding is left null.
                   For example, the site_id column is bound to the site_id field of the Search Grid's
                   displayTDM:




9.3.               Exercises
         9.3.1.            Exercise 1
                   Starting the Lab
                   1. You must first make certain that the server tag appears in the workspace.xml,
                       since this is the server we are going to work.




ASCF v7.5 Labs – v0.9                                                                      Page 65 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid

                   2. Make sure that the server is up and running because we'll need to get details from
                      the server in design time.
                        a. Login by clicking Amdocs > Login to bring up login dialog (user name = sa,
                           password = sa).
                        b.   Click Login.
                   3. Create a Search form using the Search wizard based on a database view.
                        a. Add columns and property bindings using value maps
                        b. Format handlers
                        c. Rearrange columns
                   4. Do the following:
                        a. Select File/New/Other and select Search Form.
                        b. Give a name for the package say ‘com.amdocs.forms.search’
                        c. Give a name to the form say ‘SearchSiteForm’




                        d. Select a name for the grid (for example, ‘SearchSiteFormGrid’)
                        e. Select the grid selection mode (‘Single Selection’)
                        f. Mark editable as True




ASCF v7.5 Labs – v0.9                                                                       Page 66 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                    Chapter 9. Lab I – Search Grid




                        g. Select the backend id (‘crm’) and entity name
                           (‘$table:site_view_more_billing’) for the display TDM used in the search
                           form




                            If you don't see the list of entities, you will have to re-select the crm from the
                            Backend dropdown. If crm does not appear in the Backend dropdown, it
                            means that you're not logged in; in this case you will have to login again and
                            to create the search form from the beginning.
                        h. Select the fields ‘address’, ‘customer_id’, ‘phone’, ‘site_id’ and “site_name”
                           from the display TDM to be added as columns to the search grid (as shown
                           below).

ASCF v7.5 Labs – v0.9                                                                            Page 67 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                    Chapter 9. Lab I – Search Grid

                            We will later manually add several additional by dragging and dropping from
                            the control palette.
                   5. Since this is an editable grid, you can select editable controls for the selected
                      column fields.
                        Select the following control types for the corresponding fields (see figure below):
                        a. address – control type text
                        b. customer_id - control of type text
                        c. phone – control of type text
                        d. site_id – control of type hyperlink
                        e. site_name – control of type text
                   6. Click Finish when you are done with the wizard.




                   7. The Search Grid form should be displayed with the Control and Data definitions
                      in the Outline perspective on the right.
                        a. Manually change the titles of the columns to ‘Id’ (for site_id), ‘Name’ (for
                           site_name), ‘Phone’, ‘Address’, and, ‘Customer Id’.




ASCF v7.5 Labs – v0.9                                                                          Page 68 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 9. Lab I – Search Grid




                        b. Verify that the column controls already have property bindings defined.
                           For example, the site_id control (hyperlink) should have a property binding
                           defined for the ‘text’ property with the data model left empty and the
                           fieldName specified as ‘site_id’ as shown below:




                        c. Select the Data Model for “SearchSiteFormGridSearchInfoDM”.
                            i.   Open it by clicking on the fields property.
                            ii. Specify the default value for the metadataID field as
                                ‘site_view_more_billing’




ASCF v7.5 Labs – v0.9                                                                       Page 69 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                    Chapter 9. Lab I – Search Grid




                        d.   Verify that the following SearchGrid properties are set correctly:
                             i. displayTDM = SearchSiteFormTDM
                             ii. searchCriteriaTDM = SearchSiteFormGridSearchCriteriaTDM
                             iii. searchInfoDM = SearchSiteFormGridSearchInfoDM
                             iv. sortCriteriaTDM = SearchSiteFormGridSortCriteriaTDM
                             v. searchAction = SearchSiteFormGridSearchAction




ASCF v7.5 Labs – v0.9                                                                             Page 70 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 9. Lab I – Search Grid



                        e. Select the SearchSiteFormGridSearchAction and specify the operationType
                           and operationName properties as follows:
                            i.   operationType = SearchWB
                            ii. operationName = com.clarify.common.filter.SearchFilterBaseWB




                   You will now define three additional data models
                   ■    typeTDM
                        Used as a ValueMap TDM for the site_type drop down control (to be added later)
                        property bindings.
                   ■    styleValueMapTDM
                         Used as a ValueMap TDM defined for the site_id (or ‘Id’) hyperlink control
                        ‘style’ property binding.
                   ■    licensed
                        The ‘license’ field will be bound to the ‘visible’ property of the ‘Customer Id’
                        column.
                   typeTDM
                   1. Create a manual TDM with two fields - ‘type’ (Integer) and ‘desc’ (String).
                   2. Add 2 data rows to the TDM as shown below:




ASCF v7.5 Labs – v0.9                                                                          Page 71 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 9. Lab I – Search Grid




                   styleValueMapTDM
                   1. Create a manual TDM with two fields - ‘type’ (Integer) and ‘style’ (String).
                   2. Add two data rows to the TDM as shown below:




ASCF v7.5 Labs – v0.9                                                                      Page 72 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 9. Lab I – Search Grid




                        Note that ‘style1’ and ‘weirdStyle’ should be existing styles defined in the
                        application style.properties file that can be found under /UifSamples/form.
                      a. Currently, style.properties is empty in our environment.
                      b. If there is no style.properties file, you should create one by clicking on File -
                         > New -> File.
                   3. The style.properties file should be under the form directory (in your case under
                      UIFSamples/form (1)).




ASCF v7.5 Labs – v0.9                                                                         Page 73 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 9. Lab I – Search Grid




                   4. Open the file and add the following lines in order to support the 'style1' and
                      'weirdStyle' background color:


                                              represents: Red Green Blue in Hex.


                        a. style1.*.backgroundColor=#FF00FF
                      b. weirdStyle.*.backgroundColor=#FFFF00
                   5. Style
                        Each control has a property where you can specify a style name. You set up the
                        corresponding styles in the properties file, which override the Swing look and
                        feel global and control-level settings.
                        The style statements follow this format:
                        stylename.controltype.attribute.subattribute
                        where:
                        a. stylename is the name of the style you specify as a property of the control.
                           Use an asterisk (“*”) as a wildcard to apply the setting to all styles.
                        b. controltype is the type of control (a subclass of UifControl).
                            i.   This name is the same as the control’s class name without the “Uif”
                                 prefix.

ASCF v7.5 Labs – v0.9                                                                         Page 74 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                    Chapter 9. Lab I – Search Grid

                            ii. Use an asterisk (“*”) as a wildcard to apply the setting to all controls.
                            iii. This value is case insensitive.
                        c. attribute is the name of the visual attribute such as font, foreground,
                           background, or border.
                        d. subattribute is the name of a subattribute (such as the bevel type for a
                           border).
                   licenseDM
                   1. Return to your search form ("SearchSiteForm.uiff ") and create a manual DM
                       with one field ‘license_key’ - (String).
                   2. Set a static value of ‘EAPPS’ as shown below:




                   3. Define a property binding for the ‘visible’ property of the Search Grid column
                      ‘customer_id’.
                      The goal is to hide/show the column based on some data model field. This also
                      demonstrates how to use the format handler in the binding.
                        a. Create a 1-way binding for the ‘visible’ property bound to the ‘LicenseDM’
                           and field ‘license_key’.




ASCF v7.5 Labs – v0.9                                                                           Page 75 of 115
                                                     Amdocs Smart Client Framework Verion 7.5
                                                                Chapter 9. Lab I – Search Grid




                        b. Add a format event handler - shown below – named
                           “SearchSiteFormGrid_prop_visible_format”




                   public void
                   SearchSiteFormGrid_prop_visible_format(UifDatatypeConvertEvent
                   event) {
                          if
                   (((String)licenseDM.getValue("license_key")).equalsIgnoreCase(
                   "UNIV_ALL"))
                                    event.setTargetValue(Boolean.TRUE);
                            else
                                    event.setTargetValue(Boolean.FALSE);
                   }
                           This will hide or show the column based on the “license_key” value.

ASCF v7.5 Labs – v0.9                                                                     Page 76 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid

                   4. Add a ‘Type’ drop down column by dragging and dropping a Combo Box
                      column control into the Search Grid (in the outline).
                        Define the following properties and property bindings:
                        a. name = site_type
                        b. title = Type
                        c. control.listTDM = TypeTDM
                        d. control.displayFieldName = desc
                        e. control.valueFieldName = type
                        f. (binding) control.selectedValue.fieldName = site_type
                   5. Add a ‘City’ text field column by dragging and dropping a Text Field column
                      control into the Search Grid.
                        Define the following properties and property bindings
                        a. name = city
                        b. title = City
                        c. (binding) control.text.fieldName = city
                        d. control.text.dataModel should be left empty
                   6. Add a ‘State’ label field column by dragging and dropping a Label Field column
                      control into the Search Grid.
                        Define the following properties and property bindings
                        a. name =
                        b. title = State
                        c. (binding) control.text.fieldName = state
                        d. control.text.dataModel should be left empty
                        Because the label field is neither editable nor actionable, the Grid's activation
                        action will be executed when the user double clicks a cell in the state column. We
                        will define the activation action later in Exercise 2 of this lab.




ASCF v7.5 Labs – v0.9                                                                        Page 77 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid



                   7. Add a property binding to the ‘style’ property (expand the control property, and
                      add the following binding to the style property) of the ‘site_id” or Id hyperlink
                      column control as follows:
                        a. site_id.control.style.dataModel is left empty
                        b. site_id.control.style.fieldName = site_type
                        c. site_id.control.style.valueMapTDM = StyleValueMapTDM
                        d. site_id.control.style.valueMapKeyFieldName = type
                        e. site_id.control.style.valueMapValueFieldName = style
                        This will display the background color of the site_id column for each row in a
                        different color (or style) depending on the value of the site_type field. The
                        StyleValueMapTDM provides the mapping from the value of the site_type field
                        which is an int (1 or 2) to a known style (‘style1’ or ‘weirdStyle’).




                   8. Add a mask to the ‘phone’ column text field control as follows:
                        a. phone.control.mask = (###)-###-####
                        b. maskCharsIncluded = false
                   9. Add a maxlength validation for the ‘site_name’ column text field control as
                      follows:
                        a. site_name.control.maxLength = 20
                   10. You can change the display order of the columns in several ways.
                        a. You can drag and drop the column controls under the SearchGrid node in the
                           Outline – Controls tab as shown below (the ‘site_type’ column control was
                           moved to go after the ‘site_name’ control):




ASCF v7.5 Labs – v0.9                                                                       Page 78 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid




                        b. You can change the display order of the columns is to set the
                           ‘gridColumnSequence’ property by setting a comma delimited list of column
                           names.
                   11. Add a launch action to GlobalForm.uiff to launch the SearchSiteForm and add a
                       menu item to the global menu bar to invoke this launch action.
                        The changes to the SearchSiteForm.uiff mus first be saved. This should create the
                        necessary .java, .properties files.
                        Add a launch action to GlobalForm.uiff as follows:
                        a. Drag and drop a Launch action to the Actions in GlobalForm.uiff
                        b. Specify the following properties for the Launch action:
                            i.   name = launchSearchSiteForm
                            ii. logicalFormName = com.amdocs.forms.search.SearchSiteForm
                            iii. publishedName = launchSearchSiteForm
                        Add a global menu item to launch the SearchSiteForm as follows:
                                 1. Menubar –
                                         Search Samples –
                                                      Search Sample Form




ASCF v7.5 Labs – v0.9                                                                        Page 79 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid




                   12. At runtime, selecting the “Search Sample Form” menu item will launch the
                       search form we just designed. Try the functionalities we added such as
                       validation, style, hiding columns, etc.
                   13. In order to improve the Form layout, we'll do the following steps:
                        a.   Right click on the root column header and select Grow.




                                                                                            ds
                        b. Set he first row to Grow as well.




ASCF v7.5 Labs – v0.9                                                                            Page 80 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid




                        c. To ensure that the Grid will spread over the entire form, you will need to
                           change the row alignment.
                            This is done by right clicking on the row header and selecting Fill Align.




                        d. Now when you'll run the application, the form will look much better … ☺




ASCF v7.5 Labs – v0.9                                                                         Page 81 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                    Chapter 9. Lab I – Search Grid




         9.3.2.             Exercise 2
                   Purpose
                   ■    The following will be implemented:
                        ●   A launch action for the Search Site form’s hyperlink column to launch a Site
                            Details form using the Grid’s ‘ActionRowDM’ property.
                        ●   An activationAction for the grid.
                        ●   A postSelectedRowsTDM event handler.
                   ■    Add some validation rules to the Save action for the editable Grid.
                   ■    Demonstrate a soft refresh of the Search Site grid using messaging when one of
                        the Site’s details is modified in the Site Details form.
                   Create a Site Details form as follows:
                   ■ Create an Amdocs Base form as com.amdocs.forms.search.SiteDetailsForm
                   ■    Add a data model called ‘site’ (type: singular , source: Database) with backend id
                        as ‘crm’ and entity name as ‘$table:site_view_more_billing’.
                   ■    Add four Text Field controls as follows:
                        ●   Site Id (bound to the ‘site_id’ field of site dm)
                        ●   Site Name (bound to the ‘site_name’ field of site dm)
                        ●   Address (bound to the ‘address’ field of site dm)
                        ●   City (bound to the ‘city’ field of site dm)
                   ■    The form will look like the following:




ASCF v7.5 Labs – v0.9                                                                         Page 82 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 9. Lab I – Search Grid




                   ■    Add a Save button with name and text property specified as ‘Save’.
                   ■    Define a Save_action event in the Events tab of the Save button as shown below:




ASCF v7.5 Labs – v0.9                                                                      Page 83 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                                  Chapter 9. Lab I – Search Grid

                   ■    Add the following event handler code that sends a message to the Search Site
                        form with the saved ‘site’ dm:
                        public void Save_Action(UifCancellableEvent event) {
                                       UifForm[] forms =
                        getWorkspace().findForms(null, null,

                            "com.amdocs.forms.search.SearchSiteForm", null);
                                             if (forms != null && forms.length > 0)
                                                    this.sendMessage(forms[0],
                        "updateSite", site);
                                             this.close();
                            }


                            The form sendmessage method packs the data into an instance of
                            UifMessageEvent and invokes message handler on the specified target
                            form (In our case the SearchSiteForm form).
                            A corresponding handler to handle the ‘updateSite’ message event in the
                            Search Site form will be implemented later on.
                   ■    Save SiteDetailsForm.uiff
                   ■    Go back to the SearchSiteForm.uiff and define a launch action as follows:
                        ●   name = launchSiteDetailsForm
                        ●   logicalFormName = com.amdocs.forms.search.SiteDetailsForm
                        ●   location = WORKAREA_CHILD_MODAL
                            This will open the detailsForm as a child model, meaning that you will not be
                            able to set focus on the parent form before closing the child form.
                        ●   launchDataMap as shown below where:
                            i.   Source = $DataProvider:SearchSiteFormGrid:ActionRowDM
                            ii. Target MetaData Id = $table:site_view_more_billing
                            iii. Target = site




ASCF v7.5 Labs – v0.9                                                                        Page 84 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                                   Chapter 9. Lab I – Search Grid



                   ■    Assign the ‘launchSiteDetailsForm’ launch action to the site_id hyperlink
                        column control action property. You do that by setting the action property.
                   ■    Assign the same ‘launchSiteDetailsForm’ launch action to the Search Grid’s
                        ‘activationAction’ property.
                        Grid's activation action is executed when a user double clicks a grid cell. The
                        activation action will be executed only if the cell is neither editable nor
                        actionable. In our case, then, the activation action will work only if the user
                        double clicks a cell in the "State" column.
                   ■    Implement a postSelectedRowsChange event handler from the Search Grid
                        Events tab as follows:
                        public void
                        SearchSiteFormGrid_postSelectedRowsChange(UifTabularDataMod
                        elEvent event) {


                                 UifTabularDataModel myTdm =
                        this.SearchSiteFormGrid.getSelectedRowsTDM();
                                    if (myTdm != null && myTdm.getRecordCount() > 0)
                                    {
                                       System.out.println("The values of the
                        selected row are: \n" +
                                             "site_id : " +
                        myTdm.getAt(0).getValue("site_id") + "\n" +
                                             "site_name : " +
                        myTdm.getAt(0).getValue("site_name") + "\n" +
                                             "phone : " +
                        myTdm.getAt(0).getValue("phone") + "\n" +
                                             "address : " +
                        myTdm.getAt(0).getValue("address") + "\n" +
                                             "city : " +
                        myTdm.getAt(0).getValue("city") + "\n" +
                                             "site_type : " +
                        myTdm.getAt(0).getValue("site_type") + "\n" +
                                             "site_typest : " +
                        myTdm.getAt(0).getValue("site_typest"));
                                    }
                        }
                   ■    Add a Save button to the Search Site form (as shown below) and set its name and
                        text properties to Save.
                        Typically the Save button executes a Save Submit action, but we will skip
                        creating a new Submit action here.




ASCF v7.5 Labs – v0.9                                                                         Page 85 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                                 Chapter 9. Lab I – Search Grid




                   ■    Finally, add a message handler to SearchSiteForm.java using the Application
                        Code Editor to handle the message event from the Site Details form as shown
                        below:
                        public void message_updateSite(UifMessageEvent e) {


                        UifDataModel siteDM = (UifDataModel)e.getData();


                                   SearchSiteFormTDM.updateFrom(siteDM,false);
                        }


                   The updateForm method (an UifTabularDataModel method) loops through all the
                   row data models in the target (i.e this) and invoke updateFrom on each row data
                   model with the sourceDm. Return true if any of the row data models is updated.




ASCF v7.5 Labs – v0.9                                                                      Page 86 of 115
10.     LAB J – LOOKUP CONTROL
10.1.   Purpose
        In this lab you will create a Lookup form, Search list form and a Details form using
        Form Designer.
        Lab Scenario ( WHAT to do )    You will create Search and Details forms, and then
                                       create a new form that will include the Lookup
                                       control, which you will then configure.
        Implementation Steps           ???????
        ( HOW to do it )


10.2.   Review of Lookup Control
        You use this control to let users search for objects with which to associate, as show
        below.




        A Lookup button launches a search grid where the user makes selections that update
        values in the launching form. The Lookup button is often used to create and
        editforms when the focus object needs to be related to another object.
        You can use the values in other controls in the launching form to filter what is
        displayed inthe launched search grid. You do this by associating the lookup control
        with a search launch action and setting up the action’s searchCriteriaTDM property.
        You can also associate this control with a launch action.
        The lookup control tracks its state and knows when it has already looked up
        something. After having looked up something, if the user manually changes or clears
        the value in the launching form, the control is marked as invalid. You can control this
        behavior through the validBeforeLookup and validIfClear properties:
        ■ If you set validBeforeLookup to true, the user can edit the value.
        ■   If you set validIfClear to true, the user can clear the value.
        By default, both these properties are false.
        You use the Configure Lookup Control wizard to set up a lookup control. You must,
        however ,have already set up a form with a search grid form.




                                    Information Security Level 2 - Sensitive
                                                                                            87
                        Proprietary and Confidential Information of Amdocs
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control

                   After using the Lookup Control Wizard, you can undo and redo the entire operation,
                   as follows:
                   1.   Select Configure Lookup Control from the context menu after you drop a search
                        grid on a form.
                        You cannot start the wizard after you have set any property of the lookup control.

10.3.              Starting the Lab
                   1. Login to Uif server from the design tool.
                   2. Create a Search Form (SearchForm).
                   3. From menu, select File -> New -> Other.
                   4. Select Search Form under Amdocs Smart Client Designer to bring up New
                      Search Form wizard.




                   5. Specify Package and Form names (LookupSearchForm) and click Next.
                   6. In the Search Grid Details screen, specify for the grid:
                        a. The name (LookupSearchFormGrid)
                        b. Single selection
                        c. Non-editable (False) properties
                   7. Click Next.



ASCF v7.5 Labs – v0.9                                                                        Page 88 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   8. Specify properties of the tabular data model that should be added to form, such as
                      backend id (crm), data type (Database), and the table (site_view_more_billing)
                      the tdm is associated with.
                        Click Next.




ASCF v7.5 Labs – v0.9                                                                       Page 89 of 115
                                                     Amdocs Smart Client Framework Verion 7.5
                                                            Chapter 10. Lab J – Lookup Control




                   9. From the Column definitions wizard page, select the required columns - address,
                      city, site_name, state, zipcode - to display on the search grid.




ASCF v7.5 Labs – v0.9                                                                     Page 90 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   10. Click Finish.
                   11. The Search Grid with the selected columns and grid footer are created based on
                       specified parameters.
                        You can improve the form layout as was done in the previous lab.




                   12. Check the Data tab in outline view.
                   13. DMs have been created for the following:
                        a. Search listing - LookupSearchFormTDM
                        b. Search info - LookupSearchFormGridSearchInfoDM

ASCF v7.5 Labs – v0.9                                                                      Page 91 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control

                        c. Sort criteria - LookupSearchFormGridSortCriteriaTDM
                        d. Search criteria - LookupSearchFormGridSearchCriteriaTDM




                   14. Edit Search Info DM (LookupSearchFormGridSearchInfoDM) (1) as follows:
                        a. Edit fields property (2) by clicking on the lookup   button.




                        b. Specify site_view_more_billing for metadataId and click OK.




                        c. Select Search action under Actions node (Controls tab of Outline view).

ASCF v7.5 Labs – v0.9                                                                      Page 92 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control

                        d. Specify:
                           i.   ‘crm’ for backend id
                           ii. SearchWB as the operation type
                           iii. ‘com.clarify.common.filter.SearchFilterBaseWB’ for operation name




                   15. Save the form
                   The following is an illustration of a sample Site Search form:




ASCF v7.5 Labs – v0.9                                                                   Page 93 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control


         10.3.1.            Create a Details Form
                   1. From menu, select File -> New -> Other.
                   2. Select Base Form.
                   3. Specify form name (LookupDetailsForm).




                   4. Click Finish
                   5. Add several TextFields and a button to the form (see below).
                   6. Name the following text fields: txtSiteId, txtAddress, txtState, txtSiteName,
                      txtCity, txtCountry




                   7. Add a data model of type database, call it dmSite.
                        a. Set Type to Singular
                        b. Source type to Database
                        c. Set backend to crm
                        d. Set site_view_more_billing as the entity type




ASCF v7.5 Labs – v0.9                                                                       Page 94 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   8. Bind text controls to fields of dmSite data model as follows:
                      a. txtSiteId to site_id (of dmSite),
                        b. txtSiteName to site_name
                        c. txtAddress to address
                        d. txtCity to city
                        e. txtState to state
                        f. txtCountry to country_name




ASCF v7.5 Labs – v0.9                                                                 Page 95 of 115
                                                  Amdocs Smart Client Framework Verion 7.5
                                                         Chapter 10. Lab J – Lookup Control




              Following is an illustration of sample Details form:




ASCF v7.5 Labs – v0.9                                                            Page 96 of 115
                                                     Amdocs Smart Client Framework Verion 7.5
                                                            Chapter 10. Lab J – Lookup Control



         10.3.2.           Create a Lookup Form
                   1. Create a new Base Form using the New Form Wizard (similar to the Details
                      form) – name LookUpForm.




                   2. Add a TextField and a Lookup button control.
                   3. Create a DM named dmSite with the following entities:
                        a. Source=Database
                        b. Type=Singular
                        c. Backend=crm
                        d. Table site_view_more_billing
                   4. Select the lookup button control.
                   5. Right click, and select the Configure Lookup Control menu item.




ASCF v7.5 Labs – v0.9                                                                   Page 97 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control




                   6. Specify a name for the lookup control – ‘myLookupControl’
                      Default names for Search launch action, search criteria TDM and DCE are
                      automatically generated based on the name specified for the lookup control.
                   7. Specify dmSite as the Lookup Fields DM (1).
                   8. Update the “SearchForm” to be the search listing form using the      button (2).
                   9. Unselect Validate upon Save action (3).




                   10. Click Next
                   11. Click on Add button to add search criteria .



ASCF v7.5 Labs – v0.9                                                                     Page 98 of 115
                                                        Amdocs Smart Client Framework Verion 7.5
                                                               Chapter 10. Lab J – Lookup Control

                   12. Select the following:
                        a.   field name: site_name (manually enter the name since there is currently a
                             bug in the drop-down list values in our training environment)
                        b. Operator: StartsWith
                        c. Source DM: dmSite
                        d. Source DM field: site_name




                   13. Click Next.
                   14. Check the Details checkbox.
                   15. In Details Launch Properties, specify the Details form created earlier
                       (LookupDetailsForm).
                   16. Specify a name for the Launch action (launchLookupDetailsForm)
                   17. Select the Target DM (dmSite) from dropdown.
                   18. Click Finish
                   19. Check the Data tab of outline view:




ASCF v7.5 Labs – v0.9                                                                           Page 99 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   Make sure that:

                        a. A lookup Search Criteria TDM has been added with the specified search
                           criteria.
                        b. A DCE has been added to the form (<LookupName>Dce_<suffixID>).
                        c. Check that the DCE launchAction property of the DCE points to the Search
                           form launching action (<lookupName>LaunchAction_<suffixID>)




                        d. Check the triggerEvent and triggerSource properties.

ASCF v7.5 Labs – v0.9                                                                   Page 100 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control

                           The DCE is triggered when Select button is pressed in the listing page.
                   20. Check the Actions tree node in the Controls tab of outline view.
                        Notice that two Actions were created:




                        a. A Lookup Action (1) (<lookupName>LookupAction_<suffixID>) has been
                           added with logicalFormName property set to SearchForm (3).
                        b. Take a look at the launchDataMap (1) property of the action. In the
                           Configure Launch Map dialog, select the first row (2) and hit Edit (3)…




                        c. In the Edit Launch Mapping dialog, notice that the Target Data is the Search
                           Criteria TDM of SearchForm (searchFormGridSearchCriteriaTDM)




ASCF v7.5 Labs – v0.9                                                                      Page 101 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control

                       d. A Lookup Details Action (2) (named
                          <lookupName>DetailsAction_<suffixID>) has been added with
                          logicalFormName property set to LookupDetailsForm form
                   21. Check the Lookup Menu (1) items under Lookup control in the outline view:
                        a. Lookup menu item
                           i.   Action property is set to generated lookup action (2),
                                <lookupName>LookupAction_<suffixID>.




                           ii. Same for Details menu item (action property is set to generated Lookup
                               Details action, <lookupName>DetailsAction_<suffixID>)
                   22. Add property binding to the text field control.
                   23. Specify dmSite as the DM and site_name as the DM field.




ASCF v7.5 Labs – v0.9                                                                    Page 102 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   24. Save the form.
                       You can add additional labels if you want to show the lookup result details. Make
                       sure to enter the right bindings to the empty labels.




                   25. Change the text property of the lookup control to "Site Lookup".
                   26. At runtime, the form should look something like that the following:




                   27. Create a Launching action in the Global Form.


ASCF v7.5 Labs – v0.9                                                                        Page 103 of 115
                                                         Amdocs Smart Client Framework Verion 7.5
                                                                Chapter 10. Lab J – Lookup Control

                   28. Create or open an existing application desktop (.uifad) file in Designer and add a
                       menu item to launch the Lookup Form.
                   29. Save the file.
                   30. To run the Lookup flow:
                       a. Run your project.
                        b. Login (runtime) to uif server through a login screen.
                        c. From the application desktop, select the menu item to launch LookupForm.
                        d. Click on the lookup button on the form to bring up the Search form.
                        e. Hit “Search Now” button to view the list of available sites.
                        f. Select/highlight an entry from the list and hit “Select”.
                        g. Label fields on the lookup page which are bound to the target DM (dmSite)
                           must show values of the fields from the selected Site object.
                        h. It should look something like that the following:




                        i.   Change the value of in the text control to 'a' and click on the lookup button.




                             You will see that the search criteria was transferred from the lookup form to
                             the search form.




                        j.   Allow the user to execute an action only if the user had looked up a value
                             before.
                   31. Add a launch action to the lookup form, edit its properties.
                       a. Set the name property to "LaunchDetailsForm".
                        b. Specify LookupDetailsForm for its logicalFormName property.
                        c. Edit Launch Map.
                        d. Map dmSite from launch form to the details form.
                        e. Expand the validationInfo property, and edit extraControl property by
                           selecting the Lookup control.

ASCF v7.5 Labs – v0.9                                                                           Page 104 of 115
                                                      Amdocs Smart Client Framework Verion 7.5
                                                             Chapter 10. Lab J – Lookup Control




                   32. Add a button control to the form and specify “Launch Details” for its text
                       property.
                   33. For the button’s action property, select the newly added launch action.
                   34. Shown below is a sample Lookup form:




                   35. Run the test project.
                   36. From the lookup form, click the “Launch Details” button.
                   37. You should see a validation error message indicating that a look up has not
                       happened.




ASCF v7.5 Labs – v0.9                                                                       Page 105 of 115
                                                       Amdocs Smart Client Framework Verion 7.5
                                                              Chapter 10. Lab J – Lookup Control




                   38. Select a value from the search listing using the lookup button and then click the
                       button again.
                        This time, the Details form will be launched




ASCF v7.5 Labs – v0.9                                                                       Page 106 of 115
11.     LAB K – CUSTOMS CONTROLS
        SUPPORT
11.1.   Purpose
        In this lab you will practice using a custom control in ASCF.
        Lab Scenario ( WHAT to do )     You will create and add a form to a custom control
                                        for viewing PDF files. This demonstrates how you
                                        might include other kinds of 3rd party controls in a
                                        SmartClient application
        Implementation Steps            Follow the click-stream instructions
        ( HOW to do it )



11.2.   Registering a Custom Control
        1. Close any projects you currently have open in your workspace.
        2. Select to Amdocs > Configure JavaBean Controls
        3. Click on the Add button.
           This will bring up the dialog from which you are to browse for the jar file
           that contains your custom JavaBean controls.
        4. For this lab, we will use a control that provides a viewer for PDF
           documents. Locate the jar file at: c:\_work\ascf\PDFLab\jPDFViewer.jar.
            Click Open to install the jar file.
        5. Select PDFViewerBean from the Available JavaBean Controls and click
           OK.




                                     Information Security Level 2 - Sensitive
                                                                                           107
                         Proprietary and Confidential Information of Amdocs
                                                  Error! No text of specified style in document.




                    This step will prepare the control for use in the designer. When you create
                    new ASCF projects, the jar files for the custom controls will get
                    automatically added to the project.
                    For existing projects, the jar files will get added once you save a form in
                    that project.



11.3.           Using a Custom Control
                1. Open the UIFSamples project and create a new Base form.
                   Notice that the PDFViewerBean is added to the palette under the
                   JavaBeans section.




      Information Security Level 2 - Sensitive
108
      Proprietary and Confidential Information of Amdocs
                                                  Error! No text of specified style in document.




                2. Drop a PDF Viewer control onto the form.
                3. Go to the Property Sheet and change the name of the control to
                   “pdfViewer”.
                   Note that the rest of the control’s simple properties are accessible in the
                   Property Sheet. Complex properties of custom controls are manipulated in
                   application code.
                4. Go to the Events for the Form. Locate the “postOpen” event and click on
                   the event name.
                    The button used to generate an event handler for “postOpen” will appear
                    in the far right portion of the Value column.
                    Click on this button to generate an event handler for “postOpen”.
                5. Once you click on the button, you will be directed to the Application
                   Code Editor. Add the following code to the method (assuming you have
                   the Release Notes PDF at C:\_work\ascf\PDFLab\ReleaseNotes.pdf).




      Information Security Level 2 - Sensitive
109
      Proprietary and Confidential Information of Amdocs
                                                  Error! No text of specified style in document.



                    public class PDF_ViewerForm extends UifForm {


                          protected PDFViewerBean pdfViewer;


                          /**
                              * @param event
                              */


                          public void form_PostOpen(UifFormEvent event) {
                          try {

                pdfViewer.loadPDF("C:\\_work\\ascf\\PDFlab\\ReleaseNotes.
                pdf");
                          } catch (PDFException ex) {
                                   ex.printStackTrace();
                          }
                }


                      This demonstrates that the variable for the PDF Viewer is accessible in
                      the application code and that you can use code assist to find properties
                      and methods just like any other control variable.
                6. Run the form. You will see the PDF Viewer control on the form with the
                   release notes loaded.




      Information Security Level 2 - Sensitive
110
      Proprietary and Confidential Information of Amdocs

								
To top