Package org.jbpm.ui.common.model

Examples of org.jbpm.ui.common.model.Variable


                    comboBoxes[i][0].setEnabled(false);
                    comboBoxes[i][1].setEnabled(false);
                    comboBoxes[i][2].setEnabled(false);
                    defaultTransitionCombo.setText(ifExpr.getTransition());
                } else {
                    Variable variable = ifExpr.getVariable1();
                    int index = variables.indexOf(variable);
                    if (index == -1) {
                        // required variable was deleted in process
                        // definition
                        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;
View Full Code Here


            int[] indexes = (int[]) combo.getData(DATA_INDEX_KEY);

            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);
                    }
View Full Code Here

            for (int i = 0; i < transitionNames.size(); i++) {
                IfExpr ifExpr;
                if (labels[i].getText().equals(defaultTransitionCombo.getText())) {
                    ifExpr = new IfExpr(labels[i].getText());
                } else {
                    Variable var1 = (Variable) comboBoxes[i][0].getData(DATA_VARIABLE_KEY);
                    String operationName = comboBoxes[i][1].getItem(comboBoxes[i][1].getSelectionIndex());
                    String lexem2Text = comboBoxes[i][2].getText();

                    Object lexem2;
                    Variable var2 = getVariableByName(lexem2Text);
                    if (var2 != null) {
                        lexem2 = var2;
                    } else {
                        lexem2 = lexem2Text;
                    }
View Full Code Here

            updateUsedVariables();
            comboBoxVar1.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    String varName = comboBoxVar1.getItem(comboBoxVar1.getSelectionIndex());
                    Variable variable = getVariableByName(varName);
                    comboBoxVar1.setData(variable);
                    refreshCombos();
                }
            });
View Full Code Here

            gridData.minimumWidth = 100;
            return gridData;
        }

        private void refreshCombos() {
            Variable variable = (Variable) comboBoxVar1.getData();
            List<Operation> operations = Operation.getAll(BSHTypeSupport.getByFormat(variable.getFormat()));

            comboBoxOp.setItems(new String[0]);
            for (Operation operation : operations) {
                comboBoxOp.add(operation.getVisibleName());
            }
View Full Code Here

            return null;
        }

        private void toBSHCode() {
            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);
View Full Code Here

                textData = "";
            }
            try {
                Expr expr = BSHValidationModel.fromCode(textData, allVariables);
                if (expr != null) {
                    Variable variable = expr.getVar1();
                    if (variableNames.contains(variable.getName())) {
                        comboBoxVar1.setText(variable.getName());
                        comboBoxVar1.setData(variable);
                        refreshCombos();

                        comboBoxOp.setText(expr.getOperation().getVisibleName());
                        comboBoxVar2.setText(expr.getVar2().getName());
View Full Code Here

            addElements(oldDef, newDef, org.jbpm.ui.common.model.EndState.class, "end-state");
            addElements(oldDef, newDef, org.jbpm.ui.common.model.Swimlane.class, "swimlane");

            List<Variable> oldVariables = oldDef.getChildren(Variable.class);
            for (Variable oldVariable : oldVariables) {
                Variable newVariable = new Variable(oldVariable.getName(), oldVariable.getFormat(), oldVariable.isPublicVisibility());
                newDef.addChild(newVariable);
            }

            log.append(" ---");
            return newDef;
View Full Code Here

    }

    private boolean isArrayVariable(String name, String variableName) {
        ProcessDefinition definition = ProcessCache.getProcessDefinition(name);
        if (definition != null) {
            Variable variable = definition.getVariablesMap().get(variableName);
            if (variable != null) {
                return variable.getFormat().contains("Array");
            }
        }
        return false;
    }
View Full Code Here

                } catch (Exception e) {
                    DesignerLogger.logErrorWithoutDialog("No swimlane found for " + variableName, e);
                }
                continue;
            }
            Variable variable = new Variable(variableName, formatName, publicVisibility);
            variable.setDescription(description);
            definition.addVariable(variable);
        }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.common.model.Variable

Copyright © 2018 www.massapicom. 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.