Dynamic Web Development with Seaside

Buy PDF Buy Print

6.3.1Defining a Component

First we will define a new VA Smalltalk application to hold our simple counter. We create the SampleSeasideApp application using VA Smalltalk’s Applications Manager. Select Applications | Create | Application... to specify the name of the new application, see Figure 50.

VASmalltalkApplicationManager

You will also need to specify the prerequisite applications for your new application. We are going to use the WAAdmin’ tool to manage the application, so you should specify its application (SeasideToolsCoreApp) as the only direct prerequisite of your new application.

Now we define a new Seaside component named WebCounter by defining a subclass of WAComponent. You can do this by selecting Classes | Add | New Class.... Select WAComponent as the superclass of your new class and select OK; enter the name of your new class (WebCounter) and select OK; finally, select subclass as the type of subclass you are creating and select OK. At this point you have created an application with 2 classes in it, SampleWebApp and WebCounter.

Now open a browser on the WebCounter class and add an instance variable that will contain the state of the counter. The class definition should look like this:

WAComponent subclass: #WebCounter
instanceVariableNames: 'count'
classVariableNames: ''
poolDictionaries: ''

Copyright © 20 November 2017 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.