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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon May 10 13:48:27 EDT 2010


Author: eallen
Date: 2010-05-10 13:48:27 -0400 (Mon, 10 May 2010)
New Revision: 3954

Modified:
   mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
   mgmt/newdata/cumin/python/cumin/messaging/main.py
Log:
Added 'Add broker group' task on main messaging frame

Modified: mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py	2010-05-10 17:45:19 UTC (rev 3953)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py	2010-05-10 17:48:27 UTC (rev 3954)
@@ -86,33 +86,46 @@
     def __init__(self, app, name, task):
         super(BrokerGroupForm, self).__init__(app, name, task)
 
-        self.name_ = StringField(app, "name")
+        self.name_ = self.NameField(app, "name")
         self.add_field(self.name_)
 
         self.description = self.Description(app, "description")
         self.add_field(self.description)
 
+    class NameField(StringField):
+        def render_title(self, session):
+            return "Group Name"
+
     class Description(MultilineStringField):
         def render_title(self, session):
             return "Description"
 
-class BrokerGroupAdd(ObjectTask):
-    def __init__(self, app, frame):
-        super(BrokerGroupAdd, self).__init__(app, frame)
+class BrokerGroupAdd(Task):
+    def __init__(self, app):
+        super(BrokerGroupAdd, self).__init__(app)
 
         self.form = BrokerGroupAddForm(app, self.name, self)
 
     def get_title(self, session):
         return "Add broker group"
 
+    def enter(self, session):
+        nsession = wooly.Session(self.app.form_page)
+
+        self.form.return_url.set(nsession, session.marshal())
+        self.form.show(nsession)
+
+        return nsession
+
     def do_invoke(self, invoc, obj, name, description):
         conn = self.app.database.get_connection()
         cursor = conn.cursor()
 
-        group = self.cls.create_object(cursor)
+        cls = self.app.model.com_redhat_cumin.BrokerGroup
+        group = cls.create_object(cursor)
+
         group.name = name
         group.description = description
-
         group.fake_qmf_values()
 
         try:
@@ -121,11 +134,8 @@
             cursor.close()
 
         conn.commit()
-
         invoc.end()
 
-        return group
-
 class BrokerGroupAddForm(BrokerGroupForm):
     def process_submit(self, session):
         self.validate(session)
@@ -138,7 +148,7 @@
             self.task.exit_with_redirect(session)
 
     def render_title(self, session):
-        return self.task.get_title(session, None)
+        return self.task.get_title(session)
 
 class BrokerGroupEdit(ObjectTask):
     def __init__(self, app, frame):

Modified: mgmt/newdata/cumin/python/cumin/messaging/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/main.py	2010-05-10 17:45:19 UTC (rev 3953)
+++ mgmt/newdata/cumin/python/cumin/messaging/main.py	2010-05-10 17:48:27 UTC (rev 3954)
@@ -40,6 +40,16 @@
         self.brokergroup = BrokerGroupFrame(app, "brokergroup")
         self.add_mode(self.brokergroup)
 
+        self.add_group = BrokerGroupAdd(app)
+        self.tasks = list()
+        self.tasks.append(self.add_group)
+
+    def init(self):
+        super(MessagingFrame, self).init()
+
+        for task in self.tasks:
+            task.init()
+
     def render_title(self, session):
         return "Messaging"
 
@@ -47,7 +57,7 @@
     def __init__(self, app, name):
         super(MessagingView, self).__init__(app, name)
 
-        heading = self.Heading(app, "heading")
+        heading = self.MessageViewHeading(app, "heading")
         self.add_child(heading)
 
         self.tabs = TabbedModeSet(app, "tabs")
@@ -56,9 +66,23 @@
         self.tabs.add_tab(BrokerBrowser(app, "brokers"))
         self.tabs.add_tab(BrokerGroupSelector(app, "brokergroups"))
 
-    class Heading(CuminHeading):
+    class MessageViewHeading(CuminSummary):
+        def __init__(self, app, name):
+            super(MessagingView.MessageViewHeading, self).__init__(app, name, None)
+
+            self.tasks = self.SummaryTasks(app, "tasks")
+            self.replace_child(self.tasks)
+
+            props = Widget(app, "properties")
+            self.replace_child(props)
+
         def render_title(self, session):
             return "Messaging"
 
         def render_icon_href(self, session):
             return "resource?name=broker-36.png"
+
+        class SummaryTasks(ActionSet):
+            def do_get_items(self, session):
+                return [(x.get_href(session), x.get_title(session), True)
+                    for x in self.frame.tasks]



More information about the rhmessaging-commits mailing list