Pass yourself with this

I am using vaadin 8

I have a View ClassA

@CDIView(Constants.CLASSA)
public class ClassA extends VerticalLayout implements View {

	public ClassA(...) {
		Button detailView = new Button("detailView", ev -> getUI().addWindow(ClassB(this));
		...
	}
	
	public void method(){
		...
	}

And i have a Window ClassB with the Details

public class ClassB extends Window {
	public ClassB(ClassA selectedClassA) {
	selectedClassA.method();
	...
	}
}

How is it possible to call in Class B the Method selectedClassA.method();

instead of getUI().addWindow(ClassB(this)); I think you need getUI().addWindow(new ClassB(this));

thanks