added appendPostRenderCode

This commit is contained in:
Peter Schojer 2008-09-09 09:06:01 +00:00
parent 63caffdb6e
commit 867b643fad
2 changed files with 14 additions and 3 deletions

View File

@ -62,7 +62,7 @@ void LabelRenderer::renderHead(const Renderable* pRenderable, const RenderContex
const Label* pLabel = static_cast<const Poco::WebWidgets::Label*>(pRenderable); const Label* pLabel = static_cast<const Poco::WebWidgets::Label*>(pRenderable);
//ostr << "{xtype:'label', text:'" << Utility::safe(pLabel->getText()) << "'}"; //ostr << "{xtype:'label', text:'" << Utility::safe(pLabel->getText()) << "'}";
ostr << "new Ext.form.Label({text:'" << Utility::safe(pLabel->getText()) << "',cls:'lbl'"; ostr << "new Ext.form.Label({text:'" << Utility::safe(pLabel->getText()) << "',cls:'lbl'," << "id:'" << pLabel->id() << "'";
if (pLabel->getWidth() > 0) if (pLabel->getWidth() > 0)
ostr << ",width:" << pLabel->getWidth(); ostr << ",width:" << pLabel->getWidth();
ostr << "})"; ostr << "})";

View File

@ -106,14 +106,19 @@ public:
/// Returns all dynamic functions /// Returns all dynamic functions
void setPostRenderCode(const std::string& js); void setPostRenderCode(const std::string& js);
/// Adds Javascript code that should be executed after the page code was written. The difference to afterRender /// Sets Javascript code that should be executed after the page code was written. The difference to afterRender
/// is that afterRender is a JS Event executed from within the rendering pipeline of the browser /// is that afterRender is a JS Event executed from within the rendering pipeline of the browser
/// (ie. changes to the GUI might block the browser indefinitely) whereas /// (ie. changes to the GUI might block the browser indefinitely) whereas
/// post render code is executed immediately after the JS code that generates the GUI /// post render code is executed immediately after the JS code that generates the GUI
/// (ie. it is not necessarily rendered, no data loaded but thread-safe!) /// (ie. it is not necessarily rendered, no data loaded but thread-safe!)
/// Old post render code gets deleted by this function.
/// To preverse old code use appendPostRenderCode.
const std::string& getPostRenderCode() const; const std::string& getPostRenderCode() const;
/// Returns post rnedre code. Can be an empty string /// Returns post render code. Can be an empty string
void appendPostRenderCode(const std::string& js);
/// Appends Javascript code that should be executed after the page code was written.
protected: protected:
Page(const std::string& name, const std::type_info& type); Page(const std::string& name, const std::type_info& type);
@ -178,6 +183,12 @@ inline const std::string& Page::getPostRenderCode() const
} }
inline void Page::appendPostRenderCode(const std::string& js)
{
_postRenderCode.append(js);
}
} } // namespace Poco::WebWidgets } } // namespace Poco::WebWidgets