[rhmessaging-commits] rhmessaging commits: r1646 - in mgmt/cumin/python: wooly and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Feb 6 12:04:54 EST 2008


Author: justi9
Date: 2008-02-06 12:04:54 -0500 (Wed, 06 Feb 2008)
New Revision: 1646

Modified:
   mgmt/cumin/python/cumin/brokergroup.py
   mgmt/cumin/python/cumin/widgets.py
   mgmt/cumin/python/wooly/__init__.py
Log:
Fixes a number of problems with the broker group add/edit/remove
forms.

Adds a pop_current_frame on Page.



Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py	2008-02-06 15:39:52 UTC (rev 1645)
+++ mgmt/cumin/python/cumin/brokergroup.py	2008-02-06 17:04:54 UTC (rev 1646)
@@ -95,20 +95,21 @@
 
             return "where exists (%s)" % subquery
 
-class BrokerGroupForm(CuminForm):
+class BrokerGroupForm(CuminForm, Frame):
     def __init__(self, app, name):
         super(BrokerGroupForm, self).__init__(app, name)
 
         self.group_name = TextInput(app, "name", self)
         self.add_child(self.group_name)
 
-class BrokerGroupAdd(BrokerGroupForm, Frame):
+class BrokerGroupAdd(BrokerGroupForm):
     def get_title(self, session, model):
         return "Add Group"
 
     def process_cancel(self, session, model):
         branch = session.branch()
         self.frame().show_view(branch)
+        self.page().pop_current_frame(branch)
         self.page().set_redirect_url(session, branch.marshal())
     
     def process_submit(self, session, model):
@@ -118,13 +119,14 @@
 
         self.process_cancel(session, model)
 
-class BrokerGroupEdit(BrokerGroupForm, Frame):
+class BrokerGroupEdit(BrokerGroupForm):
     def get_title(self, session, group):
         return "Edit Group '%s'" % group.name
 
     def process_cancel(self, session, group):
         branch = session.branch()
         self.frame().show_view(branch)
+        self.page().pop_current_frame(branch)
         self.page().set_redirect_url(session, branch.marshal())
 
     def process_submit(self, session, group):
@@ -137,13 +139,15 @@
     def process_display(self, session, group):
         self.group_name.set(session, group.name)
 
-class BrokerGroupRemove(CuminConfirmForm):
+class BrokerGroupRemove(CuminConfirmForm, Frame):
     def get_title(self, session, group):
         return "Remove Broker Group '%s'" % group.name
 
     def process_cancel(self, session, group):
         branch = session.branch()
-        self.app.model.broker_group.show(branch, group).show_view(branch)
+
+        self.frame().show_view(branch)
+        self.page().pop_current_frame(branch)
         self.page().set_redirect_url(session, branch.marshal())
 
     def process_submit(self, session, group):
@@ -151,7 +155,9 @@
         method.invoke(group)
 
         branch = session.branch()
-        self.page().show_main(branch)
+        self.frame().frame().show_view(branch)
+        self.page().pop_current_frame(branch)
+        self.page().pop_current_frame(branch)
         self.page().set_redirect_url(session, branch.marshal())
 
     def render_submit_content(self, session, group):

Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py	2008-02-06 15:39:52 UTC (rev 1645)
+++ mgmt/cumin/python/cumin/widgets.py	2008-02-06 17:04:54 UTC (rev 1646)
@@ -43,14 +43,24 @@
         self.__edit = mode
 
     def show_edit(self, session):
-        return self.show_mode(session, self.__edit)
+        mode = self.show_mode(session, self.__edit)
 
+        if isinstance(mode, Frame):
+            self.page().set_current_frame(session, mode)
+
+        return mode
+
     def set_remove_mode(self, mode):
         self.__remove = mode
 
     def show_remove(self, session):
-        return self.show_mode(session, self.__remove)
+        mode = self.show_mode(session, self.__remove)
 
+        if isinstance(mode, Frame):
+            self.page().set_current_frame(session, mode)
+
+        return mode
+
     def do_process(self, session, object):
         self.page().get_frames(session).append(self)
 

Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py	2008-02-06 15:39:52 UTC (rev 1645)
+++ mgmt/cumin/python/wooly/__init__.py	2008-02-06 17:04:54 UTC (rev 1646)
@@ -380,6 +380,7 @@
     def get_redirect_url(self, session):
         return self.redirect.get(session)
 
+    # XXX take "current" out of these
     def set_current_frame(self, session, frame):
         self.frame.set(session, frame)
 
@@ -388,6 +389,13 @@
     def get_current_frame(self, session):
         return self.frame.get(session)
 
+    def pop_current_frame(self, session):
+        frame = self.get_current_frame(session)
+
+        print "Popping current frame", frame
+
+        return self.set_current_frame(session, frame.frame())
+
     def set_default_frame(self, frame):
         self.frame.default = frame
 




More information about the rhmessaging-commits mailing list