Re: how to use ioc of t5 ?

2007-10-13 Thread MavenMan

thanks . you are a capable man ! I have it resolved .
but I still want to ask a basic question:Is using ioc to manage my DAO class
a best and only approach ? 





Davor Hrg wrote:
 
 you must not put your dao objects into pages or components packages...
 
 http://wiki.apache.org/tapestry/Tapestry5HowToNotMakeCustomComponent
 last section
 
 move your DAO into another package, yourApp.entities or sth..
 
 Davor Hrg
 
 On 10/12/07, MavenMan [EMAIL PROTECTED] wrote:


 I just code:

 binder.bind(CompanyDAO.class,CompanyDaoImpl.class);

 @Inject
 private CompanyDAO dao

 then call dao.method ,but

 org.apache.tapestry.internal.services.TransformationException: Error
 obtaining injected value for field com.myspacce.pages.Start.dao: No
 service
 implements the interface com.myspacce.pages.CompanyDAO.

 need I add annotation to  CompanyDaoImpl or CompanyDAO ?

 Best Regards !

 Josh Canfield-2 wrote:
 
 
 @Inject
 @Service(CompanyDAO)
 private CompanyDAO dao;
 
 
 
  This should just be:
  @Inject
  private CompanyDAO dao;
 
  Josh
 
  On 10/11/07, MavenMan [EMAIL PROTECTED] wrote:
 
 
  now I want to know how to inject service to page class .
  after I add this in AppModule :
  binder.bind(CompanyDAO.class,CompanyDaoImpl.class)
  and add
 @Inject
 @Service(CompanyDAO)
 private CompanyDAO dao;
 
  in page class.
 
  but it seem to be wrong !
 
  can you help me ?
  thanks
 
 
 
 
 
  kristian.marinkovic wrote:
  
   do you have the hibernate libraries in your classpath?
  
  
  
  
   lasitha [EMAIL PROTECTED]
   11.10.2007 09:14
   Bitte antworten an
   Tapestry users users@tapestry.apache.org
  
  
   An
   Tapestry users users@tapestry.apache.org
   Kopie
  
   Thema
   Re: how to use ioc of t5 ?
  
  
  
  
  
  
   In my setup i've got all my hibernated classes in the 'entities'
   package - which is automatically picked up tapestry-hibernate - so
   i've not had to make a contribution like this.  I'm afraid i don't
   have time to play with it right now either..., sorry.
  
   As an experiment, you might try moving (some of) your hibernated
   classes from 'domain' into 'entities' and commenting out the
   contribution code, just so we know whether your exception is related
   to contributing a package or something else.
  
   Also, is there more to that exception stack?  It doesn't seem to
   mention a cause...
  
   Lastly, i have a vague recollection of a past thread in this list
   about contributing packages to tapestry-hibernate... did you happen
 to
   run across anything in the archives?
  
   Cheers,
   lasitha.
  
  
   On 10/11/07, MavenMan [EMAIL PROTECTED] wrote:
  
   thanks.
  
   I hava add this to AppModule:
  
public static void
   contributeHibernateSessionSource(ConfigurationString
   configuration)
   {
   configuration.add(com.myspacce.domain);
   }
  
   Company.java is in  com/myspacce/domain:
  
   import javax.persistence.*;
   @Entity
   @Table(name=company)
   public class Company {
   @Id
   @GeneratedValue
  
   private int id;
   private String name;
  
   public Company()
   {
   }
   public int getId()
   {
   return id;
   }
   public void setId(int id)
   {
   this.id=id;
   }
   public String getName()
   {
   return name;
   }
   public void setName(String name)
   {
   this.name=name;
   }
  
   I have the tapestry-hibernate module in my classpath.
  
   error is :
  
   Error invoking service builder method
  
   org.apache.tapestry.hibernate.HibernateModule.build
  (HibernateSessionSource,
   ThreadCleanupHub) (at HibernateModule.java:62) (for service
   'HibernateSessionManager'): Exception constructing service
   'HibernateSessionSource': Error invoking constructor
   org.apache.tapestry.internal.hibernate.HibernateSessionSourceImpl
 (Log,
   Collection, ClassNameLocator) (at HibernateSessionSourceImpl.java
 :35)
   (for
   service 'HibernateSessionSource'):
   org/hibernate/cfg/annotations/ResultsetMappingSecondPass
  
  
   thanks
  
  
  
  
  
  
  
  
  
  
  
   lasitha wrote:
   
It looks like you don't have the tapestry-hibernate module in
 your
classpath.
   
There are a couple of starters you should checkout:
http://tapestry.apache.org/tapestry5/tapestry-hibernate/
   
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate
   
And don't forget to search the mailing list archives:
   
 http://wiki.apache.org/tapestry/Tapestry5HowToSearchTheMailingLists
   
Let us know if those don't help,
Cheers, lasitha.
   
On 10/11/07, MavenMan [EMAIL PROTECTED] wrote:
   
hello all :
   
 I write a page class :
   
package com.myspacce.pages;
import java.util.*;
import org.apache.tapestry.annotations.*;
  

Re: T5: Tapestry, Hibernate and Underscores.

2007-10-13 Thread lasitha
Hi oliver,  hibernate is pretty well documented... :)
http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html#configuration-namingstrategy
Cheers, lasitha.

On 10/13/07, Olivier [EMAIL PROTECTED] wrote:

 But that would mean I have to map each and every column. I was actually
 looking for a way to tell hibernate: Hey, all my class properties are
 prefixed with an underscore but my db columns are not.. Is something like
 that possible?

 On Fri, 12 Oct 2007 09:51:20 -0700, Josh Canfield [EMAIL PROTECTED]
 wrote:
  You can explicitly tell hibernate the names of your columns using
 hibernate
  annotations or your hibernate mapping files. You'll need to check with
 the
  hibernate docs/lists for more details.
 
  Josh
 
 
  On 10/12/07, Olivier [EMAIL PROTECTED] wrote:
 
 
  Hi,
 
 
  I followed the small tutorial on using hibernate with T5 here
  http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate and
  it
  worked like a charm. Thank you to whoever wrote this!
 
  The example uses underscores for some private fields and sometimes not.
  Now
  I want to use this in my entities but then Hibernate generates incorrect
  column names. Isn't there a way for tuning this in the configuration
  file
  or something? If someone has that info, please share it with me!
 
 
  Thank you in advance,
  Olivier
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  --
  TheDailyTube.com. Sign up and get the best new videos on the internet
  delivered fresh to your inbox.


 -
 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]



[T5] Label

2007-10-13 Thread Michael Gerzabek

Hi,

Another question from a newbie. What would it take to read the text 
surrounded by t:label for=someAttributeA pretty label 
text:/t:label and use this if no .properties are provided?


Michael

--
Path is created through walking [winged words]

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



Re: T5: Tapestry, Hibernate and Underscores.

2007-10-13 Thread Angelo Chen

Hi Olivier,

In that tutorial the only place with underscore is _session, the entities
for hibernate do not have underscore, I prefer this way, it looks normal
when u do some sql/hql queries, but for Tapestry variables ,seems to me, a
unspoken rule here is to prefix underscore.

A.C.


Olivier-36 wrote:
 
 
 Hi,
 
 
 I followed the small tutorial on using hibernate with T5 here
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate and it
 worked like a charm. Thank you to whoever wrote this!
 
 The example uses underscores for some private fields and sometimes not.
 Now
 I want to use this in my entities but then Hibernate generates incorrect
 column names. Isn't there a way for tuning this in the configuration file
 or something? If someone has that info, please share it with me!
 
 
 Thank you in advance,
 Olivier
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Tapestry%2C-Hibernate-and-Underscores.-tf4614534.html#a13188869
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: [T5] Label

2007-10-13 Thread Nick Westgate
Hi Michael.

In the future it should be easy to do this with a Mixin, but there are
a couple of problems that might (or might not) get in the way currently.

Anyway, it's very easy to write components. Just take the Radio.java
source eg from http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/
tapestry-core/src/main/java/org/apache/tapestry/corelib/components

and hack away till it does what you want. In this case, change:
@BeforeRenderBody
boolean renderBody()
{
// Don't render the body of the component even if there is one.

return false;
}

to return true based on the criteria you want, and the opposite here:
@AfterRender
void after(MarkupWriter writer)
{
writer.write(_field.getLabel());

writer.end(); // label
}

To see how to write your own components and where to put things see:
http://wiki.apache.org/tapestry/Tapestry5HowTos

Note that if you are using T5.0.6 then a few things have changed like
templates are now named *.tml. Search the list for other changes.

Cheers,
Nick.


Michael Gerzabek wrote:
 Hi,
 
 Another question from a newbie. What would it take to read the text 
 surrounded by t:label for=someAttributeA pretty label 
 text:/t:label and use this if no .properties are provided?
 
 Michael
 

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



Re: [T5] RadioGroup

2007-10-13 Thread Nick Westgate

The obvious answer to your question is the source for RadioGroup.java. ;-)
http://tapestry.apache.org/tapestry5/apidocs/src-html/org/apache/tapestry/corelib/components/RadioGroup.html

Basically, RadioGroup is responsible for the collective behaviour of
Radios when each is rendering, and when the form is submitted, through
RadioContainer Environmentals stored in the Environment service:
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/RadioContainer.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/Environment.html

When you understand how this class behaves, you could consider moving
the functionality into either a new Radio component or possibly into a
new Form component - though Form is quite complex already.

Yet another approach, since you are already preprocessing the html,
would be to automatically insert RadioGroups where necessary.

If you come up with an interesting solution, please let the list know.

Cheers,
Nick.


Michael Gerzabek wrote:

Hi,

I'm new to tapestry and started with T5. It's awesome stuff! With the 
tutorial, the maven archetype and a few hints from the wiki and the 
mailing list startup was straight forward. Compared to many other 
frameworks this is really one of the BIGGEST advantages of T5. Great job 
guys!!!


I'm working on a small technology spike to get new directions in 
developing webapps in future. It is important for me to have a clear 
separation between the different roles in projects.


One role is the graphic designers. They have to provide the whole xhtml 
stuff. Our customer likes to have the fancy features also in their logic 
pages. So we try to give them what they want making our lives easier.


On the other side there ist the role of the web developers. They need to 
put those inanimate pages into exist and gather the user conversations. 
The T5 programming model does a brilliant job here. I love Howard's 
quote ... pages are facilitators ... from one of the screencasts.


The last role of course is the one of the backend people.

So what we primarily do is we take those inanimate xhtml pages and guide 
them through an xsl stylesheet transformation to prepare tapestry 
markup. It work's really nice. T5 does a very nice separation of 
concerns out of the box here.


At the time there's only one small bump when it comes from using those 
pages the designer gives us to .tml. And it's the use of radiobuttons. 
People are used to group different radiobuttons simply by giving them 
the same name. T5 requires the newly introduced tag t:RadioGroup to 
group radiobuttons that belong together.


So my question is, where do I have to look to get an idea of how to 
implement my own t:Radio tag that automagically creates a new 
t:RadioGroup for each occurence of a new groupname?


Michael

--
Path is created through walking [winged words]




-
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: styling the error messages

2007-10-13 Thread Nick Westgate

Override the error CSS in your own CSS file, and please add a note here:
http://wiki.apache.org/tapestry/Tapestry5HowToOverrideTheDefaultErrorMessageBanner

Cheers,
Nick.


Angelo Chen wrote:

Hi,

t:errors / shows list errors in a red box, any way to style this? thanks.
A.C.


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



Re: [T5] Label

2007-10-13 Thread Michael Gerzabek
Hi Nick,

That was REALLY easy! Wow, 5 minutes and a new component is born. It's
hard to believe. The more I work with T5 the more I like it.

So let's have a look at RadioGroup...

Cheers,
Michael

Nick Westgate schrieb:
 Hi Michael.

 In the future it should be easy to do this with a Mixin, but there are
 a couple of problems that might (or might not) get in the way currently.

 Anyway, it's very easy to write components. Just take the Radio.java
 source eg from http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/
 tapestry-core/src/main/java/org/apache/tapestry/corelib/components

 and hack away till it does what you want. In this case, change:
 @BeforeRenderBody
 boolean renderBody()
 {
 // Don't render the body of the component even if there is one.

 return false;
 }

 to return true based on the criteria you want, and the opposite here:
 @AfterRender
 void after(MarkupWriter writer)
 {
 writer.write(_field.getLabel());

 writer.end(); // label
 }

 To see how to write your own components and where to put things see:
 http://wiki.apache.org/tapestry/Tapestry5HowTos

 Note that if you are using T5.0.6 then a few things have changed like
 templates are now named *.tml. Search the list for other changes.

 Cheers,
 Nick.
   


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