im using vaadin with scaladin add-on & have a class extend vaadin.scala.CustomComponent
class CostPlanImport extends CustomComponent {
var root: Panel = _
// ..
}
now i want override attach method of com.vaadin.ui.Component class in my class & access my class properties (root,..) in that method.
how i have to do?
Thanks.
As you can see from the CustomComponent source
You pass the corresponding vaadin component as a contructor argument
p(which usually stands for “peer”)That is, the scaladin component is a wrapper around your original component.
To override the behavior of the peer component, you have to do it when you pass it to the wrapper constructor.
You have different choices here
With anonymous subclass
With a trait
With a
CustomComponentsubclass[not shown, but is a mix of the preceding two examples]
Note: the code examples are not tested
UPDATE
If you need to pass parameters from your “wrapper component” constructor to the peer’s method, you can