private static int computeFunctionParameterCount( final FunctionInformation info, final FunctionDescription desc ) { if ( !desc.isInfiniteParameterCount() ) { return desc.getParameterCount(); } final String[] parameters = info.getParameters(); int lastNonEmpty = 0; for ( int i = 0; i < parameters.length; i += 1 ) { final String p = parameters[ i ]; if ( StringUtils.isEmpty( p ) ) { continue; } lastNonEmpty = i; } return Math.max( lastNonEmpty + 1, desc.getParameterCount() ) + FIELDS_ADD; }
protected void fireParameterUpdate( final int param, final String text ) { final boolean catchAllParameter = selectedFunction.isInfiniteParameterCount() && ( param >= selectedFunction.getParameterCount() ); final ParameterUpdateListener[] updateListeners = listenerList.getListeners( ParameterUpdateListener.class ); for ( int i = 0; i < updateListeners.length; i++ ) { final ParameterUpdateListener listener = updateListeners[ i ]; listener.parameterUpdated( new ParameterUpdateEvent( this, param, text, catchAllParameter ) ); } }
count = Math.min( 1, selectedFunction.getParameterCount() ); } else { count = selectedFunction.getParameterCount();
final boolean requestFocus ) { final int paramPos = Math.max( 0, Math.min( selectedFunction.getParameterCount() - 1, parameterPosition ) ); final String displayName = selectedFunction.getParameterDisplayName( paramPos, Locale.getDefault() ); final String description = selectedFunction.getParameterDescription( paramPos, Locale.getDefault() );
assertNotNull( data.getDisplayName( Locale.ENGLISH ) ); assertNotNull( data.getValueType() ); final int count = data.getParameterCount(); for ( int x = 0; x < count; x++ ) { assertNotNull( data.getParameterType( x ) );
protected void performTranslationTest( String function ) { FunctionDescription functionDesc = context.getFunctionRegistry().getMetaData( function ); assertFalse( StringUtils.isEmpty( functionDesc.getDisplayName( Locale.ENGLISH ) ) ); assertFalse( StringUtils.isEmpty( functionDesc.getDescription( Locale.ENGLISH ) ) ); int count = functionDesc.getParameterCount(); for ( int x = 0; x < count; x++ ) { assertFalse( StringUtils.isEmpty( functionDesc.getParameterDescription( x, Locale.ENGLISH ) ) ); assertFalse( StringUtils.isEmpty( functionDesc.getParameterDisplayName( x, Locale.ENGLISH ) ) ); } } }
public void testTranslationsAvailable() { FunctionRegistry registry = context.getFunctionRegistry(); String[] functions = registry.getFunctionNames(); for ( int i = 0; i < functions.length; i++ ) { String function = functions[ i ]; FunctionDescription functionDesc = registry.getMetaData( function ); assertFalse( StringUtils.isEmpty( functionDesc.getDisplayName( Locale.ENGLISH ) ) ); assertFalse( StringUtils.isEmpty( functionDesc.getDescription( Locale.ENGLISH ) ) ); int count = functionDesc.getParameterCount(); for ( int x = 0; x < count; x++ ) { assertFalse( StringUtils.isEmpty( functionDesc.getParameterDescription( x, Locale.ENGLISH ) ) ); assertFalse( StringUtils.isEmpty( functionDesc.getParameterDisplayName( x, Locale.ENGLISH ) ) ); } } } }