/** * Creates a new keyed combobox model for the given keys and values. Keys and values must have the same number of * items. * * @param keys the keys * @param values the values */ public KeyedComboBoxModel( final K[] keys, final V[] values ) { this(); setData( keys, values ); }
public static KeyedComboBoxModel<Object, Object> createModel( final ListParameter parameter, final ParameterContext parameterContext ) throws ReportDataFactoryException { final ParameterValues paramValues = parameter.getValues( parameterContext ); final int count = paramValues.getRowCount(); final Object[] keys = new Object[count]; final Object[] values = new Object[count]; for ( int i = 0; i < count; i++ ) { final Object key = paramValues.getKeyValue( i ); keys[i] = key; values[i] = paramValues.getTextValue( i ); } final KeyedComboBoxModel<Object, Object> model = new KeyedComboBoxModel<Object, Object>(); model.setData( keys, values ); return model; } }