Package jmri.util.startup
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 TypeMethodDescriptionvoidaddException(Exception exception) 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.getName()Return the name of of the model or its controlled object.booleanGet whenether this action is enabled or not.booleanisValid()Test is model is a valid model.voidPerform the startup action.voidsetEnabled(boolean value) Set whenether this action is enabled or not.voidSet 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
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 asThrowable.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
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
-