Encoder may not be instantiated directly.

2008-09-27 Thread Keith Bottner
I am trying to use a bundle a select component for the specific case  
of displaying a list of countries and from the all the documentation  
that I have run across and I always get an exception when the page is  
rendered. It says:


Component class com.shared.base.CountryEncoder may not be instantiated  
directly. You should use an @InjectPage or @InjectComponent annotation  
instead.


Code is below, any help is appreciated.

public class CountryEncoder implements ValueEncoderCountry
{

  public String toClient( Country value )
  {
if (null == value) return null;

return value.getName();
  }

  public Country toValue( String clientValue )
  {
if (InternalUtils.isBlank(clientValue)) return null;

return DAO.getCountry(clientValue);
  }

}

public class CountryOptionModel implements OptionModel
{
  Country country;

  public CountryOptionModel(Country country)
  {
this.country = country;
  }

  public String getLabel()
  {
return country.getName();
  }

  public Object getValue()
  {
return country;
  }

  public MapString, String getAttributes()
  {
return null;
  }

  public boolean isDisabled()
  {
return false;
  }
}

public class CountrySelectModel implements SelectModel
{
  private ListCountry countries;

  public CountrySelectModel()
  {
countries = DAO.getCountries();
  }

  public ListOptionGroupModel getOptionGroups()
  {
return null;
  }

  public ListOptionModel getOptions()
  {
if (null != countries)
{
  ListOptionModel options = new ArrayListOptionModel();
  for (Country c : countries)
  {
options.add(new CountryOptionModel(c));
  }
  return options;
}

return null;
  }

  public void visit( SelectModelVisitor visitor )
  {
  }
}

public class CountrySelect
{
  private Country selectedCountry;

  public Country getSelectedCountry()
  {
return selectedCountry;
  }
  public void setSelectedCountry(Country country)
  {
selectedCountry = country;
  }

  public CountrySelectModel getCountryModel()
  {
return new CountrySelectModel();
  }

  public CountryEncoder getCountryEncoder()
  {
return new CountryEncoder();
  }
}

And my template has this.

t:select t:value=selectedCountry t:model=countryModel  
t:encoder=countryEncoder/



Any ideas?

Keith

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Encoder may not be instantiated directly.

2008-09-27 Thread Ted Steen
You should not put non-component code under component packages.
see http://tapestry.apache.org/tapestry5/guide/component-classes.html
move the CountryEncoder to something like com.shared.util instead.

2008/9/27 Keith Bottner [EMAIL PROTECTED]:
 I am trying to use a bundle a select component for the specific case of
 displaying a list of countries and from the all the documentation that I
 have run across and I always get an exception when the page is rendered. It
 says:

 Component class com.shared.base.CountryEncoder may not be instantiated
 directly. You should use an @InjectPage or @InjectComponent annotation
 instead.

 Code is below, any help is appreciated.

 public class CountryEncoder implements ValueEncoderCountry
 {

  public String toClient( Country value )
  {
if (null == value) return null;

return value.getName();
  }

  public Country toValue( String clientValue )
  {
if (InternalUtils.isBlank(clientValue)) return null;

return DAO.getCountry(clientValue);
  }

 }

 public class CountryOptionModel implements OptionModel
 {
  Country country;

  public CountryOptionModel(Country country)
  {
this.country = country;
  }

  public String getLabel()
  {
return country.getName();
  }

  public Object getValue()
  {
return country;
  }

  public MapString, String getAttributes()
  {
return null;
  }

  public boolean isDisabled()
  {
return false;
  }
 }

 public class CountrySelectModel implements SelectModel
 {
  private ListCountry countries;

  public CountrySelectModel()
  {
countries = DAO.getCountries();
  }

  public ListOptionGroupModel getOptionGroups()
  {
return null;
  }

  public ListOptionModel getOptions()
  {
if (null != countries)
{
  ListOptionModel options = new ArrayListOptionModel();
  for (Country c : countries)
  {
options.add(new CountryOptionModel(c));
  }
  return options;
}

return null;
  }

  public void visit( SelectModelVisitor visitor )
  {
  }
 }

 public class CountrySelect
 {
  private Country selectedCountry;

  public Country getSelectedCountry()
  {
return selectedCountry;
  }
  public void setSelectedCountry(Country country)
  {
selectedCountry = country;
  }

  public CountrySelectModel getCountryModel()
  {
return new CountrySelectModel();
  }

  public CountryEncoder getCountryEncoder()
  {
return new CountryEncoder();
  }
 }

 And my template has this.

 t:select t:value=selectedCountry t:model=countryModel
 t:encoder=countryEncoder/


 Any ideas?

 Keith

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: append checkbox to grid list

2008-09-27 Thread wesley

hi Marcelo,

thanks very much with the advise, yeah, it's my silly mistake, i shouldn't
use actionlink on it. It Works now, thanks very much. :-)

Regards,
Wesley



Marcelo Lotif wrote:
 
 On Fri, Sep 26, 2008 at 11:40 AM, wesley [EMAIL PROTECTED] wrote:
 

 hi Marcelo,

 thanks with the feedback, the version of Tapestry that i'm using is
 5.0.14.
 
 
 I'm using 5.0.14 too.
 
 http://5.0.14.
 based on your comment, the switched method, non existing model and the
 println method; does it make difference? perhaps i should use the latest
 T5
 library?
 
 
 Of course it does. Without switching, the action link will print the list
 and the submit will clear it. With the model, the page does not even
 appear.
 I put the println because I don't know what is the Pt object.
 
 I was re-reading your post and I saw your mistake: you are trying to
 submit with an action link. When you click in the link, the values on the
 list are not updated just because you did not submit it. And your submit
 is
 clearing the list and adding new objects to it, so the values are lost.
 
 Just try to print the list on your submit method before you clear it, and
 you will get my point. :)
 
 


 Marcelo Lotif wrote:
 
  wesley,
  Considering that your onSubmitFromMy and onActionFromCheckPage methods
  are switched with each other and you used a non-existent model in your
  tml, your code has no problems. I ran exactly the same lines you put
  here and everything went fine. I change you Pt.pt with
  System.out.println and the submit printed all my changes perfectly.
 
  Which version of tapestry are you using?
 
  On Thu, Sep 25, 2008 at 10:47 PM, wesley [EMAIL PROTECTED] wrote:
 
 
  hi there,
 
  i implemented the onPrepare method and tried to print all the value
 out
  from
  the testPojoList, but all the checkbox still returned me false even i
  enabled some of it. am i doing wrong? how's the standard of
 implementing
  it?
  any short sample around?
 
  regards,
  wesley
 
 
  Jonathan Barker wrote:
  
  
   If you look at the Form documentation, you will see that the Submit
  event
   fires at the end of the submission - after any values from form
 fields
   have
   been put into your TestPojo's.  Therefore, you are wiping out any
  changes
   at
   the end of your submit.
  
   You could set up the list in onPrepare().  Just make sure not to
   re-initialized it unless that's what you really want.
  
   Jonathan
  
   -Original Message-
   From: wesley [mailto:[EMAIL PROTECTED]
   Sent: Thursday, September 25, 2008 13:02
   To: users@tapestry.apache.org
   Subject: Re: append checkbox to grid list
  
  
   hi Marcelo,
  
   1.below is my simple.tml page:
   //simple.tml
   ---
   t:form t:id=my
input type=submit value=submit/
br/
t:grid t:id=simplegrid
 t:source=testPojoList
   row=tp model=model
t:parameter name=subsCell
t:checkbox
 t:id=subs
   t:value=tp.subs/
/t:parameter
/t:grid
t:actionLink t:id=checkPageNext/t:actionLink
   /t:form
  
   2.This is Simple.java
   -
   public class Simple {
@Persist
private ListTestPojo testPojoList;
@Persist
private TestPojo tp;
  
public ListTestPojo getTestPojoList() {
return testPojoList;
}
  
public void setTestPojoList(ListTestPojo testPojoList) {
this.testPojoList = testPojoList;
}
  
Object onSubmitFromMy(){
testPojoList = new ArrayListTestPojo();
for(int i = 0; i  10; i++){
TestPojo tp = new TestPojo();
tp.setId([+i+]);
tp.setName(Name+i);
tp.setDescription(description+i);
testPojoList.add(tp);
}
return null;
}
  
Object onActionFromCheckPage(){
for(int i = 0; i  testPojoList.size(); i++){
TestPojo tps = testPojoList.get(i);
Pt.pt(id +tps.getId()+ check
 +tps.isSubs());
}
return null;
}
  
public TestPojo getTp() {
return tp;
}
  
public void setTp(TestPojo tp) {
this.tp = tp;
}
   }
  
   3. Lastly, the pojo class within the list
   --
   public class TestPojo {
private String id;
private String name;
private String description;
private boolean subs;
  
public boolean isSubs() {
return subs;
}
public void setSubs(boolean subs) {
this.subs = subs;
}
public String getId() {
return id;
  

Re: Creating inner components on the fly in a form custom component

2008-09-27 Thread Edouard sur edouardmercier.fr
Thank you so much Kris for your answer.

The Tapestry 5 BeanEditor source code gives some kind of vertigo, but
I will look at it, in order to better understand what you mean.

In the meantime, I had another idea: using some .tml inside my
component with a t:loop and t:if statements inside that nest some
t:select/t:radioGroup...: I think that it might solve my problem
(do you agree?). As soon as I have something which works, I will let
you know.

Cheers,
Édouard

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



is http://howardlewisship.com ok?

2008-09-27 Thread Korben Zhang
When I access

http://howardlewisship.com/tapestry-javaforge/tapestry-prop/

return Reported Attack Site!

Browser: Firefox 3.0.3

-- 
Korben Zhang
Blog: http://korben-zhang.blogspot.com | http://korbenzh.spaces.live.com


Re: Development Environment

2008-09-27 Thread Borut Bolčina
Luther,

it is true - you can work with WTP and Tomcat 6, but that is like driving
the BMW M5 without the M button being pressed.

Try running the quick start T5 application with mvn jetty:run and with
WTP/Tomcat. Try changing Start.java and then clicking the refresh button in
the browser. Even in this one page web application with 2 java files it
takes 10-times longer with WTP/Tomcat combo to display the changed Start
page. I can imagine it gets worse with larger apps.

And here is my point - if one of the main strengths of Tapestry 5 is live
class reloading, then it is of paramount value to tell developers how can
they harness the power in different development environments. This is where
the documentation fails. I also own the Alexander's book and as much as the
book is welcomed, it is outdated and the information given on page 43 is not
true (at least in present moment):

You will see that the change you have made is not reflected by the running
application, because you have changed an HTML file, and not Java code.
Smilar to NetBeans, Eclipse doesn't care about changes in HTML files. One
way to update the application in such case is to follow the advice given for
NetBeans - make change, even if it is an insignificant one, to some Java
file, and save the file. The application will then be reloaded
automatically.

This is so not T5-ish.

If there are many ways to develop T5 web apps, then some of this cases
should be explained clearly as this is IMHO one of the barriers many new
tapestry users are hitting at the very beginning. Of course some cases can
be published on wiki, but the most common two or three must be on main T5
page - this is where most users start.

I am filing a JIRA request for documentation improvement:
https://issues.apache.org/jira/browse/TAP5-245

Cheers,
Borut

P.S. The Issues link on T5 page (http://tapestry.apache.org/tapestry5/) is
wrong. It should be https://issues.apache.org/jira/browse/TAP5


2008/9/26 Luther Baker [EMAIL PROTECTED]

 For what its worth, I've had no trouble running Tomcat 6 with Eclipse WTP
 with MAVEN m2 plugins.

 I have NOT had to customize the tomcat instance at all.

 -Luther



 2008/9/26 Jonathan Barker [EMAIL PROTECTED]

 
  I was recently cast out of the Garden of Eden for eating the forbidden
  fruit: m2eclipse (updated).
 
  I was running the old JettyLauncher with the old (and rather limited)
  m2eclipse, on Eclipse 3.3 / MyEclipse 6.0.  Life was good.  Easy
 debugging,
  hot reloading.  I had JettyPlus configured so I could take my war file
  straight from my development system and drop it into a JBoss server for
  deployment and take advantage of pre-configured DataSources.
 
  Alas, the updated and mainly superior m2eclipse removes
 PluginDependencies
  from your classpath in order to make the execution within Eclipse be
  virtually identical to what it would be from command-line Maven.
 
  That breaks JettyLauncher and Run-Jetty-Run because you need the plugins
 on
  the classpath. Other than that, it does avoid some odd situations where
  things work in Eclipse but not when deployed elsewhere.
 
  I think I've figured out my usable alternative with external mvn
  hightide:run (hightide is a derivative of Jetty, and there is a hightide
  maven plugin).  It's not as convenient, but it is workable.
 
  Jonathan
 
   -Original Message-
   From: Kevin Menard [mailto:[EMAIL PROTECTED]
   Sent: Friday, September 26, 2008 13:59
   To: Tapestry users
   Subject: Re: Development Environment
  
   Hi Borut,
  
   Please file JIRA issues for these ideas, otherwise they're bound to be
   lost.
  
   --
   Kevin
  
  
  
   On Fri, Sep 26, 2008 at 6:53 AM, Borut Bolčina 
 [EMAIL PROTECTED]
   wrote:
Hello,
   
since JettyLauncher is not working with Eclipse Ganymede, this should
  be
mentioned at
http://tapestry.apache.org/tapestry5/tutorial1/env.html
   
I looked at http://code.google.com/p/run-jetty-run/ but some posts
   suggest
that it is not working with m2eclipse plugin.But I will try it out...
   
It would be a great time saver if tutorial at the above link would
   describe
some different scenarios how developers can set up their environments
  to
benefit from live class reloading. Reading the mailing list there
 seems
   to
be great confussion.
   
Cheers,
Borut
   
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Development Environment

2008-09-27 Thread Luther Baker
:-) Nice analogy.

So, how do I use the eclipse debugger with mvn jetty:run?

Is it possible? Can I put a breakpoint in my source and have the application
drop into it from mvn jetty:run?

If not, I have relegated myself to use the simple tomcat solution for now.
The button on an M5 is nice but I'd prefer to *work* on a 1969 muscle car if
it means I can actually get under the hood and trace the inner workings (not
quite as clever as your analogy, I know ;-)

Agree with your sentiment.

-Luther



On Sat, Sep 27, 2008 at 9:38 AM, Borut Bolčina [EMAIL PROTECTED]wrote:

 Luther,

 it is true - you can work with WTP and Tomcat 6, but that is like driving
 the BMW M5 without the M button being pressed.

 Try running the quick start T5 application with mvn jetty:run and with
 WTP/Tomcat. Try changing Start.java and then clicking the refresh button in
 the browser. Even in this one page web application with 2 java files it
 takes 10-times longer with WTP/Tomcat combo to display the changed Start
 page. I can imagine it gets worse with larger apps.

 And here is my point - if one of the main strengths of Tapestry 5 is live
 class reloading, then it is of paramount value to tell developers how can
 they harness the power in different development environments. This is where
 the documentation fails. I also own the Alexander's book and as much as the
 book is welcomed, it is outdated and the information given on page 43 is
 not
 true (at least in present moment):

 You will see that the change you have made is not reflected by the running
 application, because you have changed an HTML file, and not Java code.
 Smilar to NetBeans, Eclipse doesn't care about changes in HTML files. One
 way to update the application in such case is to follow the advice given
 for
 NetBeans - make change, even if it is an insignificant one, to some Java
 file, and save the file. The application will then be reloaded
 automatically.

 This is so not T5-ish.

 If there are many ways to develop T5 web apps, then some of this cases
 should be explained clearly as this is IMHO one of the barriers many new
 tapestry users are hitting at the very beginning. Of course some cases can
 be published on wiki, but the most common two or three must be on main T5
 page - this is where most users start.

 I am filing a JIRA request for documentation improvement:
 https://issues.apache.org/jira/browse/TAP5-245

 Cheers,
 Borut

 P.S. The Issues link on T5 page (http://tapestry.apache.org/tapestry5/) is
 wrong. It should be https://issues.apache.org/jira/browse/TAP5


 2008/9/26 Luther Baker [EMAIL PROTECTED]

  For what its worth, I've had no trouble running Tomcat 6 with Eclipse WTP
  with MAVEN m2 plugins.
 
  I have NOT had to customize the tomcat instance at all.
 
  -Luther
 
 
 
  2008/9/26 Jonathan Barker [EMAIL PROTECTED]
 
  
   I was recently cast out of the Garden of Eden for eating the forbidden
   fruit: m2eclipse (updated).
  
   I was running the old JettyLauncher with the old (and rather limited)
   m2eclipse, on Eclipse 3.3 / MyEclipse 6.0.  Life was good.  Easy
  debugging,
   hot reloading.  I had JettyPlus configured so I could take my war file
   straight from my development system and drop it into a JBoss server for
   deployment and take advantage of pre-configured DataSources.
  
   Alas, the updated and mainly superior m2eclipse removes
  PluginDependencies
   from your classpath in order to make the execution within Eclipse be
   virtually identical to what it would be from command-line Maven.
  
   That breaks JettyLauncher and Run-Jetty-Run because you need the
 plugins
  on
   the classpath. Other than that, it does avoid some odd situations where
   things work in Eclipse but not when deployed elsewhere.
  
   I think I've figured out my usable alternative with external mvn
   hightide:run (hightide is a derivative of Jetty, and there is a
 hightide
   maven plugin).  It's not as convenient, but it is workable.
  
   Jonathan
  
-Original Message-
From: Kevin Menard [mailto:[EMAIL PROTECTED]
Sent: Friday, September 26, 2008 13:59
To: Tapestry users
Subject: Re: Development Environment
   
Hi Borut,
   
Please file JIRA issues for these ideas, otherwise they're bound to
 be
lost.
   
--
Kevin
   
   
   
On Fri, Sep 26, 2008 at 6:53 AM, Borut Bolčina 
  [EMAIL PROTECTED]
wrote:
 Hello,

 since JettyLauncher is not working with Eclipse Ganymede, this
 should
   be
 mentioned at
 http://tapestry.apache.org/tapestry5/tutorial1/env.html

 I looked at http://code.google.com/p/run-jetty-run/ but some posts
suggest
 that it is not working with m2eclipse plugin.But I will try it
 out...

 It would be a great time saver if tutorial at the above link would
describe
 some different scenarios how developers can set up their
 environments
   to
 benefit from live class reloading. Reading the mailing list there
  seems
to
   

Re: Encoder may not be instantiated directly.

2008-09-27 Thread Keith Bottner

Ted,

Thanks for the pointer, that made it stop giving me the error all  
right and now it displays.


Now all I have to do is figure out why it always comes back as null  
when I include it in my template.


Keith

On Sep 27, 2008, at 1:36 AM, Ted Steen wrote:


You should not put non-component code under component packages.
see http://tapestry.apache.org/tapestry5/guide/component-classes.html
move the CountryEncoder to something like com.shared.util instead.

2008/9/27 Keith Bottner [EMAIL PROTECTED]:
I am trying to use a bundle a select component for the specific  
case of
displaying a list of countries and from the all the documentation  
that I
have run across and I always get an exception when the page is  
rendered. It

says:

Component class com.shared.base.CountryEncoder may not be  
instantiated
directly. You should use an @InjectPage or @InjectComponent  
annotation

instead.

Code is below, any help is appreciated.

public class CountryEncoder implements ValueEncoderCountry
{

public String toClient( Country value )
{
  if (null == value) return null;

  return value.getName();
}

public Country toValue( String clientValue )
{
  if (InternalUtils.isBlank(clientValue)) return null;

  return DAO.getCountry(clientValue);
}

}

public class CountryOptionModel implements OptionModel
{
Country country;

public CountryOptionModel(Country country)
{
  this.country = country;
}

public String getLabel()
{
  return country.getName();
}

public Object getValue()
{
  return country;
}

public MapString, String getAttributes()
{
  return null;
}

public boolean isDisabled()
{
  return false;
}
}

public class CountrySelectModel implements SelectModel
{
private ListCountry countries;

public CountrySelectModel()
{
  countries = DAO.getCountries();
}

public ListOptionGroupModel getOptionGroups()
{
  return null;
}

public ListOptionModel getOptions()
{
  if (null != countries)
  {
ListOptionModel options = new ArrayListOptionModel();
for (Country c : countries)
{
  options.add(new CountryOptionModel(c));
}
return options;
  }

  return null;
}

public void visit( SelectModelVisitor visitor )
{
}
}

public class CountrySelect
{
private Country selectedCountry;

public Country getSelectedCountry()
{
  return selectedCountry;
}
public void setSelectedCountry(Country country)
{
  selectedCountry = country;
}

public CountrySelectModel getCountryModel()
{
  return new CountrySelectModel();
}

public CountryEncoder getCountryEncoder()
{
  return new CountryEncoder();
}
}

And my template has this.

t:select t:value=selectedCountry t:model=countryModel
t:encoder=countryEncoder/


Any ideas?

Keith

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Development Environment

2008-09-27 Thread Martin Strand

With m2eclipse:
Right click your project, select Debug As -- Maven build... and start  
jetty:run from there


On Sat, 27 Sep 2008 17:20:54 +0200, Luther Baker [EMAIL PROTECTED]  
wrote:



:-) Nice analogy.

So, how do I use the eclipse debugger with mvn jetty:run?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Development Environment

2008-09-27 Thread Luther Baker

I love this forum!

On Sep 27, 2008, at 10:44 AM, Martin Strand wrote:


With m2eclipse:
Right click your project, select Debug As -- Maven build... and  
start jetty:run from there


On Sat, 27 Sep 2008 17:20:54 +0200, Luther Baker [EMAIL PROTECTED] 
 wrote:



:-) Nice analogy.

So, how do I use the eclipse debugger with mvn jetty:run?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Development Environment

2008-09-27 Thread Olle Hallin
Or mvnDebug jetty:run and then attach the debugger to the running jvm.
Regards,
Olle

2008/9/27 Luther Baker [EMAIL PROTECTED]

 I love this forum!


 On Sep 27, 2008, at 10:44 AM, Martin Strand wrote:

  With m2eclipse:
 Right click your project, select Debug As -- Maven build... and start
 jetty:run from there

 On Sat, 27 Sep 2008 17:20:54 +0200, Luther Baker [EMAIL PROTECTED]
 wrote:

  :-) Nice analogy.

 So, how do I use the eclipse debugger with mvn jetty:run?


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Olle Hallin M.Sc.
+46 70 6653071
[EMAIL PROTECTED]
www.hit.se


[T5] Passing page state with AJAX request

2008-09-27 Thread Alexey Hanin
Hello,
Recently I started to examine AJAX features in T5 and I already have a lot
of question of course, but I'd like to go through the each very deeply.

The question is: how can I send an AJAX request from within the control and
also include component (page) state? I've created a mixin similar to T5
component's OnEvent, which adds listener that performs AJAX request upon
event and by receiving it Tapestry dispatches control to corresponding
method of the component.

Page.tml

t:form
input t:type=TextField t:id=username/
input t:type=PasswordField t:id=password/
div id=controls
button t:type=any t:id=submitButton t:mixins=onEvent
t:event=click style=border: 1px solid #000Send AJAX request/button
/div
/t:form

So far I'm able to handle AJAX event inside page class using @OnEvent(value
= 'click', component='submitButton') annotation, but I'd like 'username' and
'password' components binded to page class properties also be updated just
like when using old good form submit with t:submit. How can this be
achieved? I tried to serialize form data and pass with request in number of
ways (i.e. as post parameters), but no luck.


Re: Encoder may not be instantiated directly.

2008-09-27 Thread Keith Bottner

Ted,

That worked but I am getting null for the value.

In my page class I have:

@Property
private Country test;

And in my template I have:

t:vf.countrySelect t:id=test /

(It is vf,countrySelect because I have this bundled in a library of  
share components and such.)


No matter what I set it to when the page displays after submission in  
my onSubmit handler test is NULL.


Anyone else had this problem? Is there something undocumented about  
getting this setup properly?


Thanks in advance,

Keith


On Sep 27, 2008, at 1:36 AM, Ted Steen wrote:


You should not put non-component code under component packages.
see http://tapestry.apache.org/tapestry5/guide/component-classes.html
move the CountryEncoder to something like com.shared.util instead.

2008/9/27 Keith Bottner [EMAIL PROTECTED]:
I am trying to use a bundle a select component for the specific  
case of
displaying a list of countries and from the all the documentation  
that I
have run across and I always get an exception when the page is  
rendered. It

says:

Component class com.shared.base.CountryEncoder may not be  
instantiated
directly. You should use an @InjectPage or @InjectComponent  
annotation

instead.

Code is below, any help is appreciated.

public class CountryEncoder implements ValueEncoderCountry
{

public String toClient( Country value )
{
  if (null == value) return null;

  return value.getName();
}

public Country toValue( String clientValue )
{
  if (InternalUtils.isBlank(clientValue)) return null;

  return DAO.getCountry(clientValue);
}

}

public class CountryOptionModel implements OptionModel
{
Country country;

public CountryOptionModel(Country country)
{
  this.country = country;
}

public String getLabel()
{
  return country.getName();
}

public Object getValue()
{
  return country;
}

public MapString, String getAttributes()
{
  return null;
}

public boolean isDisabled()
{
  return false;
}
}

public class CountrySelectModel implements SelectModel
{
private ListCountry countries;

public CountrySelectModel()
{
  countries = DAO.getCountries();
}

public ListOptionGroupModel getOptionGroups()
{
  return null;
}

public ListOptionModel getOptions()
{
  if (null != countries)
  {
ListOptionModel options = new ArrayListOptionModel();
for (Country c : countries)
{
  options.add(new CountryOptionModel(c));
}
return options;
  }

  return null;
}

public void visit( SelectModelVisitor visitor )
{
}
}

public class CountrySelect
{
private Country selectedCountry;

public Country getSelectedCountry()
{
  return selectedCountry;
}
public void setSelectedCountry(Country country)
{
  selectedCountry = country;
}

public CountrySelectModel getCountryModel()
{
  return new CountrySelectModel();
}

public CountryEncoder getCountryEncoder()
{
  return new CountryEncoder();
}
}

And my template has this.

t:select t:value=selectedCountry t:model=countryModel
t:encoder=countryEncoder/


Any ideas?

Keith

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Development Environment

2008-09-27 Thread adamh

I currently use Eclipse 3.4 J2EE, Run-Jetty-Run and Jetty 6 with no problems
at all, I can debug quite happily through the debugger with class reloading
(components/pages) and template (.tml) changes all happening live. The only
thing I need to restart for is non-managed clesses such as Entities and
Services - no biggie, jetty restarts virtually instantly on my machine.

Have a look at:
http://wiki.apache.org/tapestry/Tapestry5HowToSetupEclipseRunJettyRun

-- 
View this message in context: 
http://www.nabble.com/Development-Environment-tp19686205p19704939.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[T5] Submit does not fire selected event when using disabled property

2008-09-27 Thread Harald Geritzer


hi all,

im am having some sort of wizard with previous and next submits, which i want to disable depending 
on the actual step.
the strange thing is, if one of the submits has the property disabled set to false it submits the 
form but does not fire the selected event.


anybody else discovered that behavior?

ty
harald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[T5] XHtml approach renders a lot of b tags

2008-09-27 Thread Harald Geritzer


when following the xhtml approach from the howtos 
(http://wiki.apache.org/tapestry/Tapestry5HowToXhtml)
tapestry renders a lot of cascaded b tags in my resulting page.

any ideas why? am i missing anything?

ty
harald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Submit does not fire selected event when using disabled property

2008-09-27 Thread Ulrich Stärk
Works fine here. 2 submit components, one with disabled=true, the 
other with disabled=false, and the select event from the submit 
component with disabled=false gets fired just as expected. Maybe you 
could show us some code so we can try to figure out what's wrong with it.


Uli

Harald Geritzer schrieb:


hi all,

im am having some sort of wizard with previous and next submits, which i 
want to disable depending on the actual step.
the strange thing is, if one of the submits has the property disabled 
set to false it submits the form but does not fire the selected event.


anybody else discovered that behavior?

ty
harald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Submit does not fire selected event when using disabled property

2008-09-27 Thread Harald Geritzer


sorry, seems to be my fault. i just did not know that first the form submission is processed and 
afterwards setupRender ist called. i had some intializing logic in my setupRender function which is 
needed for calculating the submit's disabled state.


harald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]