diff --git a/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TableCellHandler.h b/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TableCellHandler.h index 057f77769..de897827c 100644 --- a/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TableCellHandler.h +++ b/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TableCellHandler.h @@ -44,6 +44,7 @@ #include "Poco/WebWidgets/ExtJS/AbstractTableCellHandler.h" #include "Poco/WebWidgets/ExtJS/CellInitializer.h" #include "Poco/WebWidgets/ImageButtonCell.h" +#include "Poco/WebWidgets/DateFieldCell.h" #include "Poco/NumberFormatter.h" #include #include @@ -383,6 +384,67 @@ private: }; + +template<> +class TableCellHandler: public AbstractTableCellHandler + /// TableCellHandler +{ +public: + TableCellHandler(bool useEditor, bool useRenderer): + AbstractTableCellHandler(useEditor, useRenderer) + { + } + + + void addFixed(const std::string& name, const std::string& fixedContent) + /// Adds a variable with a given fixed string content. The content will not be wrapped + /// with ' ' but will be written as is + { + } + + + void writeData(const void* pAny, std::ostream& out) + /// Writes the content of the table used to dynamically + /// initialize Table Columns + { + } + + void writeDynamicData(std::ostream& out) + { + out << "Ext.util.Format.dateRenderer('"; + const std::string& pocoDateFormat = _pClass->getFormat(); + out << Utility::convertPocoDateToPHPDate(pocoDateFormat) << "')"; + } + + AbstractTableCellHandler* clone() const + { + return new TableCellHandler(*this); + } + + void init(const Cell* pCell) + { + _pClass = dynamic_cast(pCell); + poco_check_ptr (_pClass); + } + +protected: + virtual ~TableCellHandler() + /// Destroys the TableCellHandler. + { + } + + + TableCellHandler(const TableCellHandler& other): + AbstractTableCellHandler(other.useEditor(), other.useRenderer()), + _pClass(other._pClass) + { + } + +private: + const DateFieldCell* _pClass; +}; + + } } } // namespace Poco::WebWidgets::ExtJS diff --git a/WebWidgets/ExtJS/src/CellInitializer.cpp b/WebWidgets/ExtJS/src/CellInitializer.cpp index 42f15c9d0..aeb9f9b11 100644 --- a/WebWidgets/ExtJS/src/CellInitializer.cpp +++ b/WebWidgets/ExtJS/src/CellInitializer.cpp @@ -43,6 +43,7 @@ #include "Poco/WebWidgets/TextFieldCell.h" #include "Poco/WebWidgets/ComboBoxCell.h" #include "Poco/WebWidgets/ButtonCell.h" +#include "Poco/WebWidgets/DateFieldCell.h" #include "Poco/NumberFormatter.h" diff --git a/WebWidgets/ExtJS/src/TableCellHandlerFactory.cpp b/WebWidgets/ExtJS/src/TableCellHandlerFactory.cpp index 909238173..1faf39f10 100644 --- a/WebWidgets/ExtJS/src/TableCellHandlerFactory.cpp +++ b/WebWidgets/ExtJS/src/TableCellHandlerFactory.cpp @@ -41,6 +41,7 @@ #include "Poco/WebWidgets/ComboBoxCell.h" #include "Poco/WebWidgets/ButtonCell.h" #include "Poco/WebWidgets/NumberFieldCell.h" +#include "Poco/WebWidgets/DateFieldCell.h" namespace Poco { @@ -84,6 +85,10 @@ TableCellHandlerFactory::TableCellHandlerFactory() TableCellHandler::Ptr pHandle(new TableCellHandler(false, true)); registerFactory(typeid(ImageButtonCell), pHandle); } + { + TableCellHandler::Ptr pHandle(new TableCellHandler(true, true)); + registerFactory(typeid(DateFieldCell), pHandle); + } } diff --git a/WebWidgets/include/Poco/WebWidgets/Button.h b/WebWidgets/include/Poco/WebWidgets/Button.h index 37adfc70a..73dfd39e2 100644 --- a/WebWidgets/include/Poco/WebWidgets/Button.h +++ b/WebWidgets/include/Poco/WebWidgets/Button.h @@ -1,7 +1,7 @@ // // Button.h // -// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Button.h#7 $ +// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Button.h#8 $ // // Library: WebWidgets // Package: Controls @@ -64,6 +64,9 @@ public: Button(const std::string& name); /// Creates a Button with the given name. + Button(const std::string& name, const std::string& lblTxt); + /// Creates a Button with the given name and lblTxt. + Button(); /// Creates an anonymous Button. diff --git a/WebWidgets/src/Button.cpp b/WebWidgets/src/Button.cpp index b0013f806..4cd55bc97 100644 --- a/WebWidgets/src/Button.cpp +++ b/WebWidgets/src/Button.cpp @@ -1,7 +1,7 @@ // // Button.cpp // -// $Id: //poco/Main/WebWidgets/src/Button.cpp#8 $ +// $Id: //poco/Main/WebWidgets/src/Button.cpp#9 $ // // Library: WebWidgets // Package: Controls @@ -75,15 +75,23 @@ Button::Button(const std::string& name): { init(); } - - + + +Button::Button(const std::string& name, const std::string& txt): + Control(name, typeid(Button)) +{ + init(); + setText(txt); +} + + Button::Button(): Control(typeid(Button)) { init(); } - + Button::~Button() { } @@ -101,8 +109,7 @@ void Button::init(Cell::Ptr ptrCell) void Button::init() { ButtonCell* pCell = new ButtonCell(this); - pCell->buttonClicked = delegate(*this, &Button::fireButtonClicked); - setCell(pCell); + init(pCell); }