velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Homuth <johannes.hom...@sourcepark.de>
Subject Possible to align strings?
Date Wed, 01 Dec 2010 14:56:39 GMT
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

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


Mime
View raw message