You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Erik Vullings <er...@gmail.com> on 2007/06/05 16:10:43 UTC

T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Hi,

I've recently started working with T5 because I liked a lot what I've
seen! I therefore have some basic questions, and I hope you can help
me with them:

1. I've started changing the quickstart project to move a current
struts2-spring-jdbc application to T5. Where can I put my dao
initialization  (creation of hsqldb tables, which used to be done via
my ContextListener class in struts2)?

2. In my existing application, I use a (folder-like) tree based on the
www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a standard
HTML unordered list, which I generate in my page's java class. In the
accompanying HTML file, I use "${formattedTree}" However, when I
return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc. How
can I change the encoding, in other words, output raw HTML to the HTML
template file.

3. Related to Q2, are there any T5 tutorials on how to develop a tree
component, similar to a grid component? Or does someone already have
it?

4. Is it possible to enable T5 javadoc help to display in the Eclipse IDE?

Thanks for your help,
Erik

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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Francois Armand <fa...@linagora.com>.
Erik Vullings wrote:
> In the end, to create the Tree component (
> http://wiki.apache.org/tapestry/Tapestry5TreeComponent) 
ho :) I didn't make the link between this page and you :)

I just opened a Jira issue to ask for the addition of a Tree element in 
the code lib, so that every users may use the same base in place of 
reinventing the wheel. Moreover, if the core developers are ok to add 
such a component, we may hope that it will be more generic, idiomatic of 
Tapestry 5, deeply tested, etc than ours. I post our two reference 
implementations as examples.

-- 
Francois Armand
Etudes & Développements J2EE
LINAGORA SA - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Erik Vullings <er...@gmail.com>.
In the end, to create the Tree component (
http://wiki.apache.org/tapestry/Tapestry5TreeComponent) I've chosen to use
the writer.outputRaw option, since the opening/closing of the <ul> is very
tricky in the DHTML drag-n-drop-folder tree component. Clearly, it's less
elegant than the writer.element, so if anyone can improve it, please do :-)

The syntax of my tree is very similar to yours: I've only included an id, so
I can refer to it in the javascript (the DHTML tree adds an AJAX-based
context menu, which I.don't use yet though)

  <t:Tree treeid='literal:demo' source="treeNodes" currentNode="node">
    <t:actionlink t:id="tree"
context="node.identifier">${node.name}</t:actionlink>
  </t:Tree>

I thought about using the java swing.tree object, but in the end, found it
more intuitive to explicitly set the depth of each node. Also because in the
sql db, I store the hierarchical elements using lft/rgt notation as
explained in

http://www.sitepoint.com/article/hierarchical-data-database/2

An example of the Tree component (image) can be found here:
http://img502.imageshack.us/img502/7000/treehi8.gif

Cheers
Erik



On 8/24/07, Francois Armand <fa...@linagora.com> wrote:
>
> Erik Vullings wrote:
> > 3. Related to Q2, are there any T5 tutorials on how to develop a tree
> > component, similar to a grid component? Or does someone already have
> > it?
> >
> I have an example tree component here :
>
> http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-t5/trunk/src/main/java/org/interldap/wui/tapestry/components/Tree.java?view=markup&rev=97
> And an example of use :
>
> http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-t5/trunk/src/t5-test/resources/org/interldap/wui/tapestry/pages/TestTree.html?view=markup&rev=139
>
> Basically, the component take a DefaultMutableTreeNode as parameter and
> print it in a preorder traversal.
> You can specify a (unique) html element as a level separator. I think it
> would be a good idea to clean the code and extend it in a more generic
> way ;)
>
> Hope it may help (and sorry for the delay, I missed your post)
>
> --
> Francois Armand
> Etudes & Développements J2EE
> LINAGORA SA - http://www.linagora.com
> Tél.: +33 (0)1 58 18 68 28
> -----------
> InterLDAP - http://interldap.org
> FederID - http://www.federid.org/
> Open Source identities management and federation
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Francois Armand <fa...@linagora.com>.
Erik Vullings wrote:
> 3. Related to Q2, are there any T5 tutorials on how to develop a tree
> component, similar to a grid component? Or does someone already have
> it?
>
I have an example tree component here :
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-t5/trunk/src/main/java/org/interldap/wui/tapestry/components/Tree.java?view=markup&rev=97
And an example of use :
http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/interldap/interldap-wui-t5/trunk/src/t5-test/resources/org/interldap/wui/tapestry/pages/TestTree.html?view=markup&rev=139

Basically, the component take a DefaultMutableTreeNode as parameter and 
print it in a preorder traversal.
You can specify a (unique) html element as a level separator. I think it 
would be a good idea to clean the code and extend it in a more generic 
way ;)

Hope it may help (and sorry for the delay, I missed your post)

-- 
Francois Armand
Etudes & Développements J2EE
LINAGORA SA - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Nick Westgate <ni...@key-planning.co.jp>.
> 2. In my existing application, I use a (folder-like) tree based on the
> www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a standard
> HTML unordered list, which I generate in my page's java class. In the
> accompanying HTML file, I use "${formattedTree}" However, when I
> return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc. How
> can I change the encoding, in other words, output raw HTML to the HTML
> template file.

Use the OutputRaw component.

> 4. Is it possible to enable T5 javadoc help to display in the Eclipse IDE?

You just need to have source attached to the jars you are using.


Cheers,
Nick.

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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Josh Canfield <jo...@thedailytube.com>.
Hehe... I suppose if I'd read the old post more closely (as opposed to just
looking at #2) I could have figured that out. Sounds like the @EagerLoad
that Robin pointed to is what you want.

On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
>
> Doh.
>
> I meant #1.
>
> Thanks.
>
> Ben
>
> On 8/23/07, Josh Canfield <jo...@thedailytube.com> wrote:
> >
> > I don't follow how invoking an init method in your builder is related to
> > the
> > problem of the html generation. Can you expand on that?
> >
> > I would use a component and the MarkupWriter in the
> > beginRender/afterRender
> > methods. Something like this: (this code has not been compiled so
> > compilation/functional defects may exist)
> >
> >
> > public class MyComponent {
> >
> >   void beginRender(MarkupWriter writer) {
> >     writer.element("ul");
> >     // if you have a tree then you could recursively build out the
> > unordered
> > list...
> >     for (String item : itemValues ) {
> >       writer.element("li");
> >       writer.write(item);
> >       writer.end();
> >     }
> >     // you could end the element here, ending it in afterrender
> >     // allows the component body to be evalutated.
> >   }
> >
> >   void afterRender(MarkupWriter writer) {
> >      writer.end();
> >   }
> > }
> >
> >
> > Josh
> > On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
> > >
> > > I have the same requirement mentioned in #2.  What is the best
> approach
> > to
> > > handle this with Tapestry 5?  I am thinking of just eager loading a
> > > service
> > > and invoking the init method in the builder method of the module.  Any
> > > other
> > > thoughts?
> > >
> > > I think this was the Tapestry 4 way:
> > >
> > >
> >
> http://tapestry.apache.org/tapestry4/tapestry/hivedocs/module/tapestry.init.html
> > >
> > > Ben
> > >
> > > On 6/5/07, Erik Vullings <er...@gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I've recently started working with T5 because I liked a lot what
> I've
> > > > seen! I therefore have some basic questions, and I hope you can help
> > > > me with them:
> > > >
> > > > 1. I've started changing the quickstart project to move a current
> > > > struts2-spring-jdbc application to T5. Where can I put my dao
> > > > initialization  (creation of hsqldb tables, which used to be done
> via
> > > > my ContextListener class in struts2)?
> > > >
> > > > 2. In my existing application, I use a (folder-like) tree based on
> the
> > > > www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a
> standard
> > > > HTML unordered list, which I generate in my page's java class. In
> the
> > > > accompanying HTML file, I use "${formattedTree}" However, when I
> > > > return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc.
> How
> > > > can I change the encoding, in other words, output raw HTML to the
> HTML
> > > > template file.
> > > >
> > > > 3. Related to Q2, are there any T5 tutorials on how to develop a
> tree
> > > > component, similar to a grid component? Or does someone already have
> > > > it?
> > > >
> > > > 4. Is it possible to enable T5 javadoc help to display in the
> Eclipse
> > > IDE?
> > > >
> > > > Thanks for your help,
> > > > Erik
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Ben Tomasini <be...@gmail.com>.
Doh.

I meant #1.

Thanks.

Ben

On 8/23/07, Josh Canfield <jo...@thedailytube.com> wrote:
>
> I don't follow how invoking an init method in your builder is related to
> the
> problem of the html generation. Can you expand on that?
>
> I would use a component and the MarkupWriter in the
> beginRender/afterRender
> methods. Something like this: (this code has not been compiled so
> compilation/functional defects may exist)
>
>
> public class MyComponent {
>
>   void beginRender(MarkupWriter writer) {
>     writer.element("ul");
>     // if you have a tree then you could recursively build out the
> unordered
> list...
>     for (String item : itemValues ) {
>       writer.element("li");
>       writer.write(item);
>       writer.end();
>     }
>     // you could end the element here, ending it in afterrender
>     // allows the component body to be evalutated.
>   }
>
>   void afterRender(MarkupWriter writer) {
>      writer.end();
>   }
> }
>
>
> Josh
> On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
> >
> > I have the same requirement mentioned in #2.  What is the best approach
> to
> > handle this with Tapestry 5?  I am thinking of just eager loading a
> > service
> > and invoking the init method in the builder method of the module.  Any
> > other
> > thoughts?
> >
> > I think this was the Tapestry 4 way:
> >
> >
> http://tapestry.apache.org/tapestry4/tapestry/hivedocs/module/tapestry.init.html
> >
> > Ben
> >
> > On 6/5/07, Erik Vullings <er...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I've recently started working with T5 because I liked a lot what I've
> > > seen! I therefore have some basic questions, and I hope you can help
> > > me with them:
> > >
> > > 1. I've started changing the quickstart project to move a current
> > > struts2-spring-jdbc application to T5. Where can I put my dao
> > > initialization  (creation of hsqldb tables, which used to be done via
> > > my ContextListener class in struts2)?
> > >
> > > 2. In my existing application, I use a (folder-like) tree based on the
> > > www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a standard
> > > HTML unordered list, which I generate in my page's java class. In the
> > > accompanying HTML file, I use "${formattedTree}" However, when I
> > > return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc. How
> > > can I change the encoding, in other words, output raw HTML to the HTML
> > > template file.
> > >
> > > 3. Related to Q2, are there any T5 tutorials on how to develop a tree
> > > component, similar to a grid component? Or does someone already have
> > > it?
> > >
> > > 4. Is it possible to enable T5 javadoc help to display in the Eclipse
> > IDE?
> > >
> > > Thanks for your help,
> > > Erik
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>

Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Josh Canfield <jo...@thedailytube.com>.
I don't follow how invoking an init method in your builder is related to the
problem of the html generation. Can you expand on that?

I would use a component and the MarkupWriter in the beginRender/afterRender
methods. Something like this: (this code has not been compiled so
compilation/functional defects may exist)


public class MyComponent {

  void beginRender(MarkupWriter writer) {
    writer.element("ul");
    // if you have a tree then you could recursively build out the unordered
list...
    for (String item : itemValues ) {
      writer.element("li");
      writer.write(item);
      writer.end();
    }
    // you could end the element here, ending it in afterrender
    // allows the component body to be evalutated.
  }

  void afterRender(MarkupWriter writer) {
     writer.end();
  }
}


Josh
On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
>
> I have the same requirement mentioned in #2.  What is the best approach to
> handle this with Tapestry 5?  I am thinking of just eager loading a
> service
> and invoking the init method in the builder method of the module.  Any
> other
> thoughts?
>
> I think this was the Tapestry 4 way:
>
> http://tapestry.apache.org/tapestry4/tapestry/hivedocs/module/tapestry.init.html
>
> Ben
>
> On 6/5/07, Erik Vullings <er...@gmail.com> wrote:
> >
> > Hi,
> >
> > I've recently started working with T5 because I liked a lot what I've
> > seen! I therefore have some basic questions, and I hope you can help
> > me with them:
> >
> > 1. I've started changing the quickstart project to move a current
> > struts2-spring-jdbc application to T5. Where can I put my dao
> > initialization  (creation of hsqldb tables, which used to be done via
> > my ContextListener class in struts2)?
> >
> > 2. In my existing application, I use a (folder-like) tree based on the
> > www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a standard
> > HTML unordered list, which I generate in my page's java class. In the
> > accompanying HTML file, I use "${formattedTree}" However, when I
> > return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc. How
> > can I change the encoding, in other words, output raw HTML to the HTML
> > template file.
> >
> > 3. Related to Q2, are there any T5 tutorials on how to develop a tree
> > component, similar to a grid component? Or does someone already have
> > it?
> >
> > 4. Is it possible to enable T5 javadoc help to display in the Eclipse
> IDE?
> >
> > Thanks for your help,
> > Erik
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Robin Helgelin <lo...@gmail.com>.
On 8/24/07, Kheldar666 <ma...@liber-mundi.org> wrote:
>
> I do this :
>
>
>
> >       In AppModule.java :
> >
> >       public void
> > contributeApplicationInitializer(OrderedConfiguration<ApplicationInitializerFilter>
> > configuration) {
> >               configuration.add("mainModuleInitializer", new
> > MainModuleInitializer());
> >       }
> >
> > With MainModuleInitializer implementing ApplicationInitializerFilter

Oh, nice! Didn't even know there was such a filter :)

-- 
        regards,
        Robin

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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Kheldar666 <ma...@liber-mundi.org>.
I do this :



> 	In AppModule.java :
> 
> 	public void
> contributeApplicationInitializer(OrderedConfiguration<ApplicationInitializerFilter>
> configuration) {
> 	        configuration.add("mainModuleInitializer", new
> MainModuleInitializer());
> 	}
> 
> With MainModuleInitializer implementing ApplicationInitializerFilter
> 
> 


Robin Helgelin wrote:
> 
> On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
>> I have the same requirement mentioned in #2.  What is the best approach
>> to
>> handle this with Tapestry 5?  I am thinking of just eager loading a
>> service
>> and invoking the init method in the builder method of the module.  Any
>> other
>> thoughts?
>> > 1. I've started changing the quickstart project to move a current
>> > struts2-spring-jdbc application to T5. Where can I put my dao
>> > initialization  (creation of hsqldb tables, which used to be done via
>> > my ContextListener class in struts2)?
> 
> I use an @EagerLoad service similar to this, example code can be found
> here:
> <http://www.localhost.nu/svn/public/tapestry5-acegi-example/src/main/java/nu/localhost/tapestry/acegi/example/services/AppModule.java>
> 
> -- 
>         regards,
>         Robin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5-questions%3A-adding-my-own-initializations--outputing-pre-formatted-HTML--tree-component--javadoc-tf3872028.html#a12309051
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Robin Helgelin <lo...@gmail.com>.
On 8/23/07, Ben Tomasini <be...@gmail.com> wrote:
> I have the same requirement mentioned in #2.  What is the best approach to
> handle this with Tapestry 5?  I am thinking of just eager loading a service
> and invoking the init method in the builder method of the module.  Any other
> thoughts?
> > 1. I've started changing the quickstart project to move a current
> > struts2-spring-jdbc application to T5. Where can I put my dao
> > initialization  (creation of hsqldb tables, which used to be done via
> > my ContextListener class in struts2)?

I use an @EagerLoad service similar to this, example code can be found here:
<http://www.localhost.nu/svn/public/tapestry5-acegi-example/src/main/java/nu/localhost/tapestry/acegi/example/services/AppModule.java>

-- 
        regards,
        Robin

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


Re: T5 questions: adding my own initializations; outputing pre-formatted HTML; tree component; javadoc

Posted by Ben Tomasini <be...@gmail.com>.
I have the same requirement mentioned in #2.  What is the best approach to
handle this with Tapestry 5?  I am thinking of just eager loading a service
and invoking the init method in the builder method of the module.  Any other
thoughts?

I think this was the Tapestry 4 way:
http://tapestry.apache.org/tapestry4/tapestry/hivedocs/module/tapestry.init.html

Ben

On 6/5/07, Erik Vullings <er...@gmail.com> wrote:
>
> Hi,
>
> I've recently started working with T5 because I liked a lot what I've
> seen! I therefore have some basic questions, and I hope you can help
> me with them:
>
> 1. I've started changing the quickstart project to move a current
> struts2-spring-jdbc application to T5. Where can I put my dao
> initialization  (creation of hsqldb tables, which used to be done via
> my ContextListener class in struts2)?
>
> 2. In my existing application, I use a (folder-like) tree based on the
> www.dhtmlgoodies.com drag-drop-folder-tree. It is based on a standard
> HTML unordered list, which I generate in my page's java class. In the
> accompanying HTML file, I use "${formattedTree}" However, when I
> return the formattedTree "<ul><li>..." it becomes &lt;ul&gt; etc. How
> can I change the encoding, in other words, output raw HTML to the HTML
> template file.
>
> 3. Related to Q2, are there any T5 tutorials on how to develop a tree
> component, similar to a grid component? Or does someone already have
> it?
>
> 4. Is it possible to enable T5 javadoc help to display in the Eclipse IDE?
>
> Thanks for your help,
> Erik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>