mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-31 14:39:53 +01:00
fixed precision field
This commit is contained in:
parent
a7da97f27d
commit
b56a1692e1
@ -40,6 +40,8 @@
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/NumberFieldCell.h"
|
||||
#include "Poco/WebWidgets/WebApplication.h"
|
||||
#include "Poco/WebWidgets/IntFormatter.h"
|
||||
#include "Poco/WebWidgets/DoubleFormatter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@ -63,8 +65,15 @@ void NumberFieldCellRenderer::renderHead(const Renderable* pRenderable, const Re
|
||||
poco_assert_dbg (pRenderable != 0);
|
||||
poco_assert_dbg (pRenderable->type() == typeid(Poco::WebWidgets::NumberFieldCell));
|
||||
const NumberFieldCell* pCell = static_cast<const Poco::WebWidgets::NumberFieldCell*>(pRenderable);
|
||||
|
||||
Formatter::Ptr pForm = pCell->getFormatter();
|
||||
IntFormatter::Ptr pIntForm = pForm.cast<IntFormatter>();
|
||||
DoubleFormatter::Ptr pDoubleForm = pForm.cast<DoubleFormatter>();
|
||||
ostr << "new Ext.form.NumberField({";
|
||||
if (pIntForm)
|
||||
ostr << "decimalPrecision:0,";
|
||||
else if (pDoubleForm)
|
||||
ostr << "decimalPrecision:" << pDoubleForm->precision() << ",";
|
||||
|
||||
|
||||
TextFieldCellRenderer::writeCellProperties(pCell, ostr);
|
||||
ostr << "})";
|
||||
|
@ -57,6 +57,9 @@ public:
|
||||
std::string format(const Poco::Any& value) const;
|
||||
Poco::Any parse(const std::string& value) const;
|
||||
|
||||
int precision() const;
|
||||
/// Returns the precision
|
||||
|
||||
protected:
|
||||
~DoubleFormatter();
|
||||
|
||||
@ -65,6 +68,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline int DoubleFormatter::precision() const
|
||||
{
|
||||
return _precision;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user