Bean Extender: Guide to Demos

Setting Up

This section discusses the steps of setting up a computer to run the 401(k) demo. It is better to perform some of the assembly before starting the demo to make the demo less repetitive and less time consuming. For example, consider assembling the b401kViewer bean and the b401kDap bean before the demo. Then, during the demo, add the AccountID bean during the demo to illustrate the procedure.

Perform the following steps to set up the computer for the 401(k) demo:

  1. Make local copies of the following files:

    Where product represents the name of the directory in which you installed Bean Extender.
    Note:Using local copies avoids entering long path names during the demo and ensures that you have write access to the classes to be morphed. This step lists the full path for the files you should copy. The remainder of the demo uses only simple file names.

  2. Make a backup copy of the accountID.jar file. This backup copy will be used during the cleanup phase.
    Note:Running the demo modifies this file, and you cannot rerun the demo unless you have an unmodified copy of the accountID.jar file.

  3. Start the Assembly Surface, if it is not already running. To start the Assembly Surface, enter:
    java com.ibm.beans.tools.assembly.AssemblySurfaceMain
    
    Note:If you do not see the Repository button in the upper right corner, resize the window until this button is visible.

  4. Display the Beans view, if not already displayed. To display the Beans view, click on View/Beans on the menu bar. The Repositories tab is displayed in the Client section of the Assembly Surface. The Client section is below the Bean tab.

  5. Load the accountID.jar repository file:
    A. Click on View/Beans on the menu bar.
    B. Click on the Add file repository button at the bottom of the Assembly Surface.
    C. In the pop-up window, specify the location of the accountID.jar file and click on the Ok button. The AccountID bean is displayed as an icon.
    Note:You must load the accountID.jar before loading the 401k.jar, or the 401k.jar will not load.

  6. Load the 401k.jar repository file:
    A. Click on the Repositories tab in the Beans view.
    B. Click on the Add file repository button at the bottom of the Assembly Surface.
    C. In the pop-up window, specify the location of the 401k.jar file and click on the Ok button. Two beans, b401kViewer and b401kDap, are displayed as icons.
    D. Select both beans by single-clicking on each bean. A bean is selected when it is outlined in gray. After selecting the bean, click on the Add beans button at the bottom of the Assembly Surface. Instances of the two beans are added to the assembly and displayed in the Contents region on the left.

  7. Load the beanfw.jar repository file:
    A. Click on the Repositories tab in the Beans view.
    B. Click on the Add file repository button at the bottom of the Assembly Surface.
    C. In the pop-up window, specify the location of the beanfw.jar file and click on the Ok button. Two beans, Version and ApplicationResources, are displayed as icons. These beans are helper beans that are used by the chart bean which is utilized later on in the demo. They must be on the classpath before the chart bean is loaded into the Assembly Surface. By loading the beanfw.jar file into the Assembly Surface as a repository, the contents of the beanfw.jar file will be expanded into the temporary subdirectory whose location you specified during the configuration of the BeanExtender product. This temporary subdirectory should be on the classpath.

  8. Connect the b401kViewer bean to the b401kInformationChanged event generated by the b401kDap bean:
    A. Click on View/Event Connections on the menu bar.
    B. Pick the following connections from the columns of the Event Connections view:
    Event Sources b401kDap
    Source Events b401kInformationChanged
    Event Targets b401kViewer
    Target Methods b401kInformationChanged

    The columns are filled in automatically as you make selections from left to right, so your choices are limited.

    C. Click on the Connect button at the bottom of the Assembly Surface to establish each event connection. The event connection is established and displayed at the bottom of the Event Connections notebook page.

  9. Connect the b401kDap to the PercentChanged event (generated by the b401kViewer):
    A. Pick the following connection items from the columns of the Event Connections view:
    Event Sources b401kViewer
    Source Events PercentChanged
    Event Targets b401kDap
    Target Methods PercentChanged
    B. Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page.
    Note:All current event connections are displayed at the bottom of the Event Connections notebook page.

  10. Arrange the visual layout of the new aggregate bean:
    A. Click on View/Layout on the menu bar. The Layout notebook page is displayed in which you can arrange the component beans you are assembling using drag-and-drop operations. The b401kDap bean has no visual presentation, so it is not displayed in the Layout view; the b401kViewer is displayed as a rectangle with drag handles on the corners and sides.
    B. Reposition the rectangle representing the b401kViewer about an inch from the top, and resize it to occupy about half the width of the layout window. To manipulate a particular bean in the Layout window, first click on it to display its drag handles. To resize it, position the mouse over one of the corners so that a resize arrow (a two-headed arrow) appears, then click and drag. To move it, position the mouse on one of the sides of the rectangle so that a repositioning arrow (a four-headed arrow) appears, then click and drag.

  11. Clean up the Assembly Surface before beginning the demo:
    A. Remove the Event Connections view from the Assembly Surface by right-clicking the Event Connections tab to display the pop-up menu and clicking on Close view or by clicking on View/Event Connections on the menu bar.
    B. Click on the Beans tab to return to the Beans view.
    C. Click on the Repository tab to go to the Repository notebook page.
    D. Click on the accountID.jar file from the list of currently loaded jar files, then click the Remove Repository button at the bottom of the Assembly Surface. This lets you show how it is loaded during the demo.

Aggregation

  1. Add an AccountID bean to the Aggregate bean:
    A. Load the accountID.jar:

    1. Click on View/Beans on the menu bar.

    2. Click on the Repository tab.

    3. Click on the Add file repository button at the bottom of the Assembly Surface.

    4. In the pop-up window, specify the location of the accountID.jar and click on the Ok button. The AccountID bean icon is displayed.
    B. Click on the AccountID bean to select the bean. When selected, the bean is outlined in gray.
    C. Click on the Add beans button at the bottom of the Assembly Surface. An instance of the AccountID bean is added to the assembly and is displayed in the left section of the Assembly Surface working area.
    Note:You can click on the Run beans button at the bottom of the Assembly Surface to see how the AccountID bean looks and works in isolation. After running the AccountID bean, close the window in which it is running by clicking on the Stop button at the bottom of the Assembly Surface.

  2. Connect the Account ID bean to the b401kDap bean:
    A. Click on View/Event Connection on the menu bar.
    B. Connect the b401kDap to the AccountIDInformationChanged event (generated by the AccountID bean) by selecting the following items from the columns:
    Event Sources AccountID
    Source Events AccountIDInformationChanged
    Event Targets b401kDap
    Target Methods AccountIDInformationChanged
    C. Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page.

  3. Adjust the Layout of the Aggregate bean.
    A. Click on the Layout tab. It should now contain a horizontal rectangle at the top showing the AccountID bean.
    B. Ensure that the Submit button on the right side of the AccountID bean is visible and does not overlap the b401kViewer bean. Reposition the rectangle, if necessary.

  4. Generate and run the new Aggregate bean:
    A. Enter the class name, package name, and repository name for the new bean into the fields in the control section of the Assembly Surface. Ensure that the class and package names are not the same and do not start with a number. For example, you might enter IBM401K, a401k, and IBM401K.jar. Do not change the default contents of the Extends field (the default value is java.awt.Panel).
    B. Click on the Generate button in the action area of the Assembly Surface. When the message "Successfully generated..." is displayed in the status bar in the action area of the Assembly Surface, the Run button in the action area of the Assembly Surface is enabled.
    C. Click on the Run button in the action area of the to display a pop-up window in which the new aggregate bean is running.
    D. Enter an account number. For the demo, the account number can be any number.
    E. Press the Submit button in the pop-up window. The Viewer bean displays percentages in several fields.

    Verify that the percentages in the Viewer can be modified using the mouse on the pull-down lists. If the percentages do not total one hundred percent, the Total field at the bottom of the viewer changes to red.

    F. Close the window by clicking on the Stop button in the action area of the Assembly Surface when you are finished viewing the running aggregate bean.

Scripting

In this phase of the demo, you add a Chart bean to the assembly and use scripting to connect it to the b401kDap bean.

The Scripting Phase consists of the following steps:

  1. Add the Chart bean to the assembly:
    A. Click on the Beans view, either by clicking on the Beans tab or by clicking on View/Beans from the menu bar.
    B. Click on the Repositories tab.
    C. Click on the Add file repository button at the bottom of the Assembly Surface.
    D. In the pop-up window, enter the location of the chart.jar file. The Chart bean is displayed. A window with a copyright disclaimer is also displayed. Close the window by clicking on the Ok button at the bottom of the window.
    E. Click on the Chart bean.
    F. Click on the Add beans button at the bottom of the Assembly Surface. An instance of the Chart bean is added to the left section of the Assembly Surface working area.

  2. Change Chart properties to pie chart:
    A. Click on the Properties view by clicking on View/Properties on the menu bar. A Properties notebook is displayed in the right section of the Assembly Surface working area.
    B. Locate the chartType field at the bottom of the window and click on the associated combination box. Click on PIECHART from the pop-up window.
    C. Close the Properties page by right-clicking the Properties tab to display the pop-up menu and clicking on Close view or by clicking on View/Properties on the menu bar.

  3. Adjust the Layout of the aggregate bean:
    A. Click on the Layout tab; it now contains a new rectangle representing the Chart bean. Initially the Chart bean is positioned on top of the b401kViewer bean.
    B. Reposition the new rectangle to the right of the rectangle that represents the b401kViewer bean. Ensure that the beans do not overlap. Make the new rectangle as wide as possible and arrange it to occupy about half of the area beneath the AccountID bean.

  4. Use scripting to connect the Chart bean to the b401kDap bean:
    A. Click on View/Scripting on the menu bar to display the Scripting notebook page, if the Scripting view is not already displayed. Three icons and a combination box are displayed on the notebook page.
    B. Click on the icon that resembles a blue ball. This is the Beans view of the Scripting IDE and shows all beans that are instantiated.
    C. Click on b401kDap. This creates a new section on the right of the Assembly Surface working area. You can enter the script code in this new section.
    Note:Ensure that you click on the word, not on the plus sign (+) beside it.
    D. Click between the curly braces to position the cursor.
    E. Click on the icon that resembles a piece of paper (above the curly braces) to import the code from a file.
    F. Specify the location of the Chart.script file and click on the Ok button. The region to the right of the Scripting IDE now contains all the scripting code necessary to connect the Chart bean to the b401kDap bean.
    G. Click on the Script0 object. You can select the Script0 object by clicking on the "Script0" text.

    The center section divides into two new sections. The left section continues to display the tree view of available objects to script. The right-hand section is a scripting area containing:

    • An icon in the upper left-hand corner.
    • A combination box beside the icon.
    • A text area beneath the icon and combination box.
    H. Click on public void initialize() in the combination box at the top of the new (right-hand) section.
    I. Click on the text area. Ensure that the cursor is positioned between the curly braces.
    J. Click on the icon to import code from a file.
    K. Specify the location of the ChartInit.script file.

  5. Generate and Run the New Aggregate Bean:
    A. Click on the Properties view by clicking on View/Properties on the menu bar. A Properties notebook is displayed in the right-hand section of the Assembly Surface working area.
    B. Locate the chartType field at the bottom of the window and click on the associated combination box. Click on PIECHART from the pop-up window.
    C. Close the Properties page by right-clicking the Properties tab to display the pop-up menu and clicking on Close view or by clicking onView/Properties on the menu bar.

  6. Adjust the Layout of the aggregate bean:
    A. Click on the Layout tab; it now contains a new rectangle representing the Chart bean. Initially the Chart bean is positioned on top of the b401kViewer bean.
    B. Reposition the new rectangle to the right of the rectangle that represents the b401kViewer bean. Ensure that the beans do not overlap. Make the new rectangle as wide as possible and arrange it to occupy about half of the area beneath the AccountID bean.

  7. Use scripting to connect the Chart bean to the b401kDap bean:
    A. Click on the Generate button in the action area of the Assembly Surface. When the generation completes, the Run button in the action area of the Assembly Surface is enabled.
    B. Click on the Run button. A window with a copyright disclaimer is displayed. Close the window by clicking on the Ok button at the bottom of the window. The new aggregate bean runs as before, except that when an account number is added, a pie chart displays the results. If you update the percentages in the b401kViewer bean, the pie chart updates automatically.
    C. Close the window when you finish viewing the running aggregate bean by clicking on the Stop button in the action area of the Assembly Surface.

Dipping

This phase of the demo adds a SessionAuthenticationDip bean to the AccountID bean.

The dipping phase consists of the following steps:

  1. Morph the AccountID bean to be a subclass of the original bean:
    A. Click on the Beans view.
    B. Click on the accountID.jar tab.
    C. Click on the AccountID bean icon, if not already selected.
    D. Click on the Morph bean button at the bottom of the Assembly Surface. The Morph Beans window is displayed. The Inheritance morphing option should be selected and the Save with original location should be specified.
    E. Click on the Morph selected bean button at the bottom of the Morph Beans window. A progress window is displayed.
    F. When the progress window closes, click on the Done button at the bottom of the Morph Beans window. The AccountIDDippable bean icon is displayed in the Beans view.
    Note:You can click on the new bean and then click on the Run button in the action area of the Assembly Surface to verify that the dippable bean looks and acts like the original. Close the window in which the bean is running when you finish.
  2. Replace the non-dippable AccountID bean :
    A. Click on the AccountIDDippable bean.
    B. Click on the Add beans button at the bottom of the Assembly Surface. An instance of the AccountIDDippable bean is added to the Contents region.
    C. In the left section of the Assembly Surface working area, click on the AccountID bean.
    D. Click on the Delete button at the bottom of the left section of the Assembly Surface working area to delete the original bean.
  3. Normalize the Layout:
    A. Click on the Layout tab.
    B. Rearrange the contents of the Layout view window to ensure that the beans do not overlay each other, if necessary. Ensure that the AccountIDDippable bean is in the desired position.
  4. Connect the b401kDap bean to the AccountIDDippable instance:
    A. Connect the b401kDap bean to the AccountIDInformationChanged event (generated by the AccountIDDippable bean) by selecting the following items from the columns:
    Event Sources AccountIDDippable
    Source Events AccountIDInformationChanged
    Event Targets b401kDap
    Target Methods AccountIDInformationChanged
    B. Click on the Connect button at the bottom of the Assembly Surface.
  5. Apply the Sessions Authentication dip:
    A. Click on View/Dips/Available dips on the menu bar.
    B. Load the dip to be applied by clicking on the Add file repository button at the bottom of the Assembly Surface.
    C. In the pop-up window, specify the location of the sessauth.jar file and click on the Ok button in the bottom of the window. This displays an icon for the SessionAuthenticationDip bean.
    D. Click on the SessionAuthenticationDip bean, then click on the AccountIDDippable bean in the left section of the Assembly Surface working area.
    E. Click on the Apply dips to selected bean button at the bottom of the Assembly Surface. A customization window for the dip opens.
    F. Do not change the information in the customization window. Click on the Apply button. Another window opens to allow you to set the ID and password.
    G. Enter an ID and password in the window.
    Note:Remember the ID and password you use. You will need them later to run the new aggregate bean.
    H. Click on the Ok button in the window.
    I. Click on the Done button to close the window.
    J. If the console window appears in the foreground, minimize it or move it out of the way.
    K. On the customization window, click on the Done button. You have successfully applied the dip. You can now view the applied dips in the region in the right section of the Assembly Surface working area by clicking on View/Dips/Applied Dips on the menu bar.
  6. Regenerate and run the aggregate bean:
    A. Click on the Generate button in the action area of the Assembly Surface. Status messages display in the status area.
    B. Click on the Run button in the action area of the Assembly Surface. This time, before the applet runs, a window requests an ID and a password.
    C. Enter the ID and password you set earlier when customizing the dip. A window with a copyright disclaimer is displayed.
    D. Close the copyright window by clicking on the Ok button in the bottom of the window. You can now verify that the applet runs as it did before.

Cleanup

Restore the system to its original state:

  1. Exit the Assembly Surface by clicking on File/Exit on the menu bar.

  2. Remove the contents of the working directory (work).

  3. Restore the accountID.jar file to its original state, using the backup copy you made earlier. This removes the AccountIDDippable bean from the JAR.


[ Top of Page | Previous Page | Next Page | Table of Contents | Documentation Homepage ]