List of usage examples for com.vaadin.ui Notification setDelayMsec
public void setDelayMsec(int delayMsec)
From source file:uicomponents.PoolingTable.java
License:Open Source License
private void initButtonMover(Table sourceTable, Table usedTable) { moveLeft.addClickListener(new Button.ClickListener() { /**/*from w w w .j a v a2 s .c o m*/ * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Table source = getActiveTable(); Set<Object> ids = (Set<Object>) source.getValue(); boolean atLeastOneNew = false; if (ids.size() > 0) { for (Object itemId : ids) { atLeastOneNew |= moveSampleToPool(source, itemId); } resizeTable(); if (!atLeastOneNew) { Notification n = new Notification("Samples are already in this pool."); n.setDelayMsec(3000); n.show(Page.getCurrent()); } } } }); }
From source file:uicomponents.PoolingTable.java
License:Open Source License
private void initDragAndDrop(final ClientSideCriterion acceptCriterion) { poolTable.setDropHandler(new DropHandler() { /**/* www . j av a2 s. c o m*/ * */ private static final long serialVersionUID = 4057757595986300434L; @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (!(t.getSourceComponent() instanceof Table)) { return; } Table source = (Table) t.getSourceComponent(); Object sourceItemId = t.getItemId(); if (!moveSampleToPool(source, sourceItemId)) { Notification n = new Notification("Sample is already in this pool."); n.setDelayMsec(3000); n.show(Page.getCurrent()); } resizeTable(); } @Override public AcceptCriterion getAcceptCriterion() { return new And(acceptCriterion, AcceptItem.ALL); } }); }
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 a2s . c o m*/ 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 ww . j a v a 2 s . co m */ 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); } } }); }