private void save(){
  if (copyCheckBox.isSelected() && JOptionPane.showConfirmDialog(this,MessageFormat.format(Bundle.getMessage("CopyCarType"),new Object[]{typeComboBox.getSelectedItem(),textCarType.getText()}),Bundle.getMessage("CopyCarTypeTitle"),JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
    return;
  }
  log.debug("Save {} trains",trainList.size());
  removePropertyChangeTrains();
  for (int i=0; i < trainList.size(); i++) {
    JCheckBox cb=trainList.get(i);
    Train train=manager.getTrainById(cb.getName());
    if (cb.isSelected()) {
      train.addTypeName((String)typeComboBox.getSelectedItem());
    }
 else {
      train.deleteTypeName((String)typeComboBox.getSelectedItem());
    }
  }
  OperationsXml.save();
  updateTrains();
  if (Setup.isCloseWindowOnSaveEnabled()) {
    dispose();
  }
}

private void save ( ) { if ( copyCheckBox . isSelected ( ) && JOptionPane . showConfirmDialog ( this , MessageFormat . format ( Bundle . getMessage ( "CopyCarType" ) , new Object [ ] { typeComboBox . getSelectedItem ( ) , textCarType . getText ( ) } ) , Bundle . getMessage ( "CopyCarTypeTitle" ) , JOptionPane . YES_NO_OPTION ) != JOptionPane . YES_OPTION ) { return ; } log . debug ( "Save {} trains" , trainList . size ( ) ) ; removePropertyChangeTrains ( ) ; for ( int i = 0 ; i < trainList . size ( ) ; i ++ ) { JCheckBox cb = trainList . get ( i ) ; Train train = manager . getTrainById ( cb . getName ( ) ) ; if ( cb . isSelected ( ) ) { train . addTypeName ( ( String ) typeComboBox . getSelectedItem ( ) ) ; } else { train . deleteTypeName ( ( String ) typeComboBox . getSelectedItem ( ) ) ; } } OperationsXml . save ( ) ; updateTrains ( ) ; if ( Setup . isCloseWindowOnSaveEnabled ( ) ) { dispose ( ) ; } }
update the car types that trains and tracks service . note that the checkbox name is the id of the train or track .
