46 #ifndef __WTX_DBO_FORMMODEL_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 47 #define __WTX_DBO_FORMMODEL_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 49 #include <Wt/Dbo/Query.h> 52 #include <Wtx/Core/Core.h> 54 #include "FieldDefBase.h" 56 #include "../FormModel.h" 112 Wt::Dbo::ptr<C>
load(
int id, Wt::Dbo::Session * s );
128 FormModel(
const Wt::Dbo::ptr<C> & itm );
142 virtual int itemId()
const;
150 const Wt::Dbo::ptr<C> &
item()
const;
158 Wt::Dbo::ptr<C> &
item();
166 Wt::Dbo::Session *
session()
const;
175 virtual bool remove();
193 virtual std::unique_ptr<Wt::WWidget> createEditWidget( Wt::WFormModel::Field f )
const;
195 virtual void staleRefresh();
223 virtual int itemVersion()
const;
232 const Field field(
const std::string & fieldName )
const;
234 virtual const Wt::cpp17::any & value(
const std::string & fieldName )
const;
238 virtual const Wt::cpp17::any & value(
const Wt::WFormModel::Field
field )
const;
240 virtual int accept();
242 virtual void reset();
244 virtual bool validate();
246 virtual bool isVisible( Wt::WFormModel::Field
field )
const;
248 virtual bool isReadOnly( Wt::WFormModel::Field
field )
const;
250 virtual Wt::WString
label( Wt::WFormModel::Field
field )
const;
252 virtual void setValue( Wt::WFormModel::Field
field,
const Wt::cpp17::any &value );
254 virtual Wt::WString valueText( Wt::WFormModel::Field
field )
const;
256 virtual void setValidator( Wt::WFormModel::Field
field,
const std::shared_ptr< Wt::WValidator > &validator );
258 virtual std::shared_ptr< Wt::WValidator > validator( Wt::WFormModel::Field
field )
const;
260 virtual bool validateField( Wt::WFormModel::Field
field );
262 virtual void setValidated( Wt::WFormModel::Field
field,
bool validated );
264 virtual bool isValidated( Wt::WFormModel::Field
field )
const;
266 virtual void setValidation( Wt::WFormModel::Field
field,
const Wt::WValidator::Result &result );
268 template <
typename T>
void act( Wt::Dbo::FieldRef<T> ref );
270 template <
typename T>
void actPtr(
const Wt::Dbo::PtrRef<T> & ref );
272 template <
typename T>
void actWeakPtr(
const Wt::Dbo::WeakPtrRef<T> & ref );
274 template <
typename T>
void actCollection(
const Wt::Dbo::CollectionRef<T> & ret );
278 Wt::Dbo::ptr<C> m_item;
282 bool m_isReadMode =
true;
286 #include "FormModel_imp.h"