@Test public void testInitializeErrorFormattedValue() throws Exception { final CountDownLatch latch = new CountDownLatch( 1 ); doReturn( "error value" ).when( updateContext ).getParameterValue( ENTRY_NAME ); SwingUtilities.invokeLater( () -> { comp.initialize(); SwingUtilities.invokeLater( () -> latch.countDown() ); } ); latch.await(); assertEquals( comp.getText(), "error value" ); assertEquals( comp.getBackground(), Color.RED ); }
public void initialize() { handler.setAdjustingToExternalInput( true ); try { final Object value = updateContext.getParameterValue( parameterName ); if ( value != null ) { try { if ( format != null ) { setText( format.format( value ) ); } else { setText( ConverterRegistry.toAttributeValue( value ) ); } } catch ( Exception e ) { setText( value.toString() ); setBackground( ParameterReportControllerPane.ERROR_COLOR ); } } else { setText( null ); } } finally { handler.setAdjustingToExternalInput( false ); } }
TextFieldParameterComponent extends JTextField implements ParameterComponent { public void initialize() { handler.setAdjustingToExternalInput( true ); try { final Object value = updateContext.getParameterValue( parameterName ); if ( value != null ) { try { if ( format != null ) { setText( format.format( value ) ); } else { setText( ConverterRegistry.toAttributeValue( value ) ); } } catch ( Exception e ) { setText( value.toString() ); setBackground( ParameterReportControllerPane.ERROR_COLOR ); } } else { setText( null ); } } finally { handler.setAdjustingToExternalInput( false ); } } }
TextFieldParameterComponent extends JTextField implements ParameterComponent { public void initialize() { handler.setAdjustingToExternalInput( true ); try { final Object value = updateContext.getParameterValue( parameterName ); if ( value != null ) { try { if ( format != null ) { setText( format.format( value ) ); } else { setText( ConverterRegistry.toAttributeValue( value ) ); } } catch ( Exception e ) { setText( value.toString() ); setBackground( ParameterReportControllerPane.ERROR_COLOR ); } } else { setText( null ); } } finally { handler.setAdjustingToExternalInput( false ); } } TextFieldParameterComponent( final ParameterDefinitionEntry entry, final ParameterContext parameterContext,
      final ParameterUpdateContext updateContext ); }
TextFieldParameterComponent extends JTextField implements ParameterComponent { public void initialize() { handler.setAdjustingToExternalInput( true ); try { final Object value = updateContext.getParameterValue( parameterName ); if ( value != null ) { try { if ( format != null ) { setText( format.format( value ) ); } else { setText( ConverterRegistry.toAttributeValue( value ) ); } } catch ( Exception e ) { setText( value.toString() ); setBackground( ParameterReportControllerPane.ERROR_COLOR ); } } else { setText( null ); } } finally { handler.setAdjustingToExternalInput( false ); } } TextFieldParameterComponent( final ParameterDefinitionEntry entry, final ParameterContext parameterContext,
      final ParameterUpdateContext updateContext ); JComponent getUIComponent(); void initialize(); }
TextFieldParameterComponent extends JTextField implements ParameterComponent { public void initialize() { handler.setAdjustingToExternalInput( true ); try { final Object value = updateContext.getParameterValue( parameterName ); if ( value != null ) { try { if ( format != null ) { setText( format.format( value ) ); } else { setText( ConverterRegistry.toAttributeValue( value ) ); } } catch ( Exception e ) { setText( value.toString() ); setBackground( ParameterReportControllerPane.ERROR_COLOR ); } } else { setText( null ); } } finally { handler.setAdjustingToExternalInput( false ); } } TextFieldParameterComponent( final ParameterDefinitionEntry entry, final ParameterContext parameterContext,
      final ParameterUpdateContext updateContext ); JComponent getUIComponent(); void initialize();  }