46 #include <Wt/WWidget.h> 47 #include <Wt/WLineEdit.h> 49 #include "TemplateFormView.h" 52 #define COUT_LINE std::cout << __FILE__ << ":" << __LINE__ << " " << __PRETTY_FUNCTION__ << std::endl 53 #define COUT_(x) std::cout << __FILE__ << ":" << __LINE__ << " " << __PRETTY_FUNCTION__ << " " << x << std::endl; 139 Wtx::TemplateFormView::~TemplateFormView()
144 Wtx::TemplateFormView::TemplateFormView(
const Wt::WString & text )
145 :
Wt::WTemplateFormView(text)
160 return std::make_unique<Wt::WLineEdit>();
167 void Wtx::TemplateFormView::updateView( Wt::WFormModel *model )
170 Wt::WTemplateFormView::updateView( model );
174 void Wtx::TemplateFormView::updateViewField( Wt::WFormModel *model, Wt::WFormModel::Field field )
177 Wt::WTemplateFormView::updateViewField( model, field );
181 void Wtx::TemplateFormView::updateViewValue( Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WFormWidget *edit )
184 Wt::WTemplateFormView::updateViewValue( model, field, edit );
188 bool Wtx::TemplateFormView::updateViewValue( Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WWidget *edit )
191 return Wt::WTemplateFormView::updateViewValue( model, field, edit );
195 void Wtx::TemplateFormView::updateModel( Wt::WFormModel *model )
198 Wt::WTemplateFormView::updateModel( model );
202 void Wtx::TemplateFormView::updateModelField( Wt::WFormModel *model, Wt::WFormModel::Field field )
205 Wt::WTemplateFormView::updateModelField( model, field );
209 void Wtx::TemplateFormView::updateModelValue( Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WFormWidget *edit )
212 Wt::WTemplateFormView::updateModelValue( model, field, edit );
216 bool Wtx::TemplateFormView::updateModelValue( Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WWidget *edit )
219 return Wt::WTemplateFormView::updateModelValue( model, field, edit );
226 void Wtx::TemplateFormView::bindString(
const std::string & varName,
const Wt::WString & value, Wt::TextFormat textFormat )
228 COUT_( varName <<
"=" << value );
229 Wt::WTemplateFormView::bindString( varName, value, textFormat );
232 void Wtx::TemplateFormView::bindWidget(
const std::string & varName, std::unique_ptr< Wt::WWidget > widget )
235 Wt::WTemplateFormView::bindWidget( varName, std::move(widget) );
238 std::unique_ptr< Wt::WWidget > Wtx::TemplateFormView::removeWidget( Wt::WWidget *widget )
241 return Wt::WTemplateFormView::removeWidget( widget );
244 bool Wtx::TemplateFormView::conditionValue(
const std::string & name )
const 246 bool retVal = Wt::WTemplateFormView::conditionValue( name );
252 void Wtx::TemplateFormView::resolveString(
const std::string & varName,
const std::vector< Wt::WString > & args, std::ostream & result )
255 Wt::WTemplateFormView::resolveString( varName, args, result );
258 void Wtx::TemplateFormView::handleUnresolvedVariable(
const std::string & varName,
const std::vector< Wt::WString > & args, std::ostream & result )
261 Wt::WTemplateFormView::handleUnresolvedVariable( varName, args, result );
264 Wt::WWidget * Wtx::TemplateFormView::resolveWidget(
const std::string & varName )
266 Wt::WWidget * w = Wt::WTemplateFormView::resolveWidget( varName );
275 bool Wtx::TemplateFormView::resolveFunction(
const std::string & name,
const std::vector< Wt::WString > & args, std::ostream & result )
277 if( name ==
"widget" )
279 if( args.size() > 0 )
281 if( args.at(0) ==
"WTabWidget" )
288 return Wt::WTemplateFormView::resolveFunction( name, args, result );
291 void Wtx::TemplateFormView::refresh()
294 Wt::WTemplateFormView::refresh();
297 void Wtx::TemplateFormView::renderTemplate( std::ostream & result )
300 Wt::WTemplateFormView::renderTemplate( result );