Package org.drools.workbench.models.guided.scorecard.shared

Examples of org.drools.workbench.models.guided.scorecard.shared.Attribute


        }
    }

    private void addAttribute( final DirtyableFlexTable selectedTable,
                               final 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
        ( (ListBox) selectedTable.getWidget( 2,
                                             0 ) ).setEnabled( false );
        ( (ListBox) selectedTable.getWidget( 2,
                                             1 ) ).setEnabled( false );
        final ListBox edd = ( (ListBox) selectedTable.getWidget( 2,
                                                                 1 ) );
        if ( edd.getSelectedIndex() > -1 ) {
            String field = edd.getValue( edd.getSelectedIndex() );
            field = field.substring( field.indexOf( ":" ) + 1 ).trim();
            final CellTable<Attribute> cellTable = (CellTable<Attribute>) characteristicsAttrMap.get( selectedTable ).getDataDisplays().iterator().next();
            final DynamicSelectionCell dynamicSelectionCell = (DynamicSelectionCell) cellTable.getColumn( 0 ).getCell();
            List<String> newOptions = null;
            if ( "double".equalsIgnoreCase( field ) || "int".equalsIgnoreCase( field ) || endsWithIgnoreCase(field, "integer")) {
                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( GuidedScoreCardConstants.INSTANCE.notApplicable() );
                }
            } else if ( "String".equalsIgnoreCase( field ) ) {
                newOptions = Arrays.asList( stringOperators );
            }
            if ( newOptions != null ) {
                dynamicSelectionCell.setOptions( newOptions );
            }
            if ( newAttribute != null ) {
                if ( newOptions != null ) {
                    newAttribute.setOperator( newOptions.get( 0 ) );
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.scorecard.shared.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.