List of usage examples for com.vaadin.ui Notification setPosition
public void setPosition(Position position)
From source file:VaadinIRC.GUI.IRC.AbstractIRCTableGUI.java
License:Open Source License
/** * Gets SQLContainer object generated with given SQL query. * @param sqlQuery SQL Query that will be used to generate the SQLContainer. * @param columnToOrder Which column will be used to order the results. * @return generated SQLContainer object. Can also be null on problems. *///from w w w . j a va 2 s . c o m public SQLContainer createSQLContainer(String sqlQuery, String columnToOrder) { try { SimpleJDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool(settings.IRCBOT_DATABASE_DRIVER, settings.IRCBOT_DATABASE_ADDRESS + settings.IRCBOT_DATABASE_NAME, settings.IRCBOT_DATABASE_USERNAME, settings.IRCBOT_DATABASE_PASSWORD, 2, 2); return new SQLContainer(new FreeformQuery(sqlQuery, Arrays.asList(columnToOrder), connectionPool)); } catch (Exception e) { Notification notification = new Notification("Problem creating SQL connection: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE); notification.setPosition(Notification.POSITION_BOTTOM_RIGHT); window.showNotification(notification); e.printStackTrace(); } return null; }
From source file:VaadinIRC.GUI.IRC.AbstractIRCTableGUI.java
License:Open Source License
/** * Hides the table and shows error message for user. * @param errorMessage Error message to be shown. *//*from w ww . ja v a 2s. c om*/ public void showError(String errorMessage) { table.setVisible(false); Notification notification = new Notification(errorMessage, Notification.TYPE_HUMANIZED_MESSAGE); notification.setDelayMsec(6000); notification.setPosition(Notification.POSITION_CENTERED); window.showNotification(notification); table.requestRepaint(); }
From source file:VaadinIRC.main.java
License:Open Source License
/** * Shows login panel for the user.//from w w w . j a va2 s .c om */ private void showLoginPanel() { loginPanel = new Panel("Login"); loginPanel.setWidth(250, Sizeable.UNITS_PIXELS); loginPanel.setHeight(200, Sizeable.UNITS_PIXELS); LoginForm login = new LoginForm(); loginPanel.addComponent(login); window.addComponent(loginPanel); VerticalLayout windowLayout = (VerticalLayout) window.getLayout(); windowLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); login.addListener(new LoginListener() { public void onLogin(LoginEvent event) { String username = event.getLoginParameter("username"); String password = event.getLoginParameter("password"); if (username.equals(settings.AUTHENTICATION_USERNAME) && password.equals(settings.AUTHENTICATION_PASSWORD)) { window.removeComponent(loginPanel); startMainApplication(); } else { Notification notification = new Notification("Wrong username or password.", Notification.TYPE_ERROR_MESSAGE); notification.setPosition(Notification.POSITION_BOTTOM_RIGHT); notification.setDelayMsec(250); window.showNotification(notification); } } }); }