Package org.drools.guvnor.client.common

Examples of org.drools.guvnor.client.common.DirtyableFlexTable


        };


        String lbl = "<div class='x-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'>" + 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'>" + constants.clickToAddPattern() + "</font>", sourcePatternClick, !this.readOnly));
        } else {
            IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();

            if (rPattern instanceof FactPattern) {
                this.sourcePatternWidget = new FactPatternWidget(this.getModeller(), rPattern, constants.All0with(), true,this.readOnly);
            } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
                this.sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(), (FromAccumulateCompositeFactPattern) rPattern,this.readOnly);
            } else if (rPattern instanceof FromCollectCompositeFactPattern) {
                this.sourcePatternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(), (FromCollectCompositeFactPattern) rPattern,this.readOnly);
            } else if (rPattern instanceof FromCompositeFactPattern) {
                this.sourcePatternWidget = new FromCompositeFactPatternWidget(this.getModeller(), (FromCompositeFactPattern) rPattern,this.readOnly);
            } else {
                throw new IllegalArgumentException("Unsuported pattern " + rPattern + " for right side of FROM ACCUMULATE");
            }

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

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

                public void onClick(Widget sender) {
                    if (Window.confirm(constants.RemoveThisBlockOfData())) {
                        setModified(true);
                        getFromAccumulatePattern().setSourcePattern(null);
                        getModeller().refreshWidget();
                    }
                }
            }));
        }

        TabPanel tPanel = new TabPanel();

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

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Init:</div>"));
        final TextBox initField = new TextBox();
        initField.setTitle("init code");
        initField.setText(getFromAccumulatePattern().getInitCode());
        codeTable.setWidget(codeTableRow++, codeTableCol--, initField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Action:</div>"));
        final TextBox actionField = new TextBox();
        actionField.setTitle("action code");
        actionField.setText(getFromAccumulatePattern().getActionCode());
        codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Reverse:</div>"));
        final TextBox reverseField = new TextBox();
        reverseField.setTitle("reverse code.");
        reverseField.setText(getFromAccumulatePattern().getReverseCode());
        codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Result:</div>"));
        final TextBox resultField = new TextBox();
        resultField.setTitle("result code");
        resultField.setText(getFromAccumulatePattern().getResultCode());
        codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);


        //panel.setWidget(r++, 0, codeTable);
        Panel codePanel = new Panel();
        codePanel.setAutoWidth(true);
        codePanel.setClosable(false);
        codePanel.setTitle("Custom Code");
        codePanel.setAutoHeight(true);
        codePanel.add(codeTable);
        codePanel.setDisabled(this.readOnly);
        tPanel.add(codePanel);

        DirtyableFlexTable functionTable = new DirtyableFlexTable();

        functionTable.setWidget(0, 0, new HTML("<div class='x-form-field'>Function:</div>"));
        final TextBox functionField = new TextBox();
        functionField.setTitle("function code");
        functionField.setText(getFromAccumulatePattern().getFunction());
        functionTable.setWidget(0, 1, functionField);

//        panel.setWidget(r++, 0, functionTable);

        Panel functionPanel = new Panel();
        functionPanel.setAutoWidth(true);
View Full Code Here


                                      Boolean readOnly) {
        super(modeller);
        this.completions = modeller.getSuggestionCompletions();
        this.pattern = pattern;

        this.layout = new DirtyableFlexTable();
        this.layout.setStyleName( "model-builderInner-Background" );

        if (readOnly != null){
            this.readOnly = readOnly;
        }else{
View Full Code Here

        };


        String lbl = "<div class='x-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'>" + 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'>" + constants.clickToAddPatterns() + "</font>", rightPatternclick, !this.readOnly));
        } else {
            IPattern rPattern = this.getFromCollectPattern().getRightPattern();

            RuleModellerWidget patternWidget = null;
            if (rPattern instanceof FactPattern) {
                patternWidget = new FactPatternWidget(this.getModeller(), rPattern, constants.All0with(), true, this.readOnly);
            } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
                patternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(), (FromAccumulateCompositeFactPattern) rPattern,this.readOnly);
            } else if (rPattern instanceof FromCollectCompositeFactPattern) {
                patternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(), (FromCollectCompositeFactPattern) rPattern,this.readOnly);
            } else if (rPattern instanceof FromCompositeFactPattern) {
                patternWidget = new FromCompositeFactPatternWidget(this.getModeller(), (FromCompositeFactPattern) rPattern,this.readOnly);
            } else if (rPattern instanceof FreeFormLine) {
                patternWidget = new FreeFormLineWidget(this.getModeller(), (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 ClickListener() {

                public void onClick(Widget sender) {
                    if (Window.confirm(constants.RemoveThisBlockOfData())) {
View Full Code Here

        }else{
            this.readOnly = readOnly;
        }


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

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

        DirtyableFlexTable panel = new DirtyableFlexTable();

        int r = 0;

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


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

        return panel;
    }
View Full Code Here

        this.model = (RuleModel) asset.content;
        this.packageName = asset.metaData.packageName;

        this.widgetFactory = widgetFactory;
       
        layout = new DirtyableFlexTable();

        initWidget();

        layout.setStyleName("model-builder-Background");
        initWidget(layout);
View Full Code Here

    public ActionCallMethodWidget(RuleModeller mod,
                                  ActionCallMethod set, Boolean readOnly) {
        super(mod);
        this.model = set;
        this.layout = new DirtyableFlexTable();

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

        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        if ( completions.isGlobalVariable( set.variable ) ) {
View Full Code Here

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

            inner.setWidget( i,
                             0,
                             fieldSelector( val ) );
            inner.setWidget( i,
                             1,
                             valueEditor( val ) );
            final int idx = i;
            /*
             * It is not possible to remove a parameter of a function
View Full Code Here

    }



  private FlexTable render(final List rfl, final Scenario sc) {
    FlexTable data = new DirtyableFlexTable();


        for (int i = 0; i < rfl.size(); i++) {
            final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);

            if (showResults && v.successResult != null) {
              if (!v.successResult.booleanValue()) {
                data.setWidget(i, 0, new Image("images/warning.gif")); //NON-NLS
                    data.setWidget(i, 4, new HTML(Format.format(constants.ActualResult(), v.actualResult)));

                data.getCellFormatter().addStyleName(i, 4, "testErrorValue");   //NON-NLS

              } else {
                data.setWidget(i, 0, new Image("images/test_passed.png"));     //NON-NLS
              }

            }
            data.setWidget(i, 1, new SmallLabel(v.ruleName + ":"));
            data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);


            final ListBox b = new ListBox();
            b.addItem(constants.firedAtLeastOnce(), "y");
            b.addItem(constants.didNotFire(), "n");
            b.addItem(constants.firedThisManyTimes(), "e");
            final TextBox num = new TextBox();
            num.setVisibleLength(5);

            if (v.expectedFire != null ) {
                b.setSelectedIndex((v.expectedFire.booleanValue()) ? 0 : 1);
                num.setVisible(false);
            } else {
                b.setSelectedIndex(2);
                String xc = (v.expectedCount != null)? "" + v.expectedCount.intValue() : "0";
                num.setText(xc);
            }

            b.addChangeListener(new ChangeListener() {
                public void onChange(Widget w) {
                    String s = b.getValue(b.getSelectedIndex());
                    if (s.equals("y") || s.equals("n")) {
                        num.setVisible(false);
                        v.expectedFire = (s.equals("y")) ? Boolean.TRUE : Boolean.FALSE;
                        v.expectedCount = null;
                    } else {
                        num.setVisible(true);
                        v.expectedFire = null;
                        num.setText("1"); v.expectedCount = new Integer(1);
                    }
                }
            });

            b.addItem(constants.ChooseDotDotDot());

            num.addChangeListener(new ChangeListener() {
                public void onChange(Widget w) {
                    v.expectedCount = new Integer(num.getText());
                }
            });

            HorizontalPanel h = new HorizontalPanel();
            h.add(b); h.add(num);
            data.setWidget(i, 2, h);

            Image del = new ImageButton("images/delete_item_small.gif", constants.RemoveThisRuleExpectation(), new ClickListener() {
        public void onClick(Widget w) {
          if (Window.confirm(constants.AreYouSureYouWantToRemoveThisRuleExpectation())) {
            rfl.remove(v);
            sc.removeFixture(v);
            outer.setWidget(1, 0, render(rfl, sc));
          }
        }
      });

            data.setWidget(i, 3, del);



            //we only want numbers here...
            num.addKeyboardListener(new KeyboardListener() {
View Full Code Here

    }

    public ActionSetFieldWidget(RuleModeller mod, ActionSetField set, Boolean readOnly) {
        super(mod);
        this.model = set;
        this.layout = new DirtyableFlexTable();

        layout.setStyleName("model-builderInner-Background");

        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
View Full Code Here

TOP

Related Classes of org.drools.guvnor.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.