Changes made on Web Client to enable usage of Facelets

cancel
Showing results for 
Search instead for 
Did you mean: 

Changes made on Web Client to enable usage of Facelets

resplin
Intermediate
0 0 814

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Needs to be ReviewedFacelets
This document is describing what has been changed within Alfresco Web Client in order to make it work with Facelets:


  • PanelGenerator static methods
    • Static methods of PanelGenerator class are very often used within markup to output HTML which than decorates certain content with nice rounded corner panel. This has been replaced with <aSmiley TongueanelGenerator> composite component which does exactly the same thing but eliminates Java from markup
  • Page tag
    • <rSmiley Tongueage> jsp tag which generates header and footer of every page has been replaced with <rSmiley Tongueage> custom component which has exactly the same attributes and produces the same output
  • Action listeners
    • Facelets framework automatically does appropriate method binding of „actionListener“ and „action“ properties. If the property is not one of these two and it has to be bound to a method, than it has to be done manually within appropriate ComponentHandler class. Fortunately, it seems that custom action listeners of Alfresco web client are following the same pattern (expandActionListener, clickActionListener..) therefore it was possible to create generic AlfrescoComponentHandler class which bounds all properties with such name pattern to a appropriate action listener method
  • Multipart/form-data
    • All jsp pages which involve some kind of file upload are designed in such way to have three forms on the page. First for components at the beginning of the page (sidebar, breadcrumb...), than multipart form in the middle which posts to the fileUploadServlet, and than another form for the rest of components on the page. This works fine for jsp, but facelets can only compile valid XML file and with these three forms on the page it is no longer valid XML and can not be compiled. As a quick solution I have replaced these three forms with only one which encloses entire content and has encoding type set as multipart. In case that upload button is clicked, javascript is changing action property of the form to fileUploadServlet. Also, return-page hidden field which is normally generated by <r:uploadForm> tag is put on the form itself.
  • Java flow control
    • Java is not allowed in facelet pages therefore Java flow control has been replaced with jstl condition tags
  • Java code inside of markup
    • As mentioned,  Java is not allowed, therefore pieces of java code which would normally become a part of servlet has been moved to TagHandler classes and has been registered inside of alfresco.taglib.xml. That way the code will be executed on every refresh of the page, just as it is part of servlet. Example: <a:authenticationChex/> <a:setLocale/>
  • Setting of component properties
    • Since there are no longer Tag classes, framework itself is setting the properties of components from tag attributes specified on the page. To enable this, component properties has to be exposed, and there are some components where attributes map is updated from the tag class and properties are not exposed. To correct this, component properties are exposed. Such cases have been found within following components so far: UIImagePicker, UINodePath.
  • UIPanel component
    • This component is doing some handling inside of Tag class in order to correctly render content even if the content is html not enclosed within verbatim tags. Since, in Facelet, everything is a component, even html and plain text, this can be left out and we can allow UIPanel component to normally render its children according to the value of isExpanded attribute
  • Markup
    • Since markup has to be valid XML, a lot of tag closing, attribute quoting and other corrections had to be done. Fortunately, this is predictable process and it has been automated.