Package jmri.util.startup
Class AbstractActionModel
- java.lang.Object
 - 
- jmri.util.startup.AbstractActionModel
 
 
- 
- All Implemented Interfaces:
 StartupModel
- Direct Known Subclasses:
 CreateButtonModel,PerformActionModel
public abstract class AbstractActionModel extends java.lang.Object implements StartupModel
Provide services for invoking actions during configuration and startup.The action classes and corresponding human-readable names are provided by
StartupActionFactoryinstances.- See Also:
 AbstractActionModelFactory
 
- 
- 
Constructor Summary
Constructors Constructor Description AbstractActionModel() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddException(java.lang.Exception exception)Add an exception to the list of exceptions thrown when loading the model or performing the action.java.lang.StringgetClassName()java.util.List<java.lang.Exception>getExceptions()Get the exceptions thrown by the startup model.java.lang.StringgetName()Return the name of of the model or its controlled object.java.lang.StringgetSystemPrefix()booleanisEnabled()Get whenether this action is enabled or not.booleanisSystemConnectionAction()booleanisValid()Test is model is a valid model.voidperformAction()Perform the startup action.protected abstract voidperformAction(javax.swing.Action action)voidsetClassName(java.lang.String n)voidsetEnabled(boolean value)Set whenether this action is enabled or not.voidsetName(java.lang.String n)Set the name of the model.voidsetSystemPrefix(java.lang.String prefix)java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
AbstractActionModel
public AbstractActionModel()
 
 - 
 
- 
Method Detail
- 
getClassName
public java.lang.String getClassName()
 
- 
getName
public java.lang.String getName()
Description copied from interface:StartupModelReturn the name of of the model or its controlled object.- Specified by:
 getNamein interfaceStartupModel- Returns:
 - the name, an empty string, or null
 
 
- 
setName
public void setName(java.lang.String n)
Description copied from interface:StartupModelSet the name of the model.- Specified by:
 setNamein interfaceStartupModel- Parameters:
 n- the name, an empty string, or null
 
- 
setClassName
public void setClassName(@Nonnull java.lang.String n)
 
- 
getSystemPrefix
@Nonnull public java.lang.String getSystemPrefix()
 
- 
setSystemPrefix
public void setSystemPrefix(@CheckForNull java.lang.String prefix)
 
- 
isSystemConnectionAction
public boolean isSystemConnectionAction()
 
- 
isValid
public boolean isValid()
Description copied from interface:StartupModelTest is model is a valid model. Invalid models will not be shown or saved by the Startup Actions Preferences panel.- Specified by:
 isValidin interfaceStartupModel- Returns:
 - true if valid; false otherwise
 
 
- 
setEnabled
public void setEnabled(boolean value)
Set whenether this action is enabled or not.- Specified by:
 setEnabledin interfaceStartupModel- Parameters:
 value- true if enabled, false otherwise
 
- 
isEnabled
public boolean isEnabled()
Get whenether this action is enabled or not.- Specified by:
 isEnabledin interfaceStartupModel- Returns:
 - true if enabled, false otherwise
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
- 
performAction
public void performAction() throws JmriException
Description copied from interface:StartupModelPerform the startup action. The caller is responsible to ensure that this startup model is enabled before calling this method.- Specified by:
 performActionin interfaceStartupModel- Throws:
 JmriException- if there is an exception thrown initializing the startup item; the original exception should be available asThrowable.getCause()
 
- 
getExceptions
public java.util.List<java.lang.Exception> getExceptions()
Description copied from interface:StartupModelGet the exceptions thrown by the startup model.- Specified by:
 getExceptionsin interfaceStartupModel- Returns:
 - the list of exceptions thrown during startup in order or an empty list if no exceptions were thrown
 
 
- 
addException
public void addException(java.lang.Exception exception)
Description copied from interface:StartupModelAdd an exception to the list of exceptions thrown when loading the model or performing the action.- Specified by:
 addExceptionin interfaceStartupModel- Parameters:
 exception- the exception to retain with the model
 
- 
performAction
protected abstract void performAction(javax.swing.Action action) throws JmriException
- Throws:
 JmriException
 
 - 
 
 -