mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
Fixes for rendering of DateField in Table, Button event fixes
This commit is contained in:
parent
4e730ecc7e
commit
0d3e23167a
@ -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 <vector>
|
||||
#include <map>
|
||||
@ -383,6 +384,67 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
class TableCellHandler<DateFieldCell>: 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<const DateFieldCell*>(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
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
||||
|
@ -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<ImageButtonCell>::Ptr pHandle(new TableCellHandler<ImageButtonCell>(false, true));
|
||||
registerFactory(typeid(ImageButtonCell), pHandle);
|
||||
}
|
||||
{
|
||||
TableCellHandler<DateFieldCell>::Ptr pHandle(new TableCellHandler<DateFieldCell>(true, true));
|
||||
registerFactory(typeid(DateFieldCell), pHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user