001package jmri.jmrix.loconet.swing;
002
003/**
004 * A LocoNet Menu item.
005 * 
006 * @author Bob Milhaupt  Copyright (C) 2021
007 */
008public class LocoNetMenuItem {
009    /**
010     * Construct a Menu Item for all LocoNet-specific connection menu(s).
011     * 
012     * @param <T> Type of class to be executed upon activation of the menu item
013     * @param name Text to be shown in the menu item
014     * @param load class to be constructed upon selection of the menu item
015     * @param interfaceOnly true if menu item is to be shown only for JMRI 
016     *          connections having a physical interface, else false
017     * @param hasGui true if the menu item has a GUI object which must be 
018     *          associated with the main JMRI Window Interface, else false
019     */
020    public <T> LocoNetMenuItem(String name, Class<T> load, boolean interfaceOnly, boolean hasGui) {
021        
022        this.name = name;
023        this.classToLoad = load;
024        this.hasGui = hasGui;
025        this.interfaceOnly = interfaceOnly;
026        }
027    
028    private final boolean interfaceOnly;
029    private final String name;
030    private final Class<?> classToLoad;
031    private final boolean hasGui;
032
033
034    public boolean isInterfaceOnly() {
035        return interfaceOnly;
036    }
037    public String getName() {
038        return name;
039    }
040
041    public Class<?> getClassToLoad() {
042        return classToLoad;
043    }
044
045    public boolean hasGui() {
046        return hasGui;
047    }
048
049}