public EmailSenderEditor(final GenericEmailSender bean,final EditorConfiguration editorConfiguration){
  super();
  m_bean=bean;
  m_subject.setText(m_bean.getSubjectPrefix());
  m_host.setText(m_bean.getHost());
  m_port.setText(String.valueOf(m_bean.getPort()));
  m_toAddress.setText(m_bean.getToAddress());
  m_login.setText(m_bean.getUserName());
  m_password.setText(m_bean.getPassword());
  m_useTLS.setSelected(m_bean.getEncryption() == GenericEmailSender.Encryption.TLS);
  final int bottomSpace=1;
  final int labelSpace=2;
  int row=0;
  add(new JLabel("Subject:"),new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
  add(m_subject,new GridBagConstraints(1,row,2,1,1.0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  row++;
  add(m_toLabel,new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
  add(m_toAddress,new GridBagConstraints(1,row,2,1,1.0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  row++;
  final JLabel m_loginLabel=new JLabel("Login:");
  add(m_loginLabel,new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
  add(m_login,new GridBagConstraints(1,row,2,1,1.0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  row++;
  final JLabel m_passwordLabel=new JLabel("Password:");
  add(m_passwordLabel,new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
  add(m_password,new GridBagConstraints(1,row,2,1,1.0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  if (editorConfiguration.showHost) {
    row++;
    add(m_hostLabel,new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
    add(m_host,new GridBagConstraints(1,row,2,1,1.0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  }
  if (editorConfiguration.showPort) {
    row++;
    add(m_portLabel,new GridBagConstraints(0,row,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,labelSpace),0,0));
    add(m_port,new GridBagConstraints(1,row,2,1,0,0,GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(0,0,bottomSpace,0),0,0));
  }
  if (editorConfiguration.showEncryption) {
    row++;
    add(m_useTLS,new GridBagConstraints(0,row,2,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,0),0,0));
    add(m_testEmail,new GridBagConstraints(2,row,1,1,0,0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,0),0,0));
    row++;
    add(m_alsoPostAfterCombatMove,new GridBagConstraints(0,row,2,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,0),0,0));
  }
 else {
    row++;
    add(m_alsoPostAfterCombatMove,new GridBagConstraints(0,row,2,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,0),0,0));
    add(m_testEmail,new GridBagConstraints(2,row,1,1,0,0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,bottomSpace,0),0,0));
  }
  setupListeners();
}

public EmailSenderEditor ( final GenericEmailSender bean , final EditorConfiguration editorConfiguration ) { super ( ) ; m_bean = bean ; m_subject . setText ( m_bean . getSubjectPrefix ( ) ) ; m_host . setText ( m_bean . getHost ( ) ) ; m_port . setText ( String . valueOf ( m_bean . getPort ( ) ) ) ; m_toAddress . setText ( m_bean . getToAddress ( ) ) ; m_login . setText ( m_bean . getUserName ( ) ) ; m_password . setText ( m_bean . getPassword ( ) ) ; m_useTLS . setSelected ( m_bean . getEncryption ( ) == GenericEmailSender . Encryption . TLS ) ; final int bottomSpace = 1 ; final int labelSpace = 2 ; int row = 0 ; add ( new JLabel ( "Subject:" ) , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_subject , new GridBagConstraints ( 1 , row , 2 , 1 , 1.0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; row ++ ; add ( m_toLabel , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_toAddress , new GridBagConstraints ( 1 , row , 2 , 1 , 1.0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; row ++ ; final JLabel m_loginLabel = new JLabel ( "Login:" ) ; add ( m_loginLabel , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_login , new GridBagConstraints ( 1 , row , 2 , 1 , 1.0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; row ++ ; final JLabel m_passwordLabel = new JLabel ( "Password:" ) ; add ( m_passwordLabel , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_password , new GridBagConstraints ( 1 , row , 2 , 1 , 1.0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; if ( editorConfiguration . showHost ) { row ++ ; add ( m_hostLabel , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_host , new GridBagConstraints ( 1 , row , 2 , 1 , 1.0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; } if ( editorConfiguration . showPort ) { row ++ ; add ( m_portLabel , new GridBagConstraints ( 0 , row , 1 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , labelSpace ) , 0 , 0 ) ) ; add ( m_port , new GridBagConstraints ( 1 , row , 2 , 1 , 0 , 0 , GridBagConstraints . EAST , GridBagConstraints . HORIZONTAL , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; } if ( editorConfiguration . showEncryption ) { row ++ ; add ( m_useTLS , new GridBagConstraints ( 0 , row , 2 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; add ( m_testEmail , new GridBagConstraints ( 2 , row , 1 , 1 , 0 , 0 , GridBagConstraints . EAST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; row ++ ; add ( m_alsoPostAfterCombatMove , new GridBagConstraints ( 0 , row , 2 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; } else { row ++ ; add ( m_alsoPostAfterCombatMove , new GridBagConstraints ( 0 , row , 2 , 1 , 0 , 0 , GridBagConstraints . NORTHWEST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; add ( m_testEmail , new GridBagConstraints ( 2 , row , 1 , 1 , 0 , 0 , GridBagConstraints . EAST , GridBagConstraints . NONE , new Insets ( 0 , 0 , bottomSpace , 0 ) , 0 , 0 ) ) ; } setupListeners ( ) ; }
creates a new instance
