001package jmri.jmrit.throttle.interfaces;
002
003
004import jmri.DccLocoAddress;
005
006/**
007 * 
008 * An interface for containers of throttle controllers user interface
009 *  (ThrottleWindow for Swing throttles for instance)
010 * 
011 * @author Lionel Jeanson 2026
012 */
013public interface ThrottleControllersUIContainer {
014
015    /**
016     * Return the number of thottle controlS containerS (ThrottleWindows forinstance)
017     *
018     * @return the number of active thottle controls containers.
019     */    
020    int getNbThrottlesControllers();
021    
022    /**
023     * Created a new throttle controller
024     *
025     * @return the newly created throttle controller
026     */    
027    ThrottleControllerUI newThrottleController();
028    
029    /**
030     * Adds an existing throttle controller to that container list at position n
031     *
032     * @param tf the throttle controller to add
033     * @param n position that it will inserted at
034     */
035    void addThrottleControllerAt(ThrottleControllerUI tf, int n);
036    
037    /**
038     * Remove a throttle controller from that container
039     *
040     * @param tf the throttle controller to add
041     */
042    void removeThrottleController(ThrottleControllerUI tf);
043    
044    /**
045     * Get the throttle controller at position n
046     *
047     * @param n position
048     * @return the throttle controller
049     */
050    ThrottleControllerUI getThrottleControllerAt(int n);
051
052    /**
053     * Get the throttle controller being used now (or on top)
054     *
055     * @return the throttle controller
056     */    
057    ThrottleControllerUI getCurentThrottleController();
058    
059    /**
060     * Force estop all throttles managed by that controllers container
061     *
062     */    
063    void emergencyStopAll();
064
065    /**
066     * Get the number of usages of a particular Loco Address.
067     * @param la the Loco Address, can be null.
068     * @return 0 if no usages, else number of AddressPanel usages.
069     */    
070    public int getNumberOfEntriesFor(DccLocoAddress la);
071
072    /**
073     * Dispose of the container and its resources.
074     * This is called when the container is closed, and should clean up any resources used by the container, such as closing windows, releasing memory, etc.
075     * Particularly will release an ythrottle still in use.
076     * 
077     */
078    public void dispose();
079}