Package jmri.util.startup
Class AbstractStartupModel
- java.lang.Object
-
- jmri.util.startup.AbstractStartupModel
-
- All Implemented Interfaces:
StartupModel
- Direct Known Subclasses:
PerformFileModel
,PerformScriptModel
,ScriptButtonModel
,StartupPauseModel
,TriggerRouteModel
public abstract class AbstractStartupModel extends java.lang.Object implements StartupModel
Abstract startup action model.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractStartupModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addException(java.lang.Exception exception)
Add an exception to the list of exceptions thrown when loading the model or performing the action.java.util.List<java.lang.Exception>
getExceptions()
Get the exceptions thrown by the startup model.java.lang.String
getName()
Return the name of of the model or its controlled object.boolean
isEnabled()
Get whenether this action is enabled or not.boolean
isValid()
Test is model is a valid model.void
setEnabled(boolean value)
Set whenether this action is enabled or not.void
setName(java.lang.String name)
Set the name of the model.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.util.startup.StartupModel
performAction
-
-
-
-
Constructor Detail
-
AbstractStartupModel
protected AbstractStartupModel()
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:StartupModel
Return the name of of the model or its controlled object.- Specified by:
getName
in interfaceStartupModel
- Returns:
- the name, an empty string, or null
-
setName
public void setName(java.lang.String name)
Description copied from interface:StartupModel
Set the name of the model.- Specified by:
setName
in interfaceStartupModel
- Parameters:
name
- the name, an empty string, or null
-
isValid
public boolean isValid()
Test is model is a valid model. Invalid models will not be shown or saved by the Startup Actions Preferences panel. The default behavior is to return true ifgetName()
returns a non-null, non-empty String.- Specified by:
isValid
in interfaceStartupModel
- Returns:
- true if valid; false otherwise
-
setEnabled
public void setEnabled(boolean value)
Set whenether this action is enabled or not.- Specified by:
setEnabled
in interfaceStartupModel
- Parameters:
value
- true if enabled, false otherwise
-
isEnabled
public boolean isEnabled()
Get whenether this action is enabled or not.- Specified by:
isEnabled
in interfaceStartupModel
- Returns:
- true if enabled, false otherwise
-
getExceptions
public java.util.List<java.lang.Exception> getExceptions()
Description copied from interface:StartupModel
Get the exceptions thrown by the startup model.- Specified by:
getExceptions
in interfaceStartupModel
- Returns:
- the list of exceptions thrown during startup in order or an empty list if no exceptions were thrown
-
addException
public void addException(@Nonnull java.lang.Exception exception)
Description copied from interface:StartupModel
Add an exception to the list of exceptions thrown when loading the model or performing the action.- Specified by:
addException
in interfaceStartupModel
- Parameters:
exception
- the exception to retain with the model
-
-