Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 16:33:59 -0200, felipexz  wrote:


Yes of course I agree. But when you have Annotated fields, it can be
instatiated in other classes, can't be ?


Remember: instantiate a class = using the Java "new" operator.


How I would know that it's not already been instatiated ? That's an
annotated field.


Check if it's null:

if (municipio == null) {
...
}

--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 16:02:50 -0200, felipexz  wrote:


Hi Sven.. I read it but the method on"Something" is a convention ?
Sorry but I'm new on Tapestry so I don't know.


Yes: http://tapestry.apache.org/component-events.html


I only found about the "onPrepare" in the wiki
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms


The event names are specific to the components that trigger them. In this  
case, "prepare" is an event triggered by Form.


--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Yes of course I agree. But when you have Annotated fields, it can be
instatiated in other classes, can't be ?
How I would know that it's not already been instatiated ? That's an
annotated field.

I'm justing asking.. as I said I'm a newbie.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117630.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



Re: Beaneditor bug null property error

2012-01-03 Thread Sven Homburg
The prefered convention in java : instantiate an class before work with it.
the documentation advise you only, where it make sense to do this job ;-)

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2012/1/3 felipexz :
> Hi Sven.. I read it but the method on"Something" is a convention ?
> Sorry but I'm new on Tapestry so I don't know.
>
> I only found about the "onPrepare" in the wiki
> http://wiki.apache.org/tapestry/Tapestry5HowToUseForms
>
> So I think if its a convention ok, right. But if not I think it should be in
> the documentation.
>
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117551.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
>

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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi Sven.. I read it but the method on"Something" is a convention ?
Sorry but I'm new on Tapestry so I don't know.

I only found about the "onPrepare" in the wiki
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

So I think if its a convention ok, right. But if not I think it should be in
the documentation.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117551.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



Re: Beaneditor bug null property error

2012-01-03 Thread Sven Homburg
have a look at this page

http://tapestry.apache.org/forms-and-validation.html

""When rendering, the Form component emits two notifications: first,
"prepareForRender", then "prepare". These allow the Form's container
to setup any fields or properties that will be referenced in the form.
For example, this is a good place to create a temporary entity object
to be rendered, or to load an entity from a database to be edited.""

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2012/1/3 felipexz :
> Hi, now its working but I think you should add this "hint" in the
> documentantion and at the Tutorial.
> I know we need to initialize the class but where was my problem.
>
> The working code is:
>
> public class CreateMunicipio
> {
>
>        @Property
>        @Persist
>        private Municipio municipio;
>
>        @Inject
>        private Session session;
>
>        void onPrepare() throws Exception {
>                municipio = new Municipio();
>        }
>
>        @CommitAfter
>        Object onSuccess()
>        {
>                session.merge(municipio);
>                return "";
>        }
>
> }
>
> Now it works. Could you add this onPrepare() in the Tutorial please ? Maybe
> more people can have the same question.
>
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117493.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
>

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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, now its working but I think you should add this "hint" in the
documentantion and at the Tutorial.
I know we need to initialize the class but where was my problem.

The working code is:

public class CreateMunicipio
{

@Property
@Persist
private Municipio municipio;

@Inject
private Session session;

void onPrepare() throws Exception {
municipio = new Municipio();
}

@CommitAfter
Object onSuccess()
{
session.merge(municipio);
return "";
}

}

Now it works. Could you add this onPrepare() in the Tutorial please ? Maybe
more people can have the same question.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117493.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



Re: Beaneditor bug null property error

2012-01-03 Thread Lenny Primak
I Don't see you initializing the municipio variable anywhere in your code. You 
need something like setupRender and initialize it via new if it is null. 

 

On Jan 3, 2012, at 12:14 PM, felipexz  wrote:

> I'm using Tomcat 7 and java 1.7.. its a problem ?
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117434.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
> 

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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
I'm using Tomcat 7 and java 1.7.. its a problem ?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117434.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



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, I think the problem is not about Persistence... the problem is municipio
is coming null. 
Anyway I tryed with session.merge.. anyway it says idMunicipio cannot be
null.

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117425.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



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:50:03 -0200, felipexz  wrote:

I tryed.. after the beaneditor submit it should persist my object.. but  
it comes null.

And I get this error:

Caused by: org.hibernate.PersistentObjectException: detached entity  
passed to persist: com.icms.feam.entities.Municipio


Use Session.merge() instead. persist() can only be used for objects that  
don't exist in the database yet.


--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
I tryed.. after the beaneditor submit it should persist my object.. but it
comes null.
And I get this error:

Caused by: org.hibernate.PersistentObjectException: detached entity passed
to persist: com.icms.feam.entities.Municipio


Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117350.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



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:38:14 -0200, felipexz  wrote:


Hi, thank you Thiago.. the code is this:

public class CreateMunicipio
{

@Property
private Municipio municipio;



When I try to run it.. my object municipio is null in  
CreateMunicipio.class

why ? I'm filling it in my beaneditor page.


If I got your problem right (you haven't said when municipio is null,  
render or for submission), it's null because Tapestry uses  
redirect-after-post and you don't persist the edited object in any way  
(@Persist in the municipio field or page activation context).


Try

@Property
@Persist
private Municipio municipio;

--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi, thank you Thiago.. the code is this:

public class CreateMunicipio
{

@Property
private Municipio municipio;

@Inject
private Session session;


@CommitAfter
Object onSuccess()
{
session.persist(municipio);
return "";
}


}

This is the CreateMunicipio.tml

http://tapestry.apache.org/schema/tapestry_5_3.xsd";>
 
 
 



This is my entity:


@Entity
public class Municipio {
//private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int idMunicipio;

private String bairro;

private String cep;

private String cnpj;

private String complemento;

private String email;

@Temporal( TemporalType.DATE)
private Date mandatoAte;

private String nomePref;

private String numero;

private String rua;

private String senha;


public int getIdMunicipio() {
return this.idMunicipio;
}

public void setIdMunicipio(int idMunicipio) {
this.idMunicipio = idMunicipio;
}

public String getBairro() {
return this.bairro;
}

public void setBairro(String bairro) {
this.bairro = bairro;
}

public String getCep() {
return this.cep;
}

public void setCep(String cep) {
this.cep = cep;
}

public String getCnpj() {
return this.cnpj;
}

public void setCnpj(String cnpj) {
this.cnpj = cnpj;
}

public String getComplemento() {
return this.complemento;
}

public void setComplemento(String complemento) {
this.complemento = complemento;
}

public String getEmail() {
return this.email;
}

public void setEmail(String email) {
this.email = email;
}

public Date getMandatoAte() {
return this.mandatoAte;
}

public void setMandatoAte(Date mandatoAte) {
this.mandatoAte = mandatoAte;
}

public String getNomePref() {
return this.nomePref;
}

public void setNomePref(String nomePref) {
this.nomePref = nomePref;
}

public String getNumero() {
return this.numero;
}

public void setNumero(String numero) {
this.numero = numero;
}

public String getRua() {
return this.rua;
}

public void setRua(String rua) {
this.rua = rua;
}

public String getSenha() {
return this.senha;
}

public void setSenha(String senha) {
this.senha = senha;
}

}

When I try to run it.. my object municipio is null in CreateMunicipio.class
why ? I'm filling it in my beaneditor page.

Best regards



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117326.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



Re: Beaneditor bug null property error

2012-01-03 Thread Thiago H. de Paula Figueiredo

On Tue, 03 Jan 2012 14:19:00 -0200, felipexz  wrote:


I'm sorry but my questions are not cleary ?


Hi!

No, they weren't clear. Please post code and the full stack trace (if  
any). Without them, we can only guess what's happening. ;)


No, tapestry-hibernate doesn't support Hibernate 4 yet, but you can always  
provide your own code if tapestry-hibernate doesn't do what you want. :)


--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Beaneditor bug null property error

2012-01-03 Thread felipexz
I'm sorry but my questions are not cleary ?

Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-sending-null-object-tp5115312p5117279.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



Re: Beaneditor bug null property error

2012-01-03 Thread Howard Lewis Ship
http://catb.org/esr/faqs/smart-questions.html

On Mon, Jan 2, 2012 at 12:11 PM, felipexz  wrote:
> Hi people, good evening. I'm trying to develop an application using
> Beaneditor like the Tapestry tutorial but when I try to persist is in my
> create java page my entity that I @Inject is comming null.
>
> I tryed at first with eclipselink and now with hibernate using Session I got
> same problem. Would it be a bug in the Beaneditor ? I didn't tryed in early
> versions.. Im in 5.3.1
>
> Tapestry 5.3 does support Hibernate 4.0 ?
>
> Thank you
> Best regards
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Beaneditor-bug-null-property-error-tp5115312p5115312.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
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Beaneditor bug null property error

2012-01-03 Thread felipexz
Hi people, good evening. I'm trying to develop an application using
Beaneditor like the Tapestry tutorial but when I try to persist is in my
create java page my entity that I @Inject is comming null.

I tryed at first with eclipselink and now with hibernate using Session I got
same problem. Would it be a bug in the Beaneditor ? I didn't tryed in early
versions.. Im in 5.3.1

Tapestry 5.3 does support Hibernate 4.0 ?

Thank you
Best regards

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Beaneditor-bug-null-property-error-tp5115312p5115312.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



Re: null property

2011-03-06 Thread Thiago H. de Paula Figueiredo
On Sun, 06 Mar 2011 20:39:20 -0300, vdelanno   
wrote:


Even if email is Annotated with persist, the value in the onSuccess is  
null.

But the value is effectively stored for the next display.
I don't expect to have to store the password with a Persist annotation
anyway.


How are you checking if the fields are null? Debugging doesn't always show  
the current field values due to the way Tapestry transforms page and  
component classes. This will be fixed when not in production mode in T5.3.


--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: null property

2011-03-06 Thread vdelanno
Even if email is Annotated with persist, the value in the onSuccess is null.
But the value is effectively stored for the next display. 
I don't expect to have to store the password with a Persist annotation
anyway. Even if I copy paste this page:
http://tapestry.apache.org/input-validation.html
I have the same problem. Would somebody have a solution?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411824.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



Re: null property

2011-03-06 Thread Thiago H. de Paula Figueiredo
On Sun, 06 Mar 2011 17:04:02 -0300, vdelanno   
wrote:



Thqnks for the reply
But I donùt want them to be available accross pages, just from the Form
submit handler.


@Persist doesn't make values available accross pages.

--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: null property

2011-03-06 Thread Josh Canfield
Look at the docs for form.  You don't want to catch action, you probably
want success or validate
On Mar 6, 2011 12:04 PM, "vdelanno"  wrote:
> Thqnks for the reply
> But I donùt want them to be available accross pages, just from the Form
> submit handler. RIght now, in the onActionFromLoginForm, loginPassword and
> loginEmail are null, whatever the value I enter in the input.
> Am I wrong? I shouldnùt have to persist the values just to use them in the
> submit handler
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411708.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
>


Re: null property

2011-03-06 Thread vdelanno
Thqnks for the reply
But I donùt want them to be available accross pages, just from the Form
submit handler. RIght now, in the onActionFromLoginForm, loginPassword and
loginEmail are null, whatever the value I enter in the input.
Am I wrong? I shouldnùt have to persist the values just to use them in the
submit handler 

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411708.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



Re: null property

2011-03-06 Thread Josh Kamau
Hi

If you want the values to be retained accross pages ,  Use @Persist
annotation on the pages

   @Property
   @Persist
   private String loginEmail;

   @Property
   @Persist
   private String loginPassword;

kind regards.


Re: null property

2011-03-06 Thread vdelanno
Sorry for double posting. But this time, the formatting should be ok

Hi all,

I'm new to Tapestry, and I have a problem with a simple Login form. When in
the OnSubmit callback of the form, the  login and pasword fields are empty.
Could someone help me at least understand why?
Here is my loginForm class:


vdelanno wrote:
> 
> 
> public class LoginForm {
>   
>   @Persist(PersistenceConstants.FLASH)
>   private String loginMessage;
>   
>   @Property
>   private String loginEmail;
>   
>   @Property
>   private String loginPassword;
>   
> @Component
> private Form loginForm;
> 
>   @Inject
>   private Authenticator authenticator;
> 
>
> public Object onActionFromLoginForm() {
> try {
> authenticator.login(loginEmail, loginPassword);
> return Index.class;
> } catch (AuthenticationException ex) {
>   setLoginMessage("Invalid user name or password.");
> }
> return null;
> 
> }
> 
>   public void setLoginMessage(String loginMessage)
>   {
>   this.loginMessage = loginMessage;
>   }
> 
>   public String getLoginMessage() {
>   if (loginMessage != null) {
>   return loginMessage;
>   } else {
>   return " ";
>   }
>   }
>   
> }
> 

here is the loginForm template


vdelanno wrote:
> 
> 
> 

>   
>   

>   ${loginMessage}
>   

>   

>   
>   
>   

>   

>   
>   
>   

>   

>   
>   

>   
> 

> 
> 
> 
> 


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411646.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

null property

2011-03-06 Thread vdelanno
Hi all,

I'm new to Tapestry, and I have a problem with a simple Login form. When in
the OnSubmit callback of the form, the  login and pasword fields are empty.
Could someone help me at least understand why?
Here is my loginForm class:

public class LoginForm {

@Persist(PersistenceConstants.FLASH)
private String loginMessage;

@Property
private String loginEmail;

@Property
private String loginPassword;

@Component
private Form loginForm;

@Inject
private Authenticator authenticator;

   
public Object onActionFromLoginForm() {
try {
authenticator.login(loginEmail, loginPassword);
return Index.class;
} catch (AuthenticationException ex) {
setLoginMessage("Invalid user name or password.");
}
return null;

}

public void setLoginMessage(String loginMessage)
{
this.loginMessage = loginMessage;
}

public String getLoginMessage() {
if (loginMessage != null) {
return loginMessage;
} else {
return " ";
}
}

}

here is the loginForm template






${loginMessage}
























--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411636.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



Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-07-10 Thread Marcus Veloso
Hi Howard,
> "In fact, if you look at the rendered URL you'll see that every time
> the Image component rendered, it rendered the same URL."

Yes, it's always the same image (the last one) in grid component.

> "The solution is to use event context to identify the book, or in some
> other way, identify where the data stream is supposed to come from."

Sorry, but i can't figured this out.
Perhaps you can elaborate the solution?

Here is the "relevant" code:
[
http://www.nabble.com/-T5.1--Using-a-custom-image-component-inside-a-Grid-td24421215s302.html]

Regards,

Marcus Veloso


Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-19 Thread Howard Lewis Ship
It's very simple.

When the Grid component renders, it is keeping the book property up-to
date as the components in its body render.  Thus, if you look at the
rendered output, you'll see an  element and a URL that references
the component and the displayImage custom event.

Now what happens when that URL is triggered?

The Image component attempts to read the book property and
de-reference the binaryStream property.  Well, it was the Grid
components job to keep the book property up-to date *while it was
rendering*, but the Grid component isn't rendering in this new
request.

In fact, if you look at the rendered URL you'll see that every time
the Image component rendered, it rendered the same URL.  How is it
supposed to know from that which book's image to stream to the client?

The solution is to use event context to identify the book, or in some
other way, identify where the data stream is supposed to come from.

On Thu, Feb 19, 2009 at 8:05 AM, Iren Tuna  wrote:
>
> If there are no other ideas, whether it should work or not (and why), the way
> I have done it, aside from the alternative solution hints, maybe I should
> try to create a bug issue in T5 jira. For me it is still not clear, why it
> does not work. Any other ideas?
>
> --
> iren
>
>
>
> Thiago H. de Paula Figueiredo wrote:
>>
>> On Sun, Feb 15, 2009 at 8:21 AM, Otho  wrote:
>>> One possible solution is to store the images in the filesystem instead of
>>> the database and store only the filename in the db from where you can
>>> construct a path. But I think that isn't compatible with your
>>> requirements?
>>
>> Maybe a better solution would be to provide an Asset binding (like
>> context and classpath) and AssetFactory, both pulling the images from
>> the database.
>>
>> --
>> Thiago
>>
>>
>
> --
> View this message in context: 
> http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2353720.html
> Sent from the Tapestry Users 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
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-19 Thread Iren Tuna

If there are no other ideas, whether it should work or not (and why), the way
I have done it, aside from the alternative solution hints, maybe I should
try to create a bug issue in T5 jira. For me it is still not clear, why it
does not work. Any other ideas?

--
iren



Thiago H. de Paula Figueiredo wrote:
> 
> On Sun, Feb 15, 2009 at 8:21 AM, Otho  wrote:
>> One possible solution is to store the images in the filesystem instead of
>> the database and store only the filename in the db from where you can
>> construct a path. But I think that isn't compatible with your
>> requirements?
> 
> Maybe a better solution would be to provide an Asset binding (like
> context and classpath) and AssetFactory, both pulling the images from
> the database.
> 
> -- 
> Thiago
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2353720.html
Sent from the Tapestry Users 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



AW: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-16 Thread Iren Tuna
OK, thanks for the alternative solution hints. They can be always implemented. 
However, the question is, whether it should work or not (and why), the way I 
have done it. It seemed to me that it should have worked so, but did not. Any 
other ideas?

--
iren



-Ursprüngliche Nachricht-
Von: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] 
Gesendet: Sonntag, 15. Februar 2009 12:47
An: Tapestry users
Betreff: Re: [T5.0.18] Bug? : Null property problem with the custom component 
inside a grid

On Sun, Feb 15, 2009 at 8:21 AM, Otho  wrote:
> One possible solution is to store the images in the filesystem instead of
> the database and store only the filename in the db from where you can
> construct a path. But I think that isn't compatible with your requirements?

Maybe a better solution would be to provide an Asset binding (like
context and classpath) and AssetFactory, both pulling the images from
the database.

-- 
Thiago

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



Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-15 Thread Thiago H. de Paula Figueiredo
On Sun, Feb 15, 2009 at 8:21 AM, Otho  wrote:
> One possible solution is to store the images in the filesystem instead of
> the database and store only the filename in the db from where you can
> construct a path. But I think that isn't compatible with your requirements?

Maybe a better solution would be to provide an Asset binding (like
context and classpath) and AssetFactory, both pulling the images from
the database.

-- 
Thiago

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



Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-15 Thread Otho
You are right.

I tried it out and came to the same result. The Image component works
everywhere except within a t:loop. It seems, that the PropertyConduitSource
is the reason for that. Is it possible, that one has to supply a custom
translator for byte[] ?

One possible solution is to store the images in the filesystem instead of
the database and store only the filename in the db from where you can
construct a path. But I think that isn't compatible with your requirements?

Otho

2009/2/14 Iren Tuna 

>
> Hi,
>
> @Persist is already there on "books". Anyway, I have no problem with the
> listing of the search results. Only the images in the grid are not
> displayed, because of this "null property" problem. I have already tried
> @Persist on the "book" property (row object of the grid) in the Search
> page,
> too. In this case, the images are indeed displayed, but then in the image
> cells of all books only the image of the last book in the result list. I
> mean, if there are 3 books, three times the image of the last book, which
> is
> for me somehow comprehensible (not totally yet, though :-)).
>
> Thanks anyway for the reply.
> iren
>
>
>
>
> Otho wrote:
> >
> > Maybe some problem in the setup of the grid page?
> >
> > Like forgetting the @Persist on the books list?
> >
> > Otho
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2326447.html
> Sent from the Tapestry Users 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
>
>


Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-14 Thread Iren Tuna

Hi,

@Persist is already there on "books". Anyway, I have no problem with the
listing of the search results. Only the images in the grid are not
displayed, because of this "null property" problem. I have already tried
@Persist on the "book" property (row object of the grid) in the Search page,
too. In this case, the images are indeed displayed, but then in the image
cells of all books only the image of the last book in the result list. I
mean, if there are 3 books, three times the image of the last book, which is
for me somehow comprehensible (not totally yet, though :-)).

Thanks anyway for the reply.
iren




Otho wrote:
> 
> Maybe some problem in the setup of the grid page?
> 
> Like forgetting the @Persist on the books list?
> 
> Otho
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2326447.html
Sent from the Tapestry Users 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



Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-14 Thread Otho
Maybe some problem in the setup of the grid page?

Like forgetting the @Persist on the books list?

Otho


[T5.0.18] Bug? : Null property problem with the custom component inside a grid

2009-02-13 Thread Iren Tuna

Hello,

I have implemented a custom component to display (Blob) images. While it
works without a problem inside BeanEditForm and BeanDisplay, inside a Grid a
NullPointerException occurs while trying to pass a property of the actual
object (row) at the grid as a parameter to the component.

The relevant parts of the code:

Image.java (component)
**
public class Image
{
...
@Parameter
private Blob data;

public Link getSrc()
{
return resources.createEventLink("displayImage", new Object[]{});
}

StreamResponse onDisplayImage()
{
return new StreamResponse() {
public String getContentType()
{
return "image/jpeg";
}

public InputStream getStream() throws IOException
{
try {
return data.getBinaryStream();
}
catch (SQLException e) {
throw new IllegalArgumentException(e);
}
}

public void prepareResponse(Response response)
{
}
};
}
}

Image.tml
***
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
< img ... src="${src}"...>



Edit.tml (page)
***
...



...

...

In this page (Edit.tml) there is no problem, and the mediumImage of the book
is passed successfully to the Image component, and displayed. However,
below...


Search.tml (page)
*
...





${book.title}


 
   * ${author.name}
 


...

Here (Search.tml), inside the Grid, always NullPointerException is thrown
with the message: "Property 'book' is null in (book.smallImage)". While
there is no problem with the "book.id", "book.title", "book.authors"...

Might this be somehow a problem in tapestry, or am I missing sth. (which is
perhaps more probable)?

Thanks a lot,
iren
-- 
View this message in context: 
http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2324166.html
Sent from the Tapestry Users 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