It would be great to have a basic abstraction class or interface gathering most of the features of a component as it was available in Vaadin 8 with the Component Interface.
This new abstraction would have an impact on the modernization of Vaadin 8 to Flow 24 applications where the Component Interface was frequently used.
Also for new developments it would provide a common access point to the most frequently used methods related to components and a way to iterate over a same class/interface instance been able to change the style, the label, the size... etc without extra castings.
First approach would be to create an interface with the methods from:
Then this abstraction would be applied to all classes that implement HasLabel, which covers the smallest subset of Flow components implementing these 5 interfaces listed above.
The list so far is:
AbstractNumberField
BigDecimalField
Checkbox
CheckboxGroup
ComboBox
ComboBoxBase
CustomField
DatePicker
DateTimePicker
EmailField
IntegerField
InternalFieldBase
MultiSelectComboBox
NumberField
PasswordField
RadioButtonGroup
Select
Tab (could be excluded, if it is not implementing HasSize)
TextArea
TextField
TimePicker
The intention is that this new feature won't have impact on existing apps as components affected should keep implementing the same interfaces just having a higher level common interface available.
For new implementations the developer would be able to call methods from the collected interfaces without additional castings. i.e.:
// listComponents is a list with different types of components such as ComboBox, Checkbox, CheckboxGroup, etc...
for (CommonComponentInterface cm : listComponents){
//HasLabel
cm.setLabel("");
//HasSize
cm.setHeight("");
//HasEnabled
cm.setEnabled(false);
//HasStyle
cm.addClassName("");
//HasTooltip
cm.setTooltipText("");
}
It would be great to have a basic abstraction class or interface gathering most of the features of a component as it was available in Vaadin 8 with the Component Interface.
This new abstraction would have an impact on the modernization of Vaadin 8 to Flow 24 applications where the Component Interface was frequently used. Also for new developments it would provide a common access point to the most frequently used methods related to components and a way to iterate over a same class/interface instance been able to change the style, the label, the size... etc without extra castings.
First approach would be to create an interface with the methods from:
Then this abstraction would be applied to all classes that implement HasLabel, which covers the smallest subset of Flow components implementing these 5 interfaces listed above.
The list so far is:
The intention is that this new feature won't have impact on existing apps as components affected should keep implementing the same interfaces just having a higher level common interface available.
For new implementations the developer would be able to call methods from the collected interfaces without additional castings. i.e.: