|
Visualizing an attribute of an instantiate simulation object in a non graphical object-window, containing text-fields, sliders or buttons.
Running a simulation, the attributes of some objects need to be monitored or changed, e.g., the temperature of rooms or radiators.
One has to install as many DisplayAttribute Patterns to the target as needed. All values will be displayed in one window. The window-size adjusts with the number of DisplayAttribute Patterns installed.
With any DisplayAttribute Pattern installed to, the target object will contain a new class-method that returns a subcanvas-specification for the display-window. This specification can be obtained by the CanvasTool delivered with VisualWave or VisualWorks.
With the first DisplayAttribute Pattern the target object will contain the method openObjectWindow and the method objectWindowSpecs . The first method is used by UIBuilding (c.f. documentation of simulator graphic) to open the object-window and activate the display. The second method changes with any DisplayAttribute Pattern installed. It returns a list of all subcanvas-specifications the target contains, i.e., the list elements are the names of the methods that return the specifications.
There are many types of subcanvas-specifications possible, so the Pattern DisplayAttribute is abstract and will not be used itself but as a superclass for other Patterns that affect the object-window. Subclasses are recommended to be named like DisplayValue . They must overwrite the spec-template and the method setupMacros , corresponding to the macros needed.

"Open an ObjectWindow and display the specs in the array objectWindowSpecs." | canvas bldr | canvas := BuildingObjectCanvas new. canvas object: self. bldr := canvas openObjectInterface: self objectWindowSpecs at: self class. canvas activate. ^bldr
^self subclassResponsibility
"Return an array with specs to display in the ObjectWindow." ^#(#{spec} )
Pattern DisplayAttribute Category display ObjectType use target SingleMethod use monitor SingleMethod use preset spec End