Author: eallen
Date: 2009-03-26 15:52:23 -0400 (Thu, 26 Mar 2009)
New Revision: 3218
Modified:
mgmt/trunk/notes/fullpage widgets.txt
Log:
Changed to reflect new way of updating widgets in fullpage mode
Modified: mgmt/trunk/notes/fullpage widgets.txt
===================================================================
--- mgmt/trunk/notes/fullpage widgets.txt 2009-03-26 19:24:49 UTC (rev 3217)
+++ mgmt/trunk/notes/fullpage widgets.txt 2009-03-26 19:52:23 UTC (rev 3218)
@@ -1,6 +1,6 @@
How to implement a full page widget
-Any block of HTML can be made full page in cumin. By full page, I mean it can be
displayed using most of the browser windows width and height.
+Any block of HTML can be made full page in cumin. By full page, I mean it can be
displayed using most of the browser window's width and height.
To do this, you need to add the class "fullpageable" to the block of HTML. If
there is no surrounding block, you'll need to add one.
For example, to make the following HTML fullpage-able:
@@ -24,6 +24,27 @@
{important_stuff}
</p>
+Background updating of widgets and fullpage:
+ Sometimes the HTML you want to make fullpagable will contain one or more widgets.
+ If those widgets get automatically updated (using self.update_enabled = True),
+ AND you want the widgets to be aware of when they are being rendered full page, you
need
+ to do three things:
+ 1. inherit the widget from FullPageNotify as well as any other classes
+ 2. in the element surrounding your widget (the same element that has the
id="{id}"), add a class named fullpage_notify.
+ 3. in the render method for the widget, examine the return value of
self.get_fullpage
+
+ For example:
+ 1. class TopTable(SqlTable, FullPageNotify):
+ 2. [TopTable.html]
+ <table id="{id}" class="TopTable fullpage_notify">
+ ...
+ </table>
+ 3. # rendering a table column in TopTable
+ def render_content(self, session, data):
+ width = self.parent.get_fullpage(session)
+ # if width is None, we are not in fullpage
+ # if width has a value, we are in fullpage and width is the available size in
pixels
+
How it looks:
A block of HTML that is fullpageable will have a special mouseover style.
When the mouse if over any part of the HTML, there will be a light purple bar at the
top of the HTML with a
@@ -41,13 +62,6 @@
of the document.body. This allows the HTML to be positioned and sized to the full
window. Clicking the
icon again will restore the HTML to it's original position in the DOM.
- Additionally, when any block of HTML is made fullpage, the current background update
url is modified to
- indicate that cumin is in fullpage mode. This allows any widgets contained in the
fullpaged HTML to modify
- how they are rendered to take advantage of the extra screen space. During render,
widgets can optionally call the
- self.page.get_fullpage(session) method to determine if they should render normally,
or full page.
- If the return of self.page.get_fullpage(session) is not None, the widget can render
full page.
- The value returned by self.page.get_fullpage(session) is the new width the widget can
occupy.
-
\ No newline at end of file
Show replies by date