You could use a DataTypeAnalyzer instead of a DefaultDataTypeAnalyzer.
This way, you have more control.
Em Wed, 04 Nov 2009 14:08:08 -0200, Martin Reurings <mar...@windgazer.nl>
escreveu:
Hi Uli and/or anybody else reading this,
Could you help me some more? I ran into an unexpected problem :) There
is a known editor-block for Joda DateTime, however, there is no known
view-block?!? When I added the following:
/**
* This method is used to add aditional editors / views to the Grid
and BeanEditor components.
* @param configuration
*/
@SuppressWarnings("unchecked")
public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
{
configuration.add(DateTime.class, "jodaTime");
}
public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
{
configuration.add(new BeanBlockContribution("jodatime",
"AppPropertyViewBlocks", "jodatime", false));
}
And the appropriate stuff in AppPropertyViewBlocks.java and .tml I was
able to view the DateTime properties on my Pojo, yay! However, this came
with an unexpected side-effect, another Pojo which contained a DateTime
field is using a BeanEditor, which was able to generate an editor for
the DateTime field and is now throwing 'Unable to locate a block to edit
property 'dateAccountCreated' (with data type 'jodaTime')' :( Any
thoughts on how I can add the viewer without killing the editor?
Cheers,
Martin
Ulrich Stärk wrote:
I just noticed that the page I referred to is missing some things:
If you just want to display (output) a property, inject the
PropertyOutputContext environmental service instead of the
PropertyEditContext. Also you might want to put your block on a page
called AppPropertyDisplayBlocks instead of AppPropertyEditBlocks (in
the end this doesn't matter since you can configure that in your
contribution to the BeanBlockSource service). Acquiring the actual
value of your property is then done with (DateTime)
context.getPropertyValue().
Uli
Am 04.11.2009 14:36 schrieb Ulrich Stärk:
That's because Tapestry doesn't know how to display
org.joda.time.DateTime. Provide a block that knows how to display a
DateTime on some page and contribute that block to the BeanBlockSouce
service (see [1] for an example).
Uli
[1] http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html
Am 04.11.2009 14:20 schrieb Martin Reurings:
Hi everybody,
I've been using T5 quite a while now but only recently started making
serious use of the Grid and BeanEditor (finally giving way to my
misgivings concerning some of the html-output in favor of development
speed). But, now that I've started using Grid I ran into something I
can't quite grasp. I have a Pojo with a reasonable set of getters and
setters, however, Grid only accepts 'public Long getId()' to be a
property, while 'public DateTime getDateCreated()' is ignored?!?
I wouldn't mind as much if it were just one field, but since we use
'org.joda.time.DateTime' a lot in our project I figured I'd be better
of figuring out what's going on and solve it now, rather than
later... Any ideas what might be going on? Any links / concepts I
should start looking at / googling for, to solve this elegantly?
Oh, and before I forget, this is how I declared my grid:
@Component(id = "pojos", parameters =
{"source=ucw.pojos","row=pojo","add=dateCreated"})
private Grid _pojosComponent;
Where ucw.pojos is returning a List of Pojo's and for testing
purposes I was storing the pojo in a property so I could test if I
was able to generate output of the dateCreated even though the Grid
was ignoring it, which turned out successful:
<p:dateCreatedCell>
${pojo.dateCreated}
</p:dateCreatedCell>
Cheers,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da
Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com
Ênfase em Java da Faculdade Pitágoras
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org