You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by kamath_svk <ka...@yahoo.co.in> on 2010/10/14 13:49:13 UTC

how to format Calendar object inside Grid component ?

Hello All,

I am using Tapestry 5.0.1.5.


please don't tell me to change the version as i need to use the same version
5.0.1.5 & calendar object itself.

i have a requirement where i am using java's calendar
object(java.util.Calendar) to store dateOfBirth.
@DataType("dateOfBirth")
private Calendar dateOfBirth;


in one class i create a calendar object as & set it to celebrity object

Calendar cal = Calendar.getInstance();
cal.set(2000, 10, 21);//year , month, date

I am using a grid to display all the contents 
<t:grid t:source="allCelebrities" rowsperPage="10" row="celebrity"
	add="delete" exclude="id"
	reorder="lastName,firstName,dateOfBirth,occupation">
	<t:parameter name="lastNameCell">
		<t:ActionLink t:page="details" t:context="celebrity.id"
			t:id="detailsLink">
	${celebrity.lastName}
			</t:ActionLink>
	</t:parameter>
	
<!--	
<t:parameter name="dateOfBirthCell">
	celebrity.dateOfBirth
	<tx:datefield t:id="celebrity.dateOfBirth"/>
	<t:output format="literal:MMM yyyy" value="celebrity.dateOfBirth"/>
</t:parameter>
	-->
	
	
	
	<t:parameter name="deleteCell">
		<t:ActionLink t:id="deleteRecord"
t:context="celebrity.id">Delete</t:ActionLink>
	</t:parameter>
</t:grid>



i want to know how to format the java's calendar object in tapestry ?
i tried to format using 
1. "<t:output format="literal:MMM yyyy" value="celebrity.dateOfBirth"/>" &
2. "<tx:datefield t:id="celebrity.dateOfBirth"/>" with 
xmlns:tx="tapestry-library:tapx"

both are giving errors.
if i don't format(don't give anything) i am getting the value as 
"java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2000,MONTH=10,WEEK_OF_YEAR=42,WEEK_OF_MONTH=3,DAY_OF_MONTH=21,DAY_OF_YEAR=287,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=7,SECOND=47,MILLISECOND=191,ZONE_OFFSET=19800000,DST_OFFSET=0]"





-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-format-Calendar-object-inside-Grid-component-tp3211934p3211934.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: how to format Calendar object inside Grid component ?

Posted by kamath_svk <ka...@yahoo.co.in>.
thank you ....

that worked...
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-format-Calendar-object-inside-Grid-component-tp3211934p3212001.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: how to format Calendar object inside Grid component ?

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 14.10.2010 13:49, kamath_svk wrote:

> i want to know how to format the java's calendar object in tapestry ?
> i tried to format using 
> 1. "<t:output format="literal:MMM yyyy" value="celebrity.dateOfBirth"/>" &
> 2. "<tx:datefield t:id="celebrity.dateOfBirth"/>" with 
> xmlns:tx="tapestry-library:tapx"

Try a simple string:

| <t:parameter name="dateOfBirthCell">
| 	${birthDate}
| </t:parameter>

| public String getBirthDate() {
| 	SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
|	return format.format(celebrity.getDateOfBirth().getTime());
| }

HTH
 Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: how to format Calendar object inside Grid component ?

Posted by kamath_svk <ka...@yahoo.co.in>.
i even tried with tapestry v 5.0.18.

unable to format Calendar. Inside Grid, Date is working properly but i
cannot change code as it is used in many other places. i need to find a
solution with Calendar object itself
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-format-Calendar-object-inside-Grid-component-tp3211934p3211941.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org