/** * Returns true of there is a field binding. */ public boolean isBound() { return this.getFieldBinding() != null && this.getFieldBinding().length() > 0; }
if ( con.isBound() ) { bindingLabel.append( "<b>[" ); bindingLabel.append( con.getFieldBinding() ); bindingLabel.append( "]</b> " );
protected List<String> getFieldBinding( FieldConstraint f ) { List<String> result = new ArrayList<String>(); if ( f instanceof SingleFieldConstraint ) { SingleFieldConstraint con = (SingleFieldConstraint) f; if ( con.isBound() ) { result.add( con.getFieldBinding() ); } if ( con.getExpressionValue() != null && con.getExpressionValue().isBound() ) { result.add( con.getExpressionValue().getBinding() ); } if ( con instanceof SingleFieldConstraintEBLeftSide ) { SingleFieldConstraintEBLeftSide exp = (SingleFieldConstraintEBLeftSide) con; if ( exp.getExpressionLeftSide() != null && exp.getExpressionLeftSide().isBound() ) { result.add( exp.getExpressionLeftSide().getBinding() ); } } } else if ( f instanceof CompositeFieldConstraint ) { CompositeFieldConstraint cfc = (CompositeFieldConstraint) f; if ( cfc.getConstraints() != null ) { for ( FieldConstraint ss : cfc.getConstraints() ) { List<String> t = getFieldBinding( ss ); result.addAll( t ); } } } return result; }
protected String getFieldBinding( FieldConstraint fc, String var ) { String fieldType = null; if ( fc instanceof SingleFieldConstraint ) { SingleFieldConstraint s = (SingleFieldConstraint) fc; if ( s.isBound() && var.equals( s.getFieldBinding() ) ) { fieldType = s.getFieldType(); } } if ( fc instanceof SingleFieldConstraintEBLeftSide ) { SingleFieldConstraintEBLeftSide s = (SingleFieldConstraintEBLeftSide) fc; if ( s.isBound() && var.equals( s.getFieldBinding() ) ) { fieldType = s.getExpressionLeftSide().getGenericType(); } } if ( fc instanceof CompositeFieldConstraint ) { CompositeFieldConstraint s = (CompositeFieldConstraint) fc; if ( s.getConstraints() != null ) { for ( FieldConstraint ss : s.getConstraints() ) { fieldType = getFieldBinding( ss, var ); } } } return fieldType; }
SingleFieldConstraint con = (SingleFieldConstraint) fc; if ( con.isBound() ) { result.add( con.getFieldBinding() );
result.add( c.getFieldBinding() );
} else { if ( constr.isBound() ) { bindingsFields.put( constr.getFieldBinding(), constr ); buf.append( constr.getFieldBinding() ); buf.append( " : " ); || constr.getOperator().equals( "== null" ) || constr.getOperator().equals( "!= null" ) ) ) || constr.getFieldBinding() != null || constr.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE || constr instanceof SingleFieldConstraintEBLeftSide ) {
private SingleFieldConstraint visitSingleFieldConstraint( SingleFieldConstraint sfc ) { SingleFieldConstraint clone = new SingleFieldConstraint(); clone.setConstraintValueType( sfc.getConstraintValueType() ); clone.setExpressionValue( (ExpressionFormLine) visit( sfc.getExpressionValue() ) ); clone.setFieldBinding( sfc.getFieldBinding() ); clone.setFactType( sfc.getFactType() ); clone.setFieldName( sfc.getFieldName() ); clone.setFieldType( sfc.getFieldType() ); clone.setOperator( sfc.getOperator() ); for ( Map.Entry<String, String> entry : sfc.getParameters().entrySet() ) { clone.setParameter( entry.getKey(), entry.getValue() ); } clone.setValue( sfc.getValue() ); if ( sfc.getConnectives() != null ) { clone.setConnectives( new ConnectiveConstraint[ sfc.getConnectives().length ] ); for ( int i = 0; i < sfc.getConnectives().length; i++ ) { clone.getConnectives()[ i ] = (ConnectiveConstraint) visit( sfc.getConnectives()[ i ] ); } } return clone; }
final HorizontalPanel vn = new HorizontalPanel(); final TextBox varName = new BindingTextBox(); if ( con.getFieldBinding() != null ) { varName.setText( con.getFieldBinding() );
cons.getValue() ); assertEquals( "$name", cons.getFieldBinding() ); assertEquals( "33 + 1", cons.getValue() ); assertNull( cons.getFieldBinding() ); assertEquals( "age > 6", cons.getValue() ); assertNull( cons.getFieldBinding() );