mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
added key events to table, fixed beforecellvaluechange event
This commit is contained in:
parent
c88a9418fc
commit
1639f5b314
@ -72,6 +72,8 @@ public:
|
||||
static const std::string EV_RENDER;
|
||||
static const std::string EV_MOUSEUP;
|
||||
static const std::string EV_MOUSEDOWN;
|
||||
static const std::string EV_KEYDOWN;
|
||||
static const std::string EV_KEYPRESSED;
|
||||
static const std::string HIDDEN_INDEX_ROW;
|
||||
|
||||
TableRenderer();
|
||||
@ -130,6 +132,14 @@ public:
|
||||
|
||||
static Poco::WebWidgets::JSDelegate createMouseDownServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has pressed a mouse button
|
||||
/// Method signature is ( Ext.EventObject e)
|
||||
|
||||
static Poco::WebWidgets::JSDelegate createKeyDownServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has a key down
|
||||
/// Method signature is ( Ext.EventObject e)
|
||||
|
||||
static Poco::WebWidgets::JSDelegate createKeyPressedServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has pressed a key
|
||||
/// Method signature is ( Ext.EventObject e)
|
||||
|
||||
static std::string createDnDGroupName(const Table* pTable);
|
||||
|
@ -64,6 +64,8 @@ const std::string TableRenderer::EV_AFTERLOAD("load");
|
||||
const std::string TableRenderer::EV_RENDER("render");
|
||||
const std::string TableRenderer::EV_MOUSEUP("mouseup");
|
||||
const std::string TableRenderer::EV_MOUSEDOWN("mousedown");
|
||||
const std::string TableRenderer::EV_KEYDOWN("keydown");
|
||||
const std::string TableRenderer::EV_KEYPRESSED("keypress");
|
||||
const std::string TableRenderer::HIDDEN_INDEX_ROW("hidIdx");
|
||||
|
||||
|
||||
@ -258,6 +260,27 @@ Poco::WebWidgets::JSDelegate TableRenderer::createMouseDownServerCallback(const
|
||||
}
|
||||
|
||||
|
||||
Poco::WebWidgets::JSDelegate TableRenderer::createKeyDownServerCallback(const Table* pTable)
|
||||
{
|
||||
poco_check_ptr (pTable);
|
||||
static const std::string signature("function(e)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, Table::EV_KEYDOWN));
|
||||
return Utility::createServerCallback(signature, addParams, pTable->id(), pTable->keyDown.getOnSuccess(), pTable->keyDown.getOnFailure());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Poco::WebWidgets::JSDelegate TableRenderer::createKeyPressedServerCallback(const Table* pTable)
|
||||
{
|
||||
poco_check_ptr (pTable);
|
||||
static const std::string signature("function(e)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, Table::EV_KEYPRESSED));
|
||||
return Utility::createServerCallback(signature, addParams, pTable->id(), pTable->keyPressed.getOnSuccess(), pTable->keyPressed.getOnFailure());
|
||||
}
|
||||
|
||||
|
||||
void TableRenderer::renderProperties(const Table* pTable, const RenderContext& context, std::ostream& ostr)
|
||||
{
|
||||
WebApplication& app = WebApplication::instance();
|
||||
@ -288,11 +311,31 @@ void TableRenderer::renderProperties(const Table* pTable, const RenderContext& c
|
||||
if (written)
|
||||
ostr << ",";
|
||||
if (pTable->beforeCellValueChanged.willDoServerCallback())
|
||||
written = Utility::writeJSEvent(ostr, EV_BEFORECELLVALUECHANGED, modList,
|
||||
written = Utility::writeJSEvent(ostr, EV_BEFORECELLVALUECHANGED, pTable->beforeCellValueChanged.jsDelegates(),
|
||||
TableRenderer::createBeforeCellValueChangedServerCallback(pTable),
|
||||
pTable->beforeCellValueChanged.getServerCallbackPos());
|
||||
else
|
||||
written = Utility::writeJSEvent(ostr, EV_BEFORECELLVALUECHANGED, modList);
|
||||
written = Utility::writeJSEvent(ostr, EV_BEFORECELLVALUECHANGED, pTable->beforeCellValueChanged.jsDelegates());
|
||||
}
|
||||
if (pTable->keyDown.hasJavaScriptCode())
|
||||
{
|
||||
if (written) ostr << ",";
|
||||
if (pTable->keyDown.willDoServerCallback())
|
||||
written = Utility::writeJSEvent(ostr, EV_KEYDOWN, pTable->keyDown.jsDelegates(),
|
||||
TableRenderer::createKeyDownServerCallback(pTable),
|
||||
pTable->keyDown.getServerCallbackPos());
|
||||
else
|
||||
written = Utility::writeJSEvent(ostr, EV_KEYDOWN, pTable->keyDown.jsDelegates());
|
||||
}
|
||||
if (pTable->keyPressed.hasJavaScriptCode())
|
||||
{
|
||||
if (written) ostr << ",";
|
||||
if (pTable->keyPressed.willDoServerCallback())
|
||||
written = Utility::writeJSEvent(ostr, EV_KEYPRESSED, pTable->keyPressed.jsDelegates(),
|
||||
TableRenderer::createKeyPressedServerCallback(pTable),
|
||||
pTable->keyPressed.getServerCallbackPos());
|
||||
else
|
||||
written = Utility::writeJSEvent(ostr, EV_KEYPRESSED, pTable->keyPressed.jsDelegates());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
static const std::string EV_RENDER;
|
||||
static const std::string EV_MOUSEUP;
|
||||
static const std::string EV_MOUSEDOWN;
|
||||
static const std::string EV_KEYDOWN;
|
||||
static const std::string EV_KEYPRESSED;
|
||||
|
||||
struct WebWidgets_API CellClick
|
||||
{
|
||||
@ -125,6 +127,10 @@ public:
|
||||
|
||||
JavaScriptEvent<Table*> mouseDown; // thrown when mouse was pressed over the table
|
||||
|
||||
JavaScriptEvent<Table*> keyDown; // thrown when a key is pressed down
|
||||
|
||||
JavaScriptEvent<Table*> keyPressed; // thrown when a key was released
|
||||
|
||||
FIFOEvent<LoadData> beforeLoad; /// thrown whenever a load is requested, internal event to which the TableRenderer must register
|
||||
|
||||
enum SelectionModel
|
||||
|
@ -59,6 +59,8 @@ const std::string Table::EV_AFTERLOAD("afterload");
|
||||
const std::string Table::EV_RENDER("render");
|
||||
const std::string Table::EV_MOUSEUP("mouseup");
|
||||
const std::string Table::EV_MOUSEDOWN("mousedown");
|
||||
const std::string Table::EV_KEYDOWN("keydown");
|
||||
const std::string Table::EV_KEYPRESSED("keypressed");
|
||||
|
||||
|
||||
Table::Table(const TableColumns& tc, TableModel::Ptr pModel):
|
||||
|
Loading…
Reference in New Issue
Block a user