« Back

Introducing the new ADT Framework

Company Blogs July 19, 2012 By Juan Fernández Staff

Hi community!

 
For the last few weeks I have been working on a new framework for Liferay Portal. We have decided to call it "Application Display Templates Framework" ("ADT Framework" for family and friends :D), and it is basically the application of our templating system to the way we see information in our applications in Liferay Portal. 
 
The ADT Framework will allow portal admins to define via Velocity templates how to show the information on each portlet. Imagine you want to show up your blog entries horizontally, or you want to list your assets in the asset publisher in different sizes depending on where they are going to be shown: now you can do it by using custom Application Display Templates! Cool, right? :)
 
For the moment I have applied it to the Asset Publisher and the Blogs portlet, but I plan to apply it to Wiki, Navigation, Site Map and Tags/Categories Navigation. 
 
 
How can you use it? There's a new application in the control panel called "Application Display Templates" (it's in the "Site" section) where you can add and manage the ADTs for the different apps in Liferay, and appart from that, on each on of the portlets that support ADTs (blogs and asset publisher for the moment), in the configuration screen you will be able to choose your ADTs, or the global ADTs (if available).
 
 
Appart from this, you'll be able to plug your custom plugins into the ADT framework, just by implementing the interface PortletDisplayTemplateHandler and declaring your implementing class in liferay-portlet.xml (in "portlet-display-template-handler")
 
How will the ADTs can look like? They will be just normal velocity templates, like the ones you use for the web content or the dynamic data lists. Additionally, there are a set of variables that have been made available for the templates (like $entries, which is the list of entries the user can see at a given moment) so that you can access all the information you need. There are a few samples made available for you in the asset publisher.
 
We have many improvements in mind that are related to this feature, but before going on I wanted to share this with you.
 
I write this blog entry for two reasons: the first one is to have the community updated on new features we the core engineering team is working on for the next version, and the second reason is to ask for your feedback and comments. 
 
Today I want to summon the Liferay Bugsquad and the rest of community members: I'd be delighted if you could test this new feature in current trunk, and I'd love to receive your feedback, the templates that you may build, your ideas, your complains or pain points, so that we can improve it asap.
 
Remember we do Liferay Portal for you: this is the kind of moments when you can have a real impact in the evolution of YOUR project.
 
Thanks in advance, and I hope you like it
Juan Fernández
 
[UPDATE] Thanks all for your feedback! We have added the features you asked for and today (a little after Milestone 4) we have implemented Freemarker support and ADT support for Asset Publisher, Blogs, Wiki, Documents and Media, Site Map, Tags Navigation and Categories Navigation... I'm sure you'll love this tool to create new awesome sites!
 
Threaded Replies Author Date
This can open alot of posibilites, but can also... Bradley Wood July 19, 2012 12:19 PM
Hi Brad! you are right: this is a really... Juan Fernández July 19, 2012 12:22 PM
Nice. Will it also support Freemarker template... Mika Koivisto July 19, 2012 12:56 PM
Hi Mika: up to now, I have done all test with... Juan Fernández July 19, 2012 6:55 PM
Hi Juan, Thanks for bringing out this... Ahmed Hasan July 20, 2012 12:13 AM
Nice Juan, I think that applying ADT to the... Christophe Cariou July 20, 2012 1:13 AM
Look very promissing feature. So basically,... Sampsa Sohlman July 20, 2012 3:55 AM
Hi, It is great one. Particular this idea is... DarshanKumar N Bhatia July 20, 2012 4:25 AM
Juan: Freemarker is very similar to Velocity... Mika Koivisto July 20, 2012 8:45 AM
Sounds great! I can really see this being a... David Rison July 20, 2012 4:17 PM
Hi guys: I respond here to your comments ... Juan Fernández July 20, 2012 4:24 PM
Hi Juan, are you gonna use this feature to... Ivica Cardic July 20, 2012 11:27 PM
Hi Ivica: in the (not so far) future it could... Juan Fernández July 20, 2012 11:28 PM
Hi Juan, Is this feature available on trunk if... Ákos Gábriel July 24, 2012 7:46 AM
Hi Akos, yeah, it's in trunk already. There... Juan Fernández July 24, 2012 7:48 AM
Seems like powerful & cool feature. Is it... Nagendra Kumar Busam August 3, 2012 12:50 AM
Hi Nagendra: no, this is a new framework and... Juan Fernández August 3, 2012 1:33 AM

Bradley Wood
This can open alot of posibilites, but can also open a can of worms. Could you add web-form portlet to the list of adding this framework. What variables will be exposed by the portlet that can be used in the template?
Posted on 7/19/12 12:19 PM.
Hi Brad!
you are right: this is a really powerful tool that can be misused, but it is always better to have flexibility and freedom, right?

Regarding the available variables, I have created an object called "contextObjects" that will allow us to share whatever we need with the template, so you'll be able to share every object you want.

Thanks for your comments
Posted on 7/19/12 12:22 PM in reply to Bradley Wood.
Nice. Will it also support Freemarker template language or are we just limiting it to the inferior and hard to debug Velocity?
Posted on 7/19/12 12:56 PM.
Hi Mika:
up to now, I have done all test with velocity. Will check Freemarker to see what changes it will imply.
Thanks for the heads up
Posted on 7/19/12 6:55 PM in reply to Mika Koivisto.
Hi Juan,

Thanks for bringing out this powerful feature. This will help the developers to avoid customizing the existing portlets through hooks inorder to change the look and feel, which usually involves too much of gymnastics. This feature will provide the flexibility and power to render the data of a portlet in whatever format the user wants "on-the-fly" just by changing the template. But it will be a long way till people really start using this new feature of Liferay.
Posted on 7/20/12 12:13 AM in reply to Juan Fernández.
Nice Juan,

I think that applying ADT to the Asset Publisher is a big improvement. As the asset publisher is a multi content type container, it could be used to display whatever we need through templates.

When do you plan to released that feauture ?

Christophe
Posted on 7/20/12 1:13 AM.
Look very promissing feature. So basically, Liferay admin can modify portlet's view template emoticon .. cool.

For sure I will test this, right on next week.
Posted on 7/20/12 3:55 AM.
Hi,
It is great one. Particular this idea is great but If I understood by applying ADT-velcoty template to particular portlet say "Language" ... and
if I have 3 langauge portlet on portal/web and all have different style (Listing/secect Box/ Icon)
-- so By Applying ADt-velocity template will it change all instance of langauge portlet ???

-- Will we change or able to use pre-defined one ???
Posted on 7/20/12 4:25 AM.
Juan: Freemarker is very similar to Velocity with the exception that it doesn't eat any errors. Another clear advantage over velocity is that you can use taglibs in the template if you have access to request and response. See ThemeUtil in how we use it with themes.
Posted on 7/20/12 8:45 AM in reply to DarshanKumar N Bhatia.
Sounds great! I can really see this being a huge improvement for asset publisher!
Posted on 7/20/12 4:17 PM.
Hi guys:
I respond here to your comments

Christophe ["When do you plan to released that feauture?"]: this is already in trunk, so it'll be part of the 6.2 release

DarshanKumar N Bhatia ["By Applying ADT template will it change all instances of portlets? Will we change or able to use pre-defined one?]: each portlet instance will be configurable, so each one could be able to be rendered using a different template, and yes, all current templates or views will be respected, so this is an "optional" feature for your portlets.

Mika ["Another clear advantage over velocity is that you can use taglibs in the template if you have access to request and response"]: awesome! I have access to req and resp so this is an awesome feature!

Thanks for the feedback!
Posted on 7/20/12 4:24 PM in reply to David Rison.
Hi Juan,
are you gonna use this feature to centalize all templates we use in Liferay? Web Content templates and DDL templates for example have their own separate places inside of Control Panel.
Posted on 7/20/12 11:27 PM in reply to Juan Fernández.
Hi Ivica:
in the (not so far) future it could be. For the moment, this is using DDMTemplate service, so they share the same backend that DDMTemplates... so yes, you're in the right direction emoticon
Posted on 7/20/12 11:28 PM in reply to Ivica Cardic.
Hi Juan,

Is this feature available on trunk if I build it now? Could you tell me the commit id?
This feature seems to be very handy, I'd like to test it. Btw do you have testcases?

Thanks,
Akos
Posted on 7/24/12 7:46 AM.
Hi Akos, yeah, it's in trunk already.
There are a couple sample templates for the asset publisher already preloaded when you install the portal, so you can use them as a reference on what to do
Thanks for your interest,
Juan
Posted on 7/24/12 7:48 AM in reply to Ákos Gábriel.
Seems like powerful & cool feature. Is it available in Liferay 6.1 EE GA2?
Posted on 8/3/12 12:50 AM.
Hi Nagendra:
no, this is a new framework and GA2 is a minor version, so this will be available in the next major version (no name yet emoticon)
Thanks for your interest
Posted on 8/3/12 1:33 AM in reply to Nagendra Kumar Busam.