private void populateDependentParameters ( Report nextReport , QueryParameter parameter ) { Map < String , QueryParameter > childParams = ParameterUtil . getChildDependentParameters ( nextReport , parameter ) ; // update model parameter values for every child parameter for ( QueryParameter childParam : childParams . values ( ) ) { if ( ! parameters . contains ( childParam ) ) { continue ; } int index = parameters . indexOf ( childParam ) ; JComponent childComponent = getParameterComponent ( index ) ; List < IdName > values = new ArrayList < IdName > ( ) ; // a parameter may depend on more than one parameter (has more parents) // we must see if all the parents have selected values (this is not done in this example) Map < String , QueryParameter > allParentParams = ParameterUtil . getParentDependentParameters ( nextReport , childParam ) ; if ( ( childParam . getSource ( ) != null ) && ( childParam . getSource ( ) . trim ( ) . length ( ) > 0 ) ) { try { Map < String , Serializable > allParameterValues = new HashMap < String , Serializable > ( ) ; for ( String name : allParentParams . keySet ( ) ) { QueryParameter parent = allParentParams . get ( name ) ; index = parameters . indexOf ( parent ) ; JComponent parentComponent = getParameterComponent ( index ) ; allParameterValues . put ( name , ( Serializable ) getParameterValue ( parentComponent , parent ) ) ; } values = ParameterUtil . getParameterValues ( connection , childParam , ParameterUtil . toMap ( parameters ) , allParameterValues ) ; setValues ( childComponent , values ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } }
and set their values too