private UIFieldSet evaluateFieldSet ( final PrintQuery _query , final Field _field , final Instance _fieldInstance ) throws EFapsException { final AttributeSet attrSet = AttributeSet . find ( getInstance ( ) . getType ( ) . getName ( ) , _field . getAttribute ( ) ) ; final Map < ? , ? > tmp = ( Map < ? , ? > ) _query . getAttributeSet ( _field . getAttribute ( ) ) ; final List < Instance > fieldins = new ArrayList <> ( ) ; if ( tmp != null ) { fieldins . addAll ( _query . getInstances4Attribute ( _field . getAttribute ( ) ) ) ; } final UIFieldSet ret = new UIFieldSet ( this , _fieldInstance , UIValue . get ( _field , getInstance ( ) . getType ( ) . getAttribute ( _field . getAttribute ( ) ) , null ) ) ; ret . setMode ( getMode ( ) ) ; for ( final String attrName : ( ( FieldSet ) _field ) . getOrder ( ) ) { final Attribute child = attrSet . getAttribute ( attrName ) ; final UIFieldSetColHeader column = new UIFieldSetColHeader ( _field . getLabel ( ) , child , _field ) ; ret . addHeader ( column ) ; } final Iterator < Instance > iter = fieldins . iterator ( ) ; final Map < String , Iterator < ? > > values = new HashMap <> ( ) ; while ( iter . hasNext ( ) ) { final Instance rowInstance = iter . next ( ) ; ret . addRow ( rowInstance ) ; for ( final String attrName : ( ( FieldSet ) _field ) . getOrder ( ) ) { final Attribute child = attrSet . getAttribute ( attrName ) ; Iterator < ? > valIter = values . get ( attrName ) ; if ( valIter == null ) { final List < ? > tmplist = ( List < ? > ) tmp . get ( attrName ) ; valIter = tmplist . iterator ( ) ; values . put ( attrName , valIter ) ; } final UIValue uiValue = UIValue . get ( _field , child , valIter . hasNext ( ) ? valIter . next ( ) : null ) ; ret . addValue ( rowInstance , new UIFieldSetValue ( this , rowInstance . getKey ( ) , ret , uiValue ) ) ; } } return ret ; }
Method evaluates a FieldSet and adds it to the row .