< Previous | Next >

Introduction to the visual snippets sample

This sample introduces you to visual snippets and demonstrates how the visual snippet editor is used to create and edit custom visual snippets.

A visual snippet is a graphical representation of Java code. There are three kinds of visual snippets:
custom visual snippets
User-defined visual snippets that you can create and edit using the visual snippet editor.
Java visual snippets
Visual snippets of Java code that you can add to your custom visual snippets to perform method calls.
standard visual snippets
Visual snippets that you can add to your custom visual snippets for a wide variety of purposes, such as defining business logic or performing mathematical operations. Standard visual snippets include the predefined visual snippets that are provided in the visual snippets library plus any user-defined custom visual snippets.

The visual snippet editor is the graphical programming environment that you use to create and edit custom visual snippets. Although the visual snippet editor is the main tool for developing visual snippets, you can use visual snippets in other component editors, such as the business processes editor. The visual snippet editor is shown in the following figure:


Picture of the visual snippet editor

In this visual snippets sample, you work with a custom visual snippet named IsListEmpty that is shown in the preceding figure of the visual snippet editor. As the name implies, this custom visual snippet simply determines whether an input list is empty and it returns a result of either true or false.

In the snippet, an input list is passed to a size Java visual snippet, which reads the number of elements in the list and then passes the number to a length variable. The length variable and an expression of 0 (zero) are then both passed to an equal to standard visual snippet, which compares the two values and passes the result to the return node. If the number of elements in the length variable is equal to 0, the return node reports a result of true. If the number of elements in the length variable is not equal to 0, the return node reports a result of false.

To work with the visual snippets sample, you can either browse the ready-made visual snippets sample or you can build the visual snippets sample yourself. These activities are described in the following topics:

This sample should take between 15 and 30 minutes to finish.

Modules in this tutorial

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