mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-14 15:05:35 +02:00
added debug mode, fixed panel rendering
This commit is contained in:
@@ -194,7 +194,7 @@ void PageRenderer::renderBody(const Renderable* pRenderable, const RenderContext
|
||||
ostr << "<body>";
|
||||
if (!pPage->empty())
|
||||
{
|
||||
//process all children: JS is a JavaScript library, we NEVER write to the body
|
||||
//process all children: ExtJS is a JavaScript library, we NEVER write to the body
|
||||
ostr << "<div id=\"p" << pPage->id() << "\" />";
|
||||
// also a tmp id for temporary storage!
|
||||
ostr << "<div id=\"" << Utility::getTmpID() << "\" />";
|
||||
|
@@ -67,12 +67,18 @@ void PanelRenderer::renderHead(const Renderable* pRenderable, const RenderContex
|
||||
ostr << ",title:'" << pPanel->getTitle() << "'";
|
||||
if (pPanel->getWidth() > 0)
|
||||
ostr << ",width:" << pPanel->getWidth();
|
||||
else
|
||||
ostr << ",width:100"; // required!
|
||||
if (pPanel->getHeight() > 0)
|
||||
ostr << ",height:" << pPanel->getHeight();
|
||||
else
|
||||
ostr << ",height:100"; // required!
|
||||
if (pPanel->getModal())
|
||||
ostr << ",modal:true";
|
||||
if (!pPanel->hasCloseIcon())
|
||||
ostr << ",closable:false";
|
||||
if (pPanel->isVisible())
|
||||
ostr << ",renderTo:Ext.getBody()";
|
||||
|
||||
// minimizable set to true only fires a minimize event, without an event handler attached
|
||||
// it is pretty useless, instead use collapsible
|
||||
|
@@ -138,9 +138,12 @@ void Utility::initialize(ResourceManager::Ptr ptr, const Poco::Path& extJSDir)
|
||||
{
|
||||
Poco::Path aDir(extJSDir);
|
||||
aDir.makeDirectory();
|
||||
|
||||
ptr->appendJSInclude(Poco::Path(aDir, "ext-base.js"));
|
||||
#ifdef _DEBUG
|
||||
ptr->appendJSInclude(Poco::Path(aDir, "ext-all-debug.js"));
|
||||
#else
|
||||
ptr->appendJSInclude(Poco::Path(aDir, "ext-all.js"));
|
||||
#endif
|
||||
ptr->appendJSInclude(Poco::Path(aDir, "DDView.js"));
|
||||
ptr->appendJSInclude(Poco::Path(aDir, "Multiselect.js"));
|
||||
|
||||
|
34343
WebWidgets/ExtJS/testsuite/bin/ext-all-debug.js
Normal file
34343
WebWidgets/ExtJS/testsuite/bin/ext-all-debug.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1386,6 +1386,82 @@ void ExtJSTest::testJSEvent2()
|
||||
assert (result == expected);
|
||||
}
|
||||
|
||||
|
||||
void ExtJSTest::testButtonRename()
|
||||
{
|
||||
ResourceManager::Ptr pRM(new ResourceManager());Utility::initialize(pRM, Poco::Path());WebApplication webApp(Poco::URI("/"), pRM);
|
||||
LookAndFeel::Ptr laf(new LookAndFeel());
|
||||
webApp.setLookAndFeel(laf);
|
||||
RenderContext context(*laf, webApp);
|
||||
Utility::initialize(laf);
|
||||
|
||||
Page::Ptr ptr = new Page("test");
|
||||
webApp.setCurrentPage(ptr);
|
||||
Button::Ptr pBut(new Button("but1", "Not Clicked"));
|
||||
ptr->add(pBut);
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << "function() {";
|
||||
ostr << "var but=Ext.getCmp('" << pBut->id() << "');";
|
||||
ostr << "if (but.getText() == 'Clicked') ";
|
||||
ostr << "but.setText('Not Clicked');";
|
||||
ostr << "else ";
|
||||
ostr << "but.setText('Clicked');";
|
||||
ostr << "}";
|
||||
pBut->buttonClicked.add(jsDelegate(ostr.str()));
|
||||
}
|
||||
std::ostringstream ostr;
|
||||
std::ofstream fstr("testButtonRename.html");
|
||||
TeeOutputStream out(ostr);
|
||||
out.addStream(fstr);
|
||||
ptr->renderHead(context, out);
|
||||
ptr->renderBody(context, out);
|
||||
std::string result = ostr.str();
|
||||
}
|
||||
|
||||
|
||||
void ExtJSTest::testPanelShowHide()
|
||||
{
|
||||
ResourceManager::Ptr pRM(new ResourceManager());Utility::initialize(pRM, Poco::Path());WebApplication webApp(Poco::URI("/"), pRM);
|
||||
LookAndFeel::Ptr laf(new LookAndFeel());
|
||||
webApp.setLookAndFeel(laf);
|
||||
RenderContext context(*laf, webApp);
|
||||
Utility::initialize(laf);
|
||||
|
||||
Page::Ptr ptr = new Page("test");
|
||||
webApp.setCurrentPage(ptr);
|
||||
Button::Ptr pBut(new Button("but1", "Show"));
|
||||
ptr->add(pBut);
|
||||
Panel::Ptr pWin(new Panel("p","Test Panel"));
|
||||
pWin->setChild(new Label("lbl1", "Just some dummy text"));
|
||||
pWin->show(false);
|
||||
ptr->add(pWin);
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << "function() {";
|
||||
ostr << "var but=Ext.getCmp('" << pBut->id() << "');";
|
||||
ostr << "var win=Ext.getCmp('" << pWin->id() << "');";
|
||||
ostr << "if (but.getText()=='Show'){";
|
||||
ostr << "but.setText('Hide');";
|
||||
ostr << "win.show();";
|
||||
ostr << "}else{";
|
||||
ostr << "but.setText('Show');";
|
||||
ostr << "win.hide();";
|
||||
ostr << "}";
|
||||
ostr << "}";
|
||||
pBut->buttonClicked.add(jsDelegate(ostr.str()));
|
||||
}
|
||||
|
||||
std::ostringstream ostr;
|
||||
std::ofstream fstr("testPanelShowHide.html");
|
||||
TeeOutputStream out(ostr);
|
||||
out.addStream(fstr);
|
||||
ptr->renderHead(context, out);
|
||||
ptr->renderBody(context, out);
|
||||
std::string result = ostr.str();
|
||||
}
|
||||
|
||||
|
||||
void ExtJSTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -1438,6 +1514,8 @@ CppUnit::Test* ExtJSTest::suite()
|
||||
CppUnit_addTest(pSuite, ExtJSTest, testTableImageButton);
|
||||
CppUnit_addTest(pSuite, ExtJSTest, testJSEvent);
|
||||
CppUnit_addTest(pSuite, ExtJSTest, testJSEvent2);
|
||||
CppUnit_addTest(pSuite, ExtJSTest, testButtonRename);
|
||||
CppUnit_addTest(pSuite, ExtJSTest, testPanelShowHide);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
@@ -83,6 +83,8 @@ public:
|
||||
void testTableImageButton();
|
||||
void testJSEvent();
|
||||
void testJSEvent2();
|
||||
void testButtonRename();
|
||||
void testPanelShowHide();
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
|
Reference in New Issue
Block a user