[prev in list] [next in list] [prev in thread] [next in thread]
List: velocity-user
Subject: Re: Possible to align strings?
From: Johannes Homuth <johannes.homuth () sourcepark ! de>
Date: 2010-12-01 15:18:31
Message-ID: 4CF66747.8080606 () sourcepark ! de
[Download RAW message or body]
Nice, thats what I'm was looking for.
Thank you Claude!
Claude Brisson wrote:
> Yes, there is. You have to put a DisplayTool in your velocity context.
>
> Check the cell() method in:
>
> http://velocity.apache.org/tools/releases/2.0/javadoc/org/apache/velocity/tools/generic/DisplayTool.html \
>
>
> You would typically write: $disp.cell($jobinfo.localNameOfJobInXml,30)
>
>
> Claude
>
>
> On 01/12/2010 15:56, Johannes Homuth wrote:
> > Hi everybody
> >
> > I want to use velocity to create a "let's say" table. Therefore I
> > have a created a simple template.
> >
> > ================================================================================
> >
> > ENGINE STATE
> > ================================================================================
> >
> > Jobname | Execution State | Duration
> > --------------------------------------------------------------------------------
> >
> > #foreach( $jobinfo in $infoList )
> > $jobinfo.localNameOfJobInXml | $jobinfo.executionState |
> > $jobinfo.executionDuration
> > --------------------------------------------------------------------------------
> >
> > #end
> > ================================================================================
> >
> >
> > Everything allright so far, but now I want to align the strings. The
> > inserted values for the variables in the template don't
> > have the same length. So the generated output looks like this
> >
> > ....
> > Jobname | Execution State | Duration
> > --------------------------------------------------------------------------------
> >
> > CheckDclStatusJob | EXECUTED_WITH_ERRORS | 00:00:00
> > --------------------------------------------------------------------------------
> >
> > PcImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
> > --------------------------------------------------------------------------------
> >
> > OeImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
> > --------------------------------------------------------------------------------
> >
> > ....
> >
> > Looks like crap! Thats why I want to align the strings. Is there
> > anything like String.format("%-20s",test) which reserves a number of
> > columns of a String?
> >
> >
> > Output should be something like this
> >
> > ....
> > Jobname | Execution State |
> > Duration
> > --------------------------------------------------------------------------------
> >
> > CheckDclStatusJob | EXECUTED_WITH_ERRORS | 00:00:00
> > --------------------------------------------------------------------------------
> >
> > PcImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
> > --------------------------------------------------------------------------------
> >
> > OeImportJob | NOT_EXECUTED_FAILED_DEPENDENCY | --:--:--
> > --------------------------------------------------------------------------------
> >
> > ....
> >
> >
> > Thx for sugestions
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
--
B.Sc. Johannes Homuth
-------------------------------------------------------
SOURCEPARK GmbH
Helmholtzstr. 2-9, Gebäude M
10587 Berlin
Tel.: +49 (0) 30 / 39 80 68 30
Fax: +49 (0) 30 / 39 80 68 39
e-mail: jhomuth@sourcepark.de
www: www.sourcepark.de
------------------------------------------------------
SOURCEPARK GmbH
Sitz der Gesellschaft: Berlin / Amtsgericht Charlottenburg
HRB 80254
Geschäftsführung: Matthias Barmeier, Harald Dürr
------------------------------------------------------
Diese Email kann vertrauliche und/oder rechtlich geschützte Informationen
enthalten. Wenn sie nicht der richtige Adressat sind oder diese E-Mail irr-
tümlich erhalten haben, informieren Sie bitte sofort diesen Absender und ver-
nichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser E-Mail ist nicht gestattet.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic