nesting facelet tag's body in a tag definition

View: New views
6 Messages — Rating Filter:   Alert me  

nesting facelet tag's body in a tag definition

by Wojciech Ciesielski-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I would like to create simple UI component for decorating content (for
example some fancy javascript-decorated panel for some content). It
would be best to be able to create a tag like my:fancyPanel, with a
standard .xhtml based definition (via source attribute in tag's
definition), like

<ui:component>
  <div .... fancy panel styles, JS functions etc>
     <!-- WHAT TO DO HERE? to include tag's body? -->
  </div>
</ui:component>

Is this possible to reference tags body in a definition like above? So
when I use my tag like this:

<my:fancyPanel>
   <!-- some custom code I'd like to be nested within fancy panel, like: -->
  <h:form>
    ...
   </h:form>
</my:fancyPanel>

Any ideas? If that's not possible easily via some code inserted in
fancyPanel .xhtml file - how can I achieve this without creating
java-based component rendering code to the response ? I'd like to keep
fancyPanel's code in an easily editable .xhtml file, not java
prints...

I would greatly appreciate any ideas how to accomplish this.

TIA
Wojtek

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


Re: nesting facelet tag's body in a tag definition

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why aren't you using Facelets templating mechanism?

https://facelets.dev.java.net/nonav/docs/dev/docbook.html#gettingstarted-view-template

Or if you want, you can create a Facelets tag:
https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create (Look for 3.5.5. Tag (Source) Files)

Cheers,
Paulo

On Wed, Sep 16, 2009 at 11:55 AM, Wojciech Ciesielski <wciesielski@...> wrote:
Hi there,

I would like to create simple UI component for decorating content (for
example some fancy javascript-decorated panel for some content). It
would be best to be able to create a tag like my:fancyPanel, with a
standard .xhtml based definition (via source attribute in tag's
definition), like

<ui:component>
 <div .... fancy panel styles, JS functions etc>
    <!-- WHAT TO DO HERE? to include tag's body? -->
 </div>
</ui:component>

Is this possible to reference tags body in a definition like above? So
when I use my tag like this:

<my:fancyPanel>
  <!-- some custom code I'd like to be nested within fancy panel, like: -->
 <h:form>
   ...
  </h:form>
</my:fancyPanel>

Any ideas? If that's not possible easily via some code inserted in
fancyPanel .xhtml file - how can I achieve this without creating
java-based component rendering code to the response ? I'd like to keep
fancyPanel's code in an easily editable .xhtml file, not java
prints...

I would greatly appreciate any ideas how to accomplish this.

TIA
Wojtek

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



Re: nesting facelet tag's body in a tag definition

by Wojciech Ciesielski-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I know about both templating and basic source-based tag
creation... What I don't know is how to use tag's body (passed while
using a tag on a page) inside tag definition source file... If it's
possible at all...

Templating requires a component to call explicitly it's template...
It's a bottom up approach (component needs to select template) - I
need a top-up - be able to wrap certain part of a component tree in my
tags/components...

Let's say we have a structure like this:
page-template.xhtml:

<ui:composition>
....
  <ui:insert />
</ui:composition>

mypage.xhtml:

<ui:composition template="page-template.xhtml">
  <ui:define>
       ... page contents ...
     <my:fancyDataTable >
        <!-- some data display component -->
     </my:fancyDataTable >

  </ui:define>
</ui:composition>

I am preparing a library of UI components - toggle panels, animated,
fancy, sexy ;-) etc. So I need to be able to use a custom tag
(my:fancyPanel) to wrap given components without wrapped component
knowing about this... So while compiled the page would look like this:

<ui:composition template="page-template.xhtml">
  <ui:define>
       ... page contents ...
     <my:fancyPanel>
       <my:fancyDataTable >
          <!-- some data display component #1 -->
       </my:fancyDataTable >
     </my:fancyPanel>

     <my:fancyPanel>
       <my:fancyDataTable >
          <!-- some data display component #2 -->
       </my:fancyDataTable >
     </my:fancyPanel>

    .... etc ...


  </ui:define>
</ui:composition>

I don't have an idea how to accomplish this with templating... I could
try to pass a template name as an argument to a fancyDataTable but
even if it works it's ugly - I'm causing a child to be aware of being
wrapped....

It would be perfect if facelets have a magic tag like <ui:putBodyHere
/> that could be used within tag's source .xhtml. But I am afraid it
does not exist (feature request maybe? ;-) )

Thanks,
Wojtek


On Wed, Sep 16, 2009 at 12:22 PM, Paulo Pinto <pjmlp@...> wrote:
> Why aren't you using Facelets templating mechanism?
>
> https://facelets.dev.java.net/nonav/docs/dev/docbook.html#gettingstarted-view-template

Cause I want to define wrapping of  some content from outside of this
content, not inside... Let's say I have my own data display tag
my:fancyTable

>
> Or if you want, you can create a Facelets tag:
> https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create
> (Look for 3.5.5. Tag (Source) Files)
>
> Cheers,
> Paulo
>
> On Wed, Sep 16, 2009 at 11:55 AM, Wojciech Ciesielski
> <wciesielski@...> wrote:
>>
>> Hi there,
>>
>> I would like to create simple UI component for decorating content (for
>> example some fancy javascript-decorated panel for some content). It
>> would be best to be able to create a tag like my:fancyPanel, with a
>> standard .xhtml based definition (via source attribute in tag's
>> definition), like
>>
>> <ui:component>
>>  <div .... fancy panel styles, JS functions etc>
>>     <!-- WHAT TO DO HERE? to include tag's body? -->
>>  </div>
>> </ui:component>
>>
>> Is this possible to reference tags body in a definition like above? So
>> when I use my tag like this:
>>
>> <my:fancyPanel>
>>   <!-- some custom code I'd like to be nested within fancy panel, like:
>> -->
>>  <h:form>
>>    ...
>>   </h:form>
>> </my:fancyPanel>
>>
>> Any ideas? If that's not possible easily via some code inserted in
>> fancyPanel .xhtml file - how can I achieve this without creating
>> java-based component rendering code to the response ? I'd like to keep
>> fancyPanel's code in an easily editable .xhtml file, not java
>> prints...
>>
>> I would greatly appreciate any ideas how to accomplish this.
>>
>> TIA
>> Wojtek
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>

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


RE: nesting facelet tag's body in a tag definition

by Raymond K. DeCampo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Check out the documentation:

https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create-
source

https://facelets.dev.java.net/nonav/docs/dev/docbook.html#template-inser
t


-----Original Message-----
From: Wojciech Ciesielski [mailto:wciesielski@...]
Sent: Wednesday, September 16, 2009 5:55 AM
To: users@...
Subject: nesting facelet tag's body in a tag definition

Hi there,

I would like to create simple UI component for decorating content (for
example some fancy javascript-decorated panel for some content). It
would be best to be able to create a tag like my:fancyPanel, with a
standard .xhtml based definition (via source attribute in tag's
definition), like

<ui:component>
  <div .... fancy panel styles, JS functions etc>
     <!-- WHAT TO DO HERE? to include tag's body? -->
  </div>
</ui:component>

Is this possible to reference tags body in a definition like above? So
when I use my tag like this:

<my:fancyPanel>
   <!-- some custom code I'd like to be nested within fancy panel, like:
-->
  <h:form>
    ...
   </h:form>
</my:fancyPanel>

Any ideas? If that's not possible easily via some code inserted in
fancyPanel .xhtml file - how can I achieve this without creating
java-based component rendering code to the response ? I'd like to keep
fancyPanel's code in an easily editable .xhtml file, not java
prints...

I would greatly appreciate any ideas how to accomplish this.

TIA
Wojtek

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


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


Re: nesting facelet tag's body in a tag definition

by Joel Weight :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We are using a component like this

comp.xhtml
<ui:composition>
<div>
    <ui:repeat value="#{asdf}" var="cur">
        ...other ui code...
        <ui:insert />
    </ui:repeat>
</div>
</ui:composition>

Then, in other files, we do something like this
<div>
    <my:comp asdf="#{someBean.getlist}">
        <h:outputText value="#{cur.name}" title="#{cur.key}" />
    </my:comp>
</div>

The body of the my:comp tag is placed wherever the ui:insert is within the composition.  The insert has no name, and I am not defining anything.  I'm not sure this is in any documentation I've read, I just tried it once, hoping it would work, and got lucky.  Is this kind of what you are looking for?

If you need to define more than one insert, then you should probably look at the ui:decorate tag.  It's great for... decorating stuff, like decorating your fancyDataTable with a fancyPanel without causing the fancyDataTable to know that it's decorated at all.

Joel

On Wed, Sep 16, 2009 at 4:37 AM, Wojciech Ciesielski <wciesielski@...> wrote:
Hi, I know about both templating and basic source-based tag
creation... What I don't know is how to use tag's body (passed while
using a tag on a page) inside tag definition source file... If it's
possible at all...

Templating requires a component to call explicitly it's template...
It's a bottom up approach (component needs to select template) - I
need a top-up - be able to wrap certain part of a component tree in my
tags/components...

Let's say we have a structure like this:
page-template.xhtml:

<ui:composition>
....
 <ui:insert />
</ui:composition>

mypage.xhtml:

<ui:composition template="page-template.xhtml">
 <ui:define>
      ... page contents ...
    <my:fancyDataTable >
       <!-- some data display component -->
    </my:fancyDataTable >

 </ui:define>
</ui:composition>

I am preparing a library of UI components - toggle panels, animated,
fancy, sexy ;-) etc. So I need to be able to use a custom tag
(my:fancyPanel) to wrap given components without wrapped component
knowing about this... So while compiled the page would look like this:

<ui:composition template="page-template.xhtml">
 <ui:define>
      ... page contents ...
    <my:fancyPanel>
      <my:fancyDataTable >
         <!-- some data display component #1 -->
      </my:fancyDataTable >
    </my:fancyPanel>

    <my:fancyPanel>
      <my:fancyDataTable >
         <!-- some data display component #2 -->
      </my:fancyDataTable >
    </my:fancyPanel>

   .... etc ...


 </ui:define>
</ui:composition>

I don't have an idea how to accomplish this with templating... I could
try to pass a template name as an argument to a fancyDataTable but
even if it works it's ugly - I'm causing a child to be aware of being
wrapped....

It would be perfect if facelets have a magic tag like <ui:putBodyHere
/> that could be used within tag's source .xhtml. But I am afraid it
does not exist (feature request maybe? ;-) )

Thanks,
Wojtek


On Wed, Sep 16, 2009 at 12:22 PM, Paulo Pinto <pjmlp@...> wrote:
> Why aren't you using Facelets templating mechanism?
>
> https://facelets.dev.java.net/nonav/docs/dev/docbook.html#gettingstarted-view-template

Cause I want to define wrapping of  some content from outside of this
content, not inside... Let's say I have my own data display tag
my:fancyTable

>
> Or if you want, you can create a Facelets tag:
> https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create
> (Look for 3.5.5. Tag (Source) Files)
>
> Cheers,
> Paulo
>
> On Wed, Sep 16, 2009 at 11:55 AM, Wojciech Ciesielski
> <wciesielski@...> wrote:
>>
>> Hi there,
>>
>> I would like to create simple UI component for decorating content (for
>> example some fancy javascript-decorated panel for some content). It
>> would be best to be able to create a tag like my:fancyPanel, with a
>> standard .xhtml based definition (via source attribute in tag's
>> definition), like
>>
>> <ui:component>
>>  <div .... fancy panel styles, JS functions etc>
>>     <!-- WHAT TO DO HERE? to include tag's body? -->
>>  </div>
>> </ui:component>
>>
>> Is this possible to reference tags body in a definition like above? So
>> when I use my tag like this:
>>
>> <my:fancyPanel>
>>   <!-- some custom code I'd like to be nested within fancy panel, like:
>> -->
>>  <h:form>
>>    ...
>>   </h:form>
>> </my:fancyPanel>
>>
>> Any ideas? If that's not possible easily via some code inserted in
>> fancyPanel .xhtml file - how can I achieve this without creating
>> java-based component rendering code to the response ? I'd like to keep
>> fancyPanel's code in an easily editable .xhtml file, not java
>> prints...
>>
>> I would greatly appreciate any ideas how to accomplish this.
>>
>> TIA
>> Wojtek
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>

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



Re: nesting facelet tag's body in a tag definition

by Wojciech Ciesielski-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 16, 2009 at 4:36 PM, Joel Weight <digitaljoel@...> wrote:
> We are using a component like this
...
> If you need to define more than one insert, then you should probably look at
> the ui:decorate tag.  It's great for... decorating stuff, like decorating
> your fancyDataTable with a fancyPanel without causing the fancyDataTable to
> know that it's decorated at all.
>
> Joel

Great, that's what I was looking for :-) Thanks a lot

Wojtek

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