1 / 24

SAS/AF  Composite Class: A Detailed Example

SAS/AF  Composite Class: A Detailed Example. Richard A. DeVenezia. Composite documentation. SAS Online Help Look under Legacy. SAS Online Doc Not present in V8 SAS Online Doc PDF Not present in V8. What is a composite ?. A custom component Comprised of other components

jfussell
Download Presentation

SAS/AF  Composite Class: A Detailed Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SAS/AF Composite Class:A Detailed Example Richard A. DeVenezia

  2. Composite documentation • SAS Online Help • Look under Legacy • SAS Online Doc • Not present in V8 • SAS Online Doc PDF • Not present in V8

  3. 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

  4. 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

  5. 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

  6. 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

  7. ListOfValues example • Visual Controls • List box, Push buttons • Non-visual • SLIST entry list model • Behaviour • List management • Persistence of list

  8. Create ListOfValues • Issue build command • build example.sugi26.listofvalues.class

  9. Layout components • Edit componentDefinition attribute to enter the CompositeDefinition window

  10. CompositeDefinition window • Components window added to docking view • Very similar to frame build window • Component Properties Editor available from context menu or View menu

  11. Component naming • Use a convention that clarifies implemen-tation 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

  12. Component attachments • Make your composite ‘size smart’ • Use menu Layout/Attach/Define Attachment • Widen and heighten the list box when composite enlarged by usingsingle directional attachmenttypes

  13. 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

  14. 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

  15. ListOfValues method overrides • Source entry Examples.Sugi26.Listofvalues.scl • Push buttons _onClick() Source Label • co_pb_AddValue onClickAdd • co_pb_ReplaceValue onClickReplace • ... onClick... • List box _onPopup() Source Label • c o_lb_Values onPopupValues

  16. 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)

  17. 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

  18. Layout finished • Exit the Composite Definition window • Answer ‘Yes’ to dialog asking to save changes • Returns to Class Editor

  19. Add public attributes • Allows customization when deployed • valuesAddDialogTitle • valuesAddDialogPrompt • valuesAddDialogMaskCharacter • valuesListBoxTitle • Set CAM = setcamValuesListBoxTitle • valuesSLISTEntryName • Set CAM = setcamValuesSLISTEntryName

  20. 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

  21. 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

  22. 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

  23. Composite SCL entry • This entry does contain a USECLASS block • All components layed out in Composite-Defintion window are implicitly available • Again, be glad that sensible naming convention was used from components

  24. 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.

More Related