Examples of EnumDropDown


Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

    }

    private void refresh() {
        root.clear();
        if ( enums != null && (enums.fixedList != null || enums.queryExpression != null) ) {
            root.add( new EnumDropDown( methodParameter.value,
                                        new DropDownValueChanged() {
                                            public void valueChanged(String newText,
                                                                     String newValue) {
                                                methodParameter.value = newValue;
                                                if ( onValueChangeCommand != null ) {
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

    private boolean isFieldVariable() {
        return field.getNature() == FieldData.TYPE_VARIABLE;
    }

    private EnumDropDown booleanEditor() {
        return new EnumDropDown(field.getValue(),
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        valueHasChanged(newValue);
                    }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

                },
                DropDownData.create(new String[]{"true", "false"}));
    }

    private EnumDropDown dropDownEditor(final DropDownData dropDownData) {
        return new EnumDropDown(field.getValue(),
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        valueHasChanged(newValue);
                        for (FieldDataConstraintEditor dependentEnumEditor : dependentEnumEditors) {
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

        }
    }

    private void refreshDropDownData() {
        if (this.valueEditorWidget instanceof EnumDropDown) {
            final EnumDropDown dropdown = (EnumDropDown) this.valueEditorWidget;
            dropdown.setDropDownData(field.getValue(),
                    helper.getEnums());
        }
    }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

        String flType = sce.getFieldType( key );
        panel.clear();

        if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_BOOLEAN ) ) {
            String[] c = new String[]{"true", "false"};
            panel.add( new EnumDropDown( field.getExpected(),
                                         new DropDownValueChanged() {
                                             public void valueChanged(String newText,
                                                                      String newValue) {
                                                 callback.valueChanged( newValue );
                                             }
                                         },
                                         DropDownData.create( c ) ) );

        } else if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_DATE ) ) {
            final DatePickerTextBox datePicker = new DatePickerTextBox( field.getExpected() );
            String m = Constants.INSTANCE.ValueFor0( field.getFieldName() );
            datePicker.setTitle( m );
            datePicker.addValueChanged( new ValueChanged() {
                public void valueChanged(String newValue) {
                    field.setExpected( newValue );
                }
            } );
            panel.add( datePicker );

        } else {
            Map<String, String> currentValueMap = new HashMap<String, String>();
            // TODO fill currentValueMap with values of other VerifyFields (if any)
            DropDownData dropDownData = sce.getEnums( factType,
                                                      field.getFieldName(),
                                                      currentValueMap );
            if ( dropDownData != null ) {
                //GUVNOR-1324: Java enums are of type TYPE_COMPARABLE whereas Guvnor enums are not.
                //The distinction here controls whether the EXPECTED value is handled as a true
                //Java enum or a literal with a selection list (i.e. Guvnor enum)
                String dataType = sce.getFieldType( key );
                if ( dataType.equals( SuggestionCompletionEngine.TYPE_COMPARABLE ) ) {
                    field.setNature( FieldData.TYPE_ENUM );
                } else {
                    field.setNature( FieldData.TYPE_LITERAL );
                }

                panel.add( new EnumDropDown( field.getExpected(),
                                             new DropDownValueChanged() {
                                                 public void valueChanged(String newText,
                                                                          String newValue) {
                                                     callback.valueChanged( newValue );
                                                 }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

    }

    private void refresh() {
        root.clear();
        if ( enums != null && (enums.fixedList != null || enums.queryExpression != null) ) {
            root.add( new EnumDropDown( methodParameter.value,
                                        new DropDownValueChanged() {
                                            public void valueChanged(String newText,
                                                                     String newValue) {
                                                methodParameter.value = newValue;
                                                if ( onValueChangeCommand != null ) {
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

            scorecardModel.setBaselineScore(Double.parseDouble(tbBaselineScore.getValue()));
            scorecardModel.setInitialScore(Double.parseDouble(tbInitialScore.getValue()));
            scorecardModel.setReasonCodesAlgorithm(ddReasonCodeAlgo.getValue(ddReasonCodeAlgo.getSelectedIndex()));
            scorecardModel.setUseReasonCodes(ddUseReasonCode.getSelectedIndex() == 1);

            EnumDropDown enumDropDown = (EnumDropDown) scorecardPropertiesGrid.getWidget(1, 0);
            String factName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
            scorecardModel.setFactName(factName);
            if (sce.getModelFields().get(factName) != null){
                for (ModelField mf : sce.getModelFields().get(factName)) {
                    if (mf.getType().equals(factName)){
                        scorecardModel.setFactName(mf.getClassName());
                        break;
                    }
                }
            }

            enumDropDown = (EnumDropDown) scorecardPropertiesGrid.getWidget(1, 1);
            if (enumDropDown.getSelectedIndex() > -1) {
                String fieldName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
                fieldName = fieldName.substring(0, fieldName.indexOf(":")).trim();
                scorecardModel.setFieldName(fieldName);
            } else {
                scorecardModel.setFieldName("");
            }

            if (ddReasonCodeField.getSelectedIndex() > -1) {
                String rcField = ddReasonCodeField.getValue(ddReasonCodeField.getSelectedIndex());
                rcField = rcField.substring(0, rcField.indexOf(":")).trim();
                scorecardModel.setReasonCodeField(rcField);
            }

            scorecardModel.getCharacteristics().clear();
            for (DirtyableFlexTable flexTable : characteristicsTables) {
                Characteristic characteristic = new Characteristic();
                characteristic.setName(((TextBox) flexTable.getWidget(0, 1)).getValue());

                enumDropDown = (EnumDropDown) flexTable.getWidget(2, 0);
                String simpleFactName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
                if (sce.getModelFields().get(simpleFactName) != null){
                    for (ModelField mf : sce.getModelFields().get(simpleFactName)) {
                        ////System.out.println(">>>> "+mf.getType()+"  "+mf.getClassName()+"  "+mf.getName());
                        if (mf.getType().equals(simpleFactName)){
                            characteristic.setFact(mf.getClassName());
                            break;
                        }
                    }
                }
                enumDropDown = (EnumDropDown) flexTable.getWidget(2, 1);
                if (enumDropDown.getSelectedIndex() > -1) {
                    String fieldName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
                    fieldName = fieldName.substring(0, fieldName.indexOf(":")).trim();
                    characteristic.setField(fieldName);
                } else {
                    characteristic.setField("");
                }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

        String flType = sce.getFieldType( key );
        panel.clear();

        if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_BOOLEAN ) ) {
            String[] c = new String[]{"true", "false"};
            panel.add( new EnumDropDown( field.getExpected(),
                                         new DropDownValueChanged() {
                                             public void valueChanged(String newText,
                                                                      String newValue) {
                                                 callback.valueChanged( newValue );
                                             }
                                         },
                                         DropDownData.create( c ) ) );

        } else if ( flType != null && flType.equals( SuggestionCompletionEngine.TYPE_DATE ) ) {
            final DatePickerTextBox datePicker = new DatePickerTextBox( field.getExpected() );
            String m = Constants.INSTANCE.ValueFor0( field.getFieldName() );
            datePicker.setTitle( m );
            datePicker.addValueChanged( new ValueChanged() {
                public void valueChanged(String newValue) {
                    field.setExpected( newValue );
                }
            } );
            panel.add( datePicker );

        } else {
            Map<String, String> currentValueMap = new HashMap<String, String>();
            // TODO fill currentValueMap with values of other VerifyFields (if any)
            DropDownData dropDownData = sce.getEnums( factType,
                                                      field.getFieldName(),
                                                      currentValueMap );
            if ( dropDownData != null ) {
                //GUVNOR-1324: Java enums are of type TYPE_COMPARABLE whereas Guvnor enums are not.
                //The distinction here controls whether the EXPECTED value is handled as a true
                //Java enum or a literal with a selection list (i.e. Guvnor enum)
                String dataType = sce.getFieldType( key );
                if ( dataType.equals( SuggestionCompletionEngine.TYPE_COMPARABLE ) ) {
                    field.setNature( FieldData.TYPE_ENUM );
                } else {
                    field.setNature( FieldData.TYPE_LITERAL );
                }

                panel.add( new EnumDropDown( field.getExpected(),
                                             new DropDownValueChanged() {
                                                 public void valueChanged(String newText,
                                                                          String newValue) {
                                                     callback.valueChanged( newValue );
                                                 }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

        String factName = scorecardModel.getFactName();
        if (factName.lastIndexOf(".") > -1){
            // if fact is a fully qualified className, strip off the packageName
            factName = factName.substring(factName.lastIndexOf(".")+1);
        }
        final EnumDropDown dropDownFields = new EnumDropDown("",
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        //do nothing
                    }
                }, DropDownData.create(new String[]{}));

        EnumDropDown dropDownFacts = new EnumDropDown(factName,
                new DropDownValueChanged() {
                    public void valueChanged(String newText, String newValue) {
                        String selectedField = scorecardModel.getFieldName();
                        selectedField = selectedField+" : double";
                        dropDownFields.setDropDownData(selectedField, DropDownData.create(getEligibleFields(newValue, typesForScore)));
                    }
                }, DropDownData.create(sce.getFactTypes()));

        ddReasonCodeField = new EnumDropDown("",
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        //do nothing
                    }
                }, DropDownData.create(new String[]{}));

        String rcField = scorecardModel.getReasonCodeField() +" : List";
        ddReasonCodeField.setDropDownData(rcField,DropDownData.create(getEligibleFields(factName,typesForRC)));

        boolean useReasonCodes = scorecardModel.isUseReasonCodes();
        String reasonCodesAlgo = scorecardModel.getReasonCodesAlgorithm();
        if (reasonCodesAlgo == null || reasonCodesAlgo.trim().length() == 0) {
            reasonCodesAlgo = "none";
        }

        ddUseReasonCode = booleanEditor(Boolean.toString(useReasonCodes));
        ddReasonCodeAlgo = dropDownEditor(DropDownData.create(REASON_CODE_ALGORITHMS), reasonCodesAlgo);
        tbBaselineScore = TextBoxFactory.getTextBox(SuggestionCompletionEngine.TYPE_NUMERIC_DOUBLE);

        scorecardPropertiesGrid.setText(0, 0, "Facts");
        scorecardPropertiesGrid.setText(0, 1, "Resultant Score Field");
        scorecardPropertiesGrid.setText(0, 2, "Initial Score");

        scorecardPropertiesGrid.setWidget(1, 0, dropDownFacts);
        scorecardPropertiesGrid.setWidget(1, 1, dropDownFields);
        scorecardPropertiesGrid.setWidget(1, 2, tbInitialScore);

        scorecardPropertiesGrid.setText(2, 0, "Use Reason Codes");
        scorecardPropertiesGrid.setText(2, 1, "Resultant Reason Codes Field");
        scorecardPropertiesGrid.setText(2, 2, "Reason Codes Algorithm");
        scorecardPropertiesGrid.setText(2, 3, "Baseline Score");

        scorecardPropertiesGrid.setWidget(3, 0, ddUseReasonCode);
        scorecardPropertiesGrid.setWidget(3, 1, ddReasonCodeField);
        scorecardPropertiesGrid.setWidget(3, 2, ddReasonCodeAlgo);
        scorecardPropertiesGrid.setWidget(3, 3, tbBaselineScore);

        /* TODO : Remove this explicitly Disabled Reasoncode support field*/
        ddUseReasonCode.setEnabled(false);

        tbBaselineScore.setText(Double.toString(scorecardModel.getBaselineScore()));

        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 0, "200px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 1, "250px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 2, "200px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 3, "200px");

        int index = Arrays.asList(sce.getFactTypes()).indexOf(factName);
        dropDownFacts.setSelectedIndex(index);
        dropDownFields.setDropDownData(scorecardModel.getFieldName()+" : double", DropDownData.create(getEligibleFields(factName, typesForScore)));

        return scorecardPropertiesGrid;
    }
View Full Code Here

Examples of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.EnumDropDown

        characteristicsAttrMap.get(selectedTable).refresh();

        //disable the fact & field dropdowns
        ((EnumDropDown) selectedTable.getWidget(2, 0)).setEnabled(false);
        ((EnumDropDown) selectedTable.getWidget(2, 1)).setEnabled(false);
        EnumDropDown edd = ((EnumDropDown) selectedTable.getWidget(2, 1));
        if (edd.getSelectedIndex() > -1) {
            String field = edd.getValue(edd.getSelectedIndex());
            field = field.substring(field.indexOf(":")+1).trim();
            CellTable<Attribute> cellTable = (CellTable<Attribute>) characteristicsAttrMap.get(selectedTable).getDataDisplays().iterator().next();
            DynamicSelectionCell dynamicSelectionCell = (DynamicSelectionCell) cellTable.getColumn(0).getCell();
            List<String> newOptions = null;
            if ("double".equalsIgnoreCase(field) || "int".equalsIgnoreCase(field)) {
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.