Package org.drools.guvnor.client.modeldriven.brl

Examples of org.drools.guvnor.client.modeldriven.brl.ActionFieldValue


    }

    public void testAdd() {
        final ActionSetField set = new ActionSetField();
        set.fieldValues = new ActionFieldValue[2];
        final ActionFieldValue v0 = new ActionFieldValue( "x",
                                                          "42",
                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
        final ActionFieldValue v1 = new ActionFieldValue( "y",
                                                          "43",
                                                          SuggestionCompletionEngine.TYPE_NUMERIC );
        set.fieldValues[0] = v0;
        set.fieldValues[1] = v1;

        final ActionFieldValue q = new ActionFieldValue( "q",
                                                         "q",
                                                         SuggestionCompletionEngine.TYPE_NUMERIC );
        set.addFieldValue( q );

        assertEquals( 3,
View Full Code Here


import org.drools.guvnor.client.modeldriven.brl.ActionFieldValue;

public class ActionFieldValueTest extends TestCase {

    public void testFormula() {
        ActionFieldValue val = new ActionFieldValue( "x",
                                                     "y",
                                                     SuggestionCompletionEngine.TYPE_NUMERIC );
        assertFalse( val.isFormula() );
        val = new ActionFieldValue( "x",
                                    "=y * 20",
                                    SuggestionCompletionEngine.TYPE_NUMERIC );
        assertTrue( val.isFormula() );
    }
View Full Code Here

        layout.setWidget( 0, 0, getAssertLabel() );

        DirtyableFlexTable inner = new DirtyableFlexTable();

        for ( int i = 0; i < model.fieldValues.length; i++ ) {
            ActionFieldValue val = model.fieldValues[i];

            inner.setWidget( i, 0, fieldSelector(val) );
            inner.setWidget( i, 1, valueEditor(val) );
            final int idx = i;
            Image remove = new ImageButton("images/delete_item_small.gif");
View Full Code Here

        popup.addAttribute(constants.AddField(), box );
        box.addChangeListener( new ChangeListener() {
            public void onChange(Widget w) {
                String fieldName = box.getItemText( box.getSelectedIndex() );
                String fieldType = completions.getFieldType( model.factType, fieldName );
                model.addFieldValue( new ActionFieldValue( fieldName, "", fieldType ) );
                modeller.refreshWidget();
                popup.hide();
            }
        });
View Full Code Here

        layout.setWidget( 0, 0, getSetterLabel() );

        DirtyableFlexTable inner = new DirtyableFlexTable();

        for ( int i = 0; i < model.fieldValues.length; i++ ) {
            ActionFieldValue val = model.fieldValues[i];

            inner.setWidget( i, 0, fieldSelector(val) );
            inner.setWidget( i, 1, valueEditor(val) );
            final int idx = i;
            Image remove = new ImageButton("images/delete_item_small.gif"); //NON-NLS
View Full Code Here

        box.addChangeListener( new ChangeListener() {
            public void onChange(Widget w) {
                String fieldName = box.getItemText( box.getSelectedIndex() );

                String fieldType = completions.getFieldType( variableClass, fieldName );
                model.addFieldValue( new ActionFieldValue( fieldName, "", fieldType ) );
                modeller.refreshWidget();
                popup.hide();
            }
        });
View Full Code Here

      Object _typeField = dataEnumLookupFields.get(type + "." + field );

      if (_typeField instanceof String) {
        String typeField = (String) dataEnumLookupFields.get(type + "." + field );
        for (int i = 0; i < currentValues.length; i++) {
          ActionFieldValue val = currentValues[i];
          if (val.field.equals(typeField)) {
            String key = type + "." + field + "[" + typeField + "=" + val.value + "]";
            return DropDownData.create((String[]) this.dataEnumLists.get(key));
          }
        }
      } else if (_typeField != null) {
        String[] fieldsNeeded = (String[]) _typeField;
        String queryString = getQueryString(type, field, this.dataEnumLists);
        String[] valuePairs = new String[fieldsNeeded.length];

        //collect all the values of the fields needed, then return it as a string...
        for (int i = 0; i < fieldsNeeded.length; i++) {
          for (int j = 0; j < currentValues.length; j++) {
            ActionFieldValue con = currentValues[j];
              if (con.field.equals(fieldsNeeded[i])) {
                valuePairs[i] = fieldsNeeded[i] + "=" + con.value;
              }
          }
        }
View Full Code Here

                if( isDSLEnhanced ) {
                    buf.append( ">" );
                }
                buf.append( variableName );

                ActionFieldValue value = fieldValues[i];
                if (value instanceof ActionFieldFunction) {
                    buf.append(".");
                    buf.append(value.field);
                } else {
                buf.append( ".set" );
View Full Code Here

            ActionInsertFact ins = new ActionInsertFact(ac.factType);
            a.action = ins;
            actions.add(a);
          }
          ActionInsertFact ins = (ActionInsertFact) a.action;
          ActionFieldValue val = new ActionFieldValue(ac.factField, cell, ac.type);
          ins.addFieldValue(val);
        } else if (c instanceof ActionRetractFactCol) {
          ActionRetractFactCol rf = (ActionRetractFactCol)c;
          LabelledAction a = find(actions, rf.boundName);
          if (a == null) {
            a = new LabelledAction();
            a.action = new ActionRetractFact(rf.boundName);
            a.boundName = rf.boundName;
            actions.add(a);
          }
        } else if (c instanceof ActionSetFieldCol) {
          ActionSetFieldCol sf = (ActionSetFieldCol)c;
          LabelledAction a = find(actions, sf.boundName);
          if (a == null) {
            a = new LabelledAction();
            a.boundName = sf.boundName;
            a.action = new ActionSetField(sf.boundName);
            actions.add(a);
          }
          ActionSetField asf = (ActionSetField) a.action;
          ActionFieldValue val = new ActionFieldValue(sf.factField, cell, sf.type);
          asf.addFieldValue(val);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.modeldriven.brl.ActionFieldValue

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.