[rhmessaging-commits] rhmessaging commits: r2723 - mgmt/trunk/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Sat Nov 1 12:47:39 EDT 2008
Author: eallen
Date: 2008-11-01 12:47:39 -0400 (Sat, 01 Nov 2008)
New Revision: 2723
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/system.py
Log:
Use an ItemSet for the grid widget's popup sticky notes
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -295,16 +295,7 @@
pool = self.parent.frame.get_args(session)[0]
return "call.xml?class=pool;method=jobs"
- def get_fn(self, session):
- return self.parent.grid.name
-
- def got_fn(self, session):
- return self.parent.grid.name
-
- def elem_id(self, session):
- return self.parent.grid.name
-
- def do_get_sticky_info(self, session):
+ def get_sticky_info(self, session):
return [("name", "ID"), ("submitter", "Submitter"), ("status", "Status")]
class PoolStatSet(StatSet):
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -145,10 +145,11 @@
super(StatUtilizationGrid, self).__init__(app, name)
self.stats_tmpl = Template(self, "cell_html")
- self.sticky_names_tmpl = Template(self, "sticky_name_html")
- self.sticky_values_tmpl = Template(self, "sticky_value_html")
self.legend_tmpl = Template(self, "legend_html")
+ self.sticky = self.Sticky(app, "sticky_info")
+ self.add_child(self.sticky)
+
self.ajax = self.Updater(app, "grid_updater")
self.add_child(self.ajax)
@@ -173,7 +174,7 @@
def render_override_style(self, session, objects):
pass
- def render_legends(self, session, slots):
+ def render_legends(self, session, objects):
colors = self.get_colors(session)
writer = Writer()
@@ -211,6 +212,9 @@
def render_cell_id(self, session, count, object):
return 1
+ def render_sticky_rows(self, session, count, object):
+ return self.sticky.render_items(session, object)
+
def get_url(self, session):
""" returns something like
"call.xml?class=system;id=%i;method=slots" % system.id
@@ -218,42 +222,32 @@
pass
def get_fn(self, session):
- return self.ajax.name
+ return self.name
def got_fn(self, session):
- return self.ajax.name
+ return self.name
def elem_id(self, session):
- return self.ajax.name
+ return self.name
- def render_sticky_names(self, session, count, object):
- names = self.do_get_sticky_info(session)
- writer = Writer()
-
- for name, desc in names:
- self.sticky_names_tmpl.render(writer, session, desc)
- return writer.to_string()
+ def get_sticky_info(self, session):
+ return [("Name", "Display Title")]
- def render_sticky_title(self, session, desc):
- return desc
-
- def render_sticky_values(self, session, count, object):
- names = self.do_get_sticky_info(session)
- writer = Writer()
+ class Sticky(ItemSet):
+ def do_get_items(self, session, *args):
+ info = self.parent.get_sticky_info(session)
+ object = args[0]
+ return [(inf, self.parent.render_cell_id(session, 1, object)) for inf in info]
- for name, desc in names:
- self.sticky_values_tmpl.render(writer, session, name, object)
- return writer.to_string()
+ def render_sticky_name(self, session, item):
+ return item[0][0]
+
+ def render_sticky_title(self, session, item):
+ return item[0][1]
+
+ def render_sticky_object_id(self, session, item):
+ return item[1]
- def render_sticky_name(self, session, name, object):
- return name
-
- def render_sticky_object_id(self, session, name, object):
- return self.render_cell_id(session, 1, object)
-
- def do_get_sticky_info(self, session):
- return [("Name", "Display Title")]
-
class Updater(AjaxField):
def do_render(self, session):
return self.render_script(session)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-11-01 16:47:39 UTC (rev 2723)
@@ -180,15 +180,13 @@
rules = sheet.rules ? sheet.rules : sheet.cssRules;
if (rules[0].selectorText) { // IE
for (var j=0; j<rules.length; j++) {
- if (rules[j].selectorText.indexOf("sticky_note") != -1) {
- if (rules[j].selectorText.indexOf("position") != -1) {
- return rules[j];
- }
+ if (rules[j].selectorText == "DIV.sticky_note") {
+ return rules[j];
}
}
} else {
for (var j=0; j<rules.length; j++) {
- if (rules[j].cssText.indexOf("div.sticky_note.position") != -1) {
+ if (rules[j].cssText == "div.sticky_note") {
return rules[j];
}
}
@@ -237,6 +235,20 @@
}
+
+function over_cell(me) {
+ var id = me.id;
+ var onote = document.getElementById("note_"+id);
+ onote.style.display = "block";
+ if (document.all) {
+ me.title = onote.innerText;
+ }
+
+}
+function out_cell(me) {
+ var id = me.id;
+ document.getElementById("note_"+id).style.display = "none";
+}
addEvent(window, "resize", ensure_notes_visible);
addEvent(window, "load", ensure_notes_visible);
@@ -277,7 +289,7 @@
font-size: 0.8em;
position: absolute;
top: 120%;
-/* width: 25em; */
+ left: 50%;
padding: 1em;
background-color: #ffffaa;
background-image: url(resource?name=shade.png);
@@ -286,20 +298,15 @@
border: 1px solid #cccc99;
z-index: 1;
}
-/* this rule is separated in order to make it easier
- to change only this attribute in the onresize handler */
-div.grid_cell div.sticky_note.position {
- left: 50%;
+
+table.sticky_table {
+ border-collapse: collapse;
}
-
-div.sticky_names {
- float: left;
+td.sticky_names {
font-weight: bold;
line-height: 1em;
- margin-right: 1em;
}
-div.sticky_values {
- float: left;
+td.sticky_values {
line-height: 1em;
}
div#cell_legend {
@@ -327,34 +334,29 @@
</div>
{grid_updater}
-[StatUtilizationGrid.legend_html]
-<div class="legend">
- <button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
-</div>
-
[StatUtilizationGrid.cell_html]
- <div class="grid_cell" style="width:{cell_width}%; height:{cell_width}%;"
- onmouseover="document.getElementById('note_{cell_id}').style.display='block';"
- onmouseout="document.getElementById('note_{cell_id}').style.display='none';">
+ <div id="{cell_id}" class="grid_cell"
+ style="width:{cell_width}%; height:{cell_width}%;"
+ onmouseover="over_cell(this)"
+ onmouseout="out_cell(this)" >
<a href="{href}"><button id="button_{cell_id}" class="btn {color}" >{contents}</button></a>
- <div id="note_{cell_id}" class="sticky_note position">
- <table cellpadding="0" cellspacing="0">
- <tr>
- <td><div class="sticky_names">
- {sticky_names}
- </div></td>
- <td><div class="sticky_values">
- {sticky_values}
- </div></td>
- </tr></table>
- <div style="clear:left;"><!-- --></div>
+ <div id="note_{cell_id}" class="sticky_note">
+ <table class="sticky_table">
+ {sticky_rows}
+ </table>
</div>
</div>
-[StatUtilizationGrid.sticky_name_html]
- <div>{sticky_title}:</div>
+[Sticky.item_html]
+<tr>
+ <td class="sticky_names" nowrap="nowrap">{sticky_title}: </td>
+ <td class="sticky_values" nowrap="nowrap"><span id="cell_{sticky_name}_{sticky_object_id}"></span></td>
+</tr>
-[StatUtilizationGrid.sticky_value_html]
- <div id="cell_{sticky_name}_{sticky_object_id}"></div>
+[StatUtilizationGrid.legend_html]
+<div class="legend">
+ <button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;" ></button> {legend_text}
+</div>
+
\ No newline at end of file
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-31 23:14:45 UTC (rev 2722)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-11-01 16:47:39 UTC (rev 2723)
@@ -93,16 +93,7 @@
system = self.parent.frame.get_args(session)[0]
return "call.xml?class=system;id=%i;method=slots" % system.id
- def get_fn(self, session):
- return self.parent.grid.name
-
- def got_fn(self, session):
- return self.parent.grid.name
-
- def elem_id(self, session):
- return self.parent.grid.name
-
- def do_get_sticky_info(self, session):
+ def get_sticky_info(self, session):
return [("name", "Name"), ("machine", "Machine"), ("job", "Job")]
class SystemView(CuminView):
More information about the rhmessaging-commits
mailing list