/** * Marshal model attributes * @param buf * @param model */ protected void marshalAttributes( final StringBuilder buf, final RuleModel model ) { boolean hasDialect = false; for ( int i = 0; i < model.attributes.length; i++ ) { RuleAttribute attr = model.attributes[ i ]; buf.append( "\t" ); buf.append( attr ); buf.append( "\n" ); if ( attr.getAttributeName().equals( "dialect" ) ) { constraintValueBuilder = DRLConstraintValueBuilder.getBuilder( attr.getValue() ); hasDialect = true; } } // Un comment below for mvel if ( !hasDialect ) { RuleAttribute attr = new RuleAttribute( "dialect", DEFAULT_DIALECT ); buf.append( "\t" ); buf.append( attr ); buf.append( "\n" ); } }
private TextBox textBoxEditor( final RuleAttribute at, final boolean isReadOnly ) { final TextBox box = new TextBox(); box.setEnabled( !isReadOnly ); box.setVisibleLength( ( at.getValue().length() < 3 ) ? 3 : at.getValue().length() ); box.setText( at.getValue() ); box.addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { at.setValue( box.getText() ); } } ); if ( at.getAttributeName().equals( DATE_EFFECTIVE_ATTR ) || at.getAttributeName().equals( DATE_EXPIRES_ATTR ) ) { if ( at.getValue() == null || "".equals( at.getValue() ) ) { box.setText( "" ); } box.setVisibleLength( 10 ); } box.addKeyUpHandler( new KeyUpHandler() { public void onKeyUp( KeyUpEvent event ) { int length = box.getText().length(); box.setVisibleLength( length > 0 ? length : 1 ); } } ); return box; }
private Widget checkBoxEditor( final RuleAttribute at, final boolean isReadOnly ) { final CheckBox box = new CheckBox(); box.setEnabled( !isReadOnly ); if ( at.getValue() == null ) { box.setValue( true ); at.setValue( TRUE_VALUE ); } else { box.setValue( ( at.getValue().equals( TRUE_VALUE ) ) ); } box.addClickHandler( new ClickHandler() { public void onClick( ClickEvent event ) { at.setValue( ( box.getValue() ) ? TRUE_VALUE : FALSE_VALUE ); } } ); return box; }
private RuleAttribute visitRuleAttribute( RuleAttribute attr ) { RuleAttribute clone = new RuleAttribute(); clone.setAttributeName( attr.getAttributeName() ); clone.setValue( attr.getValue() ); return clone; }
rm.attributes[ 0 ].getAttributeName() ); assertEquals( "a", rm.attributes[ 0 ].getValue() ); rm.attributes[ 0 ].getAttributeName() ); assertEquals( "a", rm.attributes[ 0 ].getValue() ); assertEquals( "agenda-group", rm.attributes[ 1 ].getAttributeName() ); assertEquals( "b", rm.attributes[ 1 ].getValue() );