001package jmri.jmrix;
002
003import javax.swing.JPanel;
004
005/**
006 * Interface for objects that handle configuring a layout connection.
007 * <p>
008 * General design documentation is available on the 
009 * <a href="http://jmri.org/help/en/html/doc/Technical/SystemStructure.shtml">Structure of External System Connections page</a>.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001, 2003
012 * @see JmrixConfigPane
013 * @see PortAdapter
014 */
015public interface ConnectionConfig {
016
017    String name();
018
019    String getInfo();
020
021    PortAdapter getAdapter();
022
023    String getConnectionName();
024
025    String getManufacturer();
026
027    void setManufacturer(String Manufacturer);
028
029    /** 
030     * Load the Swing widgets needed to configure
031     * this connection into a specified JPanel.
032     * Used during the configuration process to 
033     * fill out the preferences window with 
034     * content specific to this Connection type.
035     * The JPanel contents need to handle their own
036     * gets/sets to the underlying Connection content.
037     *
038     * @param details the specific Swing object to be configured and filled
039     */
040    void loadDetails(JPanel details);
041
042    /**
043     * Register the ConnectionConfig with the running JMRI process.
044     * <p>
045     * At a minimum, is responsible for:
046     * <ul>
047     * <li>Registering this object with the ConfigurationManager for persistance, typically at the "Preferences" level
048     * <li>Adding this object to the default (@link ConnectionConfigManager}
049     * </ul>
050     */
051    void register();
052    
053    /** 
054     * Done with this ConnectionConfig object.
055     * Invoked in {@link JmrixConfigPane} when switching
056     * away from this particular mode. 
057     */
058    void dispose();
059
060    boolean getDisabled();
061
062    void setDisabled(boolean disabled);
063
064    /**
065     * Determine if configuration needs to be written to disk.
066     *
067     * @return true if configuration needs to be saved, false otherwise
068     */
069    boolean isDirty();
070
071    /**
072     * Determine if application needs to be restarted for configuration changes
073     * to be applied.
074     *
075     * @return true if application needs to restart, false otherwise
076     */
077    boolean isRestartRequired();
078}