NAME
POE::XUL::ChangeManager - Keep POE::XUL in sync with the browser DOM
SYNOPSIS
Not used directly. See POE::XUL and POE::XUL::Event.
DESCRIPTION
The ChangeManager is responsible for tracking and sending all changes to a POE::XUL::Node to its corresponding DOM element. It also handles any side-effects of a DOM event that was sent from the browser.
There is only one ChangeManager per application. The application never accesses the ChangeManager directly, but rather by manipulating POE::XUL::Node.
Because there may be multiple application instances within a given process, the link between POE::XUL::Node and the ChangeManager is handled by POE::XUL::Event. Changes to a node must happen within "wrap" in POE::XUL::Event. This is done for you in the initial POE event. It must be done explicitly if you chain the initial POE event to furthur POE events.
METHODS
There is only one method that will be useful for application writers:
instruction
pxInstructions( @instructions );
$CM->instruction( $inst );
$CM->instruction( [ $inst, @params ] );
Send instructions to the javascript client library. Instructions are a HACK to quickly work around XUL and/or POE::XUL::Node limitations.
$inst
may be simply an instruction name, or an arrayref, the first element of which is the instruction name.
Current instructions are:
- empty
-
Empties all pending changes, returns the arrayref of those changes.
- flush
-
All currently known commands are put into the output buffer. Combined with
timeslice
, it allows some control over the order in which commands are executed. - timeslice
-
Tells the javascript client library to give up a
timeslice
. The idea is to give the browser time to render any new XBL. Because it is impossible to find out when all XBL has finished rendering, thetimeslice
is handled by pausing for 5 milliseconds.To be very useful, you should preceed this with a "flush".
- popup_window
-
pxInstruction( [ popup_window => $id, $features ] );
PLEASE USE "open" in POE::XUL::Window INSTEAD.
Tell the client library to create a new window. The new window's name will be
$id
. The new window will be created with the features defined in$features
:width
,height
,location
,menubar
,toolbar
,status
,scrollbars
. The following features are alwaysyes
:resizable
,dependent
. See http://developer.mozilla.org/en/docs/DOM:window.open for an explanation of what they mean.Once the window is opened, it will load
/popup.xul?app=$APP&SID=$SID
(where$APP
is the current application and$SID
is the session ID of the current application instance).popup.xul
will then send aconnect
event. See "connect" in POE::XUL. - close_window
-
pxInstruction( [ close_window => $id ] );
PLEASE USE "close" in POE::XUL::Window INSTEAD.
Closes the window
$id
. This will provoke adisconnect
event. See "disconnect" in POE::XUL.
AUTHOR
Philip Gwyn <gwyn-at-cpan.org>
CREDITS
Based on XUL::Node by Ran Eilam.
COPYRIGHT AND LICENSE
Copyright 2007-2010 by Philip Gwyn. All rights reserved;
Copyright 2003-2004 Ran Eilam. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1), POE::XUL, POE::XUL::Event.