Package org.kie.uberfire.client.common

Examples of org.kie.uberfire.client.common.DirtyableFlexTable


        this.scenario = scenario;
        this.mCall = mCall;
        this.executionTrace = executionTrace;
        this.oracle = oracle;

        this.layout = new DirtyableFlexTable();

        layout.setStyleName( "model-builderInner-Background" ); // NON-NLS

        if ( this.oracle.isGlobalVariable( mCall.getVariable() ) ) {
View Full Code Here


    private void doLayout() {
        layout.clear();
        layout.setWidget( 0,
                          0,
                          getSetterLabel() );
        DirtyableFlexTable inner = new DirtyableFlexTable();
        int i = 0;
        for ( CallFieldValue val : mCall.getCallFieldValues() ) {

            inner.setWidget( i,
                             0,
                             fieldSelector( val ) );
            inner.setWidget( i,
                             1,
                             valueEditor( val ) );
            i++;
        }
        layout.setWidget( 0,
View Full Code Here

        //Remove body (i.e Test Scenario definition) when refreshing; leaving Test Scenario Runner widget
        if (this.layout.getWidgetCount() == 2) {
            this.layout.remove(1);
        }

        DirtyableFlexTable editorLayout = scenarioWidgetComponentCreator.createDirtyableFlexTable();
        this.layout.add(editorLayout);
        ScenarioHelper scenarioHelper = new ScenarioHelper();

        List<Fixture> fixtures = scenarioHelper.lumpyMap(getScenario().getFixtures());
        List<ExecutionTrace> listExecutionTrace = scenarioHelper.getExecutionTraceFor(fixtures);

        int layoutRow = 1;
        int executionTraceLine = 0;
        ExecutionTrace previousExecutionTrace = null;
        for (final Fixture fixture : fixtures) {
            if (fixture instanceof ExecutionTrace) {
                ExecutionTrace currentExecutionTrace = (ExecutionTrace) fixture;
                createWidgetForEditorLayout(editorLayout,
                        layoutRow,
                        0,
                        scenarioWidgetComponentCreator.createExpectPanel(currentExecutionTrace));

                executionTraceLine++;
                if (executionTraceLine >= listExecutionTrace.size()) {
                    executionTraceLine = listExecutionTrace.size() - 1;
                }
                createWidgetForEditorLayout(editorLayout,
                        layoutRow,
                        1,
                        scenarioWidgetComponentCreator.createExecutionWidget(currentExecutionTrace));
                editorLayout.setHorizontalAlignmentForFlexCellFormatter(layoutRow,
                        2,
                        HasHorizontalAlignment.ALIGN_LEFT);

                previousExecutionTrace = currentExecutionTrace;
View Full Code Here

        disclosurePanel.add( config );
        container.setWidget( disclosurePanel );

        for ( final Characteristic characteristic : model.getCharacteristics() ) {
            final DirtyableFlexTable flexTable = addCharacteristic( characteristic );
            for ( Attribute attribute : characteristic.getAttributes() ) {
                addAttribute( flexTable,
                              attribute );
            }
        }
View Full Code Here

            }
        }
    }

    private DirtyableFlexTable addCharacteristic( final Characteristic characteristic ) {
        final DirtyableFlexTable cGrid = new DirtyableFlexTable();
        cGrid.setBorderWidth( 0 );
        cGrid.setCellPadding( 1 );
        cGrid.setCellSpacing( 1 );

        cGrid.setStyleName( "rule-ListHeader" );

        Button btnAddAttribute = new Button( GuidedScoreCardConstants.INSTANCE.addAttribute(),
                                             new ClickHandler() {
                                                 public void onClick( final ClickEvent event ) {
                                                     addAttribute( cGrid,
                                                                   null );
                                                 }
                                             } );

        Button btnRemoveCharacteristic = new Button( GuidedScoreCardConstants.INSTANCE.removeCharacteristic(),
                                                     new ClickHandler() {
                                                         public void onClick( ClickEvent event ) {
                                                             removeCharacteristic( cGrid );
                                                         }
                                                     } );

        String selectedFact = "";
        if ( characteristic != null ) {
            selectedFact = characteristic.getFact();
            if ( selectedFact.lastIndexOf( "." ) > -1 ) {
                selectedFact = selectedFact.substring( selectedFact.lastIndexOf( "." ) + 1 );
            }
        }

        //Fields List Box
        final ListBox dropDownFields = new ListBox();

        //Facts List Box
        final ListBox dropDownFacts = new ListBox();
        final String[] eligibleFacts = oracle.getFactTypes();
        for ( final String factType : eligibleFacts ) {
            dropDownFacts.addItem( factType );
        }
        dropDownFacts.addChangeHandler( new ChangeHandler() {

            @Override
            public void onChange( final ChangeEvent event ) {
                characteristicFactChanged( characteristic,
                                           dropDownFacts,
                                           dropDownFields );
            }

        } );
        final int selectedFactIndex = Arrays.asList( eligibleFacts ).indexOf( selectedFact );
        dropDownFacts.setSelectedIndex( selectedFactIndex >= 0 ? selectedFactIndex : 0 );
        characteristicFactChanged( characteristic,
                                   dropDownFacts,
                                   dropDownFields );

        cGrid.setWidget( 0,
                         0,
                         new Label( GuidedScoreCardConstants.INSTANCE.name() ) );
        final TextBox tbName = TextBoxFactory.getTextBox( DataType.TYPE_STRING );
        cGrid.setWidget( 0,
                         1,
                         tbName );
        cGrid.setWidget( 0,
                         2,
                         btnRemoveCharacteristic );
        cGrid.setWidget( 0,
                         3,
                         btnAddAttribute );

        cGrid.setWidget( 1,
                         0,
                         new Label( GuidedScoreCardConstants.INSTANCE.fact() ) );
        cGrid.setWidget( 1,
                         1,
                         new Label( GuidedScoreCardConstants.INSTANCE.characteristic() ) );
        cGrid.setWidget( 1,
                         2,
                         new Label( GuidedScoreCardConstants.INSTANCE.baselineScore() ) );
        cGrid.setWidget( 1,
                         3,
                         new Label( GuidedScoreCardConstants.INSTANCE.reasonCode() ) );

        cGrid.setWidget( 2,
                         0,
                         dropDownFacts );
        cGrid.setWidget( 2,
                         1,
                         dropDownFields );

        final TextBox tbBaseline = TextBoxFactory.getTextBox( DataType.TYPE_NUMERIC_DOUBLE );
        final boolean useReasonCodesValue = "true".equalsIgnoreCase( ddUseReasonCode.getValue( ddUseReasonCode.getSelectedIndex() ) );
        tbBaseline.setEnabled( useReasonCodesValue );
        cGrid.setWidget( 2,
                         2,
                         tbBaseline );

        final TextBox tbReasonCode = TextBoxFactory.getTextBox( DataType.TYPE_STRING );
        tbReasonCode.setEnabled( useReasonCodesValue );
        cGrid.setWidget( 2,
                         3,
                         tbReasonCode );

        final SimplePanel gapPanel = new SimplePanel();
        gapPanel.add( new HTML( "<br/>" ) );

        final VerticalPanel panel = new VerticalPanel();
        panel.add( cGrid );
        characteristicsAttrPanelMap.put( cGrid, panel );
        //panel.add( addAttributeCellTable( cGrid, characteristic ) );
        panel.setWidth( "100%" );
        DecoratorPanel decoratorPanel = new DecoratorPanel();
        decoratorPanel.add( panel );

        characteristicsPanel.add( decoratorPanel );
        characteristicsPanel.add( gapPanel );
        characteristicsTables.add( cGrid );

        cGrid.getColumnFormatter().setWidth( 0, "150px" );
        cGrid.getColumnFormatter().setWidth( 1, "250px" );
        cGrid.getColumnFormatter().setWidth( 2, "150px" );
        cGrid.getColumnFormatter().setWidth( 3, "150px" );

        if ( characteristic != null ) {
            tbReasonCode.setValue( characteristic.getReasonCode() );
            tbBaseline.setValue( "" + characteristic.getBaselineScore() );
            tbName.setValue( characteristic.getName() );
View Full Code Here

    private void doLayout() {
        layout.clear();
        layout.setWidget( 0,
                          0,
                          getSetterLabel() );
        DirtyableFlexTable inner = new DirtyableFlexTable();
        for ( int i = 0; i < model.getFieldValues().length; i++ ) {
            ActionFieldFunction val = model.getFieldValue( i );

            inner.setWidget( i,
                             0,
                             typeLabel( val.getType() ) );
            inner.setWidget( i,
                             1,
                             valueEditor( val ) );

        }
        layout.setWidget( 0,
View Full Code Here

            }
        };

        String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName( "from collect" ) + "</div>";

        DirtyableFlexTable panel = new DirtyableFlexTable();

        int r = 0;

        if ( pattern.getFactPattern() == null ) {
            panel.setWidget( r++,
                             0,
                             new ClickableLabel( "<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>",
                                                 leftPatternclick,
                                                 !this.readOnly ) );
        }

        panel.setWidget( r++,
                         0,
                         new HTML( lbl ) );

        if ( this.getFromCollectPattern().getRightPattern() == null ) {
            panel.setWidget( r++,
                             0,
                             new ClickableLabel( "<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>",
                                                 rightPatternclick,
                                                 !this.readOnly ) );
        } else {
            IPattern rPattern = this.getFromCollectPattern().getRightPattern();

            RuleModellerWidget patternWidget = null;
            if ( rPattern instanceof FactPattern ) {
                patternWidget = new FactPatternWidget( this.getModeller(),
                                                       this.getEventBus(),
                                                       rPattern,
                                                       true,
                                                       true,
                                                       this.readOnly );

            } else if ( rPattern instanceof FromAccumulateCompositeFactPattern ) {
                patternWidget = new FromAccumulateCompositeFactPatternWidget( this.getModeller(),
                                                                              this.getEventBus(),
                                                                              (FromAccumulateCompositeFactPattern) rPattern,
                                                                              this.readOnly );

            } else if ( rPattern instanceof FromCollectCompositeFactPattern ) {
                patternWidget = new FromCollectCompositeFactPatternWidget( this.getModeller(),
                                                                           this.getEventBus(),
                                                                           (FromCollectCompositeFactPattern) rPattern,
                                                                           this.readOnly );

            } else if ( rPattern instanceof FromEntryPointFactPattern ) {
                patternWidget = new FromEntryPointFactPatternWidget( this.getModeller(),
                                                                     this.getEventBus(),
                                                                     (FromEntryPointFactPattern) rPattern,
                                                                     this.readOnly );

            } else if ( rPattern instanceof FromCompositeFactPattern ) {
                patternWidget = new FromCompositeFactPatternWidget( this.getModeller(),
                                                                    this.getEventBus(),
                                                                    (FromCompositeFactPattern) rPattern,
                                                                    this.readOnly );

            } else if ( rPattern instanceof FreeFormLine ) {
                patternWidget = new FreeFormLineWidget( this.getModeller(),
                                                        this.getEventBus(),
                                                        (FreeFormLine) rPattern,
                                                        this.readOnly );
            } else {
                throw new IllegalArgumentException( "Unsuported pattern " + rPattern + " for right side of FROM COLLECT" );
            }

            patternWidget.addOnModifiedCommand( new Command() {
                public void execute() {
                    setModified( true );
                }
            } );

            panel.setWidget( r++,
                             0,
                             addRemoveButton( patternWidget,
                                              new ClickHandler() {

                                                  public void onClick( ClickEvent event ) {
View Full Code Here

        } else {
            this.readOnly = readOnly;
            this.isFactTypeKnown = true;
        }

        this.layout = new DirtyableFlexTable();
        if ( this.readOnly ) {
            this.layout.addStyleName( "editor-disabled-widget" );
        }
        this.layout.addStyleName( "model-builderInner-Background" );
View Full Code Here

            }
        };
        String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName( "from" ) + "&nbsp;</div>";

        DirtyableFlexTable panel = new DirtyableFlexTable();

        int r = 0;

        if ( pattern.getFactPattern() == null ) {
            panel.setWidget( r,
                             0,
                             new ClickableLabel( "<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>",
                                                 click,
                                                 !this.readOnly ) );
            r++;
        }

        panel.setWidget( r,
                         0,
                         new HTML( lbl ) );
        ExpressionBuilder expressionBuilder = new ExpressionBuilder( this.getModeller(),
                                                                     this.getEventBus(),
                                                                     this.pattern.getExpression(),
                                                                     this.readOnly );
        expressionBuilder.addOnModifiedCommand( new Command() {
            public void execute() {
                setModified( true );
            }
        } );
        panel.setWidget( r,
                         1,
                         expressionBuilder );

        return panel;
    }
View Full Code Here

            }
        };

        String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName( "from accumulate" ) + "</div>";

        DirtyableFlexTable panel = new DirtyableFlexTable();

        int r = 0;

        if ( pattern.getFactPattern() == null ) {
            panel.setWidget( r++,
                             0,
                             new ClickableLabel( "<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPattern() + "</font>",
                                                 leftPatternclick,
                                                 !this.readOnly ) );
        }

        panel.setWidget( r++,
                         0,
                         new HTML( lbl ) );

        if ( this.getFromAccumulatePattern().getSourcePattern() == null ) {
            panel.setWidget( r++,
                             0,
                             new ClickableLabel( "<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPattern() + "</font>",
                                                 sourcePatternClick,
                                                 !this.readOnly ) );
        } else {
            IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();

            RuleModellerWidget sourcePatternWidget;
            if ( rPattern instanceof FactPattern ) {
                sourcePatternWidget = new FactPatternWidget( this.getModeller(),
                                                             getEventBus(),
                                                             rPattern,
                                                             true,
                                                             true,
                                                             this.readOnly );

            } else if ( rPattern instanceof FromAccumulateCompositeFactPattern ) {
                sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget( this.getModeller(),
                                                                                    this.getEventBus(),
                                                                                    (FromAccumulateCompositeFactPattern) rPattern,
                                                                                    this.readOnly );

            } else if ( rPattern instanceof FromCollectCompositeFactPattern ) {
                sourcePatternWidget = new FromCollectCompositeFactPatternWidget( this.getModeller(),
                                                                                 this.getEventBus(),
                                                                                 (FromCollectCompositeFactPattern) rPattern,
                                                                                 this.readOnly );

            } else if ( rPattern instanceof FromEntryPointFactPattern ) {
                sourcePatternWidget = new FromEntryPointFactPatternWidget( this.getModeller(),
                                                                           this.getEventBus(),
                                                                           (FromEntryPointFactPattern) rPattern,
                                                                           this.readOnly );

            } else if ( rPattern instanceof FromCompositeFactPattern ) {
                sourcePatternWidget = new FromCompositeFactPatternWidget( this.getModeller(),
                                                                          this.getEventBus(),
                                                                          (FromCompositeFactPattern) rPattern,
                                                                          this.readOnly );
            } else {
                throw new IllegalArgumentException( "Unsupported pattern "
                                                            + rPattern + " for right side of FROM ACCUMULATE" );
            }

            sourcePatternWidget.addOnModifiedCommand( new Command() {
                public void execute() {
                    setModified( true );
                }
            } );

            panel.setWidget( r++,
                             0,
                             addRemoveButton( sourcePatternWidget,
                                              new ClickHandler() {

                                                  public void onClick( ClickEvent event ) {
                                                      if ( Window.confirm( GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData() ) ) {
                                                          setModified( true );
                                                          getFromAccumulatePattern().setSourcePattern( null );
                                                          getModeller().refreshWidget();
                                                      }

                                                  }
                                              } ) );
        }

        //REVISIT: Nested TabLayoutPanel does not work, its content is truncated.
        //TabLayoutPanel tPanel = new TabLayoutPanel(2, Unit.EM);
        TabPanel tPanel = new TabPanel();

        DirtyableFlexTable codeTable = new DirtyableFlexTable();
        int codeTableRow = 0;
        int codeTableCol = 0;

        codeTable.setWidget( codeTableRow,
                             codeTableCol++,
                             new HTML( "<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Init() +":</div>" ) );

        final TextBox initField = new TextBox();
        initField.setTitle( GuidedRuleEditorResources.CONSTANTS.InitCode() );
        initField.setText( getFromAccumulatePattern().getInitCode() );
        initField.setEnabled( !this.readOnly );
        codeTable.setWidget( codeTableRow++,
                             codeTableCol--,
                             initField );

        codeTable.setWidget( codeTableRow,
                             codeTableCol++,
                             new HTML( "<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Action() + ":</div>" ) );
        final TextBox actionField = new TextBox();
        actionField.setTitle( GuidedRuleEditorResources.CONSTANTS.ActionCode() );
        actionField.setText( getFromAccumulatePattern().getActionCode() );
        actionField.setEnabled( !this.readOnly );
        codeTable.setWidget( codeTableRow++,
                             codeTableCol--,
                             actionField );

        codeTable.setWidget( codeTableRow,
                             codeTableCol++,
                             new HTML( "<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Reverse() + ":</div>" ) );
        final TextBox reverseField = new TextBox();
        reverseField.setTitle( GuidedRuleEditorResources.CONSTANTS.ReverseCode() );
        reverseField.setText( getFromAccumulatePattern().getReverseCode() );
        reverseField.setEnabled( !this.readOnly );
        codeTable.setWidget( codeTableRow++,
                             codeTableCol--,
                             reverseField );

        codeTable.setWidget( codeTableRow,
                             codeTableCol++,
                             new HTML( "<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Result() + ":</div>" ) );
        final TextBox resultField = new TextBox();
        resultField.setTitle( GuidedRuleEditorResources.CONSTANTS.ResultCode() );
        resultField.setText( getFromAccumulatePattern().getResultCode() );
        resultField.setEnabled( !this.readOnly );
        codeTable.setWidget( codeTableRow++,
                             codeTableCol--,
                             resultField );

        //panel.setWidget(r++, 0, codeTable);
        ScrollPanel codePanel = new ScrollPanel();
        codePanel.add( codeTable );

        tPanel.add( codePanel,
                GuidedRuleEditorResources.CONSTANTS.CustomCode() );

        DirtyableFlexTable functionTable = new DirtyableFlexTable();

        functionTable.setWidget( 0,
                                 0,
                                 new HTML( "<div class='form-field'>" + GuidedRuleEditorResources.CONSTANTS.Function() + ":</div>" ) );
        final TextBox functionField = new TextBox();
        functionField.setTitle( GuidedRuleEditorResources.CONSTANTS.FunctionCode() );
        functionField.setText( getFromAccumulatePattern().getFunction() );
        functionField.setEnabled( !this.readOnly );
        functionTable.setWidget( 0,
                                 1,
                                 functionField );

        //        panel.setWidget(r++, 0, functionTable);
View Full Code Here

TOP

Related Classes of org.kie.uberfire.client.common.DirtyableFlexTable

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.