public interface CoreListener extends EventListener {
/**
+ * Notifies all listener that a new key store was created.
+ *
+ * @param keyStore
+ * The key store that was created
+ */
+ public void keyStoreCreated(KeyStore keyStore);
+
+ /**
+ * Notifies all listeners that a key store of the given type could not be
+ * created.
+ *
+ * @param keyStoreType
+ * The type of the key store that should be created
+ * @param reason
+ * The reason why the key store could not be created
+ */
+ public void keyStoreNotCreated(String keyStoreType, Throwable reason);
+
+ /**
* Notifies all listeners that a key store was loaded from a file.
*
* @param keyStoreFile
//
/**
+ * Notifies all listeners that a new key store was created.
+ *
+ * @see CoreListener#keyStoreCreated(KeyStore)
+ * @param keyStore
+ * The key store that was created
+ */
+ public void fireKeyStoreCreated(KeyStore keyStore) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.keyStoreCreated(keyStore);
+ }
+ }
+
+ /**
+ * Notifies all listeners that a key store could not be created.
+ *
+ * @param keyStoreType
+ * The type of the key store
+ * @param reason
+ * The reason why the key store could not be created
+ */
+ public void fireKeyStoreNotCreated(String keyStoreType, Throwable reason) {
+ for (CoreListener coreListener : getListeners()) {
+ coreListener.keyStoreNotCreated(keyStoreType, reason);
+ }
+ }
+
+ /**
* Notifies all listeners that a keystore was loaded from a file.
*
* @see CoreListener#keyStoreLoaded(File, KeyStore)
/**
* {@inheritDoc}
*/
+ public void keyStoreCreated(KeyStore keyStore) {
+ /* TODO */
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void keyStoreNotCreated(String keyStoreType, Throwable reason) {
+ JOptionPane.showMessageDialog(mainFrame, "Could not create a key store of type “" + keyStoreType + "”.", "Could Not Create Key Store", JOptionPane.ERROR_MESSAGE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
/* TODO - create keystore frame. */
}