Step-by-step examples building VA Smalltalk ICs
To illustrate the steps required to package applications as one or more ICs, this section provides a simple example designed only to illustrate the IC packaging process. The example is a simple to-do list comprised of two applications:
IcTestView provides a user interface and simple to-do list capabilities.
IcTestModel provides the domain model, in this simple case, a model of the objects contained in the to-do list.
To create the to-do list example, perform the following steps:
1. In the Organizer, create two applications, IcTestView and IcTestModel.
2. Select IcTestModel and create a new nonvisual part, called Thing. In the Public Interface Editor, give it one attribute called name, generate the default scripts, and save the part.
3. Define the instance method printOn: for Thing to be something like the following, so text is shown correctly in the user interface:
printOn: aStream
aStream
nextPutAll: self name;
nextPutAll: ' thing'.
4. Select IcTestView and create a new visual part called ToDoListView.
5. Add three Push Buttons, a Text part, a Multiple Select List, an OrderedCollection, and an Object Factory. Label the three push buttons Add, Delete, and Exit. Set the Object Factory's instanceClass property to Thing.
6. Tear off the instance (Thing) attribute of the Object Factory.
7. Make the following connections:
a. Connect clicked of Add push button to new of Object Factory.
b. Connect object of Text part to the name attribute of Object Factory.
c. Connect clicked of Add push button to add: of OrderedCollection.
d. Connect the name attribute of instance of Object Factory to anObject of the clicked-add: connection.
e. Connect clicked of Delete push button to removeAll: of OrderedCollection.
f. Connect selectedItems of Multiple Select List to aCollection of the clicked-removeAll: connection.
g. Connect clicked of Exit push button to closeWidget of Window.
h. Connect self of OrderedCollection to items of Multiple Select List.
Your visual part now resembles:
To-do list
Save the part and test it to ensure it works correctly.
Next, complete two steps described in Packaging preparation: load configuration maps and set the correct prerequisites.
Verify the prerequisites for IcTestView because it uses the Thing class defined in IcTestModel. That is, ensure that IcTestView specifies IcTestModel as a prerequisite.
Test your application once again to ensure you've made these changes correctly. Also, before packaging these two applications as ICs, version and release the classes and version the applications. You should also unload and load your application to ensure you've defined the application class methods correctly.
Finally, create an application called IcTestPackagingInstructions with an immediate prerequisite of EpImageInstructions. This application will contain the packaging instructions.
Note: If EpImageInstructions is not available. It needs to be loaded into the image.
The next four sections go through four examples of creating ICs, starting with the simplest example and progressing through more complex ones. The examples include:
This example involves packaging the To-Do List as one leaf IC.
This example involves packaging IcTestModel as a reusable IC and IcTestView as a leaf IC. The leaf IC will include the reusable IC as a prerequisite.
This example involves packaging the To-Do List as an IC and another sample application provided by VA Smalltalk as an IC. We'll then create another example application, a simple desktop launcher, to dynamically load and unload these ICs.
This example involves a slight modification of your To-Do List example to make it platform dependent. We'll package IcTestModel and IcTestView as two platform dependent leaf ICs, one for Windows and one for OS/2.
Last modified date: 01/18/2024