incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Lombart <christophe.lomb...@sword-technologies.com>
Subject Proposal : Graffito/J2 portlet framework
Date Tue, 17 May 2005 05:33:31 GMT
Hi all,

I'm currently thinking about a small "Graffito portlet  frameworks" 
which can solve some classic issues. I think this one can be donate
later (after some discussion between us) to Jetspeed project.Here is a 
brief summary. Can you tell me what do you think about that
? In order to give you more details, I can commit the code of this 
proposal this week.  I'm ready to see other solutions and if needed
I'm ready to review the complete code.

Situation :
-------------
1. The Graffito browser portlet has to manage different kind of cms 
objects (folders, binaries, simple texts, html docs, ...). It is a
nice portlet to manage the complete content tree in one place but it 
contains many templates and actions to process.  This causes too many
checks and important amount of code in the different portlet methods 
(doView, doEdit and processAction). This complexity will increase when
we will add server references, articles, news, ...

2. Moving from the view mode to edit mode is not so simple. Depending on 
the cms object nature, this portlet has to choose the appropriate
template and method used to retrieve the correct information. For 
example : in the view mode, it is possible to navigate across the
content tree and select an HTML document. When the user switch to the 
edit mode, an html editor should be display.
On the other hand, if the user select another kind of cms object, other 
information has to be display in the edit mode.

3. This Graffito portlet uses tabs (in the edit mode) to show details on 
the selected cms object (eg. for a folder : its children, its
attributes ans its associated permissions).

4. Last point, it should be nice to have some "wizard" fonctionnalities 
to manage cms object creation, delete, ...

Features/solution :
------------------------

Note : this framework is not usefull for simple portlets containing a 
few amount of templates and actions to proceed or when no wizard and
no tab are required.

* Declarative page management :
- The framework engine uses an xml config file containing each "page" 
available in the view & edit mode and the relation between them ( eg.
: the "folderView" page is linked to the "folderEdit" page).
- A page is associated to a template (VM or jsp, ...) and an action.This 
action is used to retrieve the correct information. Maybe
"action" is not the correct name and can give some confusion 
with"processAction". Optionnally, a page can contains one or more tabs.
There is a default page for the view mode and another one for the edit mode.
- a template href  or a submit button can be used to forward to a page 
just by specifying its name. In function of this name, the engine will
display the page template and execute the page action.
- a template href  or a submit button can execute an simple action (like 
delete a cms object). After executing this action, the engine
will render the current page.

* Tab management :
- A tab is composed of different tab page. A tab page is associated to a 
template and also an action. This action is used to populate the tab
page. No additionnal code is required to navigate across the different 
tab pages. It is also possible to add some condition to show a tab
page. Eg. if the document is an article, display the article editor 
otherwise the html editor.

* Other features :
- Upload support
- Populate beans from portlet request
- Velocity macros and jsp custom tags used display document links, cms 
path, tabs, ...

Plan to do  :
- Wizard is not yet supported. I would like to define also the wizards 
in a config file. This one can specify how to naviagate across the
different wizard pages.
- Treeview (with lazy loading) : I would like to use more and more tools 
like XMLHttpRequest which can increase portlet performances. It
just an idea - let me know you point of view.

What the developer has to do ?
------------------------------

Programming with this framework , the developers has only to do :
* Define the page structures in an xml config file.
* Build some action classes and templates.
* The same portlet can be used to manage an important number of
actions and template. One ancestor portlet can be defined.

Other solutions (?)
------------------------

Another solution is to split this Browser portlet into smaller
portlets. This approach can gives more complexities in the psml file
(compare to this "all in one" portlet :-) )

Page config file sample
-----------------------------

<pages>
       <view>
               <page id = "folderViewer" action="folder.retrieve" 
template="/WEB-INF/view/folder/folder-browser.vm" defaultPage="true" />

               <page id = "documentHtmlTextViewer" 
action="document.retrieve" 
template="/WEB-INF/view/document/document-view-text-html.vm">
                       <editpage>documentEdit</editpage>
               </page>

               <page id = "documentUploadViewer" 
action="document.retrieve" 
template="/WEB-INF/view/document/document-view-upload.vm">
                       <editpage>documentEdit</editpage>
               </page>

       </view>
       <edit>
               <page id = "folderEdit" 
template="/WEB-INF/view/folder/folder-tab.vm" defaultPage="true">
                       <tab id="folder-edit">
                               <page id="children" 
label="tab.folder-edit.children" 
template="/WEB-INF/view/folder/folder-children.vm" action =
                                       "folder.retrieve" 
defaultTabPage="true" />
                               <page id="metadata" 
label="tab.folder-edit.metadata" 
template="/WEB-INF/view/folder/folder-metadata.vm" action =
                                       "folder.retrieve" />
                               <page id="security" label="tab.security" 
template="/WEB-INF/view/security/security-browser.vm" action
                                       ="permission.retrieve" />
                       </tab>
               </page>
               <page id = "folderCreate" action="folder.create" 
template="/WEB-INF/view/folder/folder-metadata.vm" >
                       <viewPage>folderViewer< /viewPage>
               </page>

               <page id = "documentEdit" 
template="/WEB-INF/view/document/document-tab.vm">
                       <tab id="document-edit">
                               <page id="content" 
label="tab.document-edit.content" template= 
"/WEB-INF/view/document/document-edit-content.vm"
                                       action="document.retrieve" 
defaultTabPage="true" />
                               <page id="metadata" 
label="tab.document-edit.metadata" template= 
"/WEB-INF/view/document/document-edit-metadata.vm" 
action="document.retrieve" />
                               <page id="security" label="tab.security" 
template="/WEB-INF/view/security/security-browser.vm"   
action="permission.retrieve" />
                       </tab>
                       <viewPage 
condition='documentDTO.getDocument().getContentType().equals( 
"text/plain")|| 
documentDTO.getDocument().getContentType().equals("text/html")'>documentHtmlTextViewer</viewPage>
                       <viewPage 
condition='documentDTO.getDocument().getContentType().equals("text/html")'>documentUploadViewer</viewPage>
               </page>
               <page id = "documentCreate" 
action="document.createWizard" 
template="/WEB-INF/view/document/document-edit-metadata.vm" />

               <page id = "textEdit" action="document.createWizard" 
template="/WEB-INF/view/document/document-edit-text.vm" >
                       <viewPage>documentHtmlTextViewer</viewPage>
               </page>
               <page id = "htmlEdit" action="document.createWizard" 
template="/kupu/kupu.vm" >
                       <viewPage>documentHtmlTextViewer</viewPage>
               </page>
               <page id = "uploadEdit" action="document.createWizard" 
template="/WEB-INF/view/document/document-edit-upload.vm" >
                       <viewPage>documentUploadViewer</viewPage>
               </page>
               <page id = "permissionCreate" action="permission.create" 
template="/WEB-INF/view/security/security-permission.vm" />
       </edit>
</pages>

What do you think ?

Kind regards,
Christophe

Mime
View raw message