29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

28. A Visual Org<strong>an</strong>izer<br />

28.1 <strong>Introduction</strong><br />

This chapter presents a VisualWorks version of the Org<strong>an</strong>izer Class described earlier in the book.<br />

That is, a graphical front end is constructed that works with the classes previously constructed. The<br />

org<strong>an</strong>izer was intended as <strong>an</strong> electronic personal org<strong>an</strong>izer. It therefore possessed <strong>an</strong> address book, a<br />

diary (or appointments section) <strong><strong>an</strong>d</strong> a section for notes. However the version previously described<br />

required the user to send the appropriate messages to <strong>an</strong> inst<strong>an</strong>ce of Org<strong>an</strong>izer using the Workspace.<br />

For example, in Figure 28.1 the user has created <strong>an</strong> inst<strong>an</strong>ce of Org<strong>an</strong>izer <strong><strong>an</strong>d</strong> sent it a variety of<br />

messages which record addresses, appointments <strong><strong>an</strong>d</strong> notes. This certainly works, however, the use of a<br />

graphical interface would be preferable. This wo uld allow the user to input the appropriate information<br />

via buttons, input fields <strong><strong>an</strong>d</strong> text windows.<br />

Figure 28.1: Using the (non graphical) Org<strong>an</strong>izer<br />

Figure 28.3 illustrates the type of interface to be constructed for the address input window. As c<strong>an</strong><br />

be seen from this figure, having a graphical user interface (GUI) leads to a far more intuitive interface.<br />

The chapter is structured in the following m<strong>an</strong>ner: Section two desc ribes the VisualOrg<strong>an</strong>izer<br />

class which acts as the class used to define the graphical interface, Section three describes the<br />

associated AddressBook class <strong><strong>an</strong>d</strong> Section four provides a final comment.<br />

28.2 VisualOrg<strong>an</strong>izer class<br />

In the example in this chapter we are going to construct a graphical version of the Org<strong>an</strong>izer we<br />

constructed earlier in this book. We shall make a number of ch<strong>an</strong>ges to the architecture of the<br />

Org<strong>an</strong>izer in order to define the VisualOrg<strong>an</strong>izer. The major ch<strong>an</strong>ges are:<br />

1. The VisualOrg<strong>an</strong>izer class will be a subclass of ApplicationModel rather th<strong>an</strong> <strong>Object</strong>.<br />

This is because we wish to inherit all the facilities used to m<strong>an</strong>age VisualWorks windows. This is<br />

236

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!