Class AppController

java.lang.Object
eirb.pub.app.display.javafx.controller.AppController

public class AppController extends Object
  • Constructor Details

    • AppController

      public AppController(javafx.stage.Stage stage)
      Create the controller for the whole application - Create views - Manipulate data
      Parameters:
      stage - the main window of the application
  • Method Details

    • getModel

      public AppModel getModel()
    • showAlert

      public void showAlert(javafx.scene.control.Alert.AlertType type, String title, String message)
      Create a popup on the main window
      Parameters:
      type - Error / Information / Warning / Confirmation
      title - name of the popup
      message - the message in the popup
    • showError

      public void showError(String message)
      Create a popup on the main window for an error
      Parameters:
      message - the message in the popup
    • showHome

      public void showHome()
      Show the view where you can select one of the four method of connection ( CloudConnection / CloudRegister / VaultOpener / VaultFileCreator )
    • showVaultFileCreator

      public void showVaultFileCreator(boolean online)
      Show the view where you can create a new vault
    • showRegister

      public void showRegister()
      Show the view where you can register
    • showVaultViewer

      public void showVaultViewer()
      Show the main view of the application with the password
    • showVaultOpener

      public void showVaultOpener(VaultFile vaultfile, boolean online)
      Show the view where you can open a local vault
    • showServerVaultList

      public void showServerVaultList()
    • getMainWindow

      public javafx.stage.Stage getMainWindow()
    • setVaultFile

      public void setVaultFile(Path newVaultFile) throws VaultFileIOException, VaultFileFormatException
      Set a new File of the database and call the listener for "absolutePath"
      Parameters:
      newVaultFile - the new path of the database
      Throws:
      VaultFileIOException - IO error
      VaultFileFormatException - The format of the provided file is incorrect
    • setVaultFile

      public void setVaultFile(VaultFile newVaultFile)
    • getNameVault

      public String getNameVault()
      Get the name of the database
      Returns:
      the name of the database
    • setPlainVault

      public void setPlainVault(String password) throws PasswordException, CipherVaultException, IOException
      Set the plain vault in model
      Parameters:
      password - the password of the database selected
      Throws:
      PasswordException - if it's the wrong password throw error
      CipherVaultException - If an error occurred during the decryption of the CipherVault
      IOException
    • getPlainVault

      public PlainVault getPlainVault()
      Get the plain vault to show his data
      Returns:
      the plain vault
    • createEmptyVaultFile

      public void createEmptyVaultFile(String name, String password) throws VaultFileGenerationException, PasswordException, CipherVaultException, IOException
      Set the plain vault in model
      Parameters:
      password - the password of the database selected
      Throws:
      VaultFileGenerationException - if the generation of the file failed
      PasswordException
      CipherVaultException
      IOException
    • setVaultPath

      public void setVaultPath(Path newPath)
      Set database absolute path (/directory/file.dbx.json)
      Parameters:
      newPath - new path
    • getVaultPath

      public Path getVaultPath()
      Get database absolute path
      Returns:
      actual absolute path
    • setVaultDir

      public void setVaultDir(Path newDir)
      Set parent directory of database
      Parameters:
      newDir - new parent directory
    • getVaultDir

      public Path getVaultDir()
      Get parent directory of database
      Returns:
      actual parent directory
    • saveToPath

      public void saveToPath() throws VaultFileIOException, VaultFileFormatException
      Save the database
      Throws:
      VaultFileIOException - if it can't save it IO operation
      VaultFileFormatException - if the format is incorrect
    • addUserData

      public void addUserData(UserData userData, String event) throws VaultOperationException
      Add new password to the vault
      Parameters:
      userData - UserData to add
      Throws:
      VaultOperationException - if an error during the operation
    • addUserData

      public void addUserData(UserData userData) throws VaultOperationException
      Add new password to the vault
      Parameters:
      userData - UserData to add
      Throws:
      VaultOperationException - if an error during the operation
    • removeUserData

      public void removeUserData(UUID userDataID) throws VaultOperationException
      Remove the UserData with the ID userDataID
      Parameters:
      userDataID - id of the UserData to remove from the vault
      Throws:
      VaultOperationException - if an error during the operation
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Add the listener to the model
      Parameters:
      listener - view which implement PropertyChangeListener
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Remove the listener to the param pcs
      Parameters:
      listener - view which implement PropertyChangeListener
    • closeVault

      public void closeVault()
      close the vault by unbinding infos
    • firePropertyChange

      public void firePropertyChange(String propertyName, Object oldValue, Object newValue)
      Fires a property change event to notify listeners of changes to a specific property. This method is used to propagate property changes to the model so that observers can respond to the change.
      Parameters:
      propertyName - The name of the property that has changed.
      oldValue - The previous value of the property.
      newValue - The new value of the property.
    • initCustomPassInfos

      public void initCustomPassInfos()
      Initializes the custom password information with default values. This method delegates to the model to initialize the custom password settings for the application.
    • setCustomPassInfos

      public void setCustomPassInfos(CustomPasswordData customizor)
      Sets the custom password information using the provided CustomPasswordData object. This method delegates to the model to update the custom password settings with the specified configuration.
      Parameters:
      customizor - A CustomPasswordData object that contains the new password customization settings.
    • getCustomPassInfos

      public CustomPasswordData getCustomPassInfos()
      Retrieves the current custom password information. This method delegates to the model to return the current password settings stored in the application.
      Returns:
      The current CustomPasswordData instance.
    • addUserDataWithUndo

      public void addUserDataWithUndo(UserData userData) throws VaultOperationException
      Throws:
      VaultOperationException
    • removeUserDataWithUndo

      public void removeUserDataWithUndo(UserData userInfos) throws VaultOperationException
      Throws:
      VaultOperationException
    • editUserDataWithUndo

      public void editUserDataWithUndo(UUID id, UserData oldData, UserData newData) throws VaultOperationException
      Throws:
      VaultOperationException
    • undo

      public void undo()
    • redo

      public void redo()
    • hasUnsavedChanges

      public boolean hasUnsavedChanges()
    • setServerAuth

      public void setServerAuth(ServerAuthentication servAut)
    • getServerVault

      public ServerVault getServerVault()
    • getServerShare

      public ServerShare getServerShare()
    • setSync

      public void setSync()
    • removeSync

      public void removeSync()
    • setOnline

      public void setOnline(boolean connected)
    • isOnline

      public boolean isOnline()
    • synchronizeVault

      Throws:
      ForbiddenAccessException
      AuthenticationException
      VaultUpdateException
      IOException
      TimeoutException
    • shareUserData

      public SharedUserData shareUserData(UserData userData, ServerUser receiver) throws ServerException, IOException, TimeoutException
      Throws:
      ServerException
      IOException
      TimeoutException
    • getServerAuth

      public ServerAuthentication getServerAuth()
    • getAuthenticatedUser

      public ServerUser getAuthenticatedUser()
    • showNotification

      public void showNotification(String content)