[stringtemplate-interest] Tabular rendering ?

Terence Parr parrt at cs.usfca.edu
Sat Jan 22 12:11:35 PST 2011


On Jan 18, 2011, at 6:34 AM, Daniel Kasmeroglu wrote:
>   private SeatBeltManager     sbmanager;
>   private List                seats;
>   private ARElement           monitoringdevice;
> 
> As you can see the names are aligned in one column. I already know how to generate
> this code (I've simply created a custom renderer which allows to get a spacing
> attribute so the rendering will fill up the strings with whitespace).
> Nevertheless I personally would prefer a more elegant solution, so I would like to know
> if someone knows how to realise this or if there's some kind of "tabular" rendering
> in ST4 ?

Hi Daniel,

Have you looked at the predefined StringRenderer? it eventually calls

        return String.format(formatString, s);

You could do something like

<x; format="%6s">
<y; format="%19s">

Ter


More information about the stringtemplate-interest mailing list