< Previous

Connecting the elements in the custom visual snippet

After adding the required elements to the custom visual snippet, you need to connect the elements with links in the visual snippet editor. Links are used to specify the order that you want your elements to execute in a custom visual snippet.

In the following steps, you connect the elements of the IsDisplayArticle custom visual snippet.

To connect the elements in the custom visual snippet:

  1. At the very top of the visual snippet editor canvas, connect the false expression to the isDisplayArticle expression by completing the following steps:
    1. In the visual snippet editor canvas, hover your cursor over the triangular output terminal on the right side of the false expression. The Add a Link icon is displayed, as shown in the following figure:
      Picture of the cursor hovering over the output terminal of the false expression
    2. Click the small circle at the end of the Add a Link icon, as shown in the following figure:
      Picture of the cursor selecting the small circle on the Add a Link icon
      The Add a Link icon changes to a moveable link.
    3. Hover your cursor over the input terminal of the isDisplayArticle expression, as shown in the following figure:
      Picture of the cursor hovering over the isDisplayArticle expression
    4. Click the input terminal of the isDisplayArticle expression to connect the link from the false expression. The visual snippet editor automatically realigns the connected false expression and the isDisplayArticle expression in the canvas, as shown in the following figure:
      Picture of the false expression and the isDisplayArticle expression aligned in the canvas
  2. At the top of the visual snippet editor canvas, use the same procedure to connect the symbols variable, isListEmpty standard visual snippet, and if true header of the Choice control structure, as shown in the following figure:
    Picture of the symbols variable, isListEmpty standard visual snippet, and if true header connected
  3. At the very bottom of the visual snippet editor canvas, connect the isDisplayArticle variable to the return activity, as shown in the following figure:
    Picture of the isDisplayArticle variable connected to the return activity
  4. Using the following figure as a guide, connect the remaining elements as described below:
    Picture of the visual snippet editor with the remaining elements connected
    1. In the if true section at the top of the Choice control structure, connect the output terminal of the true expression to the input terminal of the isDisplayArticle variable.
    2. In the otherwise section of the Choice control structure, connect the output terminal of the symbols variable to the input terminal of the iterator Java visual snippet and then connect the output terminal of the iterator Java visual snippet to the input terminal of the it expression.
    3. In the condition area (upper section) of the While true control structure, connect the output terminal of the it variable to the input terminal of the hasNext Java visual snippet and then connect the output terminal of the hasNext Java visual snippet to the input terminal of the hasMoreSymbols expression.
    4. In the condition area (upper section) of the While true control structure, connect the output terminal of the hasMoreSymbols && isDisplayArticle == false expression to the condition input terminal.
    5. In the body (lower section) of the While true control structure, connect the output terminal of the it variable to the input terminal of the next Java visual snippet and then connect the output terminal of the next Java visual snippet to the input terminal of the symbol expression.
    6. In the body (lower section) of the While true control structure, connect the output terminal of the article.title variable to the top input terminal of the indexOf Java visual snippet and then connect the output terminal of the indexOf Java visual snippet to the input terminal of the index expression.
    7. In the body (lower section) of the While true control structure, connect the output terminal of the symbol variable to the bottom input terminal of the indexOf Java visual snippet.
    8. In the body (lower section) of the While true control structure, connect the output terminal of the index > -1 expression to the input terminal of the if true header of the Choice control structure.
    9. In the if true section of the Choice control structure, connect the output terminal of the true expression to the input terminal of the isDisplayArticle variable.
    10. Press Ctrl-S to save your changes. The workspace begins to rebuild itself and the warning and error symbols on the elements disappear.
The elements have now been connected in the custom visual snippet and you have finished building the sample.

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
< Previous