Package org.drools.ide.common.client.modeldriven.brl

Examples of org.drools.ide.common.client.modeldriven.brl.ExpressionFormLine


public class CopyExpressionVisitorTest {

    @Test
    public void testCopy() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fp = new FactPattern(SuggestionCompletionEngine.TYPE_OBJECT);
    fp.boundName = "$o";
    efl.appendPart(new ExpressionVariable(fp));
    ExpressionMethod em = new ExpressionMethod("aMethod", "aClass", "aType");
   
    ExpressionFormLine param = new ExpressionFormLine();
    param.appendPart(new ExpressionText("\"hello world\""));
    em.putParam("hi", param);
   
    efl.appendPart(em);
   
   
    ExpressionCollectionIndex index = new ExpressionCollectionIndex("get", "aRetType", "aGeneric");
    efl.appendPart(index);
   
    index = new ExpressionCollectionIndex("get2", "aRetType", "aGeneric");
    efl.appendPart(index);
   
    System.out.println(efl.getText());
    ExpressionFormLine copy = new ExpressionFormLine(efl);
    assertNotSame(efl, copy);
    assertEquals(efl.getText(), copy.getText());
    for (ExpressionPart e1 = efl.getRootExpression(), e2 = copy.getRootExpression(); e1 != null; e1 = e1.getNext(), e2 = e2.getNext()) {
      assertNotSame(e1, e2);
      assertEquals(e1.getClass(), e2.getClass());
    }
  }
View Full Code Here


public class ExpressionFormLineTest {

  @Test
  public void toStringText() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fact = new FactPattern("String");
    fact.boundName = "$v";
    efl.appendPart(new ExpressionVariable(fact));
    efl.appendPart(new ExpressionMethod("size", "int", SuggestionCompletionEngine.TYPE_NUMERIC));
      assertEquals("$v.size()", efl.getText());
   
    efl.setBinding("$s");
   
      assertEquals("$s: $v.size()", efl.getText(true));
   
  }
View Full Code Here

                                                                 "java.lang.Object",
                                                                 SuggestionCompletionEngine.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        SuggestionCompletionEngine.TYPE_NUMERIC ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
                                          index );
                expression.appendPart( collectionIndex );
            }
View Full Code Here

            ebBtn.addClickHandler( new ClickHandler() {
                public void onClick(ClickEvent event) {
                    SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                    con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                    pattern.addConstraint( con );
                    con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                    modeller.refreshWidget();
                    popup.hide();
                }
            } );
            popup.addAttribute( constants.ExpressionEditor(),
View Full Code Here

public class CopyExpressionVisitorTest {

  @Test
  public void testCopy() {
    ExpressionFormLine efl = new ExpressionFormLine();
    FactPattern fp = new FactPattern(SuggestionCompletionEngine.TYPE_OBJECT);
    fp.boundName = "$o";
    efl.appendPart(new ExpressionVariable(fp));
    ExpressionMethod em = new ExpressionMethod("aMethod", "aClass", "aType");
   
    ExpressionFormLine param = new ExpressionFormLine();
    param.appendPart(new ExpressionText("\"hello world\""));
    em.putParam("hi", param);
   
    efl.appendPart(em);
   
   
    ExpressionCollectionIndex index = new ExpressionCollectionIndex("get", "aRetType", "aGeneric");
    efl.appendPart(index);
   
    index = new ExpressionCollectionIndex("get2", "aRetType", "aGeneric");
    efl.appendPart(index);
   
    System.out.println(efl.getText());
    ExpressionFormLine copy = new ExpressionFormLine(efl);
    assertNotSame(efl, copy);
    assertEquals(efl.getText(), copy.getText());
    for (ExpressionPart e1 = efl.getRootExpression(), e2 = copy.getRootExpression(); e1 != null; e1 = e1.getNext(), e2 = e2.getNext()) {
      assertNotSame(e1, e2);
      assertEquals(e1.getClass(), e2.getClass());
    }
  }
View Full Code Here

public class CopyExpressionVisitorTest {

    @Test
    public void testCopy() {
        ExpressionFormLine efl = new ExpressionFormLine();
        FactPattern fp = new FactPattern(SuggestionCompletionEngine.TYPE_OBJECT);
        fp.setBoundName("$o");
        efl.appendPart(new ExpressionVariable(fp));
        ExpressionMethod em = new ExpressionMethod("aMethod", "aClass", "aType");

        ExpressionFormLine param = new ExpressionFormLine();
        param.appendPart(new ExpressionText("\"hello world\""));
        em.putParam("hi", param);

        efl.appendPart(em);


        ExpressionCollectionIndex index = new ExpressionCollectionIndex("get", "aRetType", "aGeneric");
        efl.appendPart(index);

        index = new ExpressionCollectionIndex("get2", "aRetType", "aGeneric");
        efl.appendPart(index);

        System.out.println(efl.getText());
        ExpressionFormLine copy = new ExpressionFormLine(efl);
        assertNotSame(efl, copy);
        assertEquals(efl.getText(), copy.getText());
        for (ExpressionPart e1 = efl.getRootExpression(), e2 = copy.getRootExpression(); e1 != null; e1 = e1.getNext(), e2 = e2.getNext()) {
            assertNotSame(e1, e2);
            assertEquals(e1.getClass(), e2.getClass());
        }
    }
View Full Code Here

public class ExpressionFormLineTest {

    @Test
    public void toStringText() {
        ExpressionFormLine efl = new ExpressionFormLine();
        FactPattern fact = new FactPattern("String");
        fact.setBoundName("$v");
        efl.appendPart(new ExpressionVariable(fact));
        efl.appendPart(new ExpressionMethod("size", "int", SuggestionCompletionEngine.TYPE_NUMERIC));
        assertEquals("$v.size()", efl.getText());

        efl.setBinding("$s");

        assertEquals("$s: $v.size()", efl.getText(true));

    }
View Full Code Here

                //Reset Constraint's value and value type
                if ( Window.confirm( Constants.INSTANCE.RemoveConstraintValueDefinitionQuestion() ) ) {
                    constraint.setConstraintValueType( BaseSingleFieldConstraint.TYPE_UNDEFINED );
                    constraint.setValue( null );
                    constraint.clearParameters();
                    constraint.setExpressionValue( new ExpressionFormLine() );
                    doTypeChosen();
                }
            }

        } );
View Full Code Here

                                                                 "java.lang.Object",
                                                                 SuggestionCompletionEngine.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        SuggestionCompletionEngine.TYPE_NUMERIC ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
                                          index );
                expression.appendPart( collectionIndex );
            }
View Full Code Here

        ebBtn.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                SingleFieldConstraintEBLeftSide con = new SingleFieldConstraintEBLeftSide();
                con.setConstraintValueType( SingleFieldConstraint.TYPE_UNDEFINED );
                con.setExpressionLeftSide( new ExpressionFormLine( new ExpressionUnboundFact( pattern ) ) );
                hasConstraints.addConstraint( con );
                modeller.refreshWidget();
                popup.hide();
            }
        } );
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.brl.ExpressionFormLine

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.