@Test public void testCreateTimeZone() { TimeZone defaultTimeZone = mock( TimeZone.class ); TimeZone timezone = TextComponentEditHandler.createTimeZone( null, defaultTimeZone ); assertThat( timezone, is( equalTo( defaultTimeZone ) ) ); timezone = TextComponentEditHandler.createTimeZone( "server", defaultTimeZone ); assertThat( timezone, is( equalTo( defaultTimeZone ) ) ); timezone = TextComponentEditHandler.createTimeZone( "client", defaultTimeZone ); assertThat( timezone, is( equalTo( defaultTimeZone ) ) ); timezone = TextComponentEditHandler.createTimeZone( "utc", defaultTimeZone ); assertThat( timezone, is( not( equalTo( defaultTimeZone ) ) ) ); assertThat( timezone.getID(), is( equalTo( "UTC" ) ) ); timezone = TextComponentEditHandler.createTimeZone( "GMT", defaultTimeZone ); assertThat( timezone, is( not( equalTo( defaultTimeZone ) ) ) ); assertThat( timezone.getID(), is( equalTo( "GMT" ) ) ); }
public static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ) { if ( selectedItem == null ) { return defaultValue; } if ( "server".equals( selectedItem ) || "client".equals( selectedItem ) ) { return defaultValue; } final String id = String.valueOf( selectedItem ); if ( "utc".equals( id ) ) { return TimeZone.getTimeZone( "UTC" ); } final TimeZone timeZone = TimeZone.getTimeZone( id ); if ( "GMT".equals( timeZone.getID() ) && "GMT".equals( id ) == false ) { return defaultValue; } return timeZone; }
TextComponentEditHandler implements Runnable, DocumentListener, ActionListener { public static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ) { if ( selectedItem == null ) { return defaultValue; } if ( "server".equals( selectedItem ) || "client".equals( selectedItem ) ) { return defaultValue; } final String id = String.valueOf( selectedItem ); if ( "utc".equals( id ) ) { return TimeZone.getTimeZone( "UTC" ); } final TimeZone timeZone = TimeZone.getTimeZone( id ); if ( "GMT".equals( timeZone.getID() ) && "GMT".equals( id ) == false ) { return defaultValue; } return timeZone; } }
TextComponentEditHandler implements Runnable, DocumentListener, ActionListener { public static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ) { if ( selectedItem == null ) { return defaultValue; } if ( "server".equals( selectedItem ) || "client".equals( selectedItem ) ) { return defaultValue; } final String id = String.valueOf( selectedItem ); if ( "utc".equals( id ) ) { return TimeZone.getTimeZone( "UTC" ); } final TimeZone timeZone = TimeZone.getTimeZone( id ); if ( "GMT".equals( timeZone.getID() ) && "GMT".equals( id ) == false ) { return defaultValue; } return timeZone; } TextComponentEditHandler( final Class type, final String keyName, final JTextComponent textComponent,
      final ParameterUpdateContext updateContext, final Format formatter ); }
TextComponentEditHandler implements Runnable, DocumentListener, ActionListener { public static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ) { if ( selectedItem == null ) { return defaultValue; } if ( "server".equals( selectedItem ) || "client".equals( selectedItem ) ) { return defaultValue; } final String id = String.valueOf( selectedItem ); if ( "utc".equals( id ) ) { return TimeZone.getTimeZone( "UTC" ); } final TimeZone timeZone = TimeZone.getTimeZone( id ); if ( "GMT".equals( timeZone.getID() ) && "GMT".equals( id ) == false ) { return defaultValue; } return timeZone; } TextComponentEditHandler( final Class type, final String keyName, final JTextComponent textComponent,
      final ParameterUpdateContext updateContext, final Format formatter ); boolean isAdjustingToExternalInput(); void setAdjustingToExternalInput( final boolean adjustingToExternalInput ); void insertUpdate( final DocumentEvent e ); void removeUpdate( final DocumentEvent e ); void changedUpdate( final DocumentEvent e ); void run(); void actionPerformed( final ActionEvent e ); static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ); static Format createFormat( final String formatString, final Locale locale, final TimeZone timeZone,
      final Class parameterType ); }
TextComponentEditHandler implements Runnable, DocumentListener, ActionListener { public static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ) { if ( selectedItem == null ) { return defaultValue; } if ( "server".equals( selectedItem ) || "client".equals( selectedItem ) ) { return defaultValue; } final String id = String.valueOf( selectedItem ); if ( "utc".equals( id ) ) { return TimeZone.getTimeZone( "UTC" ); } final TimeZone timeZone = TimeZone.getTimeZone( id ); if ( "GMT".equals( timeZone.getID() ) && "GMT".equals( id ) == false ) { return defaultValue; } return timeZone; } TextComponentEditHandler( final Class type, final String keyName, final JTextComponent textComponent,
      final ParameterUpdateContext updateContext, final Format formatter ); boolean isAdjustingToExternalInput(); void setAdjustingToExternalInput( final boolean adjustingToExternalInput ); void insertUpdate( final DocumentEvent e ); void removeUpdate( final DocumentEvent e ); void changedUpdate( final DocumentEvent e ); void run(); void actionPerformed( final ActionEvent e ); static TimeZone createTimeZone( final String selectedItem, final TimeZone defaultValue ); static Format createFormat( final String formatString, final Locale locale, final TimeZone timeZone,
      final Class parameterType );  }