Re: Missing ValueEncoder for java.util.Calendar

2011-08-11 Thread Eric Torti
Hi, Thiago,

I'm tackling the construction of a Calendar Value Enconder and, as you've
said it, the javadocs are pretty much it :]

I didn't get though how do I address localization issues. For example, if
the String received as a parameter for the toValue(...) method and it is
formatted according to pt_BR the month will be in place of the day regarding
the default behavior as localized by en_US.

Is it the best approach to implement the value encoder to address Strings as
en_US formatted?

Thanks again,

Eric Torti

On Thu, Aug 11, 2011 at 2:28 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 11 Aug 2011 12:45:16 -0300, Eric Torti 
> wrote:
>
>  Thank you, Thiago!
>>
>
> You're welcome!
>
>
>  Normally I prefer to use Calendar, so I'll try to provide a value encoder
>> for that type on my project. Do you know of any implementation for that or
>> something similar? I've googled it with no success :]
>>
>
> Just read the ValueEncoder JavaDoc implementation. That's everything you
> need.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Missing ValueEncoder for java.util.Calendar

2011-08-11 Thread Eric Torti
Thank you, Thiago!

Normally I prefer to use Calendar, so I'll try to provide a value encoder
for that type on my project. Do you know of any implementation for that or
something similar? I've googled it with no success :]

On Thu, Aug 11, 2011 at 12:36 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 11 Aug 2011 11:50:20 -0300, Eric Torti 
> wrote:
>
>  Hello, guys!
>>
>
> Hi!
>
>
>  Do I have to provide a value encoder for Calendar, or am I missing
>> something on the configuration of the project? I've searched around the docs
>> but
>> didn't quite get it.
>>
>
> As far as I know having editable class fields with Calendar type is quite
> rare (java.util.Date used instead), so that's probably why Tapestry doesn't
> provide a ValueEncoder for it out-of-the-box..
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Missing ValueEncoder for java.util.Calendar

2011-08-11 Thread Eric Torti
Hello, guys!

I have a beaneditform that's used to create and update instances of one of
the models on my app. When it's used to create and persist the instaces I
have no problem. But when it comes to editing them as on
domain.com/project/somebean/edit/10, instead of rendereing the form with the
loaded properties, the page displays an error regarding the absence of a
value encoder for java.util.Calendar.

Naturally, the bean I'm trying to update has a Calendar property.

Do I have to provide a value encoder for Calendar, or am I missing something
on the configuration of the project? I've searched around the docs but
didn't quite get it.

I could provide source if you find it to be appropriate.

Thanks,

Eric Torti


Reusing form from CreateSomeBean on EditSomeBean

2011-08-10 Thread Eric Torti
Hello, guys,

I`m trying to reuse the beaneditform I`ve came up with for one of my pages,
whose responsibility is to CreateSomeBean. I would like to make the core
form a compontent so that I could use it either on the CreateSomeBean as on
the EditSomeBean page.

Is there a tutorial or how to that points out how this can be accomplished?

Thanks,

Eric Torti


Re: t:grid showing pager but not data

2011-08-09 Thread Eric Torti
Sorry, noob`s mistake :]

I was missing the getters on the model that represents the rows on the grid.

Thanks.

Eric Torti

On Tue, Aug 9, 2011 at 6:49 PM, Eric Torti  wrote:

> Hello, guys,
>
> I`m using a  grid element, as in:
>
> 
>
> To show a bean`s property which is a list. The pager is rendered but not
> the data itself. So no rows appear.
>
> On the same page I have  working as
> expected. I thought it might have something to do with hibernate lazy
> loading the list, but if that was the case, the pager would not appear,
> right?
>
> Would you happen to know what may I be doing wrong?
>
> Thanks,
>
> Eric
>


t:grid showing pager but not data

2011-08-09 Thread Eric Torti
Hello, guys,

I`m using a  grid element, as in:



To show a bean`s property which is a list. The pager is rendered but not the
data itself. So no rows appear.

On the same page I have  working as
expected. I thought it might have something to do with hibernate lazy
loading the list, but if that was the case, the pager would not appear,
right?

Would you happen to know what may I be doing wrong?

Thanks,

Eric


Re: T5 - using t:select nested inside beaneditform

2011-08-07 Thread Eric Torti
Ok, Vangel, thanks. Problem solved!

I`m going to move on to your proposition of using t:selectObject. In the
event of me getting stuck :] I`ll post the problems on a new thread.

Thank you for the help. I greatly appreciated it.

Eric Torti

On Sun, Aug 7, 2011 at 8:38 AM, Vangel V. Ajanovski  wrote:

> On 08/07/2011 06:31 AM, Eric Torti wrote:
>
>> 
>> > model="contratanteSelectModel" />
>> 
>> ...
>>
> You have to use the "add" parameter in beaneditform for each manytoone
> property, and then use   to wrap the select (or any other custom
> html to be shown for this property.
>
> Just copy the structure from my example and change selectobject with simple
> select.
>
>


Re: T5 - using t:select nested inside beaneditform

2011-08-06 Thread Eric Torti
Thanks again, Vangel!

I`m trying the simplest approach as described on the docs page (the choosing
colors example). But when the page renders, the form is displayed without
the select element.

If you could please have a look at my code, I`ll provide it here. I`ve kept
the domain in portuguese (my native language) to avoid any typos in the
transcription. But if necessary I could translate it.

The page class (NovoAtestado.java):

public class NovoAtestado {

@Property
private Atestado atestado;

@Property
private SelectModel contratanteSelectModel;

@Property
private Long selectedContratanteId = 1L;
...
void setupRender(){
List contratantes = contratanteDao.listaTodos();
contratanteSelectModel = selectModelFactory.create(contratantes,
"nome");
 }
}

The page template (NovoAtestado.tml):
...



...

The beaneditform main bean model (Atestado.java):

@Entity
public class Atestado {

@NonVisual
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;

@ManyToOne
private Contratante contratante;
...
}

The ManyToOne model (Contratante.java)

@Entity
public class Contratante {
@NonVisual
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
 private Long id;

private String nome;

@Override
public String toString() {
return id.toString();
}
}

Do you notice anything wrong? Thank you.

Eric Torti


On Sat, Aug 6, 2011 at 9:18 PM, Vangel V. Ajanovski  wrote:

> On 08/06/2011 04:46 PM, Eric Torti wrote:
>
>> The only doubt I still have is whether the  tag is
>> supposed to work nested inside the  tag.
>>
> The bean model does not automatically create fields for the ManyToOne
> links, so they are not like standard part of the BeanEditForm, but I "add"
> virtual fields for them and proceed like this (just a piece of working tml
> in our app):
>
> t:submitlabel="message:save" t:exclude="instructorID"
>t:reorder="person, institution, fromDate, toDate"
>t:add="person,institution">
> 
> 
> labelField="literal:lastName '\s' firstName '\s'
> userName"
>keyField="literal:personId" blankOption="NEVER"
> />
> 
> 
> 
> value="newInstructor.**institution"
> labelField="literal:title"
>keyField="literal:**institutionId"
> blankOption="NEVER" />
> 
> 
>
> But, have in mind that the doc from the wiki does not do all of what I
> said, as I have made some additional changes (like for example the
> "keyField"). But you can try to read the source carefully and customize it
> depending on what exactly you need.
>
>


Re: T5 - using t:select nested inside beaneditform

2011-08-06 Thread Eric Torti
Thank you, Vangel,

That`s exactly the case! I`ll have a look at the docs you provided and have
a go at it.

The only doubt I still have is whether the  tag is
supposed to work nested inside the  tag.

Thanks. I`ll provide feedback as soon as I get to experiment with your
suggestion.

Eric

On Sat, Aug 6, 2011 at 11:01 AM, Vangel V. Ajanovski  wrote:

> On 08/06/2011 02:54 PM, Eric Torti wrote:
>
>> Thank you, based2.
>>
>> I am following the jumpstart examples. But in my case, the property I need
>> to choose from a t:select is not an enum. It`s a complex type.
>>
> Official documentation has the easiest way if your situation is not very
> complex.
> https://tapestry.apache.org/**using-select-with-a-list.html<https://tapestry.apache.org/using-select-with-a-list.html>
>
> For more complex cases (in fact always) I use this component:
> https://wiki.apache.org/**tapestry/Tapestry5SelectObject<https://wiki.apache.org/tapestry/Tapestry5SelectObject>
>
> I have added few modifications to it so that it will work even more
> generic.
>
> For your example with my modification, the component can be used like this:
> t:id="selectProduct"
>list="productList"
>value="selectedProduct"
>labelField="literal:**productName '\s-\s' price '\s-\s' category.name"
>keyField="literal:productId"
> />
>
> What it will do?
>
> For example, let's say that "Products" is a database @Entity and if you
> have "@Property List productList" in the background java, and you
> have "productName" and "price" in each Product, and you have a "@ManyToOne"
> link to Category (also an @Entity) and you have "name" in "Category".
>
> The select list will look like this (look into the labelField)
> LG LC51 - $500 - TV
> Nokia E71 - $100 - Mobile
>
> And the behind html values linked to each element will be taken from the
> primary key of Product (look into keyField).
>
> If this is what you want to do, I can send you the code with full
> modification (our subversion host is down at the moment). Maybe I should
> post these modifications on the Wiki, but there were some comments that in
> general this is not a very good approach.
>
>


Re: T5 - using t:select nested inside beaneditform

2011-08-06 Thread Eric Torti
Thank you, based2.

I am following the jumpstart examples. But in my case, the property I need
to choose from a t:select is not an enum. It`s a complex type.

The t:beaneditform should generate the select all by itself?

Thanks

Eric

On Sat, Aug 6, 2011 at 4:44 AM, based2  wrote:

>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/morecontroledit1/1
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-using-t-select-nested-inside-beaneditform-tp4671749p4671987.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


T5 - using t:select nested inside beaneditform

2011-08-05 Thread Eric Torti
Hello, guys,

I`m struggling to get a beaneditform to show a t:select element.

I`ve accomplished the creation of the GenericSelectModel but I
don`t know if I`m on the right track. My template reads as follows:








The form is displayed but no  is rendered.

Is this the right way to go? Any help will be greatly appreciated.

Thanks