How to make class that extends generated class implements View become a win

[color=#000000]
Hi , Good Day Experts!

I have a Question : How to make class that extends generated class implements View become a Windows view?
Here is my Code, I used vaadin designer to generate my design html , then I have Generated Class and Subclass View:

I have Four classes :-
[/color]

a) CustomerForm.java ( Generated class from vaadin designer)
b) CustomerFormView.java ( subclass controller)
c) CustomerSearch.java ( Generated class from vaadin designer)
d) CustomerSearchView.java ( Subclass controller to search)

[color=#000000]

  1. First of all, i wanted to add a function from class CustomerSearchView.java where User will click a button Update and will load a windows from class CustomerView.java as a form with update , how to make a class that extends view can be Windows?

1.1. CustomerSearchView.java
[/color]

[code]
HorizontalLayout horizon= new HorizontalLayout();
Button updateCustomer= new Button(new ThemeResource(“…/sample/img/updateCust.gif”));
updateCustomer.addStyleName(“nobackgroundTable”);

updateCustomer.setDescription(“Edit Customer”);
demo.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Notification.show(“Edit user”);
CustomerFormView.open((Customer)itemId, false);
}
});
[/code]
2. CustomerFormView.java

....
public class CustomerFormView extends CustomerForm implements View {

// constructor
@SuppressWarnings("serial")
    public CustomerFormView(final Customers customer,final boolean preferencesTabOpen) {
    // my controller to add data to forms.
}
public static void open(final Customers customer, final boolean preferencesTabActive) {
     DashboardEventBus.post(new CloseOpenWindowsEvent());
            Windows w =new CustomerFormView(customer, preferencesTabActive);
           UI.getCurrent().addWindow(w);
            w.focus();
        }


Error Occurred at this line :

Window w =new PatientRegistrationView(person, preferencesTabActive); UI.getCurrent().addWindow(w);
errors description:

[color=#B22222]
Multiple markers at this line
- Type mismatch: cannot convert from CustomerFormView to
Window
- Line breakpoint:CustomerFormView [line: 791]

  • open(Customer,
    boolean)
    [/color]


Anyone have Idea to solve this problem , add the Window page.

Window can be a ViewDisplay, but it can’t really implement View meangingfully. Also Designer doesn’t let you create a design using a Window.

Maybe just keep the CustomerForm and its subclass as is and do something like this in open method.

public static void open(final Customers customer, final boolean preferencesTabActive) {
     DashboardEventBus.post(new CloseOpenWindowsEvent());
     Window w = new Window("My window", new CustomerFormView(customer, preferencesTabActive));
     UI.getCurrent().addWindow(w);
     w.focus();
}

Good Day Johannes ,

Its work fine, Thank You very much for the solutions.