46 #include <Wt/WString.h> 47 #include <Wt/WLineEdit.h> 48 #include <Wt/WWidget.h> 50 #include "FormModel.h" 51 #include "Dbo/FieldDefBase.h" 55 std::cout << __FILE__ << ":" << __LINE__ << std::endl; 67 Wtx::FormModel::~FormModel()
71 void Wtx::FormModel::init()
73 for(
auto fieldDef : tableDef().fieldDefs() )
75 auto fieldName = fieldDef-> fieldName();
77 addField( fieldName );
88 setReadOnly( fieldName, fieldDef-> isReadOnly() );
89 setVisible( fieldName, fieldDef-> isVisible() );
92 setVisible( fieldName,
false );
99 std::unique_ptr<Wt::WWidget> Wtx::FormModel::createWidget(
Wtx::Dbo::Session & session )
102 return std::make_unique<Wt::WLineEdit>();
105 void Wtx::FormModel::reset()
108 Wt::WFormModel::reset();
111 bool Wtx::FormModel::validate()
114 return Wt::WFormModel::validate();
118 bool Wtx::FormModel::isVisible( Wt::WFormModel::Field field )
const 121 return Wt::WFormModel::isVisible( field );
125 bool Wtx::FormModel::isReadOnly( Wt::WFormModel::Field field )
const 128 return Wt::WFormModel::isReadOnly( field );
145 Wt::WString retVal = tableDef().fieldDef(field)-> label();
158 retVal = Wt::WFormModel::label( field );
166 if( retVal.toUTF8().substr(0,2) ==
"??" )
174 void Wtx::FormModel::setValue( Wt::WFormModel::Field field,
const Wt::cpp17::any &value )
177 Wt::WFormModel::setValue( field, value );
181 const Wt::cpp17::any & Wtx::FormModel::value( Wt::WFormModel::Field field )
const 184 return Wt::WFormModel::value( field );
188 Wt::WString Wtx::FormModel::valueText( Wt::WFormModel::Field field )
const 191 return Wt::WFormModel::valueText( field );
195 void Wtx::FormModel::setValidator( Wt::WFormModel::Field field,
const std::shared_ptr< Wt::WValidator > &validator )
198 Wt::WFormModel::setValidator( field, validator );
202 std::shared_ptr< Wt::WValidator > Wtx::FormModel::validator( Wt::WFormModel::Field field )
const 205 return Wt::WFormModel::validator( field );
209 bool Wtx::FormModel::validateField( Wt::WFormModel::Field field )
212 return Wt::WFormModel::validateField( field );
216 void Wtx::FormModel::setValidated( Wt::WFormModel::Field field,
bool validated )
219 Wt::WFormModel::setValidated( field, validated );
223 bool Wtx::FormModel::isValidated( Wt::WFormModel::Field field )
const 226 return Wt::WFormModel::isValidated( field );
230 void Wtx::FormModel::setValidation( Wt::WFormModel::Field field,
const Wt::WValidator::Result &result )
233 Wt::WFormModel::setValidation( field, result );
0x0010 ~ the field will not call upon createWidget