fixes to dynamic codegen

This commit is contained in:
Peter Schojer 2008-10-02 07:51:26 +00:00
parent a0392bbd64
commit e12ca44470
3 changed files with 14 additions and 7 deletions

View File

@ -66,7 +66,7 @@ public:
void renderBody(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr);
/// Emits code for the page body to the given output stream.
void renderVariables(const DynamicCodeLoader* pLoader, const RenderContext& context, std::ostream& ostr);
static void renderVariables(const DynamicCodeLoader* pLoader, const RenderContext& context, std::ostream& ostr);
// You must first call renderVariables then renderHead
private:

View File

@ -119,7 +119,6 @@ void DynamicCodeLoaderRenderer::renderHead(const Renderable* pRenderable, const
}
// write loadAll
str << "function " << pLoader->loadAllFunctionName() << "(){" << std::endl;
std::vector<const DynamicCodeLoader*>::const_iterator it = deps.begin();
str << "function " << pLoader->loadAllFunctionName() << "(){" << std::endl;

View File

@ -37,6 +37,7 @@
#include "Poco/WebWidgets/ExtJS/PageRenderer.h"
#include "Poco/WebWidgets/ExtJS/Utility.h"
#include "Poco/WebWidgets/ExtJS/PanelRenderer.h"
#include "Poco/WebWidgets/ExtJS/DynamicCodeLoaderRenderer.h"
#include "Poco/WebWidgets/Page.h"
#include "Poco/WebWidgets/Panel.h"
#include "Poco/WebWidgets/RenderContext.h"
@ -146,13 +147,20 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
ostr << "oHead.appendChild(oScript);" << std::endl;
ostr << "}" << std::endl;
}
std::set<DynamicCodeLoader::Ptr>::const_iterator itDC = dcls.begin();
for (; itDC != dcls.end(); ++itDC)
{
(*itDC)->renderHead(context, ostr);
std::set<DynamicCodeLoader::Ptr>::const_iterator itDC = dcls.begin();
for (; itDC != dcls.end(); ++itDC)
{
DynamicCodeLoaderRenderer::renderVariables((*itDC), context, ostr);
}
}
{
std::set<DynamicCodeLoader::Ptr>::const_iterator itDC = dcls.begin();
for (; itDC != dcls.end(); ++itDC)
{
(*itDC)->renderHead(context, ostr);
}
}
ostr << "Ext.onReady(function() {";
ostr << "var " << VAR_LOCALTMP << ";"; // tmp variable needed for table renderer