Date: Tue, 22 Dec 2009 17:11:59 -0500
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: SAS/AF: Adjust Row Height in Table Viewer
In-Reply-To: <6a24f981-669b-4bc9-be16-a2a57aa7e823@o19g2000vbj.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
This is a very nicely constructed teaching lesson! Merry Christmas!
On Tue, Dec 22, 2009 at 5:05 PM, Richard A. DeVenezia
<rdevenezia@gmail.com>wrote:
> > >-----Original Message-----
> > >From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
> Paul
> > Walker
> > >Sent: Thursday, December 03, 2009 12:26 PM
> > >To: SA...@LISTSERV.UGA.EDU
> > >Subject: SAS/AF: Adjust Row Height in Table Viewer
> >
> > >Is it possible to adjust the row height either for specific rows or for
> > >all rows in a table viewer?
> >
> > >The current behavior is that row heights are established automatically
> > >according to the contents in the cells of that row. However, on UNIX
> this
> > >sizing is not done very accurately, and the row height is much larger
> than
> > >it need be. I would like to set a reduced row height for some rows, or
> a
> > >uniform row height for all the rows. Is this possible?
> >
> > >I could not find any attribute or method of the table viewer which
> > >controlled the row height.- Hide quoted text -
>
> Paul:
>
> For this discussion, class names as found in the help files are
> doubled quoted to separate them from surrounding text.
>
> The "Table Viewer Control" is used to render information provided by
> and according to an attached "Data Model".
> The "SAS Data Set Model" is one such model that is most often used,
> and the attachment is made at build time by dropping the model
> component onto a table viewer.
>
> The "SAS Data Set Model" is a realizing subclass of the abstract class
> "Data Model".
> "Data Model" has the interface "Data Model Interface". The interface
> is a list of methods that a realizing subclass must implement.
>
> Amongst the methods in the "Data Model Interface" is "_getRowInfo".
> _getRowInfo is utilized by the table viewer (or perhaps its
> controller) to obtain (from the model) information about the row it is
> rendering.
> The information is passed by way of a "Row/Column Data Vector
> Class" (rcdvec) argument.
>
> The rcdvec stores a wide variety of context and content (position,
> format and display) parameter settings. If you read the docs it looks
> like many of the parameters are the same ones that can be set in
> ModelSCL via the "SAS Data Set Model" _SetViewerAttribute method.
> Unfortunately, not all rcdvec parameters are surfaced by the method.
>
> So, somewhere in the proprietary bowels of the table viewer & data
> model system a call
> <data-model>._getRowInfo ( <rcdvecid> )
> occurs.
>
> Your mission is to override the data models _getRowInfo and force it
> to perform the row height adjustment you want.
>
> In this sample, the adjustment is to make every fifth row one inch
> high.
>
> Consider a frame with a Table Viewer and attached Data Model.
>
> In the frame SCL init section override the data models _getRowInfo
>
> ------ mylib.mycat.myframe.scl -----
> init:
> sasdataset1._setInstanceMethod
> ( '_getRowInfo' /* method to override */
> , 'mylib.mycat.myoverrides.scl' /* override scl entry */
> , 'getRowInfo' /* override method name */
> );
> return;
> ---------------------------
>
> In a separate SCL place the override code (be sure to compile the SCL)
> ----- mylib.mycat.myoverrides.scl -----
> declare sashelp.classes.datamodel_c _self_ = _self_;
> declare char _method_ = _method_;
>
> /* Override of _getRowInfo */
>
> getrowinfo:
>
> method o_rcdvec:input:sashelp.fsp.rcdvec.class;
>
> * ensure default behaviour;
>
> call super(_SELF_,_method_,o_rcdvec);
>
> /* _getCoordinates returns the row dimension indices
> * because this is _getRowInfo override
> *
> * in a plain table a row is 1-dimensional, so coords will have
> listlen 1
> * in a mddb table a row is n-dimensional, so coords would have
> listlen n
> */
>
> declare list coords = {};
>
> o_rcdvec._getCoordinates_(coords);
>
> rownum = getitemn(coords,1);
> coords = dellist (coords);
>
> /* conditionally tweak the row height */
>
> if mod(rownum,5) = 0 then
> o_rcdvec._setDimension(1.0,'in');
>
> endmethod;
> ---------------------------
>
>
> Richard A. DeVenezia
> http://www.devenezia.com
>
|