I am very much new with Vaadin. I have made buttons on Composite UI and now I want to call another compositeUI (loginUI) on the button click. What should I do and where should I write the click event. I tried but failed. Below are my code
public class Logon extends CustomComponent {
@AutoGenerated
private AbsoluteLayout mainLayout;
@AutoGenerated
private Label welcome;
@AutoGenerated
private HorizontalLayout horizontalLayout_2;
@AutoGenerated
private Button registerButton;
@AutoGenerated
private Button loginButton;
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
final static Logger logger = Logger.getLogger(Logon.class);
/**
* The constructor should first build the main layout, set the
* composition root and then do any custom initialization.
*
* The constructor will not be automatically regenerated by the
* visual editor.
*/
public Logon() {
buildMainLayout();
setCompositionRoot(mainLayout);
// TODO add user code here
logger.info(resources.org.tu.strike4cash.LogonConf.buttonClickA);
LoginUI loginUI = new LoginUI();
}
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
// top-level component properties
setWidth("100.0%");
setHeight("100.0%");
// horizontalLayout_2
horizontalLayout_2 = buildHorizontalLayout_2();
mainLayout.addComponent(horizontalLayout_2, "top:90.0px;right:348.0px;bottom:334.0px;left:120.0px;");
// welcome
welcome = new Label();
welcome.setCaption("Welcome to Strike4Cash");
welcome.setImmediate(false);
welcome.setWidth("-1px");
welcome.setHeight("100.0%");
welcome.setValue("Earn cash in simple click");
mainLayout.addComponent(welcome, "top:60.0px;bottom:374.0px;left:431.0px;");
return mainLayout;
}
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_2() {
// common part: create layout
horizontalLayout_2 = new HorizontalLayout();
horizontalLayout_2.setImmediate(false);
horizontalLayout_2.setWidth("100.0%");
horizontalLayout_2.setHeight("100.0%");
horizontalLayout_2.setMargin(false);
// loginButton
loginButton = new Button();
loginButton.setCaption("Login");
loginButton.setImmediate(true);
loginButton.setWidth("100.0%");
loginButton.setHeight("-1px");
horizontalLayout_2.addComponent(loginButton);
horizontalLayout_2.setExpandRatio(loginButton, 1.0f);
// registerButton
registerButton = new Button();
registerButton.setCaption("Register");
registerButton.setImmediate(true);
registerButton.setWidth("100.0%");
registerButton.setHeight("-1px");
horizontalLayout_2.addComponent(registerButton);
horizontalLayout_2.setExpandRatio(registerButton, 1.0f);
return horizontalLayout_2;
}
}