001package jmri.util.startup; 002 003import java.awt.Component; 004import jmri.spi.JmriServiceProviderInterface; 005 006/** 007 * A factory for {@link StartupModel}s. 008 * 009 * StartupModelFactories are loaded via the Java {@link java.util.ServiceLoader} 010 * mechanism to allow the actions JMRI can take on startup to be extended within 011 * an external JAR. 012 * 013 * @author Randall Wood 014 */ 015public interface StartupModelFactory extends JmriServiceProviderInterface { 016 017 /** 018 * Get the {@link java.lang.Class} that is generated by this factory. The 019 * Class must be a subclass of {@link StartupModel}. 020 * 021 * @return The class this factory generates. 022 */ 023 Class<? extends StartupModel> getModelClass(); 024 025 /** 026 * Get the description for models this factory generates. This is used in 027 * the preferences UI to describe the class, so it should be short. 028 * 029 * @return A short description. 030 */ 031 String getDescription(); 032 033 /** 034 * Get the action text for models this factory generates. This is used in 035 * menus and UI elements that start the process of creating and editing a 036 * new startup action. 037 * 038 * If the startup action is not configurable, this should be the same as 039 * {@link #getDescription()}. 040 * 041 * @return Action text 042 */ 043 String getActionText(); 044 045 /** 046 * Create a new instance of the model. 047 * 048 * @return the new instance 049 */ 050 StartupModel newModel(); 051 052 /** 053 * Allow user to edit the model. 054 * 055 * @param model the model to edit 056 * @param parent the parent component for the editing UI 057 */ 058 void editModel(StartupModel model, Component parent); 059 060 /** 061 * Provides a mechanism for the {@link StartupActionsManager} to run 062 * any required post-construction initialization. 063 */ 064 void initialize(); 065}