/** * Locate metadata element * @param attributeName - value to look for * @return null if not found */ public RuleMetadata getMetaData( String attributeName ) { if ( metadataList != null && attributeName != null ) { for ( int i = 0; i < metadataList.length; i++ ) { if ( attributeName.equals( metadataList[ i ].getAttributeName() ) ) { return metadataList[ i ]; } } } return null; }
private boolean isLock( String attr ) { if ( isReadOnly() ) { return true; } if ( this.model.metadataList.length == 0 ) { return false; } for ( RuleMetadata at : this.model.metadataList ) { if ( at.getAttributeName().equals( attr ) ) { return true; } } return false; }
private Widget getEditorWidget( final RuleMetadata rm, final int idx, final boolean isReadOnly ) { Widget editor; if ( rm.getAttributeName().equals( LOCK_LHS ) || rm.getAttributeName().equals( LOCK_RHS ) ) { editor = new InfoPopup( Constants.INSTANCE.FrozenAreas(), Constants.INSTANCE.FrozenExplanation() ); } else { editor = textBoxEditor( rm, isReadOnly ); } DirtyableHorizontalPane horiz = new DirtyableHorizontalPane(); horiz.add( editor ); if ( !isReadOnly ) { horiz.add( getRemoveMetaIcon( idx ) ); } return horiz; }
private RuleMetadata visitRuleMetadata( RuleMetadata md ) { RuleMetadata clone = new RuleMetadata(); clone.setAttributeName( md.getAttributeName() ); clone.setValue( md.getValue() ); return clone; }
/** * Update metaData element if it exists or add it otherwise * @param target * @return true on update of existing element false on added of element */ public boolean updateMetadata( final RuleMetadata target ) { RuleMetadata metaData = getMetaData( target.getAttributeName() ); if ( metaData != null ) { metaData.setValue( target.getValue() ); return true; } addMetadata( target ); return false; }
rm.metadataList.length ); assertEquals( "foo", rm.metadataList[ 0 ].getAttributeName() ); assertEquals( "bar", rm.metadataList[ 0 ].getValue() ); rm.metadataList.length ); assertEquals( "foo", rm.metadataList[ 0 ].getAttributeName() ); assertEquals( "bar1", rm.metadataList[ 0 ].getValue() ); assertEquals( "foo2", rm.metadataList[ 1 ].getAttributeName() ); assertEquals( "bar2", rm.metadataList[ 1 ].getValue() );
layout.addAttribute( rmd.getAttributeName(), getEditorWidget( rmd, i,