New <pe:layout>, templating and dynamic inclusions

Community Driven Extensions Project
ds_dev
Posts: 19
Joined: 27 Oct 2011, 10:03

12 Oct 2012, 11:34

Hi,

I was really excited about the new implementation of the <pe:layout> component but sadly it kinda feels like a regression to me (for my use case at least).

I was planning on using the new features to have a full ajax application.
Basically the idea was to have a general layout with dynamic areas. This layout would be written as a template (facelets) and <ui:insert> and <ui:define> would allow to customize the dynamic areas.
Given the possibility of creating nested <pe:layoutPane> and later the ability to update specific <pe:layoutPane>, it seemed really great.

Unfortunately, the new design forces you to use a LayoutOptions object. It's fine as long as you don't have templates including other templates and dynamic stuff going on.
This seems counterintuitive to have to declare your UI in your bean and then redeclare it in your XHTML page when with the previous implementation the XHTML page was "self-explanatory".

Are there any plans to be able to declare complex layouts without the need of a LayoutOptions object in a bean ? by pure XHTML like before ?
This would seem much more natural and would allow for greater flexibility as you would be able to focus on the UI you are creating without having to worry about a parent layout you should not need to know about.

Also, is there an approximate date for the support of updating nested <pe:layoutPane> ?

Thanks for your answers.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

12 Oct 2012, 14:23

We have discussed many times updatable nested layouts in this forum. This feature will be added, I worked on it but could not finish (by time reason). Read other posts below please regarding this. Sure, it will be possible with LayoutOtions.

Having LayoutOptions has advantages in comparison to options attributes. You can not blow up pe:layoutPane with 100+ option attributes. But with LayoutOptions you don't have this limitation. How do you would define e.g. "resizeWhileDragging" = false?
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

ds_dev
Posts: 19
Joined: 27 Oct 2011, 10:03

12 Oct 2012, 15:48

Sorry about the updatable nested layouts, I must have missed the informations, I'll take a look.

Regarding LayoutOptions, while I do agree that having such an object allows to use tons of atributes to fine tune layouts, I still think that from a pure UI design perspective, it feels odd.
Using LayoutOptions, you have to declare your layout twice, once in bean, once in view, and make sure the two match.
This makes for unnecessary complexity especially when dealing with multiple levels of templating and dynamic stuff.

Do you have any tips or patterns to deal with this given the new architecture ?
Would it be possible to still have the option to not use LayoutOptions ?

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

13 Oct 2012, 19:54

Using LayoutOptions, you have to declare your layout twice, once in bean, once in view, and make sure the two match.
LayoutOptions is the model. The same is valid for many PF components as well. E.g. Tree is created in model too although you have XHTML code with tags. What is wrong here?
Would it be possible to still have the option to not use LayoutOptions ?
No LayoutOptions means Layout (pe:layout) should get all Layout Panes (pe:layoutPane), extract their options and build them together. If you don't like LayoutOptions, you can still use PF Layout (p:layout). But of course, I will think about an alternative "mode" with options in pe:layoutPane. I quess there are two modes then: 1) use LayoutOptions in pe:layout 2) use (limited) options in pe:layoutPane.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

ds_dev
Posts: 19
Joined: 27 Oct 2011, 10:03

15 Oct 2012, 09:50

Thanks for taking the time to answer my questions.
LayoutOptions is the model. The same is valid for many PF components as well. E.g. Tree is created in model too although you have XHTML code with tags. What is wrong here?
I don't fully agree with you on this.

For instance, the tree component can be defined in two ways :
- statically: you define all the nodes of the tree in your page;
- dynamically: you supply a model and then just define how a node is to be displayed, you don't need to explicitly redefine the tree structure.

But you never define both of them at the same time. The same goes for <p:menuBar>, you either use the model attribute or write static sub elements.
If you don't like LayoutOptions, you can still use PF Layout (p:layout).
Don't get me wrong, I love the work you're doing and the PFE Layout is better than the PF layout, and I know there's more to come, so I will gladly use it.
I quess there are two modes then: 1) use LayoutOptions in pe:layout 2) use (limited) options in pe:layoutPane
That would be a nice solution although I don't really understand what bothers you in having too many attributes for <pe:layoutPane>.
Are these technical issues or are you worried it would get too complex for the users? <p:commandButton> has about 50 attributes and it's not really an issue.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

15 Oct 2012, 11:05

I'm afraid, 50 attributes for layout options are too little :-). We will keep the old ones maybe, the most important. Keep in mind, every attribute participates in the state saving. Less attributes --> better performance. But I agree generally, having two possibilities: with LayoutOptions and without would be great. This is not the main focus for the next maintenance release. Next small release should contain "updatable layout panes feature".
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

ds_dev
Posts: 19
Joined: 27 Oct 2011, 10:03

15 Oct 2012, 11:55

Thank you for considering this as an enhancement to the component. It's great that you listen to the community.
Do you want me to file an enhancement request so you can keep that in my mind more easily :) .

Also happy to hear about the "updatable layout panes feature" for the next release.

Have a nice day!

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

15 Oct 2012, 12:11

Yes, you can file an issue "Add options to pe:layoutPane".
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

alexrk6@gmail.com
Posts: 6
Joined: 12 Sep 2012, 22:55
Location: Russia

16 Oct 2012, 20:36

please let me add my words, i tried using pe:layout with nested layouts in the templating sections that are rendered it the main central area of the application with ajax-navigation mechanism .. and a couple of thoughts:

1. LayoutOptions are not fully compliant with the xhtml markup. i.e layoutOptions.setChildOptions(new LayoutOptions()) is sufficient to render two child layoutPanes without qualifing their details in LayoutOptions.
So you are totally confused having to manage xhtml markup and LayoutOptions coherent and can't correctly define responsibilities between them.

2. In ajax rendered sections with different inner layouts you have to manage LayoutOptions in addition to xhtml markup so you need to define special mechanism for updating LayoutOptions in ManagedBeans ... i.e. you need to add another layer of responsibility (another peace of code) in the ManagedBeans and it is not trivial and is not looks like good architecture.

So i am fully support ds_dev considerations and wish you a good time to do your nice things to make them better )
with best regards,
Alex

ds_dev
Posts: 19
Joined: 27 Oct 2011, 10:03

17 Oct 2012, 09:12

Oups I realized I forgot to put the link to the issue related. So here it is:
http://code.google.com/p/primefaces-ext ... ail?id=285

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests