Interface StartupModel

All Known Implementing Classes:
AbstractActionModel, AbstractStartupModel, CreateButtonModel, PerformActionModel, PerformFileModel, PerformScriptModel, ScriptButtonModel, StartupPauseModel, TriggerRouteModel

public interface StartupModel
Startup object models all need to implement this interface. This allows the StartupActionsManager to handle lists of different model classes.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add an exception to the list of exceptions thrown when loading the model or performing the action.
    Get the exceptions thrown by the startup model.
    Return the name of of the model or its controlled object.
    boolean
    Get whenether this action is enabled or not.
    boolean
    Test is model is a valid model.
    void
    Perform the startup action.
    void
    setEnabled(boolean value)
    Set whenether this action is enabled or not.
    void
    Set the name of the model.
  • Method Details

    • getName

      Return the name of of the model or its controlled object.
      Returns:
      the name, an empty string, or null
    • setName

      Set the name of the model.
      Parameters:
      name - the name, an empty string, or null
    • isValid

      boolean isValid()
      Test is model is a valid model. Invalid models will not be shown or saved by the Startup Actions Preferences panel.
      Returns:
      true if valid; false otherwise
    • setEnabled

      void setEnabled(boolean value)
      Set whenether this action is enabled or not.
      Parameters:
      value - true if enabled, false otherwise
    • isEnabled

      boolean isEnabled()
      Get whenether this action is enabled or not.
      Returns:
      true if enabled, false otherwise
    • performAction

      Perform the startup action. The caller is responsible to ensure that this startup model is enabled before calling this method.
      Throws:
      JmriException - if there is an exception thrown initializing the startup item; the original exception should be available as Throwable.getCause()
    • getExceptions

      Get the exceptions thrown by the startup model.
      Returns:
      the list of exceptions thrown during startup in order or an empty list if no exceptions were thrown
    • addException

      void addException(@Nonnull Exception exception)
      Add an exception to the list of exceptions thrown when loading the model or performing the action.
      Parameters:
      exception - the exception to retain with the model