Next |
The Tiles project provides an example of a Bean Works component that is more complicated than those provided in the Hello1 through Hello4 projects. A Tiles component allows the user to add "tiles" of predefined types to the component, change the color of selected tiles, and move tiles around the view. The user can also cut and paste selected tiles between Tiles components.
Tiles are of the type "Rock" (circle), "Paper" (square), or "Scissors" (triangle):
The program features in the Tiles project code include:
Use of a selection object to provide access to the data in the component model. Each of the commands in the Tiles project takes a selection as its target.
Event handling that includes simple mouse events, mouse motion, and hit detection to determine whether the user is clicking on a "tile."
Extension of the default component user interface, adding a menu and additional tool buttons with flyover help.
Support for clipboard operations, implemented through the selection object.
The Tiles project implements model, view, controller, interface, and command classes, as well as a Tile class to represent each tile. Select any class below to see documented code:
TileModel provides the data management for the Tiles component. TileModel stores a growable array of Tile objects.
Tile represents individual "tile" objects, stored by the model.
TileView displays tiles currently in the model and provides the event handling mechanisms that let users select and drag tiles with the mouse.
TileSelection specifies one or more tiles and allows access to the selected tiles, including cut, copy, paste, and delete operations.
TilesGUIHandler provides the extended user interface elements.
Tiles is the controller for the component.
TileColorCommand is used to reset the color of selected tiles.
TileCreateCommand is used to add a tile of a specified type to the model.
TileMoveCommand is used to change the position of a selected tile.
TilesResources maintains the string resources used to build a Tiles component.
TileBeanInfo identifies the icon to use to represent the bean.
Source code for the Tiles project is in WebRunner\BeanTools\samples\tiles. You can launch a Tiles component by typing run at the command prompt from this directory, or from the "VisualAge WebRunner" program group.
Next |
Copyright ©
Taligent, Inc. 1996 - 1997.
Copyright © IBM Corporation 1996 - 1997.
All Rights Reserved.