Author: jmorliaguet Date: Tue Apr 11 22:11:04 2006 New Revision: 2824 Modified: cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt Log:
- doc update Modified: cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt ============================================================================== --- cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt (original) +++ cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt Tue Apr 11 22:11:04 2006 @@ -54,8 +54,7 @@ 1) a portlet has some data to display, called the 'Display Data'. it corresponds to the model in the Model-View-Controller paradigm. - - the display data can be for instance: + the Display Data can be for instance: - a list of menu items @@ -77,8 +76,7 @@ - ... -2) the data is displayed in a Display Element, (here: a box) : - it corresponds to the 'view' in the MVC paradigm. +2) the data is then displayed in a Display Element (here: a box). >>> from zope.interface.verify import verifyClass >>> from cpsskins.standard.displays.box import Box @@ -86,7 +84,7 @@ >>> verifyClass(IDisplay, Box) True - the box is then formatted with a widget. + the box and its content is formatted with a *widget*: >>> from cpsskins.standard.formats.widget import Widget >>> from cpsskins.elements.interfaces import IFormat @@ -95,13 +93,22 @@ >>> widget = Widget([u'standard.plain_html']) + A list of widget names can be specified, i.e. if the first type of widget + cannot render the data structure, the next widget will be used, etc. until + a suitable widget is found. -3) The portlet is finally rendered by passing the data to the filter - (here a widget filter): + >>> widget = Widget([u'standard.special_widget', u'standard.plain_html']) - >>> rendered = u'<h1>Test of HTML</h1>' + Otherwise a basic widget view registered by default for the data type will + be used. + + +3) The portlet is finally rendered with a widget filter. -the widget filter adapts the data structure for providing a view: + It corresponds to the 'view' in the MVC paradigm. + + the widget filter attempts to find a named view for the data structure or + it falls back to the basic widget view registered for the data structure. >>> from cpsskins.standard.filters.widget import WidgetFilter >>> from cpsskins.standard.formats.widget import IWidget @@ -109,6 +116,8 @@ >>> ztapi.provideAdapter(IWidget, IFilterView, WidgetFilter) + >>> rendered = u'<h1>Test of HTML</h1>' + >>> def test_render(widget, rendered, info): ... widget_filter = IFilterView(widget) ... return widget_filter(rendered, info) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins