@Override
  public void reset() {
    List<X509Certificate> original = myTrustManager.getCertificates();
    myTreeBuilder.reset(original);

    myCertificates.clear();
    myCertificates.addAll(original);

    myDetailsPanel.removeAll();
    myDetailsPanel.add(myEmptyPanel, EMPTY_PANEL);

    // fill lower panel with cards
    for (X509Certificate certificate : original) {
      addCertificatePanel(certificate);
    }

    if (!myCertificates.isEmpty()) {
      myTreeBuilder.selectFirstCertificate();
    }

    CertificateManager.Config state = CertificateManager.getInstance().getState();
    myAcceptAutomatically.setSelected(state.ACCEPT_AUTOMATICALLY);
    myCheckHostname.setSelected(state.CHECK_HOSTNAME);
    myCheckValidityPeriod.setSelected(state.CHECK_VALIDITY);
  }
 @Override
 public void certificateRemoved(final X509Certificate certificate) {
   UIUtil.invokeLaterIfNeeded(
       () -> {
         if (myTreeBuilder != null && myCertificates.contains(certificate)) {
           myCertificates.remove(certificate);
           myTreeBuilder.removeCertificate(certificate);
         }
       });
 }
 @Override
 public void certificateAdded(final X509Certificate certificate) {
   UIUtil.invokeLaterIfNeeded(
       () -> {
         if (myTreeBuilder != null && !myCertificates.contains(certificate)) {
           myCertificates.add(certificate);
           myTreeBuilder.addCertificate(certificate);
           addCertificatePanel(certificate);
         }
       });
 }