Examples of BSHTypeSupport


Examples of org.jbpm.ui.bsh.BSHTypeSupport

                        continue;
                    }
                    comboBoxes[i][0].select(index);
                    refreshComboItems(comboBoxes[i][0]);

                    BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable.getFormat());

                    index = Operation.getAll(typeSupport).indexOf(ifExpr.getOperation());
                    if (index == -1) {
                        // required operation was deleted !!!
                        continue;
                    }
                    comboBoxes[i][1].select(index);
                    refreshComboItems(comboBoxes[i][1]);

                    String lexem2Text = ifExpr.getLexem2TextValue();
                    int combo3index = 0;
                    if (getVariableByName(lexem2Text) != null) {
                        combo3index = getCombo3VariableNames(variable).indexOf(lexem2Text);
                    } else {
                        int predefinedIndex = typeSupport.getPredefinedValues(ifExpr.getOperation()).indexOf(lexem2Text);
                        if (predefinedIndex >= 0) {
                            combo3index = getCombo3VariableNames(variable).size() + predefinedIndex;
                        } else {
                            comboBoxes[i][2].add(lexem2Text, 0);
                            comboBoxes[i][2].setData(DATA_USER_INPUT_KEY, lexem2Text);
View Full Code Here

Examples of org.jbpm.ui.bsh.BSHTypeSupport

            if (indexes[1] == 2) {
                if (INPUT_VALUE.equals(combo.getText())) {
                    String oldUserInput = (String) combo.getData(DATA_USER_INPUT_KEY);
                    Variable variable1 = (Variable) comboBoxes[indexes[0]][0].getData(DATA_VARIABLE_KEY);
                    BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable1.getFormat());
                    UserInputDialog inputDialog = typeSupport.createUserInputDialog(INPUT_VALUE, oldUserInput);
                    if (OK == inputDialog.open()) {
                        String userInput = inputDialog.getUserInput();
                        if (oldUserInput != null) {
                            combo.remove(0);
                        }
                        combo.setData(DATA_USER_INPUT_KEY, userInput);
                        combo.add(userInput, 0);
                        combo.select(0);
                    } else {
                        combo.deselectAll();
                    }
                } else {
                    Variable variable = getVariableByName(combo.getText());
                    if (variable != null) {
                        combo.setData(DATA_VARIABLE_KEY, variable);
                    }
                }
                return;
            }

            Combo targetCombo = comboBoxes[indexes[0]][indexes[1] + 1];
            targetCombo.setItems(new String[0]);
            if (indexes[1] == 0) {
                // there was changed value in first (variable) combo in 'i' row
                Variable variable = getVariableByName(combo.getText());
                combo.setData(DATA_VARIABLE_KEY, variable);
                if (variable != null) {
                    BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable.getFormat());
                    for (Operation operation : Operation.getAll(typeSupport)) {
                        targetCombo.add(operation.getVisibleName());
                    }
                }
            } else if (indexes[1] == 1) {
                // there was changed value in second (operation) combo in 'i'
                // row
                Variable variable1 = (Variable) comboBoxes[indexes[0]][0].getData(DATA_VARIABLE_KEY);
                if (variable1 != null) {
                    BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable1.getFormat());
                    Operation operation = Operation.getByName(combo.getText(), typeSupport);
                    combo.setData(DATA_OPERATION_KEY, operation);
                    for (String variableName : getCombo3VariableNames(variable1)) {
                        targetCombo.add(variableName);
                    }
                    for (String pv : typeSupport.getPredefinedValues(operation)) {
                        targetCombo.add(pv);
                    }
                    if (typeSupport.hasUserInputEditor()) {
                        targetCombo.add(INPUT_VALUE);
                    }
                }
            }
        } catch (RuntimeException e) {
View Full Code Here

Examples of org.jbpm.ui.bsh.BSHTypeSupport

        }
    }

    private List<String> getCombo3VariableNames(Variable variable1) {
        List<String> vars = new ArrayList<String>();
        BSHTypeSupport typeSupport1 = BSHTypeSupport.getByFormat(variable1.getFormat());
        for (Variable variable : variables) {
            BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable.getFormat());
            // formats are equals, variable not selected in the first combo
            if (typeSupport1.getClass() == typeSupport.getClass() && variable1 != variable) {
                vars.add(variable.getName());
            }
        }
        return vars;
    }
View Full Code Here

Examples of org.jbpm.ui.bsh.BSHTypeSupport

                    if (var2 != null) {
                        lexem2 = var2;
                    } else {
                        lexem2 = lexem2Text;
                    }
                    BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(var1.getFormat());

                    ifExpr = new IfExpr(labels[i].getText(), var1, lexem2, Operation.getByName(operationName, typeSupport));
                }
                decisionModel.addIfExpr(ifExpr);
            }
View Full Code Here

Examples of org.jbpm.ui.bsh.BSHTypeSupport

            }
        }

        private List<String> getCombo2VariableNames(Variable variable1) {
            List<String> vars = new ArrayList<String>();
            BSHTypeSupport typeSupport1 = BSHTypeSupport.getByFormat(variable1.getFormat());
            for (Variable variable : allVariables) {
                BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(variable.getFormat());
                // formats are equals, variable not selected in the first combo
                if ((typeSupport1 == typeSupport) && (variable1 != variable) && (variableNames.contains(variable1.getName()))) {
                    if (variable.getName().indexOf(" ") < 0) {
                        vars.add(variable.getName());
                    }
View Full Code Here

Examples of org.jbpm.ui.bsh.BSHTypeSupport

            if ((comboBoxVar1.getText().length() > 0) && (comboBoxOp.getText().length() > 0) && (comboBoxVar2.getText().length() > 0)) {
                Variable var1 = (Variable) comboBoxVar1.getData();
                String operationName = comboBoxOp.getItem(comboBoxOp.getSelectionIndex());
                Variable var2 = getVariableByName(comboBoxVar2.getText());

                BSHTypeSupport typeSupport = BSHTypeSupport.getByFormat(var1.getFormat());
                Operation operation = Operation.getByName(operationName, typeSupport);
                String bsh = operation.generateCode(var1, var2);

                bshCodeText.setText(bsh);
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.