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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Nov 13 11:14:26 EST 2007


Author: justi9
Date: 2007-11-13 11:14:26 -0500 (Tue, 13 Nov 2007)
New Revision: 1297

Modified:
   mgmt/cumin/python/cumin/broker.strings
   mgmt/cumin/python/cumin/brokergroup.strings
   mgmt/cumin/python/cumin/brokerprofile.py
   mgmt/cumin/python/cumin/brokerprofile.strings
   mgmt/cumin/python/cumin/exchange.strings
   mgmt/cumin/python/cumin/page.py
   mgmt/cumin/python/cumin/queue.strings
   mgmt/cumin/python/cumin/realm.strings
   mgmt/cumin/python/cumin/widgets.strings
   mgmt/cumin/python/wooly/forms.strings
   mgmt/notes/justin-todo.txt
Log:
Adds broker profile add and edit forms.  Also fixes form input focus
and tab indexing.



Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/broker.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -134,7 +134,7 @@
 </form>
 <script defer="defer">
 (function() {
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())
@@ -232,7 +232,7 @@
 </form>
 <script defer="defer">
 (function() {
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())

Modified: mgmt/cumin/python/cumin/brokergroup.strings
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/brokergroup.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -48,7 +48,7 @@
 {tabs}
 
 [BrokerGroupForm.html]
-<form id="{id}" class="BrokerGroupForm mform" method="post" action="?">
+<form id="{id}" class="mform" method="post" action="?">
   <div class="head">
     <h1>{title}</h1>
   </div>
@@ -66,7 +66,7 @@
 </form>
 <script defer="defer">
 (function() {
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())

Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/brokerprofile.py	2007-11-13 16:14:26 UTC (rev 1297)
@@ -10,6 +10,11 @@
 strings = StringCatalog(__file__)
 
 class BrokerProfileSet(ItemSet):
+    def render_profile_add_href(self, session, profile):
+        branch = session.branch()
+        self.page().show_broker_profile_add(branch)
+        return branch.marshal()
+
     def get_items(self, session, model):
         return sorted_by(model.get_broker_profiles())
 
@@ -30,6 +35,10 @@
         self.add_mode(self.view)
         self.set_view_mode(self.view)
 
+        self.edit = BrokerProfileEdit(app, "edit")
+        self.add_mode(self.edit)
+        self.set_edit_mode(self.edit)
+
     def get_title(self, session, profile):
         return "Broker Profile '%s'" % profile.name
 
@@ -49,6 +58,11 @@
     def render_name(self, session, profile):
         return profile.name
 
+    def render_edit_href(self, session, profile):
+        branch = session.branch()
+        self.page().show_broker_profile(branch, profile).show_edit(branch)
+        return branch.marshal()
+
     class ProfileConfigTab(ConfigPropertySet):
         def get_items(self, session, profile):
             return sorted_by(profile.config_property_items())
@@ -82,3 +96,49 @@
                             diffs += 1
                             
             return "%i difference(s)" % diffs
+
+class BrokerProfileForm(CuminForm):
+    def __init__(self, app, name):
+        super(BrokerProfileForm, self).__init__(app, name)
+
+        self.profile_name = TextInput(app, "name", self)
+        self.add_child(self.profile_name)
+
+    def process_profile(self, session, profile):
+        profile.lock()
+        try:
+            profile.name = self.profile_name.get(session)
+        finally:
+            profile.unlock()
+
+        branch = session.branch()
+        self.page().show_broker_profile(branch, profile).show_view(branch)
+        self.page().set_redirect_url(session, branch.marshal())
+
+class BrokerProfileAdd(BrokerProfileForm, Frame):
+    def get_title(self, session, model):
+        return "Add Profile"
+
+    def process_cancel(self, session, model):
+        branch = session.branch()
+        self.page().show_view(branch)
+        self.page().set_redirect_url(session, branch.marshal())
+    
+    def process_submit(self, session, model):
+        profile = BrokerProfile(model)
+        self.process_profile(session, profile)
+    
+class BrokerProfileEdit(BrokerProfileForm, Frame):
+    def get_title(self, session, profile):
+        return "Edit Profile '%s'" % profile.name
+
+    def process_cancel(self, session, profile):
+        branch = session.branch()
+        self.parent.show_view(branch)
+        self.page().set_redirect_url(session, branch.marshal())
+
+    def process_submit(self, session, profile):
+        self.process_profile(session, profile)
+
+    def process_display(self, session, profile):
+        self.profile_name.set(session, profile.name)

Modified: mgmt/cumin/python/cumin/brokerprofile.strings
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/brokerprofile.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -1,9 +1,9 @@
 [BrokerProfileSet.html]
 <ul class="actions">
-  <li><a class="nav" href="{href}">Add Broker Profile</a></li>
+  <li><a class="nav" href="{profile_add_href}">Add Broker Profile</a></li>
 </ul>
 
-<table class="BrokerProfileSet mobjects">
+<table class="mobjects">
   <tr>
     <th>Name</th>
   </tr>
@@ -24,7 +24,7 @@
   <tr>
     <th class="actions" colspan="2">
       <h2>Act on This Profile:</h2>
-      <a class="nav" href="{href}">Edit</a>
+      <a class="nav" href="{edit_href}">Edit</a>
       <a href="{href}">Remove</a>
     </th>
   </tr>
@@ -74,3 +74,28 @@
   <td>{item_link}</td>
   <td><a href="{item_config_href}">{item_config_status}</a></td>
 </tr>
+
+[BrokerProfileForm.html]
+<form id="{id}" class="mform" method="post" action="?">
+  <div class="head">
+    <h1>{title}</h1>
+  </div>
+  <div class="body">
+    <span class="legend">Name</span>
+    <fieldset>{name}</fieldset>
+
+    {hidden_inputs}
+  </div>
+  <div class="foot">
+    <a class="help action" href="{href}" target="help">Help</a>
+    {cancel}
+    {submit}
+  </div>
+</form>
+<script defer="defer">
+(function() {
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
+    elem.focus();
+    elem.select();
+}())
+</script>

Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/exchange.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -1,6 +1,6 @@
 [ExchangeInputSet.item_html]
 <div class="field">
-  <input type="radio" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+  <input type="radio" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
   {item_content}
 </div>
 
@@ -77,7 +77,7 @@
 <script defer="defer">
 (function() {
     // elements[0] is a fieldset, at least in firefox
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())

Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/page.py	2007-11-13 16:14:26 UTC (rev 1297)
@@ -44,6 +44,9 @@
         self.profile = BrokerProfileFrame(app, "profile")
         self.add_mode(self.profile)
 
+        self.profile_add = BrokerProfileAdd(app, "profileadd")
+        self.add_mode(self.profile_add)
+
         self.cluster = BrokerClusterFrame(app, "cluster")
         self.add_mode(self.cluster)
 
@@ -93,16 +96,20 @@
         frame = self.show_mode(session, self.group_add)
         return self.set_current_frame(session, frame)
 
+    def show_broker_profile(self, session, profile):
+        frame = self.show_mode(session, self.profile)
+        frame.set_object(session, profile)
+        return self.set_current_frame(session, frame)
+
+    def show_broker_profile_add(self, session):
+        frame = self.show_mode(session, self.profile_add)
+        return self.set_current_frame(session, frame)
+
     def show_broker_cluster(self, session, cluster):
         frame = self.show_mode(session, self.cluster)
         frame.set_object(session, cluster)
         return self.set_current_frame(session, frame)
 
-    def show_broker_profile(self, session, profile):
-        frame = self.show_mode(session, self.profile)
-        frame.set_object(session, profile)
-        return self.set_current_frame(session, frame)
-
     def show_queue(self, session, queue):
         broker = queue.get_virtual_host().get_broker()
         frame = self.show_broker(session, broker)

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/queue.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -82,7 +82,7 @@
 </form>
 <script defer="defer">
 (function() {
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())
@@ -229,7 +229,7 @@
 </form>
 <script defer="defer">
 (function() {
-    var elem = wooly.doc().elem("{id}").node.elements[1];
+    var elem = wooly.doc().elembyid("{id}").node.elements[1];
     elem.focus();
     elem.select();
 }())

Modified: mgmt/cumin/python/cumin/realm.strings
===================================================================
--- mgmt/cumin/python/cumin/realm.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/realm.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -1,6 +1,6 @@
 [RealmInputSet.item_html]
 <div class="field">
-  <input type="checkbox" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+  <input type="checkbox" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
   {item_content}
 </div>
 

Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/cumin/widgets.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -10,7 +10,7 @@
   </div>
 </form>
 <script>
-wooly.doc().elem("{id}").node.elements[1].focus();
+  wooly.doc().elembyid("{id}").node.elements[1].focus();
 </script>
 
 [CuminStatus.html]

Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/cumin/python/wooly/forms.strings	2007-11-13 16:14:26 UTC (rev 1297)
@@ -1,5 +1,5 @@
 [FormButton.html]
-<button id="{id}" type="submit" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr}>{content}</button>
+<button id="{id}" type="submit" name="{name}" value="{value}" tabindex="{tab_index}" {disabled_attr}>{content}</button>
 
 [FormInput.errors_html]
 <ul class="errors">{error_messages}</ul>

Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt	2007-11-13 13:41:48 UTC (rev 1296)
+++ mgmt/notes/justin-todo.txt	2007-11-13 16:14:26 UTC (rev 1297)
@@ -8,6 +8,9 @@
 
 Deferred
 
+ * Add a wooly.focus(id) method to replace the ad-hoc javascript I'm
+   using
+
  * Think about making css and jscript pages produce their document in
    some kind of widget-tree traversal order
 




More information about the rhmessaging-commits mailing list