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

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


        }
        if ( col instanceof AttributeCol52 ) {
            return true;
        }
        if ( col instanceof ConditionCol52 ) {
            final ConditionCol52 c = (ConditionCol52) col;
            if ( c.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_LITERAL ) {
                if ( c.getFactField() == null
                        || c.getFactField().equals( "" ) ) {
                    return false;
                }
                if ( c.getOperator() == null
                        || c.getOperator().equals( "" ) ) {
                    return false;
                }
                return true;
            }
            return true;
View Full Code Here


                for ( int iCol = 0; iCol < this.columns.size(); iCol++ ) {
                    final ColumnValues cv = this.columns.get( iCol );
                    if ( cv instanceof ColumnDynamicValues ) {
                        final ColumnDynamicValues cdv = (ColumnDynamicValues) cv;
                        if ( cdv.context.getBasePattern().equals( this.context.getBasePattern() ) ) {
                            final ConditionCol52 cc = (ConditionCol52) cdv.context.getBaseColumn();
                            final DTCellValue52 value = row.get( iCol );
                            if ( value != null ) {
                                currentValueMap.put( cc.getFactField(),
                                                     value.getStringValue() );
                            }
                        }
                    }
                }
View Full Code Here

            return DataType.DataTypes.BOOLEAN;
        }

        //Operators "is null" and "is not null" require a boolean cell
        if ( column instanceof ConditionCol52 ) {
            ConditionCol52 cc = (ConditionCol52) column;
            if ( cc.getOperator() != null && ( cc.getOperator().equals( "== null" ) || cc.getOperator().equals( "!= null" ) ) ) {
                return DataType.DataTypes.BOOLEAN;
            }
        }

        //Extended Entry...
View Full Code Here

        btnMoveUp.addClickHandler( new ClickHandler() {

            @Override
            public void onClick( final ClickEvent event ) {
                final int index = chosenConditions.indexOf( chosenConditionsSelection );
                final ConditionCol52 c = chosenConditions.remove( index );
                chosenConditions.add( index - 1,
                                      c );
                setChosenConditions( chosenConditions );
                availablePatternsSelection.setChildColumns( chosenConditions );
            }

        } );
        btnMoveDown.addClickHandler( new ClickHandler() {

            @Override
            public void onClick( final ClickEvent event ) {
                final int index = chosenConditions.indexOf( chosenConditionsSelection );
                final ConditionCol52 c = chosenConditions.remove( index );
                chosenConditions.add( index + 1,
                                      c );
                setChosenConditions( chosenConditions );
                availablePatternsSelection.setChildColumns( chosenConditions );
            }
View Full Code Here

    }

    private ConditionCol52 makeNewConditionColumn( final AvailableField f ) {
        final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
        if ( format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY ) {
            final ConditionCol52 c = new ConditionCol52();
            c.setFactField( f.getName() );
            c.setFieldType( f.getType() );
            c.setConstraintValueType( f.getCalculationType() );
            return c;
        } else {
            final LimitedEntryConditionCol52 c = new LimitedEntryConditionCol52();
            c.setFactField( f.getName() );
            c.setFieldType( f.getType() );
            c.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
            return c;
        }

    }
View Full Code Here

    private boolean allowEmptyValues() {
        return this.model.getTableFormat() == TableFormat.EXTENDED_ENTRY;
    }

    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

                                          list );
                        pop.show();
                    }

                    private void showConditionSimple() {
                        final ConditionCol52 column = makeNewConditionColumn();
                        ConditionPopup dialog = new ConditionPopup( model,
                                                                    oracle,
                                                                    new ConditionColumnCommand() {
                                                                        public void execute( Pattern52 pattern,
                                                                                             ConditionCol52 column ) {

                                                                            //Update UI
                                                                            dtable.addColumn( pattern,
                                                                                              column );
                                                                            refreshConditionsWidget();
                                                                        }
                                                                    },
                                                                    column,
                                                                    true,
                                                                    isReadOnly );
                        dialog.show();
                    }

                    private void showConditionBRLFragment() {
                        final BRLConditionColumn column = makeNewConditionBRLFragment();
                        switch ( model.getTableFormat() ) {
                            case EXTENDED_ENTRY:
                                BRLConditionColumnViewImpl popup = new BRLConditionColumnViewImpl( path,
                                                                                                   model,
                                                                                                   oracle,
                                                                                                   ruleNameService,
                                                                                                   column,
                                                                                                   eventBus,
                                                                                                   true,
                                                                                                   isReadOnly );
                                popup.setPresenter( BRL_CONDITION_PRESENTER );
                                popup.show();
                                break;
                            case LIMITED_ENTRY:
                                LimitedEntryBRLConditionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLConditionColumnViewImpl( path,
                                                                                                                                      model,
                                                                                                                                      oracle,
                                                                                                                                      ruleNameService,
                                                                                                                                      (LimitedEntryBRLConditionColumn) column,
                                                                                                                                      eventBus,
                                                                                                                                      true,
                                                                                                                                      isReadOnly );
                                limtedEntryPopup.setPresenter( LIMITED_ENTRY_BRL_CONDITION_PRESENTER );
                                limtedEntryPopup.show();
                                break;
                        }
                    }

                    private void showActionInsert() {
                        final ActionInsertFactCol52 afc = makeNewActionInsertColumn();
                        ActionInsertFactPopup ins = new ActionInsertFactPopup( model,
                                                                               oracle,
                                                                               new GenericColumnCommand() {
                                                                                   public void execute( DTColumnConfig52 column ) {
                                                                                       newActionAdded( (ActionCol52) column );
                                                                                   }
                                                                               },
                                                                               afc,
                                                                               true,
                                                                               isReadOnly );
                        ins.show();
                    }

                    private void showActionSet() {
                        final ActionSetFieldCol52 afc = makeNewActionSetColumn();
                        ActionSetFieldPopup set = new ActionSetFieldPopup( model,
                                                                           oracle,
                                                                           new GenericColumnCommand() {
                                                                               public void execute( DTColumnConfig52 column ) {
                                                                                   newActionAdded( (ActionCol52) column );
                                                                               }
                                                                           },
                                                                           afc,
                                                                           true,
                                                                           isReadOnly );
                        set.show();
                    }

                    private void showActionRetract() {
                        final ActionRetractFactCol52 arf = makeNewActionRetractFact();
                        ActionRetractFactPopup popup = new ActionRetractFactPopup( model,
                                                                                   new GenericColumnCommand() {
                                                                                       public void execute( DTColumnConfig52 column ) {
                                                                                           newActionAdded( (ActionCol52) column );
                                                                                       }
                                                                                   },
                                                                                   arf,
                                                                                   true,
                                                                                   isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemAction() {
                        final ActionWorkItemCol52 awi = makeNewActionWorkItem();
                        ActionWorkItemPopup popup = new ActionWorkItemPopup( path,
                                                                             model,
                                                                             GuidedDecisionTableWidget.this,
                                                                             new GenericColumnCommand() {
                                                                                 public void execute( DTColumnConfig52 column ) {
                                                                                     newActionAdded( (ActionCol52) column );
                                                                                 }
                                                                             },
                                                                             awi,
                                                                             workItemDefinitions,
                                                                             true,
                                                                             isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemActionSet() {
                        final ActionWorkItemSetFieldCol52 awisf = makeNewActionWorkItemSetField();
                        ActionWorkItemSetFieldPopup popup = new ActionWorkItemSetFieldPopup( model,
                                                                                             oracle,
                                                                                             new GenericColumnCommand() {
                                                                                                 public void execute( DTColumnConfig52 column ) {
                                                                                                     newActionAdded( (ActionCol52) column );
                                                                                                 }
                                                                                             },
                                                                                             awisf,
                                                                                             true,
                                                                                             isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemActionInsert() {
                        final ActionWorkItemInsertFactCol52 awiif = makeNewActionWorkItemInsertFact();
                        ActionWorkItemInsertFactPopup popup = new ActionWorkItemInsertFactPopup( model,
                                                                                                 oracle,
                                                                                                 new GenericColumnCommand() {
                                                                                                     public void execute( DTColumnConfig52 column ) {
                                                                                                         newActionAdded( (ActionCol52) column );
                                                                                                     }
                                                                                                 },
                                                                                                 awiif,
                                                                                                 true,
                                                                                                 isReadOnly );
                        popup.show();
                    }

                    private void showActionBRLFragment() {
                        final BRLActionColumn column = makeNewActionBRLFragment();
                        switch ( model.getTableFormat() ) {
                            case EXTENDED_ENTRY:
                                BRLActionColumnViewImpl popup = new BRLActionColumnViewImpl( path,
                                                                                             model,
                                                                                             oracle,
                                                                                             ruleNameService,
                                                                                             column,
                                                                                             eventBus,
                                                                                             true,
                                                                                             isReadOnly );
                                popup.setPresenter( BRL_ACTION_PRESENTER );
                                popup.show();
                                break;
                            case LIMITED_ENTRY:
                                LimitedEntryBRLActionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLActionColumnViewImpl( path,
                                                                                                                                model,
                                                                                                                                oracle,
                                                                                                                                ruleNameService,
                                                                                                                                (LimitedEntryBRLActionColumn) column,
                                                                                                                                eventBus,
                                                                                                                                true,
                                                                                                                                isReadOnly );
                                limtedEntryPopup.setPresenter( LIMITED_ENTRY_BRL_ACTION_PRESENTER );
                                limtedEntryPopup.show();
                                break;
                        }

                    }

                    private void newActionAdded( ActionCol52 column ) {
                        dtable.addColumn( column );
                        refreshActionsWidget();
                    }
                } );

                //If a separator is clicked disable OK button
                choice.addClickHandler( new ClickHandler() {

                    public void onClick( ClickEvent event ) {
                        int itemIndex = choice.getSelectedIndex();
                        if ( itemIndex < 0 ) {
                            return;
                        }
                        ok.setEnabled( !choice.getValue( itemIndex ).equals( SECTION_SEPARATOR ) );
                    }

                } );

                pop.setTitle( GuidedDecisionTableConstants.INSTANCE.AddNewColumn() );
                pop.addAttribute( GuidedDecisionTableConstants.INSTANCE.TypeOfColumn(),
                                  choice );
                pop.addAttribute( "",
                                  chkIncludeAdvancedOptions );
                pop.addAttribute( "",
                                  ok );
                pop.show();
            }

            private ConditionCol52 makeNewConditionColumn() {
                switch ( model.getTableFormat() ) {
                    case LIMITED_ENTRY:
                        return new LimitedEntryConditionCol52();
                    default:
                        return new ConditionCol52();
                }
            }

            private ActionInsertFactCol52 makeNewActionInsertColumn() {
                switch ( model.getTableFormat() ) {
View Full Code Here

        // Row 2 (Fact Types) - Condition Columns
        int iRow2ColColumn = 0;
        for ( int iCol = 0; iCol < widget.visibleConditionCols.size(); iCol++ ) {
            DynamicColumn<BaseColumn> col = widget.visibleConditionCols.get( iCol );
            ConditionCol52 cc = (ConditionCol52) col.getModelColumn();
            Pattern52 ccPattern = model.getPattern( cc );

            // Merging
            int colSpan = 1;
            int width = col.getWidth();
            while ( iCol + colSpan < widget.visibleConditionCols.size() ) {
                DynamicColumn<BaseColumn> mergeCol = widget.visibleConditionCols.get( iCol + colSpan );
                ConditionCol52 mergeCondCol = (ConditionCol52) mergeCol.getModelColumn();
                Pattern52 mergeCondColPattern = model.getPattern( mergeCondCol );
                if ( mergeCondColPattern != ccPattern ) {
                    break;
                }
                width = width + mergeCol.getWidth();
View Full Code Here

                                            resources.rowHeaderHeight() ) );
                tce.<TableCellElement>cast().setRowSpan( 4 );
                tce.addClassName( resources.headerRowIntermediate() );
                tce.addClassName( resources.cellTableColumn( modelCol ) );
            } else if ( modelCol instanceof ConditionCol52 ) {
                ConditionCol52 cc = (ConditionCol52) modelCol;
                StringBuilder header = new StringBuilder();
                if ( cc.isBound() ) {
                    header.append( cc.getBinding() );
                    header.append( " : " );
                }
                header.append( cc.getHeader() );
                tce.appendChild( makeLabel( header.toString(),
                                            width,
                                            resources.rowHeaderHeight() ) );
                tce.addClassName( resources.cellTableColumn( modelCol ) );
            } else if ( modelCol instanceof ActionCol52 ) {
View Full Code Here

                case 2:
                    // Condition FactType, merged between identical
                    for ( int iCol = 0; iCol < visibleConditionCols.size(); iCol++ ) {
                        DynamicColumn<BaseColumn> col = visibleConditionCols.get( iCol );
                        ConditionCol52 cc = (ConditionCol52) col.getModelColumn();
                        Pattern52 ccPattern = model.getPattern( cc );

                        tce = DOM.createTD();
                        tce.addClassName( resources.headerText() );
                        tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
                        tce.addClassName( resources.headerRowIntermediate() );
                        tre.appendChild( tce );

                        // Merging
                        int colSpan = 1;
                        int width = col.getWidth();
                        while ( iCol + colSpan < visibleConditionCols.size() ) {
                            DynamicColumn<BaseColumn> mergeCol = visibleConditionCols.get( iCol + colSpan );
                            ConditionCol52 mergeCondCol = (ConditionCol52) mergeCol.getModelColumn();
                            Pattern52 mergeCondColPattern = model.getPattern( mergeCondCol );
                            if ( mergeCondColPattern != ccPattern ) {
                                break;
                            }
                            width = width + mergeCol.getWidth();
                            colSpan++;
                        }
                        iCol = iCol + colSpan - 1;

                        //Make applicable label (TODO move to Factory method)
                        StringBuilder label = new StringBuilder();
                        if ( cc instanceof LimitedEntryBRLConditionColumn ) {
                            //Nothing needed
                        } else if ( cc instanceof BRLConditionVariableColumn ) {
                            BRLConditionVariableColumn brl = (BRLConditionVariableColumn) cc;
                            label.append( brl.getVarName() );
                        } else if ( cc instanceof ConditionCol52 ) {
                            String factType = ccPattern.getFactType();
                            String boundName = ccPattern.getBoundName();
                            if ( factType != null && factType.length() > 0 ) {
                                if ( ccPattern.isNegated() ) {
                                    label.append( GuidedDecisionTableConstants.INSTANCE.negatedPattern() ).append( " " ).append( factType );
                                } else {
                                    label.append( factType ).append( " [" ).append( boundName ).append( "]" );
                                }
                            }
                        }

                        tce.appendChild( makeLabel( label.toString(),
                                                    width,
                                                    ( splitter.isCollapsed ? 0 : resources.rowHeaderHeight() ) ) );
                        tce.<TableCellElement>cast().setColSpan( colSpan );

                    }

                    //Action FactType
                    for ( int iCol = 0; iCol < visibleActionCols.size(); iCol++ ) {
                        DynamicColumn<BaseColumn> col = visibleActionCols.get( iCol );
                        ActionCol52 ac = (ActionCol52) col.getModelColumn();

                        tce = DOM.createTD();
                        tce.addClassName( resources.headerText() );
                        tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
                        tce.addClassName( resources.headerRowIntermediate() );
                        tre.appendChild( tce );

                        //Make applicable label (TODO move to Factory method)
                        StringBuilder label = new StringBuilder();
                        if ( ac instanceof ActionInsertFactCol52 ) {
                            ActionInsertFactCol52 aifc = (ActionInsertFactCol52) ac;
                            String factType = aifc.getFactType();
                            String binding = aifc.getBoundName();
                            if ( factType != null && factType.length() > 0 ) {
                                label.append( factType );
                                if ( binding != null ) {
                                    label.append( " [" + binding + "]" );
                                }
                            }
                        } else if ( ac instanceof ActionSetFieldCol52 ) {
                            String factType = ( (ActionSetFieldCol52) ac ).getBoundName();
                            if ( factType != null && factType.length() > 0 ) {
                                label.append( factType );
                            }
                        } else if ( ac instanceof LimitedEntryActionRetractFactCol52 ) {
                            String factType = ( (LimitedEntryActionRetractFactCol52) ac ).getValue().getStringValue();
                            if ( factType != null && factType.length() > 0 ) {
                                label.append( factType );
                            }
                        } else if ( ac instanceof ActionWorkItemCol52 ) {
                            String factType = ( (ActionWorkItemCol52) ac ).getWorkItemDefinition().getDisplayName();
                            if ( factType != null && factType.length() > 0 ) {
                                label.append( factType );
                            }
                        } else if ( ac instanceof BRLActionVariableColumn ) {
                            String factType = ( (BRLActionVariableColumn) ac ).getVarName();
                            if ( factType != null && factType.length() > 0 ) {
                                label.append( factType );
                            }
                        }

                        tce.appendChild( makeLabel( label.toString(),
                                                    col.getWidth(),
                                                    ( splitter.isCollapsed ? 0 : resources.rowHeaderHeight() ) ) );
                    }
                    break;

                case 3:
                    // Condition Fact Fields
                    for ( DynamicColumn<BaseColumn> col : visibleConditionCols ) {
                        tce = DOM.createTD();
                        tce.addClassName( resources.headerText() );
                        tce.addClassName( resources.headerRowIntermediate() );
                        tce.addClassName( resources.cellTableColumn( col.getModelColumn() ) );
                        tre.appendChild( tce );
                        ConditionCol52 cc = (ConditionCol52) col.getModelColumn();

                        //Make applicable label (TODO move to Factory method)
                        StringBuilder label = new StringBuilder();
                        if ( cc instanceof LimitedEntryBRLConditionColumn ) {
                            //Nothing needed
                        } else if ( cc instanceof BRLConditionVariableColumn ) {
                            BRLConditionVariableColumn brl = (BRLConditionVariableColumn) cc;
                            String field = brl.getFactField();
                            label.append( field == null ? "" : field );
                        } else if ( cc instanceof ConditionCol52 ) {
                            String factField = cc.getFactField();
                            if ( factField != null && factField.length() > 0 ) {
                                label.append( factField );
                            }
                            if ( cc.getConstraintValueType() != BaseSingleFieldConstraint.TYPE_PREDICATE ) {
                                label.append( " [" );
                                label.append( cc.getOperator() );
                                String lev = getLimitedEntryValue( cc );
                                if ( lev != null ) {
                                    label.append( lev );
                                }
                                label.append( "]" );
View Full Code Here

TOP

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

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.