From d7283d6bacc296d7d2204c6087361522f4625b58 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Fri, 21 May 2010 12:38:50 +0000
Subject: [PATCH] Add a new listbox parameter to define the list of display
 style (tabular, search, ...)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35526 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/ListBox.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index a5204a2ee5..981c5715ad 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -389,6 +389,14 @@ class ListBoxWidget(Widget.Widget):
                                  required=0)
     property_names.append('report_root_list')
 
+    display_style_list = fields.ListTextAreaField('display_style_list',
+                                title="Display style",
+                                description=(
+        "A list of styles which change the listbox rendering."),
+                                default=[],
+                                required=0)
+    property_names.append('display_style_list')
+
     list_action = fields.StringField('list_action',
                                  title='List Action',
                                  description=('The id of the object action'
@@ -916,6 +924,15 @@ class ListBoxRenderer:
 
   getReportRootList = lazyMethod(getReportRootList)
 
+  def getDisplayStyleList(self):
+    """Return the list of avaible display style. Make sure that the 
+    titles are in unicode"""
+    display_style_list = self.field.get_value('display_style_list')
+    return [(str(c[0]), unicode(c[1], self.getEncoding())) for c in \
+                                                      display_style_list]
+
+  getDisplayStyleList = lazyMethod(getDisplayStyleList)
+
   def getSearchColumnIdSet(self):
     """Return the set of the ids of the search columns. Fall back to the catalog schema, if not defined.
     """
-- 
2.30.9