Package org.drools.ide.common.client.modeldriven.scorecards

Examples of org.drools.ide.common.client.modeldriven.scorecards.Attribute


            }
        }
    }

    private void addAttribute(final DirtyableFlexTable selectedTable, Attribute attribute) {
        Attribute newAttribute = null;
        if (attribute != null) {
            characteristicsAttrMap.get(selectedTable).getList().add(attribute);
        } else {
            newAttribute = new Attribute();
            characteristicsAttrMap.get(selectedTable).getList().add(newAttribute);
        }
        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)) {
                newOptions = Arrays.asList(numericOperators);
            } else if ("boolean".equalsIgnoreCase(field)) {
                newOptions = Arrays.asList(booleanOperators);
                CustomEditTextCell etc = (CustomEditTextCell)cellTable.getColumn(1).getCell();
                etc.setEnabled(false);
                ((Button)selectedTable.getWidget(0, 3)).setEnabled(characteristicsAttrMap.get(selectedTable).getList().size() != 2);
                if (newAttribute != null) {
                    newAttribute.setValue("N/A");
                }
            } else if ("String".equalsIgnoreCase(field)) {
                newOptions = Arrays.asList(stringOperators);
            }
            dynamicSelectionCell.setOptions(newOptions);
            if ( newAttribute != null) {
                if (newOptions != null) {
                    newAttribute.setOperator(newOptions.get(0));
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.scorecards.Attribute

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.