List of usage examples for com.vaadin.ui Notification show
public static Notification show(String caption, Type type)
From source file:com.fnc.connection.ShowErrorNotification.java
public static void error(String error, String className) { Notification.show(error + " \n Class: " + className, Notification.Type.ERROR_MESSAGE); }
From source file:com.fnc.connection.ShowErrorNotification.java
public static void warning(String warning) { Notification.show(warning, Notification.Type.ERROR_MESSAGE); }
From source file:com.fnc.connection.ShowErrorNotification.java
public static void tray(String tray) { Notification.show(tray, Notification.Type.ERROR_MESSAGE); }
From source file:com.github.daytron.tablebean.tableColumn.DateSourcePlay.java
License:Open Source License
public DateSourcePlay() { Property<String> property = new ObjectProperty<>("ABC"); final TextField tf = new TextField(property); tf.setBuffered(true);//from w w w. j a va 2s. com tf.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { Notification.show("Text change (event): " + event.getText(), Notification.Type.TRAY_NOTIFICATION); } }); Button commitButton = new Button("Save"); commitButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Notification.show("Before commit (property): " + tf.getPropertyDataSource().getValue(), Notification.Type.TRAY_NOTIFICATION); tf.commit(); Notification.show("After commit (property): " + tf.getPropertyDataSource().getValue(), Notification.Type.TRAY_NOTIFICATION); } }); Button discardButton = new Button("Cancel"); discardButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Notification.show("Before discard (property): " + tf.getPropertyDataSource().getValue(), Notification.Type.TRAY_NOTIFICATION); tf.discard(); Notification.show("After discard (property): " + tf.getPropertyDataSource().getValue(), Notification.Type.TRAY_NOTIFICATION); } }); addComponent(tf); addComponent(commitButton); addComponent(discardButton); }
From source file:com.github.mjvesa.herd.Interpreter.java
License:Apache License
/** * /*www . ja va2s .c om*/ * Inner interpreter * * Execution: * * Base words are atomic, so just fetch and execute. Defined words consist * of other words. Obtain list of words and execute in series. Store * previous point in return stack so there will be no problems with nested * calls. */ public void execute(Word word) { if (word == null) { Notification.show("Attempted to excute undefined word!", Type.ERROR_MESSAGE); return; // TODO return to main loop or stop interpreting when this happens. } logExecutedWord(word); word.execute(this); }
From source file:com.hack23.cia.web.impl.ui.application.UiInstanceErrorHandler.java
License:Apache License
@Override public void error(final ErrorEvent event) { if (event.getThrowable() instanceof AccessDeniedException) { final AccessDeniedException accessDeniedException = (AccessDeniedException) event.getThrowable(); Notification.show(accessDeniedException.getMessage(), Notification.Type.ERROR_MESSAGE); ui.getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME); return;/*from ww w . j av a2s .c o m*/ } else if (event.getThrowable().getCause() != null && event.getThrowable().getCause().getCause() != null && event.getThrowable().getCause().getCause().getCause() instanceof AccessDeniedException) { final AccessDeniedException accessDeniedException = (AccessDeniedException) event.getThrowable() .getCause().getCause().getCause(); Notification.show(accessDeniedException.getMessage(), Notification.Type.ERROR_MESSAGE); ui.getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME); return; } else { LOGGER.warn(LOG_WARN_VAADIN_ERROR, event.getThrowable()); } }
From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) { final AppUI ui = AppUI.getCurrent(); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override//from ww w . j a v a 2 s . c o m public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); setCaption(caption != null ? caption : messages.getMainMessage("exceptionDialog.caption")); ThemeConstants theme = ui.getApp().getThemeConstants(); setWidth(theme.get("cuba.web.ExceptionDialog.width")); center(); final String text = message != null ? message : getText(throwable); Throwable exception = removeRemoteException(throwable); final String stackTrace = getStackTrace(exception); mainLayout = new VerticalLayout(); mainLayout.setSpacing(true); TextArea textArea = new TextArea(); textArea.setHeight(theme.get("cuba.web.ExceptionDialog.textArea.height")); textArea.setWidth(100, Unit.PERCENTAGE); boolean showExceptionDetails = userSessionSource.getUserSession() != null && security.isSpecificPermitted("cuba.gui.showExceptionDetails"); if (showExceptionDetails) { textArea.setValue(text); } else { textArea.setValue(messages.getMainMessage("exceptionDialog.contactAdmin")); } textArea.setReadOnly(true); mainLayout.addComponent(textArea); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.setWidth("100%"); mainLayout.addComponent(buttonsLayout); Button closeButton = new CubaButton(messages.getMainMessage("exceptionDialog.closeBtn")); closeButton.addClickListener((Button.ClickListener) event -> this.close()); buttonsLayout.addComponent(closeButton); showStackTraceButton = new CubaButton(messages.getMainMessage("exceptionDialog.showStackTrace")); showStackTraceButton .addClickListener((Button.ClickListener) event -> setStackTraceVisible(!isStackTraceVisible)); buttonsLayout.addComponent(showStackTraceButton); showStackTraceButton.setVisible(showExceptionDetails); Label spacer = new Label(); buttonsLayout.addComponent(spacer); buttonsLayout.setExpandRatio(spacer, 1); String cubaLogContentClass = "c-exception-dialog-log-content"; String cubaCopyLogContentClass = cubaLogContentClass + "-" + UUID.randomUUID(); if (browserSupportCopy()) { copyButton = new CubaButton(messages.getMainMessage("exceptionDialog.copyStackTrace")); copyButton.setVisible(false); CubaCopyButtonExtension copyExtension = CubaCopyButtonExtension.copyWith(copyButton, cubaCopyLogContentClass); copyExtension .addCopyListener( event -> Notification.show( messages.getMainMessage(event.isSuccess() ? "exceptionDialog.copingSuccessful" : "exceptionDialog.copingFailed"), Notification.Type.TRAY_NOTIFICATION)); buttonsLayout.addComponent(copyButton); } if (userSessionSource.getUserSession() != null) { if (!StringUtils.isBlank(clientConfig.getSupportEmail())) { Button reportButton = new CubaButton(messages.getMainMessage("exceptionDialog.reportBtn")); reportButton.addClickListener((Button.ClickListener) event -> { sendSupportEmail(text, stackTrace); reportButton.setEnabled(false); }); buttonsLayout.addComponent(reportButton); if (ui.isTestMode()) { reportButton.setCubaId("errorReportButton"); } } } Button logoutButton = new CubaButton(messages.getMainMessage("exceptionDialog.logout")); logoutButton.addClickListener((Button.ClickListener) event -> logoutPrompt()); buttonsLayout.addComponent(logoutButton); stackTraceTextArea = new TextArea(); stackTraceTextArea.setSizeFull(); stackTraceTextArea.setWordwrap(false); stackTraceTextArea.setValue(stackTrace); stackTraceTextArea.setStyleName(cubaLogContentClass); stackTraceTextArea.addStyleName(cubaCopyLogContentClass); stackTraceTextArea.setReadOnly(true); setContent(mainLayout); setResizable(false); if (ui.isTestMode()) { setId(ui.getTestIdManager().getTestId("exceptionDialog")); setCubaId("exceptionDialog"); closeButton.setCubaId("closeButton"); if (copyButton != null) { copyButton.setCubaId("copyStackTraceButton"); } showStackTraceButton.setCubaId("showStackTraceButton"); stackTraceTextArea.setCubaId("stackTraceTextArea"); logoutButton.setCubaId("logoutButton"); } }
From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java
@Override public void drop(final DragAndDropEvent dropEvent) { // expecting this to be an html5 drag final DragAndDropWrapper.WrapperTransferable tr = (DragAndDropWrapper.WrapperTransferable) dropEvent .getTransferable();/*from ww w . ja va 2 s.co m*/ final Html5File[] files = tr.getFiles(); if (files != null) { for (final Html5File html5File : files) { final String fileName = html5File.getFileName(); if (html5File.getFileSize() > FILE_SIZE_LIMIT) { Notification.show("File rejected. Max 100Mb files are accepted!", Notification.Type.WARNING_MESSAGE); } else { final ByteArrayOutputStream bas = new ByteArrayOutputStream(); final StreamVariable streamVariable = new StreamVariable() { @Override public OutputStream getOutputStream() { return bas; } @Override public boolean listenProgress() { return false; } @Override public void onProgress(final StreamVariable.StreamingProgressEvent event) { } @Override public void streamingStarted(final StreamVariable.StreamingStartEvent event) { } @Override public void streamingFinished(final StreamVariable.StreamingEndEvent event) { progress.setVisible(false); showFile(fileName, html5File.getType(), bas); processFile(fileName, html5File.getType(), bas); } @Override public void streamingFailed(final StreamVariable.StreamingErrorEvent event) { progress.setVisible(false); } @Override public boolean isInterrupted() { return false; } }; html5File.setStreamVariable(streamVariable); progress.setVisible(true); } } } else { final String text = tr.getText(); if (text != null) { showText(text); } } }
From source file:com.hris.payroll.alphalist.AlphaListMainUI.java
void populateDataGrid() { if (getBranchId() == 0) { Notification.show("Select a Branch!!!", Notification.Type.WARNING_MESSAGE); return;//from ww w. ja v a 2 s . co m } exportToExcelButton.setEnabled(false); grid.getContainerDataSource().removeAllItems(); getUI().getSession().getLockInstance(); try { ImplementAlphaListRunnable ir = new ImplementAlphaListRunnable(grid, progress, status, exportToExcelButton, getBranchId(), CommonUtil.convertStringToInteger(year.getValue().toString()), current, dataSize, processLabel, employmentStatus.getValue().toString(), alphaListButton()); Thread t = new Thread(ir); t.start(); Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(AlphaListMainUI.class.getName()).log(Level.SEVERE, null, ex); } UI.getCurrent().setPollInterval(500); }
From source file:com.hris.payroll.alphalist.AlphaListMainUI.java
private Button alphaListButton() { alphaListBtn.setWidth("200px"); alphaListBtn.setIcon(FontAwesome.SPINNER); alphaListBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); alphaListBtn.addStyleName(ValoTheme.BUTTON_SMALL); alphaListBtn.setDisableOnClick(true); alphaListBtn.addClickListener((Button.ClickEvent event) -> { status.setValue(" Loading... "); current = 1.0;/*from w w w . ja v a 2 s . c o m*/ dataSize = es.findEmployeeByBranchForAlphaList(getBranchId(), employmentStatus.getValue().toString(), CommonUtil.convertStringToInteger(year.getValue().toString())).size(); List<EmployeePersonalInformation> employeeLists = es.findEmployeeByBranchForAlphaList(getBranchId(), employmentStatus.getValue().toString(), CommonUtil.convertStringToInteger(year.getValue().toString())); if (employeeLists.isEmpty()) { Notification.show("NO DATA FOUND!!!", Notification.Type.WARNING_MESSAGE); alphaListBtn.setEnabled(true); return; } populateDataGrid(); }); return alphaListBtn; }