Example usage for com.vaadin.ui Notification show

List of usage examples for com.vaadin.ui Notification show

Introduction

In this page you can find the example usage for com.vaadin.ui Notification show.

Prototype

public static Notification show(String caption, String description, Type type) 

Source Link

Document

Shows a notification message the current page.

Usage

From source file:com.hybridbpm.ui.component.chart.ChartEditor.java

License:Apache License

private void run() {
    try {/*from   ww  w.  ja v  a2 s  .c o  m*/
        save();

        DiagrammePreferenceValue secondFieldValue = getPreferenceValue(DiagrammePreference.SECOND_COLUMN_FIELD,
                preferences);
        boolean groupingOn = secondFieldValue != null;

        DiagrammeChartType chartType = DiagrammeChartType.valueOf(chartTypeGroup.getValue().toString());
        prepareData();
        AbstractChart chart = chartType.createChart(container, groupingOn);
        chart.bind(preferences);
        chart.render();
        getDevelopmentView().openTab(chart.drawChart(), module);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.chart.ChartEditor.java

License:Apache License

private void executeRequest() {
    try {/*from   w  w  w .  j  a  v a  2s .c o  m*/
        prepareData();
        table.setContainerDataSource(container);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.comment.CommentFormLayout.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnSubmit)) {
        try {//from  w  w  w  .j ava2s.c  o  m
            bodyField.commit();
            binder.commit();
            comment = binder.getItemDataSource().getBean();
            Comment newComment = HybridbpmUI.getCommentAPI().saveComment(comment);
            ((AbstractOrderedLayout) getParent()).addComponent(new CommentViewLayout(newComment),
                    ((AbstractOrderedLayout) getParent()).getComponentIndex(this));
            if (deleteOnSave) {
                ((AbstractOrderedLayout) getParent()).removeComponent(this);
            } else {
                bodyField.setValue(null);
            }
        } catch (Exception ex) {
            Notification.show("Error", ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE);
            Logger.getLogger(CommentFormLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
        }
    }
}

From source file:com.hybridbpm.ui.component.development.ConnectorExecutionLayout.java

License:Apache License

public void run() {
    try {/*from  w  w  w.  ja  v  a  2s .  c  om*/
        Map<String, String> input = inputInParametersLayout.getValues();
        Map<String, Object> result = HybridbpmUI.getBpmAPI().executeConnector(connectoModel, input);
        if (result != null && !result.isEmpty()) {
            outputOutParametersLayout.setValues(result);
        }
        tabSheet.setSelectedTab(outputOutParametersLayout);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.development.ConnectorParametersLayout.java

License:Apache License

public void save() {
    try {//from   w ww .  j ava 2s.  com
        connectoModel.getInParameters().clear();
        connectoModel.getOutParameters().clear();

        for (Component comp : inParametersLayout) {
            if (comp instanceof FieldForm) {
                FieldForm fieldForm = (FieldForm) comp;
                fieldForm.commit();
                connectoModel.getInParameters().add(fieldForm.getFieldModel());
            }
        }

        for (Component comp : outParametersLayout) {
            if (comp instanceof FieldForm) {
                FieldForm fieldForm = (FieldForm) comp;
                fieldForm.commit();
                connectoModel.getOutParameters().add(fieldForm.getFieldModel());
            }
        }
        Module.setModel(HybridbpmCoreUtil.objectToJson(connectoModel));
        HybridbpmUI.getDevelopmentAPI().saveModule(Module);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.development.FormEditor.java

License:Apache License

private void run() {
    try {/*from   ww  w.java  2  s .c  om*/
        save();
        Component component = (Component) HybridbpmUiUtil.generateFormObject(module);
        if (component != null) {
            getDevelopmentView().openTab(component, module);
        }
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.development.FormEditor.java

License:Apache License

private void compileTheme() {
    try {/*  www  .j a  va2 s . c o  m*/
        binder.commit();
        ServletContext context = VaadinServlet.getCurrent().getServletContext();
        String fullPath = context.getRealPath("/VAADIN/themes/dashboard");
        String customScssFileName = fullPath + "/custom.scss";
        SassCompiler.writeFile(customScssFileName, module.getModel());

        ProcessBuilder processBuilder = new ProcessBuilder("java", "-cp", "../../../WEB-INF/lib/*",
                "com.vaadin.sass.SassCompiler", "styles.scss", "styles.css");
        processBuilder.directory(new File(fullPath));
        File error = new File(fullPath, "custom.scss.log");
        processBuilder.redirectErrorStream(true);
        processBuilder.redirectError(Redirect.PIPE);
        Process process = processBuilder.start();
        process.waitFor();

        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        StringBuilder builder = new StringBuilder();
        String line = reader.readLine();
        while (line != null) {
            builder.append(line);
            line = reader.readLine();
        }
        reader.close();
        if (!builder.toString().trim().isEmpty()) {
            throw new Exception(builder.toString());
        }

    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

public void login(String username, String password, boolean rememberMe) {
    try {/* www  .  j a  va  2s  .c  o m*/
        user = AccessAPI.get(null, null).login(username, password);
        updateContent();
        subscribe();
        getBpmAPI().notifyTaskList();
        if (rememberMe) {
            CookieManager.setCookie(COOKIENAME_USERNAME, user.getUsername(),
                    VaadinService.getCurrentRequest().getContextPath());
        }
    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.view.DevelopmentView.java

License:Apache License

public static void openModule(Module Module, Window.CloseListener closeListener) {
    final ModuleLayout moduleLayout = new ModuleLayout(Module);
    final ConfigureWindow configureWindow = new ConfigureWindow(moduleLayout, "New Module");
    Button.ClickListener clickListener = new Button.ClickListener() {

        @Override/* w  ww .  j  ava2  s . c  o  m*/
        public void buttonClick(Button.ClickEvent event) {
            try {
                if (event.getButton().equals(configureWindow.btnClose)) {

                } else if (event.getButton().equals(configureWindow.btnOk)) {
                    moduleLayout.save();
                }
                configureWindow.close();
            } catch (RuntimeException re) {
                logger.log(Level.SEVERE, re.getMessage(), re);
                Notification.show("Error", re.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    };
    configureWindow.setClickListener(clickListener);
    configureWindow.addCloseListener(closeListener);
    HybridbpmUI.getCurrent().addWindow(configureWindow);
}

From source file:com.klwork.explorer.NotificationManager.java

License:Apache License

public void showErrorNotification(String captionKey, String description) {
    Notification.show(i18nManager.getMessage(captionKey), "<br/>" + description,
            Notification.Type.ERROR_MESSAGE);
}