[rhmessaging-commits] rhmessaging commits: r3934 - mgmt/newdata/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Apr 26 16:11:32 EDT 2010


Author: eallen
Date: 2010-04-26 16:11:31 -0400 (Mon, 26 Apr 2010)
New Revision: 3934

Modified:
   mgmt/newdata/cumin/python/cumin/objectselector.py
Log:
Added ObjectTable class

Modified: mgmt/newdata/cumin/python/cumin/objectselector.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objectselector.py	2010-04-26 20:07:04 UTC (rev 3933)
+++ mgmt/newdata/cumin/python/cumin/objectselector.py	2010-04-26 20:11:31 UTC (rev 3934)
@@ -10,7 +10,7 @@
 
 strings = StringCatalog(__file__)
 
-class ObjectSelector(DataTable, Form):
+class ObjectTable(DataTable):
     def __init__(self, app, name, cls, adapter=None):
         assert isinstance(cls, RosemaryClass), cls
 
@@ -19,50 +19,22 @@
 
         assert isinstance(adapter, ObjectSqlAdapter), adapter
 
-        super(ObjectSelector, self).__init__(app, name, adapter)
+        super(ObjectTable, self).__init__(app, name, adapter)
 
         self.cls = cls
 
         self.update_enabled = True
 
-        item = IntegerParameter(app, "item")
-
-        self.ids = ListParameter(app, "id", item)
-        self.add_parameter(self.ids)
-
-        self.checkbox_column = ObjectCheckboxColumn \
-            (app, "id", cls._id, self.ids)
-        self.add_column(self.checkbox_column)
-
-        self.switches = ObjectSelectorSwitches(app, "switches")
-        self.add_child(self.switches)
-
-        self.filters = ObjectSelectorFilters(app, "filters")
-        self.add_child(self.filters)
-
-        self.buttons = ObjectSelectorButtons(app, "buttons")
-        self.add_child(self.buttons)
-
         # (RosemaryAttribute this, RosemaryAttribute that, Attribute object)
         self.filter_specs = list()
 
-        self.tasks = list()
-
     def init(self):
-        super(ObjectSelector, self).init()
+        super(ObjectTable, self).init()
 
         assert self.cls, self
         assert self.adapter, self
         assert self.adapter.id_field, self
 
-        for task in self.tasks:
-            task.init()
-
-        for task in self.tasks:
-            button = SelectionTaskButton(self.app, task)
-            self.buttons.add_child(button)
-            button.init()
-
     def add_attribute_column(self, attr):
         assert isinstance(attr, RosemaryAttribute), attr
 
@@ -101,6 +73,41 @@
     def render_title(self, session):
         return "%ss" % self.cls._title
 
+class ObjectSelector(ObjectTable, Form):
+    def __init__(self, app, name, cls, adapter=None):
+        super(ObjectSelector, self).__init__(app, name, cls, adapter)
+
+        item = IntegerParameter(app, "item")
+
+        self.ids = ListParameter(app, "selection", item)
+        self.add_parameter(self.ids)
+
+        self.checkbox_column = ObjectCheckboxColumn \
+            (app, "id", cls._id, self.ids)
+        self.add_column(self.checkbox_column)
+
+        self.switches = ObjectSelectorSwitches(app, "switches")
+        self.add_child(self.switches)
+
+        self.filters = ObjectSelectorFilters(app, "filters")
+        self.add_child(self.filters)
+
+        self.buttons = ObjectSelectorButtons(app, "buttons")
+        self.add_child(self.buttons)
+
+        self.tasks = list()
+
+    def init(self):
+        super(ObjectSelector, self).init()
+
+        for task in self.tasks:
+            task.init()
+
+        for task in self.tasks:
+            button = SelectionTaskButton(self.app, task)
+            self.buttons.add_child(button)
+            button.init()
+
 class ObjectAttributeColumn(DataTableColumn):
     def __init__(self, app, name, attr):
         super(ObjectAttributeColumn, self).__init__(app, name, None)



More information about the rhmessaging-commits mailing list