mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-14 15:05:35 +02:00
changed requestprocessor interface
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
#include "Poco/WebWidgets/ExtJS/FormRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/ButtonCell.h"
|
||||
#include "Poco/WebWidgets/Button.h"
|
||||
#include "Poco/WebWidgets/RequestHandler.h"
|
||||
#include "Poco/WebWidgets/WebApplication.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -45,6 +49,9 @@ namespace WebWidgets {
|
||||
namespace ExtJS {
|
||||
|
||||
|
||||
const std::string ButtonCellRenderer::EV_CLICK("click");
|
||||
|
||||
|
||||
ButtonCellRenderer::ButtonCellRenderer()
|
||||
{
|
||||
}
|
||||
@@ -89,7 +96,7 @@ void ButtonCellRenderer::renderProperties(const ButtonCell* pButtonCell, const s
|
||||
Utility::writeRenderableProperties(pButtonCell, ostr);
|
||||
if (!pButtonCell->isEnabled())
|
||||
ostr << ",disabled:true";
|
||||
View* pOwner = pButtonCell->getOwner();
|
||||
Button* pOwner = dynamic_cast<Button*>(pButtonCell->getOwner());
|
||||
if (pOwner)
|
||||
{
|
||||
if (!pOwner->getName().empty())
|
||||
@@ -98,11 +105,21 @@ void ButtonCellRenderer::renderProperties(const ButtonCell* pButtonCell, const s
|
||||
ostr << ",minWidth:" << pOwner->getWidth();
|
||||
if (!pOwner->isVisible())
|
||||
ostr << ",hidden:true";
|
||||
if (!pOwner->buttonClicked.jsDelegates().empty())
|
||||
{
|
||||
ostr << ",listeners:{";
|
||||
Utility::writeJSEvent(ostr, EV_CLICK, pOwner->buttonClicked.jsDelegates());
|
||||
ostr << "}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string toolTip(pButtonCell->getToolTip());
|
||||
if (!toolTip.empty())
|
||||
ostr << ",tooltip:'" << Utility::safe(toolTip) << "'";
|
||||
|
||||
WebApplication::instance().registerAjaxProcessor(Poco::NumberFormatter::format(pButtonCell->id()), const_cast<ButtonCell*>(pButtonCell));
|
||||
}
|
||||
|
||||
|
||||
@@ -120,4 +137,15 @@ void ButtonCellRenderer::writeConfigData(const Cell* pCell, const RenderContext&
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ButtonCellRenderer::addClickServerCallback(Button* pButton, const std::string& onSuccess, const std::string& onFailure)
|
||||
{
|
||||
//click : ( Button this, EventObject e )
|
||||
static const std::string signature("function(but,e)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, ButtonCell::EV_BUTTONCLICKED));
|
||||
Utility::addServerCallback(pButton->buttonClicked, signature, addParams, pButton->getCell()->id(), onSuccess, onFailure);
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::WebWidgets::ExtJS
|
||||
|
@@ -68,7 +68,7 @@ ComboBoxCellRenderer::~ComboBoxCellRenderer()
|
||||
void ComboBoxCellRenderer::addSelectedServerCallback(ComboBox* pCombo, const std::string& onSuccess, const std::string& onFailure)
|
||||
{
|
||||
//select : ( Ext.form.ComboBox combo, Ext.data.Record record, Number index )
|
||||
static const std::string signature("function(combo,rec, idx)");
|
||||
static const std::string signature("function(combo,rec,idx)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(ComboBoxCell::FIELD_VAL, "+rec.get('d')"));
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, ComboBoxCell::EV_SELECTED));
|
||||
|
Reference in New Issue
Block a user