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.access.UserLayout.java

License:Apache License

public void save() {
    if (!readOnly) {
        try {/*  w  ww .j a  v  a 2  s .co  m*/
            binder.commit();
            User ui = binder.getItemDataSource().getBean();
            if (!Objects.equals(password1.getValue(), password2.getValue())) {
                errorLabel.setValue("Passwords should be the same!");
                errorLabel.setVisible(true);
                throw new RuntimeException("Passwords should be the same!");
            } else if (password1.getValue() != null && !password1.getValue().isEmpty()) {
                ui.setPassword(HybridbpmCoreUtil.hashPassword(password1.getValue()));
            }
            ui = HybridbpmUI.getAccessAPI().saveUser(ui, image);
            binder.setItemDataSource(ui);
        } catch (FieldGroup.CommitException ex) {
            Logger.getLogger(UserLayout.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
        } catch (RuntimeException ex) {
            Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
        }
    }
}

From source file:com.hybridbpm.ui.component.bpm.CaseListLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    super.buttonClick(event);
    try {/* ww w .j a va 2  s . c o  m*/
        if (event.getButton().getData() != null && event.getButton().getData() instanceof Case) {
            Case case1 = (Case) event.getButton().getData();
            TabSheet.Tab tab = tabSheet.addTab(new CaseLayout(case1.getId().toString()),
                    "Process " + case1.getId().toString());
            tab.setClosable(true);
            tabSheet.setSelectedTab(tab);
        }
    } 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.bpm.CaseTaskListLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    try {//www  .j a  va 2s  . co m
        if (event.getButton().getData() != null && event.getButton().getData() instanceof Task) {
            //                TaskInstance task = (TaskInstance) event.getButton().getData();
            //                TabSheet.Tab tab = tabSheet.addTab(new TaskLayout(task.getProcessInstanceId(), task.getId().toString(), task.getProcessName(), task.getTaskName()), task.getTaskTitle());
            //                tab.setClosable(true);
            //                tabSheet.setSelectedTab(tab);
        }
    } 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.bpm.designer.TaskConfigureCustomComponent.java

License:Apache License

public void initUI(final ProcessModelLayout processModelLayout) {
    try {/* www.ja v a  2 s  . c o  m*/
        this.processModelLayout = processModelLayout;
        design.actorScriptField.setMode(AceMode.groovy);
        design.actorScriptField.setTheme(AceTheme.textmate);
        design.actorScriptField.setShowGutter(false);
        SuggestionExtension extension = new SuggestionExtension(
                new VariableSuggester(this.processModelLayout.getProcessModel()));
        extension.setSuggestOnDot(false);
        extension.extend(design.actorScriptField);

        design.typeOptionGroup.addValueChangeListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                if (event.getProperty().getValue().equals(TaskModel.TASK_TYPE.AUTOMATIC)) {
                    design.tabSheet.getTab(design.humanTaskLayout).setVisible(false);
                    design.tabSheet.getTab(design.automaticTaskLayout).setVisible(true);
                } else {
                    design.tabSheet.getTab(design.humanTaskLayout).setVisible(true);
                    design.tabSheet.getTab(design.automaticTaskLayout).setVisible(false);
                }
            }
        });
        for (TaskModel.TASK_TYPE type : TaskModel.TASK_TYPE.values()) {
            design.typeOptionGroup.addItem(type);
            design.typeOptionGroup.setItemCaption(type, type.name());
        }

        for (TaskModel.GATE_TYPE type : TaskModel.GATE_TYPE.values()) {
            design.joinOptionGroup.addItem(type);
            design.joinOptionGroup.setItemCaption(type, type.name());
        }

        for (TaskModel.GATE_TYPE type : TaskModel.GATE_TYPE.values()) {
            design.splitOptionGroup.addItem(type);
            design.splitOptionGroup.setItemCaption(type, type.name());
        }

        design.roleComboBox.addContainerProperty(NAME, String.class, null);
        design.roleComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
        design.roleComboBox.setItemCaptionPropertyId(NAME);
        for (Role instance : HybridbpmUI.getAccessAPI().getAllRoles()) {
            Item item = design.roleComboBox.addItem(instance.getName());
            item.getItemProperty(NAME).setValue(instance.getName());
        }

        design.formComboBox.addContainerProperty(NAME, String.class, null);
        design.formComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
        design.formComboBox.setItemCaptionPropertyId(NAME);
        for (Module module : HybridbpmUI.getDevelopmentAPI()
                .getFormListForProcess(this.processModelLayout.getProcessModel().getName())) {
            Item item = design.formComboBox.addItem(module.getName());
            item.getItemProperty(NAME).setValue(module.getName());
        }

        design.mobileFormComboBox.addContainerProperty(NAME, String.class, null);
        design.mobileFormComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
        design.mobileFormComboBox.setItemCaptionPropertyId(NAME);
        for (Module module : HybridbpmUI.getDevelopmentAPI()
                .getMobileFormListForProcess(this.processModelLayout.getProcessModel().getName())) {
            Item item = design.mobileFormComboBox.addItem(module.getName());
            item.getItemProperty(NAME).setValue(module.getName());
        }

        design.connectorComboBox.addContainerProperty(NAME, String.class, null);
        design.connectorComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
        design.connectorComboBox.setItemCaptionPropertyId(NAME);
        for (Module module : HybridbpmUI.getDevelopmentAPI().getModuleListByType(Module.MODULE_TYPE.CONNECTOR,
                false)) {
            Item item = design.connectorComboBox.addItem(module.getName());
            item.getItemProperty(NAME).setValue(module.getName());
        }
        design.connectorComboBox.addValueChangeListener(this);

        fieldGroup.bind(design.titleTextField, "name");
        fieldGroup.bind(design.xTextField, "x");
        fieldGroup.bind(design.yTextField, "y");
        fieldGroup.bind(design.joinOptionGroup, "joinType");
        fieldGroup.bind(design.splitOptionGroup, "splitType");
        fieldGroup.bind(design.typeOptionGroup, "taskType");
        fieldGroup.bind(design.titleTextField, "title");
        fieldGroup.bind(design.descriptionTextField, "description");
        fieldGroup.bind(design.roleComboBox, "role");
        fieldGroup.bind(design.actorScriptField, "actorScript");
        fieldGroup.bind(design.formComboBox, "form");
        fieldGroup.bind(design.mobileFormComboBox, "mobileForm");
        fieldGroup.bind(design.connectorComboBox, "connector");
        fieldGroup.setItemDataSource(this.processModelLayout.getActiveElement().getTaskModel());
    } catch (Exception ex) {
        ex.printStackTrace();
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }

}

From source file:com.hybridbpm.ui.component.bpm.designer.TaskConfigureCustomComponent.java

License:Apache License

public void save() {
    try {//from  w  ww . java 2s  . c om
        fieldGroup.commit();
        this.processModelLayout.getActiveElement().getTaskModel().getInParameters().clear();
        this.processModelLayout.getActiveElement().getTaskModel().getInParameters()
                .putAll(design.inputInParametersLayout.getValues());
        this.processModelLayout.getActiveElement().getTaskModel().getOutParameters().clear();
        this.processModelLayout.getActiveElement().getTaskModel().getOutParameters()
                .putAll(design.outputOutParametersLayout.getValues());
    } catch (Validator.InvalidValueException | FieldGroup.CommitException ex) {
        ex.printStackTrace();
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.hybridbpm.ui.component.bpm.StartProcessLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    super.buttonClick(event);
    try {/* w  w w.  j a va 2  s  . c o m*/
        if (event.getButton().getData() != null && event.getButton().getData() instanceof StartProcess) {
            StartProcess spd = (StartProcess) event.getButton().getData();
            TabSheet.Tab tab = tabSheet.addTab(
                    new TaskLayout(null, spd.getProcessModel().getName(), spd.getTaskName(), true),
                    spd.getProcessModel().getTaskModelByName(spd.getTaskName()).getTitle());
            tab.setClosable(true);
            tabSheet.setSelectedTab(tab);
        }
    } 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.bpm.TaskListLayout.java

License:Apache License

@Override
public void buttonClick(final Button.ClickEvent event) {
    try {//from   w ww. j av a2  s .  co  m
        if (event.getButton().equals(btnAdd)) {
            addNew();
        } else if (event.getButton().equals(btnRefresh)) {
            refreshTable();
            HybridbpmUI.getBpmAPI().notifyTaskList();
        } else if (event.getButton().getData() != null && event.getButton().getData() instanceof Task) {
            Task task = (Task) event.getButton().getData();
            TabSheet.Tab tab = tabSheet.addTab(new TaskLayout(task.getId().toString(),
                    task.getProcessModelName(), task.getTaskName(), true), task.getTaskTitle());
            tab.setClosable(true);
            tabSheet.setSelectedTab(tab);
        }
    } 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.bpm.window.FormConfigureWindow.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnClose)) {
        close();//from ww w .j av a2 s  . c  o m
    } else if (event.getButton().equals(btnOk)) {
        try {
            formModel.getParameters().clear();

            for (Component comp : parametersLayout) {
                if (comp instanceof FieldForm) {
                    FieldForm fieldForm = (FieldForm) comp;
                    fieldForm.commit();
                    formModel.getParameters().add(fieldForm.getFieldModel());
                }
            }
            module.setModel(HybridbpmCoreUtil.objectToJson(formModel));
            HybridbpmUI.getDevelopmentAPI().saveModule(module);
            close();
        } 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.bpm.window.ProcessConfigureWindow.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnClose)) {
        close();/*from   w  w w  .jav a 2  s  .com*/
    } else if (event.getButton().equals(btnOk)) {
        try {
            processModelLayout.getProcessModel().getVariableModels().clear();
            processModelLayout.getProcessModel().getFileModels().clear();

            for (Component comp : variableEditorLayout) {
                if (comp instanceof FieldForm) {
                    FieldForm fieldForm = (FieldForm) comp;
                    fieldForm.commit();
                    processModelLayout.getProcessModel().getVariableModels().add(fieldForm.getFieldModel());
                }
            }

            for (Component comp : fileEditorLayout) {
                if (comp instanceof FileForm) {
                    FileForm fileForm = (FileForm) comp;
                    fileForm.commit();
                    processModelLayout.getProcessModel().getFileModels().add(fileForm.getFileModel());
                }
            }
            close();
        } 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.bpm.window.TransitionConfigureWindow.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnClose)) {
        close();/*w w w  . java  2s .  c om*/
    } else if (event.getButton().equals(btnShowMore)) {
        xTextField.setVisible(!xTextField.isVisible());
        yTextField.setVisible(!yTextField.isVisible());
    } else if (event.getButton().equals(btnOk)) {
        try {
            // check transition name uniqueness
            if (!processModelLayout.getActiveElement().getTransitionModel().getName()
                    .equalsIgnoreCase(nameTextField.getValue())
                    && processModelLayout.getProcessModel()
                            .getTransitionModelByName(nameTextField.getValue()) != null) {
                throw new Validator.InvalidValueException("Transition name already exists!");
            }
            fieldGroup.commit();
            close();
        } catch (Validator.InvalidValueException | FieldGroup.CommitException ex) {
            ex.printStackTrace();
            Notification.show(("error"), ex.getMessage(), Notification.Type.ERROR_MESSAGE);
        }
    }
}