Blossom 2.0    Tobias Mattsson, Senior Software     Magnolia International Ltd.    Engineer                               ...
Take advantage of Spring Framework                  Spring is a java based application framework                   • Focus...
How Blossom integrates Spring                  Integrates Spring into the module mechanism                   • Module Life...
Model View Controller Pattern                  The controller receives input, performs requested operations and    Control...
Template example        @Controller        @Template(id = "blossomSample:pages/main", title = "Main template")        publ...
Magnolia rendering sequence                  Template   Component                             Component                   ...
Blossom managed templates and                                   Template       Component                                  ...
The Blossom programming model                  Based on annotations                  Non-intrusive                  Spring...
Example Template with Area        @Controller        @Template(id = "blossomSample:pages/main", title = "Main template")  ...
Example Component     @Controller     @Template(id = "blossomSample:components/shoppingCart", title = "Shopping Cart")    ...
Specifying what goes into an Area     @Controller     @Area("promos")     @AvailableComponentClasses({TextComponent.class,...
Area inheritance     @Controller     @Area("promos")     @Inherits     @AvailableComponentClasses({TextComponent.class, Sh...
Blossom Managed Dialogs                   Dialogs are created using code, not configuration                   Based on anno...
Blossom Managed Dialogs       @DialogFactory("page-dialog")       public class PageDialog {              @TabFactory("Cont...
Dialog inheritance             public abstract class BaseDialog {                 @TabFactory("Meta")                 publ...
Dialog validation            @DialogFactory("page-properties")            public class PagePropertiesDialog {             ...
Templates can contain dialog factories            @Controller            @Template(id=”blossomSample:pages/section” title=...
Dynamic dialogs       @Controller       @Template(id=”blossomSample:components/book” title=“Book”)       public class Book...
View Technologies                   Best of both worlds approach                   Magnolia and Spring constructs work sid...
Pre-executing a controller (component)                                 Template         Component                         ...
Pre-executing a controller (component)                                                                  Template   C      ...
Summary                   Spring centric approach based on annotations                   Novel features like pre-execution...
Resources                   Documentation                     • http://documentation.magnolia-cms.com/modules/            ...
Upcoming SlideShare
Loading in …5
×

Blossom 2.0 Presentation

2,071 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,071
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
24
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Blossom 2.0 Presentation

    1. 1. Blossom 2.0 Tobias Mattsson, Senior Software Magnolia International Ltd. Engineer Magnolia is a registered trademark owned by Magnolia1 Version 1.1 International Ltd.
    2. 2. Take advantage of Spring Framework Spring is a java based application framework • Focus on web applications and enterprise applications • One of the most popular frameworks in the java space Pioneered a broad feature set • Lightweight container • Dependency Injection (DI) • Aspect Oriented Programming (AOP) • Enterprise Service Abstraction Magnolia is a registered trademark owned by Magnolia2 Version 1.1 International Ltd.
    3. 3. How Blossom integrates Spring Integrates Spring into the module mechanism • Module Lifecycle Integrates with Spring Web MVC And additional bridging Magnolia is a registered trademark owned by Magnolia3 Version 1.1 International Ltd.
    4. 4. Model View Controller Pattern The controller receives input, performs requested operations and Controller provides the resulting model. The view is responsible for providing the UI representation of the model. Keeps business logic separated from presentation. Model View Magnolia is a registered trademark owned by Magnolia4 Version 1.1 International Ltd.
    5. 5. Template example @Controller @Template(id = "blossomSample:pages/main", title = "Main template") public class MainTemplate { @RequestMapping("/mainTemplate") public String render(Node page, ModelMap model) { return "pages/main.jsp"; } @TabFactory("Content") public void propertiesDialog(TabBuilder tab) { tab.addEdit("title", "Title", ""); } } Magnolia is a registered trademark owned by Magnolia5 Version 1.1 International Ltd.
    6. 6. Magnolia rendering sequence Template Component Component Magnolia is a registered trademark owned by Magnolia6 Version 1.1 International Ltd.
    7. 7. Blossom managed templates and Template Component C C M M V V Component C Templates and components are decoupled from view M rendering V Magnolia is a registered trademark owned by Magnolia7 Version 1.1 International Ltd.
    8. 8. The Blossom programming model Based on annotations Non-intrusive Spring centric approach • The controller is the template • The controller is the component • and they’re automatically available in Magnolia Dialogs are created programmatically Magnolia is a registered trademark owned by Magnolia8 Version 1.1 International Ltd.
    9. 9. Example Template with Area @Controller @Template(id = "blossomSample:pages/main", title = "Main template") public class MainTemplate { @Controller @Area("main") public static class MainArea { @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("borderWidth", "Border width", "Width of the border around the area"); } @RequestMapping("/mainTemplate/main") public String render() { return "areas/main.jsp"; } } ... } Magnolia is a registered trademark owned by Magnolia9 Version 1.1 International Ltd.
    10. 10. Example Component @Controller @Template(id = "blossomSample:components/shoppingCart", title = "Shopping Cart") @TemplateDescription("Shopping cart") public class ShoppingCartComponent { @RequestMapping("/shoppingCart") public String handleRequest() { ... return "components/shoppingCart.jsp"; } ... } Magnolia is a registered trademark owned by Magnolia10 Version 1.1 International Ltd.
    11. 11. Specifying what goes into an Area @Controller @Area("promos") @AvailableComponentClasses({TextComponent.class, ShoppingCartComponent.class}) public static class PromosArea { @RequestMapping("/mainTemplate/promos") public String render() { return "areas/promos.jsp"; } } Magnolia is a registered trademark owned by Magnolia11 Version 1.1 International Ltd.
    12. 12. Area inheritance @Controller @Area("promos") @Inherits @AvailableComponentClasses({TextComponent.class, ShoppingCartComponent.class}) public static class PromosArea { @RequestMapping("/mainTemplate/promos") public String render() { return "areas/promos.jsp"; } } Magnolia is a registered trademark owned by Magnolia12 Version 1.1 International Ltd.
    13. 13. Blossom Managed Dialogs Dialogs are created using code, not configuration Based on annotations Detected and automatically available in Magnolia Validation of dialog input Magnolia is a registered trademark owned by Magnolia13 Version 1.1 International Ltd.
    14. 14. Blossom Managed Dialogs @DialogFactory("page-dialog") public class PageDialog { @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("title", "Title", "Title of this page"); tab.addCheckbox("navigation", "Navigation", "Include page in menu"); } Text @TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("author", "Author", ""); tab.addEdit("keywords", "Keywords", "Keywords for this page"); tab.addEdit("description", "Description", "Concise page explanation"); } } Magnolia is a registered trademark owned by Magnolia14 Version 1.1 International Ltd.
    15. 15. Dialog inheritance public abstract class BaseDialog { @TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("keywords", "Keywords", "Keywords for this page"); tab.addEdit("description", "Description", "Concise page explanation"); } } Text @DialogFactory("news-properties") @TabOrder("Content", “Meta”) public class NewsPageDialog extends BaseDialog { @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("subject", "Subject", "News subject"); tab.addDate("date", "Publication Date", "Date of publication"); tab.addFckEditor("text", "Text", ""); tab.addFile("image", "Image", ""); } } Magnolia is a registered trademark owned by Magnolia15 Version 1.1 International Ltd.
    16. 16. Dialog validation @DialogFactory("page-properties") public class PagePropertiesDialog { @TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("description", "Description", "A concise page explanation"); } Text @TabValidator("Meta") public void validateMetaTab(DialogTab tab) { if (tab.getSub("description").getValue().length() < 20) AlertUtil.setMessage("Meta description needs to be longer"); } } Magnolia is a registered trademark owned by Magnolia16 Version 1.1 International Ltd.
    17. 17. Templates can contain dialog factories @Controller @Template(id=”blossomSample:pages/section” title="Section") public class SectionTemplate { @RequestMapping("/section") public ModelAndView handleRequest() { } Text return new ModelAndView("sectionTemplate.jsp"); @DialogFactory("section-properties") public void propertiesDialog(DialogBuilder dialog) { TabBuilder contentTab = dialog.addTab("Content"); contentTab.addEdit("title", "Title", "Title of this page"); TabBuilder metaTab = dialog.addTab("Meta"); metaTab.addEdit("description", "Description", "Page explanation"); } } Magnolia is a registered trademark owned by Magnolia17 Version 1.1 International Ltd.
    18. 18. Dynamic dialogs @Controller @Template(id=”blossomSample:components/book” title=“Book”) public class BookComponent { @Autowired private BookStoreWebService webService; @RequestMapping("/book") Text public ModelAndView handleRequest() { Content content = MgnlContext.getAggregationState().getCurrentContent(); String bookId = content.getNodeData("id").getString(); ModelAndView mav = new ModelAndView("book.jsp"); mav.addAttribute("book", webService.getBook(bookId)); return mav; } @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addSelect("id", "Book", "Select the book", webService.getBooks()); } } Magnolia is a registered trademark owned by Magnolia18 Version 1.1 International Ltd.
    19. 19. View Technologies Best of both worlds approach Magnolia and Spring constructs work side by side Built-in support for Freemarker and JSP Everything Spring supports work out-of-the-box, such as JSON, PDF, XML and RSS Magnolia is a registered trademark owned by Magnolia19 Version 1.1 International Ltd.
    20. 20. Pre-executing a controller (component) Template Component C C C M M V V Component C The pre-executed controller can choose to skip page rendering by M sending a redirect or directly V render something on its own Magnolia is a registered trademark owned by Magnolia20 Version 1.1 International Ltd.
    21. 21. Pre-executing a controller (component) Template C Component C C M M <form> V V <blossom:pecid-input /> <input type=”text” name=”email” /> ... Component C </form> M Outputs: V <form> <input type=”hidden” name=”_pecid” value=”ff6cefa6-d958-47b1-af70-c82a414f17e1”/> <input type=”text” name=”email” /> ... </form> Magnolia is a registered trademark owned by Magnolia21 Version 1.1 International Ltd.
    22. 22. Summary Spring centric approach based on annotations Novel features like pre-execution and dialog validation Code over configuration • Versioning • Collaboration Enables access to Spring features and technologies • Directly in templates, paragraphs and dialogs Magnolia is a registered trademark owned by Magnolia22 Version 1.1 International Ltd.
    23. 23. Resources Documentation • http://documentation.magnolia-cms.com/modules/ blossom.html Wiki • http://wiki.magnolia-cms.com/display/WIKI/Magnolia +Blossom Samples • http://git.magnolia-cms.com/gitweb/?p=modules/blossom/ samples.git Blog • http://tobias-mattsson-magnolia.blogspot.se/ Magnolia is a registered trademark owned by Magnolia23 Version 1.1 International Ltd.

    ×