From 19fe46d8787d06cd07458daa8fcf4b4299afef4f Mon Sep 17 00:00:00 2001 From: Peter Schojer Date: Mon, 15 Sep 2008 11:56:31 +0000 Subject: [PATCH] added template class --- WebWidgets/ExtJS/ExtJS_VS80.vcproj | 8 + WebWidgets/ExtJS/ExtJS_VS90.vcproj | 8 + .../Poco/WebWidgets/ExtJS/TemplateRenderer.h | 76 +++++ WebWidgets/ExtJS/src/TemplateRenderer.cpp | 70 ++++ WebWidgets/WebWidgets_VS80.vcproj | 8 + WebWidgets/WebWidgets_VS90.vcproj | 8 + WebWidgets/include/Poco/WebWidgets/Template.h | 128 ++++++++ WebWidgets/src/Template.cpp | 299 ++++++++++++++++++ 8 files changed, 605 insertions(+) create mode 100644 WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TemplateRenderer.h create mode 100644 WebWidgets/ExtJS/src/TemplateRenderer.cpp create mode 100644 WebWidgets/include/Poco/WebWidgets/Template.h create mode 100644 WebWidgets/src/Template.cpp diff --git a/WebWidgets/ExtJS/ExtJS_VS80.vcproj b/WebWidgets/ExtJS/ExtJS_VS80.vcproj index 07fb512a4..d6f7ffe8e 100644 --- a/WebWidgets/ExtJS/ExtJS_VS80.vcproj +++ b/WebWidgets/ExtJS/ExtJS_VS80.vcproj @@ -337,6 +337,10 @@ RelativePath=".\include\Poco\WebWidgets\ExtJS\TabViewRenderer.h" > + + @@ -485,6 +489,10 @@ RelativePath=".\src\TabViewRenderer.cpp" > + + diff --git a/WebWidgets/ExtJS/ExtJS_VS90.vcproj b/WebWidgets/ExtJS/ExtJS_VS90.vcproj index 77f00bc4d..4e3a6a36d 100644 --- a/WebWidgets/ExtJS/ExtJS_VS90.vcproj +++ b/WebWidgets/ExtJS/ExtJS_VS90.vcproj @@ -332,6 +332,10 @@ RelativePath=".\include\Poco\WebWidgets\ExtJS\TabViewRenderer.h" > + + @@ -476,6 +480,10 @@ RelativePath=".\src\TabViewRenderer.cpp" > + + diff --git a/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TemplateRenderer.h b/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TemplateRenderer.h new file mode 100644 index 000000000..ea614d625 --- /dev/null +++ b/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TemplateRenderer.h @@ -0,0 +1,76 @@ +// +// TemplateRenderer.h +// +// $Id: //poco/Main/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/TemplateRenderer.h#1 $ +// +// Library: ExtJS +// Package: Core +// Module: TemplateRenderer +// +// Definition of the TemplateRenderer class. +// +// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef ExtJS_TemplateRenderer_INCLUDED +#define ExtJS_TemplateRenderer_INCLUDED + + +#include "Poco/WebWidgets/ExtJS/ExtJS.h" +#include "Poco/WebWidgets/Renderer.h" + + +namespace Poco { +namespace WebWidgets { + + class Frame; + +namespace ExtJS { + + +class ExtJS_API TemplateRenderer: public Poco::WebWidgets::Renderer + /// TemplateRenderer renders a single Panel +{ +public: + TemplateRenderer(); + /// Creates the TemplateRenderer. + + virtual ~TemplateRenderer(); + /// Destroys the TemplateRenderer. + + void renderHead(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr); + /// Emits code for the page header to the given output stream. + + void renderBody(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr); + /// Emits code for the page body to the given output stream. +}; + + +} } } // namespace Poco::WebWidgets::ExtJS + + +#endif // ExtJS_TemplateRenderer_INCLUDED diff --git a/WebWidgets/ExtJS/src/TemplateRenderer.cpp b/WebWidgets/ExtJS/src/TemplateRenderer.cpp new file mode 100644 index 000000000..abbfaad94 --- /dev/null +++ b/WebWidgets/ExtJS/src/TemplateRenderer.cpp @@ -0,0 +1,70 @@ +// +// TemplateRenderer.cpp +// +// $Id: //poco/Main/WebWidgets/ExtJS/src/TemplateRenderer.cpp#7 $ +// +// Library: ExtJS +// Package: Core +// Module: TemplateRenderer +// +// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#include "Poco/WebWidgets/ExtJS/TemplateRenderer.h" +#include "Poco/WebWidgets/Template.h" + + +namespace Poco { +namespace WebWidgets { +namespace ExtJS { + + +TemplateRenderer::TemplateRenderer() +{ +} + + +TemplateRenderer::~TemplateRenderer() +{ +} + + +void TemplateRenderer::renderHead(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr) +{ + poco_assert_dbg (pRenderable != 0); + poco_assert_dbg (pRenderable->type() == typeid(Poco::WebWidgets::Template)); + const Template* pTemplate = static_cast(pRenderable); + pTemplate->parse(context, ostr); +} + + +void TemplateRenderer::renderBody(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr) +{ +} + + +} } } // namespace Poco::WebWidgets::ExtJS diff --git a/WebWidgets/WebWidgets_VS80.vcproj b/WebWidgets/WebWidgets_VS80.vcproj index c62889b95..ce367d8e9 100644 --- a/WebWidgets/WebWidgets_VS80.vcproj +++ b/WebWidgets/WebWidgets_VS80.vcproj @@ -277,6 +277,10 @@ RelativePath=".\include\Poco\WebWidgets\ResourceManager.h" > + + @@ -357,6 +361,10 @@ RelativePath=".\src\ResourceManager.cpp" > + + diff --git a/WebWidgets/WebWidgets_VS90.vcproj b/WebWidgets/WebWidgets_VS90.vcproj index 0a622f310..a62751f07 100644 --- a/WebWidgets/WebWidgets_VS90.vcproj +++ b/WebWidgets/WebWidgets_VS90.vcproj @@ -276,6 +276,10 @@ RelativePath=".\include\Poco\WebWidgets\ResourceManager.h" > + + @@ -356,6 +360,10 @@ RelativePath=".\src\ResourceManager.cpp" > + + diff --git a/WebWidgets/include/Poco/WebWidgets/Template.h b/WebWidgets/include/Poco/WebWidgets/Template.h new file mode 100644 index 000000000..26b7935b9 --- /dev/null +++ b/WebWidgets/include/Poco/WebWidgets/Template.h @@ -0,0 +1,128 @@ +// +// Template.h +// +// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Template.h#2 $ +// +// Library: WebWidgets +// Package: Templates +// Module: Template +// +// Definition of the Template class. +// +// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef WebWidgets_Template_INCLUDED +#define WebWidgets_Template_INCLUDED + + +#include "Poco/WebWidgets/Renderable.h" +#include "Poco/FIFOEvent.h" +#include "Poco/Any.h" +#include + + +namespace Poco { +namespace WebWidgets { + + +class RenderContext; + + +class WebWidgets_API Template: public Renderable + /// A JavaScript template class: Defines a template string which contains wildcards of the form %0, %1 %2 ... + /// You can bind values to the wildcards. Values must be of type: + /// - string, int, double, float, char, bool, Poco::WebWidgets::Renderable, DateTime +{ +public: + typedef Poco::AutoPtr