Package org.drools.workbench.models.guided.dtable.shared.model

Examples of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52


    private ActionRetractFactCol52 cloneActionRetractColumn( ActionRetractFactCol52 col ) {
        ActionRetractFactCol52 clone = null;
        if ( col instanceof LimitedEntryCol ) {
            clone = new LimitedEntryActionRetractFactCol52();
            DTCellValue52 dcv = new DTCellValue52( ( (LimitedEntryCol) col ).getValue().getStringValue() );
            ( (LimitedEntryCol) clone ).setValue( dcv );
        } else {
            clone = new ActionRetractFactCol52();
        }
        clone.setHeader( col.getHeader() );
View Full Code Here


                            if ( !valueList.contains( defaultValue ) ) {
                                editingCol.getDefaultValue().clearValues();
                            }
                        } else {
                            //Ensure the Default Value has been updated to represent the column's data-type.
                            final DTCellValue52 defaultValue = editingCol.getDefaultValue();
                            final DataType.DataTypes dataType = utilities.getDataType( editingCol );
                            utilities.assertDTCellValue( dataType,
                                                         defaultValue );
                        }
                    }
View Full Code Here

    private ActionSetFieldCol52 cloneActionSetColumn( ActionSetFieldCol52 col ) {
        ActionSetFieldCol52 clone = null;
        if ( col instanceof LimitedEntryActionSetFieldCol52 ) {
            clone = new LimitedEntryActionSetFieldCol52();
            DTCellValue52 dcv = cloneLimitedEntryValue( ( (LimitedEntryCol) col ).getValue() );
            ( (LimitedEntryCol) clone ).setValue( dcv );
        } else {
            clone = new ActionSetFieldCol52();
        }
        clone.setBoundName( col.getBoundName() );
        clone.setFactField( col.getFactField() );
        clone.setHeader( col.getHeader() );
        clone.setType( col.getType() );
        clone.setValueList( col.getValueList() );
        clone.setUpdate( col.isUpdate() );
        clone.setDefaultValue( new DTCellValue52( col.getDefaultValue() ) );
        clone.setHideColumn( col.isHideColumn() );
        return clone;
    }
View Full Code Here

    private DTCellValue52 cloneLimitedEntryValue( DTCellValue52 dcv ) {
        if ( dcv == null ) {
            return null;
        }
        DTCellValue52 clone = new DTCellValue52( dcv );
        return clone;
    }
View Full Code Here

        }

        //Ensure the Default Value has been updated to represent the column's
        //data-type. Legacy Default Values are all String-based and need to be
        //coerced to the correct type
        final DTCellValue52 defaultValue = editingCol.getDefaultValue();
        final DataType.DataTypes dataType = utilities.getDataType( editingCol );
        utilities.assertDTCellValue( dataType,
                                     defaultValue );
        defaultValueWidgetContainer.setWidget( factory.getWidget( model.getConditionPattern( editingCol.getBoundName() ),
                                                                  editingCol,
View Full Code Here

            if ( !valueList.contains( defaultValue ) ) {
                selectedAction.getDefaultValue().clearValues();
            }
        } else {
            //Ensure the Default Value has been updated to represent the column's data-type.
            final DTCellValue52 defaultValue = selectedAction.getDefaultValue();
            final DataType.DataTypes dataType = cellUtils.getDataType( selectedPattern,
                                                                       selectedAction );
            cellUtils.assertDTCellValue( dataType,
                                         defaultValue );
        }
View Full Code Here

            if ( !valueList.contains( defaultValue ) ) {
                selectedAction.getDefaultValue().clearValues();
            }
        } else {
            //Ensure the Default Value has been updated to represent the column's data-type.
            final DTCellValue52 defaultValue = selectedAction.getDefaultValue();
            final DataType.DataTypes dataType = cellUtils.getDataType( selectedAction );
            cellUtils.assertDTCellValue( dataType,
                                         defaultValue );
        }
    }
View Full Code Here

                || attributeName.equals( RuleAttributeWidget.ACTIVATION_GROUP_ATTR )
                || attributeName.equals( RuleAttributeWidget.TIMER_ATTR )
                || attributeName.equals( RuleAttributeWidget.CALENDARS_ATTR ) ) {
            final TextBox tb = TextBoxFactory.getTextBox( DataType.TYPE_STRING );
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( "" ) );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            tb.setValue( defaultValue.getStringValue() );
            tb.setEnabled( !isReadOnly );
            if ( !isReadOnly ) {
                tb.addValueChangeHandler( new ValueChangeHandler<String>() {

                    public void onValueChange( ValueChangeEvent<String> event ) {
                        defaultValue.setStringValue( tb.getValue() );
                        defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(defaultValue));
                    }

                } );
            }
            editor = tb;

        } else if ( attributeName.equals( RuleAttributeWidget.SALIENCE_ATTR ) ) {
            final TextBox tb = TextBoxFactory.getTextBox( DataType.TYPE_NUMERIC_INTEGER );
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( 0 ) );
            } else {
                assertIntegerDefaultValue( ac.getDefaultValue() );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            final Integer numericValue = (Integer) defaultValue.getNumericValue();
            tb.setValue( numericValue == null ? "" : numericValue.toString() );
            tb.setEnabled( !isReadOnly );
            if ( !isReadOnly ) {
                tb.addValueChangeHandler( new ValueChangeHandler<String>() {

                    public void onValueChange( ValueChangeEvent<String> event ) {
                        try {
                            defaultValue.setNumericValue( new Integer( event.getValue() ) );
                        } catch ( NumberFormatException nfe ) {
                            defaultValue.setNumericValue( new Integer( "0" ) );
                            tb.setValue( "0" );
                        } finally {
                            defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(defaultValue));
                        }
                    }

                } );
            }
            editor = tb;

        } else if ( attributeName.equals( RuleAttributeWidget.DURATION_ATTR ) ) {
            final TextBox tb = TextBoxFactory.getTextBox( DataType.TYPE_NUMERIC_LONG );
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( 0L ) );
            } else {
                assertLongDefaultValue( ac.getDefaultValue() );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            final Long numericValue = (Long) defaultValue.getNumericValue();
            tb.setValue( numericValue == null ? "" : numericValue.toString() );
            tb.setEnabled( !isReadOnly );
            if ( !isReadOnly ) {
                tb.addValueChangeHandler( new ValueChangeHandler<String>() {

                    public void onValueChange( ValueChangeEvent<String> event ) {
                        try {
                            defaultValue.setNumericValue( new Long( event.getValue() ) );
                        } catch ( NumberFormatException nfe ) {
                            defaultValue.setNumericValue( new Long( "0" ) );
                            tb.setValue( "0" );
                        } finally {
                            defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(defaultValue));
                        }
                    }

                } );
            }
            editor = tb;

        } else if ( attributeName.equals( RuleAttributeWidget.NO_LOOP_ATTR )
                || attributeName.equals( RuleAttributeWidget.LOCK_ON_ACTIVE_ATTR )
                || attributeName.equals( RuleAttributeWidget.AUTO_FOCUS_ATTR )
                || attributeName.equals( RuleAttributeWidget.ENABLED_ATTR )
                || attributeName.equals( GuidedDecisionTable52.NEGATE_RULE_ATTR ) ) {
            final CheckBox cb = new CheckBox();
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( Boolean.FALSE ) );
            } else {
                assertBooleanDefaultValue( ac.getDefaultValue() );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            final Boolean booleanValue = defaultValue.getBooleanValue();
            cb.setEnabled( !isReadOnly );
            if ( booleanValue == null ) {
                cb.setValue( false );
                defaultValue.setBooleanValue( Boolean.FALSE );
            } else {
                cb.setValue( booleanValue );
            }

            cb.addClickHandler( new ClickHandler() {
                public void onClick( ClickEvent event ) {
                    defaultValue.setBooleanValue( cb.getValue() );
                    defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(defaultValue));
                }
            } );
            editor = cb;

        } else if ( attributeName.equals( RuleAttributeWidget.DATE_EFFECTIVE_ATTR )
                || attributeName.equals( RuleAttributeWidget.DATE_EXPIRES_ATTR ) ) {
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( new Date() ) );
            } else {
                assertDateDefaultValue( ac.getDefaultValue() );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            if ( isReadOnly ) {
                final TextBox tb = TextBoxFactory.getTextBox( DataType.TYPE_STRING );
                tb.setValue( format.format( defaultValue.getDateValue() ) );
                tb.setEnabled( false );
            } else {
                final PopupDatePicker dp = new PopupDatePicker( false );
                final Date dateValue = defaultValue.getDateValue();
                dp.setValue( dateValue );

                dp.addValueChangeHandler( new ValueChangeHandler<Date>() {

                    public void onValueChange( ValueChangeEvent<Date> event ) {
                        defaultValue.setDateValue( event.getValue() );
                        defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(defaultValue));
                    }

                } );
                editor = dp;
            }
        } else if ( attributeName.equals( RuleAttributeWidget.DIALECT_ATTR ) ) {
            final ListBox lb = new ListBox();
            lb.addItem( RuleAttributeWidget.DIALECTS[ 0 ] );
            lb.addItem( RuleAttributeWidget.DIALECTS[ 1 ] );
            if ( ac.getDefaultValue() == null ) {
                ac.setDefaultValue( new DTCellValue52( RuleAttributeWidget.DIALECTS[ 1 ] ) );
            }
            final DTCellValue52 defaultValue = ac.getDefaultValue();
            final String stringValue = defaultValue.getStringValue();
            lb.setEnabled( !isReadOnly );
            if ( !isReadOnly ) {
                lb.addChangeHandler( new ChangeHandler() {
                    @Override
                    public void onChange( ChangeEvent event ) {
                        final int selectedIndex = lb.getSelectedIndex();
                        if ( selectedIndex < 0 ) {
                            return;
                        }
                        DTCellValue52 newValue = new DTCellValue52( lb.getValue( selectedIndex ) );
                        ac.setDefaultValue( newValue );
                        defaultValueChangedEventHandler.onDefaultValueChanged(new DefaultValueChangedEvent(newValue));
                    }
                } );
            }
View Full Code Here

                            if ( !valueList.contains( defaultValue ) ) {
                                editingCol.getDefaultValue().clearValues();
                            }
                        } else {
                            //Ensure the Default Value has been updated to represent the column's data-type.
                            final DTCellValue52 defaultValue = editingCol.getDefaultValue();
                            final DataType.DataTypes dataType = utilities.getDataType( editingPattern,
                                                                                       editingCol );
                            utilities.assertDTCellValue( dataType,
                                                         defaultValue );
                        }
View Full Code Here

    private ConditionCol52 cloneConditionColumn( ConditionCol52 col ) {
        ConditionCol52 clone = null;
        if ( col instanceof LimitedEntryConditionCol52 ) {
            clone = new LimitedEntryConditionCol52();
            DTCellValue52 dcv = cloneLimitedEntryValue( ( (LimitedEntryCol) col ).getValue() );
            ( (LimitedEntryCol) clone ).setValue( dcv );
        } else {
            clone = new ConditionCol52();
        }
        clone.setConstraintValueType( col.getConstraintValueType() );
        clone.setFactField( col.getFactField() );
        clone.setFieldType( col.getFieldType() );
        clone.setHeader( col.getHeader() );
        clone.setOperator( col.getOperator() );
        clone.setValueList( col.getValueList() );
        clone.setDefaultValue( new DTCellValue52( col.getDefaultValue() ) );
        clone.setHideColumn( col.isHideColumn() );
        clone.setParameters( col.getParameters() );
        clone.setWidth( col.getWidth() );
        clone.setBinding( col.getBinding() );
        return clone;
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52

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.