List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:jp.primecloud.auto.ui.MyCloudAdd.java
License:Open Source License
MyCloudAdd(Application ap) { apl = ap;/* w w w . ja v a 2 s. co m*/ // setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.myCloudAdd")); setModal(true); setWidth("550px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(true); // layout.addComponent(new BasicTab()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); //okbar.setWidth("100%"); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // Add Button addButton = new Button(ViewProperties.getCaption("button.add")); addButton.setDescription(ViewProperties.getCaption("description.mycloud.add")); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudAdd.this.addButtonClick(event); } }); okbar.addComponent(addButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cansel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudAdd.this.close(); } }); okbar.addComponent(cancelButton); // ?? initValidation(); // ??? initData(); // showTemplates(); }
From source file:jp.primecloud.auto.ui.MyCloudEdit.java
License:Open Source License
MyCloudEdit(Application apl, Long farmNo) { this.apl = apl; this.farmNo = farmNo; ////from ww w . ja va 2 s .c o m setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.myCloudEdit")); setModal(true); setWidth("450px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(true); // layout.addComponent(new BasicTab()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); //okbar.setWidth("100%"); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); okButton.setDescription(ViewProperties.getCaption("description.editCloud.ok")); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudEdit.this.editButtonClick(event); } }); okbar.addComponent(okButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudEdit.this.close(); } }); okbar.addComponent(cancelButton); //??? initData(); // ?? initValidation(); }
From source file:jp.primecloud.auto.ui.MyCloudManage.java
License:Open Source License
MyCloudManage(Application ap) { apl = ap;//from w w w. j a va 2s . c o m // setIcon(Icons.EDITMINI.resource()); setCaption(ViewProperties.getCaption("window.myCloudManage")); setModal(true); setWidth("550px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); // ? HorizontalLayout tbar = new HorizontalLayout(); tbar.setWidth("100%"); tbar.setSpacing(true); // ? Label tcaption = new Label(ViewProperties.getCaption("table.cloud")); tcaption.setWidth("300px"); tbar.addComponent(tcaption); tbar.setComponentAlignment(tcaption, Alignment.MIDDLE_LEFT); // Edit Button editButton = new Button(ViewProperties.getCaption("button.editCloud")); editButton.setDescription(ViewProperties.getCaption("description.editCloud")); editButton.setIcon(Icons.EDITMINI.resource()); editButton.setWidth("85px"); editButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.editButtonClick(event); } }); tbar.addComponent(editButton); tbar.setComponentAlignment(editButton, Alignment.BOTTOM_RIGHT); // Delete Button deleteButton = new Button(ViewProperties.getCaption("button.delete")); deleteButton.setDescription(ViewProperties.getCaption("description.delete")); deleteButton.setWidth("85px"); deleteButton.setIcon(Icons.DELETEMINI.resource()); deleteButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.deleteButtonClick(event); } }); tbar.addComponent(deleteButton); tbar.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT); tbar.setExpandRatio(tcaption, 10); layout.addComponent(tbar); // ? Label spacer1 = new Label(""); spacer1.setHeight("5px"); layout.addComponent(spacer1); // cloudTable = new CloudTable(); layout.addComponent(cloudTable); // ? Label spacer2 = new Label(""); spacer2.setHeight("7px"); layout.addComponent(spacer2); // ?? HorizontalLayout bbar = new HorizontalLayout(); bbar.setWidth("100%"); HorizontalLayout rlay = new HorizontalLayout(); rlay.setSpacing(true); // New Button addButton = new Button(ViewProperties.getCaption("button.newCloud")); addButton.setDescription(ViewProperties.getCaption("description.newCloud")); addButton.setIcon(Icons.ADD.resource()); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.addButtonClick(event); } }); bbar.addComponent(addButton); bbar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT); // Switch Button switchButton = new Button(ViewProperties.getCaption("button.switch")); switchButton.setDescription(ViewProperties.getCaption("description.mycloud.switch")); switchButton.setWidth("85px"); switchButton.setIcon(Icons.SELECTMINI.resource()); switchButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.switchButtonClick(event); } }); // [Enter]?switchButton switchButton.setClickShortcut(KeyCode.ENTER); switchButton.focus(); rlay.addComponent(switchButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.setWidth("85px"); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { MyCloudManage.this.close(); } }); rlay.addComponent(cancelButton); bbar.addComponent(rlay); bbar.setComponentAlignment(rlay, Alignment.MIDDLE_RIGHT); layout.addComponent(bbar); // ??? initData(); //???/? if (ViewContext.getPowerUser()) { addButton.setEnabled(true); deleteButton.setEnabled(true); editButton.setEnabled(true); //?????????????? if (ViewContext.getPowerUser() && !ViewContext.getPowerDefaultMaster().equals(ViewContext.getLoginUser())) { addButton.setEnabled(false); } } else if (ViewContext.getUserNo().equals(ViewContext.getLoginUser())) { addButton.setEnabled(true); deleteButton.setEnabled(true); editButton.setEnabled(true); } else { addButton.setEnabled(false); deleteButton.setEnabled(false); editButton.setEnabled(false); } // showClouds(); }
From source file:jp.primecloud.auto.ui.ServiceTable.java
License:Open Source License
Button getLoadBalancerButton(LoadBalancerDto lbDto) { Button btn = new Button(); btn.setCaption(lbDto.getLoadBalancer().getLoadBalancerName()); btn.setIcon(Icons.LOADBALANCER_TAB.resource()); btn.setData(lbDto);/*from ww w . ja va2 s .c om*/ btn.addStyleName("borderless"); btn.addStyleName("loadbalancer-button"); btn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { loadBalancerButtonClick(event); } }); return btn; }
From source file:jp.primecloud.auto.ui.TopBar.java
License:Open Source License
@Override public void attach() { addStyleName("TopBar"); setWidth("100%"); setHeight("30px"); setMargin(false, true, false, false); // PrimeCloud Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML); plbl.addStyleName("logo"); addComponent(plbl);//from w ww . j av a2 s.com // ?? String versionProp = Config.getVersionProperty("version"); if (StringUtils.isNotEmpty(versionProp)) { StringBuilder version = new StringBuilder(); version.append("ver").append(versionProp); Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNo"); addComponent(versionNo); } else { Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNoNone"); addComponent(versionNo); } // myCloud? Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage")); myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage")); myCloudButton.addStyleName("borderless"); myCloudButton.addStyleName("mycloud"); myCloudButton.setIcon(Icons.CLOUDBIG.resource()); myCloudButton.setVisible(true); myCloudButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { showCloudEditWindow(); } }); addComponent(myCloudButton); // (Zabbix) String useZabbix = Config.getProperty("zabbix.useZabbix"); if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) { String url = Config.getProperty("zabbix.display"); Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url)); zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix")); zabbix.setIcon(Icons.MNGSYSTEM.resource()); zabbix.setTargetName("_blank"); zabbix.addStyleName("zabbix"); addComponent(zabbix); } // Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog")); eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog")); eventLogButton.addStyleName("borderless"); eventLogButton.addStyleName("eventlog"); eventLogButton.setIcon(Icons.CUSTOM.resource()); eventLogButton.setVisible(true); eventLogButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinLogView window = new WinLogView(); getApplication().addWindow(window); getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank"); } }); addComponent(eventLogButton); // Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment")); if (BooleanUtils.isTrue(usePayment)) { String url2 = Config.getProperty("payment.display"); Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2)); payment.setDescription(ViewProperties.getCaption("description.link.payment")); payment.setIcon(Icons.PAYSYSTEM.resource()); payment.setTargetName("_payment"); payment.addStyleName("payment"); addComponent(payment); } // Button logoutButton = new Button(ViewProperties.getCaption("button.logout")); logoutButton.setDescription(ViewProperties.getCaption("description.logout")); logoutButton.addStyleName("borderless"); logoutButton.addStyleName("logout"); logoutButton.setIcon(Icons.LOGOUT.resource()); logoutButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"), ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel); Callback callback = new Callback() { @Override public void onDialogResult(Result result) { if (result == Result.OK) { // ? LoggingUtils.removeContext(); ContextUtils.invalidateSession(); accountButton.setVisible(false); // ???? getApplication().close(); } } }; dialog.setCallback(callback); getApplication().getMainWindow().addWindow(dialog); } }); addComponent(logoutButton); // ? accountButton = new Button(ViewProperties.getCaption("button.account")); accountButton.setDescription(ViewProperties.getCaption("description.account")); accountButton.addStyleName("borderless"); accountButton.addStyleName("account"); accountButton.setIcon(Icons.USER.resource()); accountButton.setVisible(false); addComponent(accountButton); }
From source file:jp.primecloud.auto.ui.WinLogin.java
License:Open Source License
WinLogin() { // Window/*from ww w.jav a 2 s . c o m*/ setIcon(Icons.LOGIN.resource()); setCaption(ViewProperties.getCaption("window.login")); setModal(true); setWidth("300px"); setResizable(false); setClosable(false); // Layout VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); layout.setSpacing(true); // Form form = new Form(); form.addStyleName("form-login"); usernameField = new TextField(ViewProperties.getCaption("field.userName")); usernameField.setWidth("90%"); passwordField = new TextField(ViewProperties.getCaption("field.password")); passwordField.setSecret(true); passwordField.setWidth("90%"); form.getLayout().addComponent(usernameField); form.getLayout().addComponent(passwordField); layout.addComponent(form); // usernameField.focus(); // Button Button ok = new Button(ViewProperties.getCaption("button.login")); ok.setDescription(ViewProperties.getCaption("description.login")); ok.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { loginButtonClick(event); } }); // [Enter]?OK ok.setClickShortcut(KeyCode.ENTER); layout.addComponent(ok); layout.setComponentAlignment(ok, "right"); // ?? initValidation(); }
From source file:jp.primecloud.auto.ui.WinServerAdd.java
License:Open Source License
WinServerAdd(Application ap) { apl = ap;/*from w w w . j a v a 2s . c o m*/ // setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.winServerAdd")); setModal(true); setWidth("620px"); //setHeight("600px"); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true, true, false, true); layout.setSpacing(false); // layout.addComponent(new BasicForm()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // Add Button addButton = new Button(ViewProperties.getCaption("button.add")); addButton.setDescription(ViewProperties.getCaption("description.addServer")); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { addButtonClick(event); } }); // [Enter]?addButton addButton.setClickShortcut(KeyCode.ENTER); addButton.focus(); okbar.addComponent(addButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); okbar.addComponent(cancelButton); // ?? initValidation(); // ??? initData(); // ? showClouds(); }
From source file:jp.primecloud.auto.ui.WinServerAddSimple.java
License:Open Source License
WinServerAddSimple(Application ap, Long componentTypeNo) { apl = ap;//from w w w. j a v a 2 s. c om this.componentTypeNo = componentTypeNo; // setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.winServerAddSimple")); setModal(true); setWidth("450px"); setResizable(false); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true, true, false, true); layout.setSpacing(false); // layout.addComponent(new ServerAddForm()); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // Add Button addButton = new Button(ViewProperties.getCaption("button.add")); addButton.setDescription(ViewProperties.getCaption("description.add")); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { final List<String> serverNames = getServerNames(); DialogConfirm dialog = null; String message = ""; if (serverNames == null) { return; } else if (serverNames.size() > 1) { message = ViewMessages.getMessage("IUI-000043", serverNames.get(0), serverNames.get(serverNames.size() - 1), serverNames.size()); } else { message = ViewMessages.getMessage("IUI-000042", serverNames.get(0), serverNames.size()); } dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message, Buttons.OKCancel); dialog.setCallback(new DialogConfirm.Callback() { @Override public void onDialogResult(Result result) { if (result != Result.OK) { return; } else { addButtonClick(serverNames); } } }); getApplication().getMainWindow().addWindow(dialog); } }); okbar.addComponent(addButton); // Cancel Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); okbar.addComponent(cancelButton); // ?? initValidation(); // ??? initData(); // ? showClouds(); }
From source file:jp.primecloud.auto.ui.WinServerDataDiskConfig.java
License:Open Source License
WinServerDataDiskConfig(Application ap, Long instanceNo, DataDiskDto dataDiskDto) { this.ap = ap; this.instanceNo = instanceNo; this.dataDiskDto = dataDiskDto; // Window//from w ww. ja va2 s. c o m isAddMode = (this.dataDiskDto == null) ? true : false; if (isAddMode) { //? setIcon(Icons.ADD.resource()); setCaption(ViewProperties.getCaption("window.WinServerAddDataDisk")); } else { //? setIcon(Icons.EDIT.resource()); setCaption(ViewProperties.getCaption("window.WinServerEditDataDisk")); } setModal(true); setWidth("400px"); setResizable(false); // Layout VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); layout.setSpacing(true); // Form Form form = new Form(); txtDiskSize = new TextField(ViewProperties.getCaption("field.diskSize")); txtDiskSize.setWidth("90%"); form.getLayout().addComponent(txtDiskSize); layout.addComponent(form); // ?? HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSpacing(true); buttonBar.setMargin(false, true, true, false); layout.addComponent(buttonBar); layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT); // OK Button Button btnOk = new Button(ViewProperties.getCaption("button.ok")); btnOk.setDescription(ViewProperties.getCaption("description.ok")); btnOk.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { okButtonClick(event); } }); buttonBar.addComponent(btnOk); // [Enter]?OK btnOk.setClickShortcut(KeyCode.ENTER); //Cancel Button Button btnCancel = new Button(ViewProperties.getCaption("button.cancel")); btnCancel.setDescription(ViewProperties.getCaption("description.cancel")); btnCancel.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttonBar.addComponent(btnCancel); // showData(); // ?? initValidation(); }
From source file:jp.primecloud.auto.ui.WinServerEdit.java
License:Open Source License
WinServerEdit(Application ap, Long instanceNo) { apl = ap;/*from w w w .j a v a2s. c o m*/ this.instanceNo = instanceNo; // ??? initData(); // setCaption(ViewProperties.getCaption("window.winServerEdit")); setModal(true); setWidth("600px"); setIcon(Icons.EDITMINI.resource()); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(true); //Tab? basicTab = new BasicTab(); tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource()); layout.addComponent(tab); // ?? basicTab.initValidation(); // ? basicTab.showData(); //Tab? String platformType = platformDto.getPlatform().getPlatformType(); // TODO CLOUD BRANCHING if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformType)) { awsDetailTab = new AWSDetailTab(); tab.addTab(awsDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? awsDetailTab.initValidation(); // ? awsDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platformType)) { vmwareDetailTab = new VMWareDetailTab(); tab.addTab(vmwareDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); // ?? vmwareDetailTab.initValidation(); // ? vmwareDetailTab.showData(); boolean enableVmwareStaticIp = BooleanUtils.toBoolean(Config.getProperty("ui.enableVmwareEditIp")); if (BooleanUtils.isTrue(enableVmwareStaticIp)) { this.vmwareEditIpTab = new VmwareEditIpTab(); tab.addTab(vmwareEditIpTab, ViewProperties.getCaption("tab.editIp"), Icons.DETAIL.resource()); this.vmwareEditIpTab.showData(); this.vmwareEditIpTab.initValidation(); } layout.addComponent(tab); } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platformType)) { niftyDetailTab = new NiftyDetailTab(); tab.addTab(niftyDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? niftyDetailTab.initValidation(); // ? niftyDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformType)) { cloudStackDetailTab = new CloudStackDetailTab(); tab.addTab(cloudStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? cloudStackDetailTab.initValidation(); // ? cloudStackDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platformType)) { // vcloudDetailTab = new VcloudDetailTab(); tab.addTab(vcloudDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); // ?? vcloudDetailTab.initValidation(); // ? vcloudDetailTab.showData(); //? vcloudNetworkTab = new VcloudNetworkTab(); tab.addTab(vcloudNetworkTab, ViewProperties.getCaption("tab.network"), Icons.DETAIL.resource()); vcloudNetworkTab.showData(); layout.addComponent(tab); } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platformType)) { azureDetailTab = new AzureDetailTab(); tab.addTab(azureDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? azureDetailTab.initValidation(); // ? azureDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platformType)) { openStackDetailTab = new OpenStackDetailTab(); tab.addTab(openStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? openStackDetailTab.initValidation(); // ? openStackDetailTab.showData(); } // tab.addTab(new UserTab(), "", new ThemeResource("icons/user.png")); // layout.addComponent(tab); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); okButton.setDescription(ViewProperties.getCaption("description.editServer.ok")); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { okButtonClick(event); } }); okbar.addComponent(okButton); // [Enter]?okButton okButton.setClickShortcut(KeyCode.ENTER); okButton.focus(); Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); okbar.addComponent(cancelButton); }