Wt
4.11.1
|
Abstract delegate class for creating form widgets. More...
#include <Wt/Form/WAbstractFormDelegate.h>
Public Member Functions | |
WAbstractFormDelegate () | |
Constructor. | |
virtual | ~WAbstractFormDelegate () |
Destructor. | |
virtual std::unique_ptr< Wt::WWidget > | createFormWidget ()=0 |
Create the widget to be used in the View. | |
virtual std::shared_ptr< Wt::WValidator > | createValidator () |
Create the validator to be used by the Model. More... | |
virtual void | updateModelValue (Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WFormWidget *edit) |
Updates a value in the Model. More... | |
virtual bool | updateModelValue (Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WWidget *edit) |
Updates a value in the Model. More... | |
virtual void | updateViewValue (Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WFormWidget *edit) |
Updates a value in the View. More... | |
virtual bool | updateViewValue (Wt::WFormModel *model, Wt::WFormModel::Field field, Wt::WWidget *edit) |
Updates a value in the View. More... | |
Abstract delegate class for creating form widgets.
Form delegates will be automatically generated using Wt::Dbo's persist method. Depending on the data type used by the Dbo class, the form delegate will have a different behavior. For example: for WString objects the default widget in the view will be a WLineEdit.
Form delegates will be automatically generated when calling Dbo::FormView<C>::setFormModel(). This FormView also has the option to override the delegates that are generated by using Dbo::FormView<C>::setFormDelegate().
Form delegates will also create the corresponding WValidator and update the WFormModel and WTemplateFormView accordingly.
|
virtual |
Create the validator to be used by the Model.
By default this returns a null pointer. When specializing this class, the user needs to override this method if they want to add validation to this field.
Reimplemented in Wt::Form::WFormDelegate< double, void >, Wt::Form::WFormDelegate< int, void >, Wt::Form::WFormDelegate< Wt::WTime, void >, and Wt::Form::WFormDelegate< Wt::WDate, void >.
|
virtual |
Updates a value in the Model.
By default this sets the value in the model to the string returned by WFormWidget::valueText
The user should only override this method or the other updateModelValue method returning a boolean, depending on the type of widget that's returned by createFormWidget.
Reimplemented in Wt::Form::WFormDelegate< double, void >, Wt::Form::WFormDelegate< int, void >, Wt::Form::WFormDelegate< bool, void >, Wt::Form::WFormDelegate< Wt::WDateTime, void >, Wt::Form::WFormDelegate< Wt::WTime, void >, Wt::Form::WFormDelegate< Wt::WDate, void >, and Wt::Form::WFormDelegate< std::string, void >.
|
virtual |
Updates a value in the Model.
By default this method returns false.
The user should only override this method or the other updateModelValue method, depending on the type of widget that's returned by createFormWidget.
|
virtual |
Updates a value in the View.
By default this uses WFormWidget::setValueText and WFormModel::value to update the widget
The user should only override this method or the other updateViewValue method returning a boolean, depending on the type of widget that's returned by createFormWidget.
Reimplemented in Wt::Form::WFormDelegate< double, void >, Wt::Form::WFormDelegate< int, void >, Wt::Form::WFormDelegate< bool, void >, Wt::Form::WFormDelegate< Wt::WTime, void >, and Wt::Form::WFormDelegate< Wt::WDate, void >.
|
virtual |
Updates a value in the View.
By default this method returns false.
The user should only override this method or the other updateViewValue method, depending on the type of widget that's returned by createFormWidget.