various fixes

This commit is contained in:
Peter Schojer
2008-08-27 12:55:57 +00:00
parent 8dddbfb147
commit cdab287496
15 changed files with 146 additions and 27 deletions

View File

@@ -114,17 +114,9 @@ void ButtonCellRenderer::renderProperties(const ButtonCell* pButtonCell, const s
{
ostr << ",listeners:{";
Utility::writeJSEvent(ostr, EV_CLICK, pOwner->buttonClicked, &ButtonCellRenderer::createClickServerCallback, pOwner);
/*
if (pOwner->buttonClicked.willDoServerCallback())
Utility::writeJSEvent(ostr, EV_CLICK, pOwner->buttonClicked.jsDelegates(),
createClickServerCallback(pOwner), pOwner->buttonClicked.getServerCallbackPos());
else
Utility::writeJSEvent(ostr, EV_CLICK, pOwner->buttonClicked.jsDelegates());*/
ostr << "}";
}
}
std::string toolTip(pButtonCell->getToolTip());
if (!toolTip.empty())

View File

@@ -63,7 +63,7 @@ void FormRenderer::renderHead(const Renderable* pRenderable, const RenderContext
ostr << "new Ext.FormPanel({id:'" << pForm->id() << "',";
ostr << "onSubmit:Ext.emptyFn,submit:function(){this.getEl().dom.submit();},";
//ostr << "onSubmit:Ext.emptyFn,submit:function(){this.getEl().dom.submit();},";
if (pForm->getMethod() == Form::METHOD_POST)
ostr << "method:'POST',";
ostr << "title:'" << pForm->getName() << "',autoHeight:true,autoWidth:true,url:'" << pForm->getURI().toString() << "',frame:true,items:[";

View File

@@ -87,7 +87,7 @@ void ImageButtonCellRenderer::writeHTML(const ImageButtonCell* pButtonCell, bool
const Poco::WebWidgets::ImageButton* pOwner = static_cast<const Poco::WebWidgets::ImageButton*>(pButtonCell->getOwner());
poco_check_ptr (pOwner);
ostr << "'<div>";
ostr << "<div>";
ostr << "<div><center>";
ostr << "<input src=\"" << Utility::safe(ptrImg->getURI().toString()) << "\"";
if (!pOwner->getName().empty())
ostr << " name=\"" << pOwner->getName() << "\"";
@@ -107,7 +107,7 @@ void ImageButtonCellRenderer::writeHTML(const ImageButtonCell* pButtonCell, bool
ostr << "\"";
}
ostr << " type=\"image\"/>";
ostr << "</div>";
ostr << "</center></div>";
std::string txt(pOwner->getText());
if (showTxt && !txt.empty())
ostr << "<div><center>" << Utility::safe(pButtonCell->getOwner()->getText()) << "</center></div>";

View File

@@ -115,8 +115,6 @@ void LayoutRenderer::renderParameters(const Layout* pLayout, const RenderContext
void LayoutRenderer::visitChildren(const Layout* pLayout, int cols, int horPad, int vertPad, const RenderContext& context, std::ostream& ostr)
{
ContainerView::ConstIterator it = pLayout->begin();
int cnt(0);
std::string padHor;
if (horPad > 0)
@@ -133,10 +131,11 @@ void LayoutRenderer::visitChildren(const Layout* pLayout, int cols, int horPad,
pad << "<p style=\"margin-top:" << vertPad << "px\"></p>";
padVert = pad.str();
}
ContainerView::ConstIterator it = pLayout->begin();
int cnt(0);
for (; it != pLayout->end(); ++it, ++cnt)
{
if (it != pLayout->begin())
if (cnt > 0)
{
ostr << ",";
if (cnt < cols && !padHor.empty())

View File

@@ -94,7 +94,7 @@ void TimeFieldCellRenderer::writeCellProperties(const TimeFieldCell* pCell, std:
else if (fmt == TimeField::FMT_AMPM_WITHSECONDS)
ostr << ",format:" << fmtAmPms;
else
; // this is the default
; // this is the default
}

View File

@@ -1542,6 +1542,35 @@ void ExtJSTest::testGridLayout()
}
void ExtJSTest::testGridLayout2()
{
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);
GridLayout::Ptr pHor(new GridLayout(5,2));
pHor->setHorizontalPadding(30);
pHor->setVerticalPadding(15);
pHor->add(new Label("", "txt"));
pHor->add(new Button("b1", "But1"));
pHor->add(new Button("b2", "But2"));
pHor->add(new Button("b3", "But3"));
pHor->add(new Button("b4", "But4"));
ptr->add(pHor);
std::ostringstream ostr;
std::ofstream fstr("testGridLayout.html");
TeeOutputStream out(ostr);
out.addStream(fstr);
ptr->renderHead(context, out);
ptr->renderBody(context, out);
std::string result = ostr.str();
}
void ExtJSTest::setUp()
{
}
@@ -1598,6 +1627,7 @@ CppUnit::Test* ExtJSTest::suite()
CppUnit_addTest(pSuite, ExtJSTest, testPanelShowHide);
CppUnit_addTest(pSuite, ExtJSTest, testHorizontalLayout);
CppUnit_addTest(pSuite, ExtJSTest, testGridLayout);
CppUnit_addTest(pSuite, ExtJSTest, testGridLayout2);
CppUnit_addTest(pSuite, ExtJSTest, testVerticalLayout);
return pSuite;

View File

@@ -88,6 +88,7 @@ public:
void testHorizontalLayout();
void testVerticalLayout();
void testGridLayout();
void testGridLayout2();
void setUp();
void tearDown();