SAS/AF Composite - Richard DeVenezia

Download Report

Transcript SAS/AF Composite - Richard DeVenezia

SAS/AF Composite Class:
A Detailed Example
Richard A. DeVenezia
Composite documentation

SAS Online Help


SAS Online Doc


Look under Legacy
Not present in V8
SAS Online Doc PDF

Not present in V8
What is a composite ?
A custom component
 Comprised of other components

 Visual
controls
– text entry, combo box, list box, push button, etc...
 Non-visual
models
– library list, catalog list, data set list, etc...
A subclass of sashelp.fsp.Composit.class
 Deployed by using in a frame

Developing classes
A single SCL entry
 Two or more SCL entries
 A CLASS entry and a SCL entry
 A CLASS entry and multiple SCL entries

 This
is the scenario of the sample composite
ListOfValues
CLASS entry and SCL entries

Class Editor (GUI) used to develop CLASS
entry
 attributes,
methods
 events, event handlers
 interfaces

SCL entries for implementations
 attribute
methods: setCAM, getCAM
 methods: new and overrides
SCL entries

USECLASS / ENDUSECLASS block
 All
the attributes and methods of _self_ are
implicitly available.
– Early binding allows checks at compile time

No USECLASS block
 Attributes
and methods of _self_ must be
referenced through _self_ dot notation.
– Late binding, checks are done at run time
ListOfValues example

Visual Controls
 List

box, Push buttons
Non-visual
 SLIST

entry list model
Behaviour
 List
management
 Persistence of list
Create ListOfValues

Issue build command
 build
example.sugi26.listofvalues.clas
s
Layout components

Edit componentDefinition attribute to enter
the CompositeDefinition window
CompositeDefinition window
Components window added to docking view
 Very similar to frame build window
 Component Properties Editor available from
context menu or View menu

Component naming
Use a convention that clarifies implementation SCL code
 co_type_name

 co
indicates a component in the composite
 type
– pb for push button control
– lb for list box control
– mdl for a model
 name
indicating functionality
Component attachments
Make your composite ‘size smart’
 Use menu Layout/Attach/Define Attachment
 Widen and heighten the list box when
composite enlarged by using
single directional attachment
types

Model / Viewer linkages

Set co_lb_Values model attribute to
co_mdl_ValuesSLIST
 When
the SLIST entryName is set, the model
will pass the SCL list read to the list box items
attribute, causing the list of values shown to
change
Configuring method overrides

A method of the component is selected in
the Properties Editor
 Overridden

using context menu
Source Entry set to a SCL entry
 Examples.Sugi26.Listofvalues.scl

Source Label set to a method label in the
SCL entry
ListOfValues method overrides
Source entry
Examples.Sugi26.Listofvalues.scl
 Push buttons _onClick() Source Label

 co_pb_AddValue
 co_pb_ReplaceValue
 ...

List box _onPopup()
 co_lb_Values
onClickAdd
onClickReplace
onClick...
Source Label
onPopupValues
onClick...() override SCL
Does not have a USECLASS block
 Accessing other components in composite

 lov
= _self_.ownerId;
lov._getWidget ( widgetName, widgetId );
widgetId...

Be glad component naming conventions
were used (widgetName)
onPopup() override SCL

Invokes _sendEvent() on _self_.ownerId
 Not
required, but implemented this way for
demonstration of technique
 Custom event “valuesListBox
ContextMenuRequested” sent
 The composite (ownerId) must be configured to
handle the custom event
Layout finished



Exit the Composite
Definition window
Answer ‘Yes’ to dialog
asking to save changes
Returns to Class Editor
Add public attributes

Allows customization when deployed
 valuesAddDialogTitle
 valuesAddDialogPrompt
 valuesAddDialogMaskCharacter
 valuesListBoxTitle
– Set CAM = setcamValuesListBoxTitle
 valuesSLISTEntryName
– Set CAM = setcamValuesSLISTEntryName
setcam... methods

setcamValuesListBoxTitle
 Forwards
attribute value to list box title
atttribute

setcamValuesSLISTEntryName
 Forwards
attribute value to SLIST entry list
model entryName attribute
– Reads SCL list from catalog entry
– SLIST entry list model feeds list box viewer
 Invokes
the list box _refresh() method
Override methods

_term
 The
current list shown in list box will be stored
in catalog entry named in attribute
valuesSLISTEntryName
 savelist() function used to store SCL list

This behavior implements the persistent
aspect of ListOfValues
Add event and handler
Event name “valuesListBox
ContextMenuRequested”
 Event handler definition configures which
method is dispatch when the event occurs

 onValuesListBoxContextMenuRequested()

The handler method pops up a menu to
allow a value to be added or removed from
the list box
Composite SCL entry
This entry does contain a USECLASS
block
 All components layed out in CompositeDefintion window are implicitly available
 Again, be glad that sensible naming
convention was used from components

Conclusion
The composite class is very flexible
 Time should be taken to learn model/viewer
fundamentals and new features in SAS/AF
 The wide range of implementation
possibilities can make it hard to determine
which route to follow

SAS and SAS/AF are registered trademarks or trademarks of SAS Institute Inc, in the USA and other countries.  indicates USA registration.