List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);//www . j av a2 s . c o m typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.ServerDetailsForm.java
License:Apache License
public ServerDetailsForm() { FormLayout layout = new FormLayout(); setCompositionRoot(layout);//ww w . j a v a 2s . com Label title = new Label("<h1> Server Details</h1>"); title.setContentMode(Label.CONTENT_XHTML); layout.addComponent(title); final TextField serverIP = new TextField("Server IP"); serverIP.setWidth(COMMON_FIELD_WIDTH); layout.addComponent(serverIP); final TextField port = new TextField("Port"); port.setWidth(COMMON_FIELD_WIDTH); layout.addComponent(port); Button applyButton = new Button("Apply"); layout.addComponent(applyButton); applyButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { try { // Window mainWindow = new Window(); FHEMServer server = new FHEMServer((String) serverIP.getValue(), Integer.parseInt((String) port.getValue())); getWindow().setContent(new HWindow(server)); // VaadinServletResponse response = // (VaadinServletResponse) VaadinService.getCurrentResponse(); // Cookie ipCookie = new Cookie("ip", (String)serverIP.getValue()); // Cookie portCookie = new Cookie("port", (String) port.getValue()); // ipCookie.setMaxAge(30 * 24 * 60 * 60); // ipCookie.setPath("/HWC"); // portCookie.setMaxAge(30 * 24 * 60 * 60); // portCookie.setPath("/HWC"); // response.addCookie(ipCookie); // response.addCookie(portCookie); } catch (ConnectException e) { getWindow().setContent(new Window("Could not connect to FHEM!\n Cause: " + e.getMessage())); getWindow().showNotification("Error!", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); // // VaadinServletRequest request = // (VaadinServletRequest) VaadinService.getCurrentRequest(); // if(request != null){ // Cookie[] cookies = request.getCookies(); // for (Cookie cookie : cookies) { // if (cookie.getName().equals("ip")) { // serverIP.setValue(cookie.getValue()); // }else if(cookie.getName().equals("port")){ // port.setValue(cookie.getValue()); // } // } // } }
From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java
private HorizontalLayout createButtonBar() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSizeFull();//from w w w .j av a2 s . c o m Button buttonRefresh = new Button("Refresh"); buttonRefresh.setIcon(new ThemeResource("images/refresh16x16.gif")); buttonRefresh.setEnabled(true); buttonRefresh.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { AS2WebUI.this.refreshOverviewTableData(); } }); buttonLayout.addComponent(buttonRefresh); this.buttonDetails = new Button("Message details"); this.buttonDetails.setIcon(new ThemeResource("images/messagedetails16x16.gif")); this.buttonDetails.setEnabled(false); this.buttonDetails.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { AS2WebUI.this.displayMessageDetailsOfSelectedRow(); } }); buttonLayout.addComponent(this.buttonDetails); this.labelUsername.setWidth(null); buttonLayout.addComponent(this.labelUsername); buttonLayout.setComponentAlignment(this.labelUsername, Alignment.MIDDLE_RIGHT); buttonLayout.setExpandRatio(buttonRefresh, 0.0f); buttonLayout.setExpandRatio(this.buttonDetails, 0.0f); buttonLayout.setExpandRatio(this.labelUsername, 1.0f); return (buttonLayout); }
From source file:de.twenty11.skysail.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("Skysail OSGi Monitor Vaadin Client"); setMainWindow(window);//from w ww .ja v a 2s . com // Needed because composites are full size window.getContent().setSizeFull(); MyComponent myComposite = new MyComponent(); window.addComponent(myComposite); Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking")); } }); window.addComponent(button); /* Create the table with a caption. */ Table table = new Table("This is my Table"); /* * Define the names and data types of columns. The "default value" parameter is meaningless here. */ table.addContainerProperty("First Name", String.class, null); table.addContainerProperty("Last Name", String.class, null); table.addContainerProperty("Year", Integer.class, null); /* Add a few items in the table. */ table.addItem(new Object[] { "Nicolaus", "Copernicus", new Integer(1473) }, new Integer(1)); table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) }, new Integer(2)); table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) }, new Integer(3)); table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) }, new Integer(4)); table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) }, new Integer(5)); table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) }, new Integer(6)); window.addComponent(table); setTheme("skysail.client.osgimonitor.vaadintheme"); }
From source file:de.unioninvestment.portal.explorer.view.vfs.ConfigView.java
License:Apache License
public ConfigView(ConfigBean cb, VFSFileExplorerPortlet instance) { final OptionGroup group = new OptionGroup("Type"); group.addItem("FILE"); group.addItem("FTP"); group.addItem("SFTP"); group.setValue(cb.getVfsType());//from w ww . j av a 2s .c om group.setImmediate(true); final TextField tfDirectory = new TextField("Directory"); tfDirectory.setValue(cb.getVfsUrl()); final TextField tfKeyFile = new TextField("Keyfile"); tfKeyFile.setValue(cb.getKeyfile()); final TextField tfProxyHost = new TextField("Proxy Host (sftp)"); tfProxyHost.setValue(cb.getProxyHost()); final TextField tfProxyPort = new TextField("Proxy Port (sftp)"); tfProxyPort.setValue(cb.getProxyPort()); final TextField tfUser = new TextField("User"); tfUser.setValue(cb.getUsername()); final PasswordField tfPw = new PasswordField("Password"); tfPw.setValue(cb.getPassword()); final CheckBox cbUploadEnabled = new CheckBox("Upload Enabled"); if (cb.isUploadEnabled()) { cbUploadEnabled.setValue(true); } else cbUploadEnabled.setValue(false); final TextField tfRolesUpload = new TextField("Upload Rollen"); tfRolesUpload.setValue(cb.getUploadRoles()); final CheckBox cbDeleteEnabled = new CheckBox("Delete Enabled"); if (cb.isDeleteEnabled()) { cbDeleteEnabled.setValue(true); } else cbDeleteEnabled.setValue(false); final TextField tfRolesDelete = new TextField("Delete Rollen"); tfRolesDelete.setValue(cb.getDeleteRoles()); group.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { setVisibleFields(group, tfKeyFile, tfProxyHost, tfProxyPort, tfUser, tfPw); } }); setVisibleFields(group, tfKeyFile, tfProxyHost, tfProxyPort, tfUser, tfPw); Button saveProps = new Button("Save"); final VFSFileExplorerPortlet app = instance; saveProps.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { PortletPreferences prefs = app.getPortletPreferences(); String type = group.getValue().toString(); prefs.setValue("type", type); String con = tfDirectory.getValue().toString(); prefs.setValue("directory", con); String key = tfKeyFile.getValue().toString(); prefs.setValue("keyfile", key); String proxyHost = tfProxyHost.getValue().toString(); prefs.setValue("proxyHost", proxyHost); String proxyPort = tfProxyPort.getValue().toString(); prefs.setValue("proxyPort", proxyPort); String uploadRoles = tfRolesUpload.getValue().toString(); prefs.setValue("uploadRoles", uploadRoles); String deleteRoles = tfRolesDelete.getValue().toString(); prefs.setValue("deleteRoles", deleteRoles); String username = tfUser.getValue().toString(); prefs.setValue("username", username); String password = tfPw.getValue().toString(); prefs.setValue("password", password); Boolean bDel = (Boolean) cbDeleteEnabled.getValue(); Boolean bUpl = (Boolean) cbUploadEnabled.getValue(); if (bDel) prefs.setValue("deleteEnabled", "true"); else prefs.setValue("deleteEnabled", "false"); if (bUpl) prefs.setValue("uploadEnabled", "true"); else prefs.setValue("uploadEnabled", "false"); prefs.store(); logger.log(Level.INFO, "Roles Upload " + prefs.getValue("uploadEnabled", "-")); logger.log(Level.INFO, "Roles Delete " + prefs.getValue("deleteEnabled", "-")); ConfigBean cb = new ConfigBean(type, bDel, false, bUpl, con, username, password, key, proxyHost, proxyPort, uploadRoles, deleteRoles); app.getEventBus().fireEvent(new ConfigChangedEvent(cb)); } catch (Exception e) { logger.log(Level.INFO, "Exception " + e.toString()); e.printStackTrace(); } } }); addComponent(group); addComponent(tfDirectory); addComponent(tfKeyFile); addComponent(tfProxyHost); addComponent(tfProxyPort); addComponent(tfUser); addComponent(tfPw); HorizontalLayout ul = new HorizontalLayout(); ul.setSpacing(true); ul.addComponent(cbUploadEnabled); ul.addComponent(tfRolesUpload); ul.setComponentAlignment(cbUploadEnabled, Alignment.MIDDLE_CENTER); ul.setComponentAlignment(tfRolesUpload, Alignment.MIDDLE_CENTER); addComponent(ul); HorizontalLayout dl = new HorizontalLayout(); dl.setSpacing(true); dl.addComponent(cbDeleteEnabled); dl.addComponent(tfRolesDelete); dl.setComponentAlignment(cbDeleteEnabled, Alignment.MIDDLE_CENTER); dl.setComponentAlignment(tfRolesDelete, Alignment.MIDDLE_CENTER); addComponent(dl); addComponent(saveProps); }
From source file:de.unioninvestment.portal.explorer.view.vfs.TableView.java
License:Apache License
public void attach() { selectedDir = cb.getVfsUrl();// www . j av a2 s .c o m try { final VFSFileExplorerPortlet app = instance; final User user = (User) app.getUser(); final FileSystemManager fFileSystemManager = fileSystemManager; final FileSystemOptions fOpts = opts; final Table table = new Table() { private static final long serialVersionUID = 1L; protected String formatPropertyValue(Object rowId, Object colId, Property property) { if (TABLE_PROP_FILE_NAME.equals(colId)) { if (property != null && property.getValue() != null) { return getDisplayPath(property.getValue().toString()); } } if (TABLE_PROP_FILE_DATE.equals(colId)) { if (property != null && property.getValue() != null) { SimpleDateFormat sdf = new SimpleDateFormat("dd.MMM yyyy HH:mm:ss"); return sdf.format((Date) property.getValue()); } } return super.formatPropertyValue(rowId, colId, property); } }; table.setSizeFull(); table.setMultiSelect(true); table.setSelectable(true); table.setImmediate(true); table.addContainerProperty(TABLE_PROP_FILE_NAME, String.class, null); table.addContainerProperty(TABLE_PROP_FILE_SIZE, Long.class, null); table.addContainerProperty(TABLE_PROP_FILE_DATE, Date.class, null); if (app != null) { app.getEventBus().addHandler(TableChangedEvent.class, new TableChangedEventHandler() { private static final long serialVersionUID = 1L; @Override public void onValueChanged(TableChangedEvent event) { try { selectedDir = event.getNewDirectory(); fillTableData(event.getNewDirectory(), table, fFileSystemManager, fOpts, null); } catch (IOException e) { e.printStackTrace(); } } }); } table.addListener(new Table.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { Set<?> value = (Set<?>) event.getProperty().getValue(); if (null == value || value.size() == 0) { markedRows = null; } else { markedRows = value; } } }); fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); Button btDownload = new Button("Download File(s)"); btDownload.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (markedRows == null || markedRows.size() == 0) getWindow().showNotification("No Files selected !", Window.Notification.TYPE_WARNING_MESSAGE); else { String[] files = new String[markedRows.size()]; int fileCount = 0; for (Object item : markedRows) { Item it = table.getItem(item); files[fileCount] = it.getItemProperty(TABLE_PROP_FILE_NAME).toString(); fileCount++; } File dlFile = null; if (fileCount == 1) { try { String fileName = files[0]; dlFile = getFileFromVFSObject(fFileSystemManager, fOpts, fileName); logger.log(Level.INFO, "vfs2portlet: download file " + fileName + " by " + user.getScreenName()); } catch (Exception e) { e.printStackTrace(); } } else { byte[] buf = new byte[1024]; try { dlFile = File.createTempFile("Files", ".zip"); ZipOutputStream out = new ZipOutputStream( new FileOutputStream(dlFile.getAbsolutePath())); for (int i = 0; i < files.length; i++) { String fileName = files[i]; logger.log(Level.INFO, "vfs2portlet: download file " + fileName + " by " + user.getScreenName()); File f = getFileFromVFSObject(fFileSystemManager, fOpts, fileName); FileInputStream in = new FileInputStream(f); out.putNextEntry(new ZipEntry(f.getName())); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); } catch (IOException e) { } } if (dlFile != null) { try { DownloadResource downloadResource = new DownloadResource(dlFile, getApplication()); getApplication().getMainWindow().open(downloadResource, "_new"); } catch (FileNotFoundException e) { getWindow().showNotification("File not found !", Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); } } if (dlFile != null) { dlFile.delete(); } } } }); Button btDelete = new Button("Delete File(s)"); btDelete.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (markedRows == null || markedRows.size() == 0) getWindow().showNotification("No Files selected !", Window.Notification.TYPE_WARNING_MESSAGE); else { for (Object item : markedRows) { Item it = table.getItem(item); String fileToDelete = it.getItemProperty(TABLE_PROP_FILE_NAME).toString(); logger.log(Level.INFO, "Delete File " + fileToDelete); try { FileObject delFile = fFileSystemManager.resolveFile(fileToDelete, fOpts); logger.log(Level.INFO, "vfs2portlet: delete file " + delFile.getName() + " by " + user.getScreenName()); boolean b = delFile.delete(); if (b) logger.log(Level.INFO, "delete ok"); else logger.log(Level.INFO, "delete failed"); } catch (FileSystemException e) { e.printStackTrace(); } } try { fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); } catch (IOException e) { e.printStackTrace(); } } } }); Button selAll = new Button("Select All", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(Button.ClickEvent event) { table.setValue(table.getItemIds()); } }); Button selNone = new Button("Select None", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(Button.ClickEvent event) { table.setValue(null); } }); final UploadReceiver receiver = new UploadReceiver(); upload = new Upload(null, receiver); upload.setImmediate(true); upload.setButtonCaption("File Upload"); upload.addListener((new Upload.SucceededListener() { private static final long serialVersionUID = 1L; public void uploadSucceeded(SucceededEvent event) { try { String fileName = receiver.getFileName(); ByteArrayOutputStream bos = receiver.getUploadedFile(); byte[] buf = bos.toByteArray(); ByteArrayInputStream bis = new ByteArrayInputStream(buf); String fileToAdd = selectedDir + "/" + fileName; logger.log(Level.INFO, "vfs2portlet: add file " + fileToAdd + " by " + user.getScreenName()); FileObject localFile = fFileSystemManager.resolveFile(fileToAdd, fOpts); localFile.createFile(); OutputStream localOutputStream = localFile.getContent().getOutputStream(); IOUtils.copy(bis, localOutputStream); localOutputStream.flush(); fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); app.getMainWindow().showNotification("Upload " + fileName + " successful ! ", Notification.TYPE_TRAY_NOTIFICATION); } catch (Exception e) { e.printStackTrace(); } } })); upload.addListener(new Upload.FailedListener() { private static final long serialVersionUID = 1L; public void uploadFailed(FailedEvent event) { System.out.println("Upload failed ! "); } }); multiFileUpload = new MultiFileUpload() { private static final long serialVersionUID = 1L; protected void handleFile(File file, String fileName, String mimeType, long length) { try { byte[] buf = FileUtils.readFileToByteArray(file); ByteArrayInputStream bis = new ByteArrayInputStream(buf); String fileToAdd = selectedDir + "/" + fileName; logger.log(Level.INFO, "vfs2portlet: add file " + fileToAdd + " by " + user.getScreenName()); FileObject localFile = fFileSystemManager.resolveFile(fileToAdd, fOpts); localFile.createFile(); OutputStream localOutputStream = localFile.getContent().getOutputStream(); IOUtils.copy(bis, localOutputStream); localOutputStream.flush(); fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); } catch (FileSystemException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } protected FileBuffer createReceiver() { FileBuffer receiver = super.createReceiver(); /* * Make receiver not to delete files after they have been * handled by #handleFile(). */ receiver.setDeleteFiles(false); return receiver; } }; multiFileUpload.setUploadButtonCaption("Upload File(s)"); HorizontalLayout filterGrp = new HorizontalLayout(); filterGrp.setSpacing(true); final TextField tfFilter = new TextField(); Button btFileFilter = new Button("Filter", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(Button.ClickEvent event) { String filterVal = (String) tfFilter.getValue(); try { if (filterVal == null || filterVal.length() == 0) { fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); } else { fillTableData(selectedDir, table, fFileSystemManager, fOpts, filterVal); } } catch (IOException e) { e.printStackTrace(); } } }); Button btResetFileFilter = new Button("Reset", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(Button.ClickEvent event) { try { tfFilter.setValue(""); fillTableData(selectedDir, table, fFileSystemManager, fOpts, null); } catch (ReadOnlyException e) { e.printStackTrace(); } catch (ConversionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); filterGrp.addComponent(tfFilter); filterGrp.addComponent(btFileFilter); filterGrp.addComponent(btResetFileFilter); addComponent(filterGrp); addComponent(table); HorizontalLayout btGrp = new HorizontalLayout(); btGrp.setSpacing(true); btGrp.addComponent(selAll); btGrp.setComponentAlignment(selAll, Alignment.MIDDLE_CENTER); btGrp.addComponent(selNone); btGrp.setComponentAlignment(selNone, Alignment.MIDDLE_CENTER); btGrp.addComponent(btDownload); btGrp.setComponentAlignment(btDownload, Alignment.MIDDLE_CENTER); List<Role> roles = null; boolean matchUserRole = false; try { if (user != null) { roles = user.getRoles(); } } catch (SystemException e) { e.printStackTrace(); } if (cb.isDeleteEnabled() && cb.getDeleteRoles().length() == 0) { btGrp.addComponent(btDelete); btGrp.setComponentAlignment(btDelete, Alignment.MIDDLE_CENTER); } else if (cb.isDeleteEnabled() && cb.getDeleteRoles().length() > 0) { matchUserRole = isUserInRole(roles, cb.getDeleteRoles()); if (matchUserRole) { btGrp.addComponent(btDelete); btGrp.setComponentAlignment(btDelete, Alignment.MIDDLE_CENTER); } } if (cb.isUploadEnabled() && cb.getUploadRoles().length() == 0) { btGrp.addComponent(upload); btGrp.setComponentAlignment(upload, Alignment.MIDDLE_CENTER); btGrp.addComponent(multiFileUpload); btGrp.setComponentAlignment(multiFileUpload, Alignment.MIDDLE_CENTER); } else if (cb.isUploadEnabled() && cb.getUploadRoles().length() > 0) { matchUserRole = isUserInRole(roles, cb.getUploadRoles()); if (matchUserRole) { btGrp.addComponent(upload); btGrp.setComponentAlignment(upload, Alignment.MIDDLE_CENTER); btGrp.addComponent(multiFileUpload); btGrp.setComponentAlignment(multiFileUpload, Alignment.MIDDLE_CENTER); } } addComponent(btGrp); } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.ParameterScreenViewImpl.java
License:Open Source License
/** * *///from w ww . j a va 2s. co m private void addLogoutButton() { Button logoutButton = new Button("Logout"); logoutButton.setStyleName("default"); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); //LogoutButton hinzufgen und ausrichten logoutButton.setEnabled(true); right.addComponent(logoutButton); right.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java
License:Open Source License
private void addOverviewButton() { Button overviewButton = new Button("Projektbersicht"); overviewButton.addStyleName("default"); overviewButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w w w. j av a2s. co m public void buttonClick(ClickEvent event) { presenter.showProjectList(); } }); this.topbarinnerlayout.addComponent(overviewButton); this.topbarinnerlayout.setComponentAlignment(overviewButton, Alignment.MIDDLE_CENTER); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java
License:Open Source License
/** * Diese Methode fuegt der Navigation einen Navigationsbutton hinzu und registriert * einen passenden ClickListener auf ihn. * /*from w w w . j a va2 s. c o m*/ * @param value Der Prozessschritt, der durch den Navigationsbutton repraesentiert werden soll. * @author Julius Hacker */ @Override public void addNavigationButton(final NavigationSteps navigationStep) { //this.innerlayout.addComponent(arrow); Button navigationButton = new Button(navigationStep.getCaption()); this.navigationButtons.put(navigationStep, navigationButton); navigationButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { presenter.showStep(navigationStep); } }); navigationButton.setEnabled(false); navigationButton.setWidth(Sizeable.SIZE_UNDEFINED, 5); this.innerlayout.addComponent(navigationButton); this.innerlayout.setComponentAlignment(navigationButton, Alignment.BOTTOM_CENTER); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java
License:Open Source License
private void addLogoutButton(String text) { Button logoutButton = new Button(text); logoutButton.addStyleName("default"); logoutButton.setVisible(true);//from ww w . j a v a 2s . c o m logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); logoutButton.setEnabled(true); this.layout.addComponent(logoutButton); this.layout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }