001package jmri.jmrit.logixng.actions.swing;
002
003import javax.annotation.CheckForNull;
004import javax.annotation.Nonnull;
005import javax.swing.JPanel;
006
007import jmri.*;
008import jmri.jmrit.logixng.*;
009import jmri.jmrit.logixng.swing.AbstractSwingConfigurator;
010
011/**
012 * Abstract class for SwingConfiguratorInterface
013 * 
014 * @author Daniel Bergqvist Copyright 2021
015 */
016public abstract class AbstractAnalogActionSwing extends AbstractSwingConfigurator {
017
018    protected JPanel panel;
019    
020    /** {@inheritDoc} */
021    @Override
022    public String getExecuteEvaluateMenuText() {
023        return Bundle.getMessage("MenuText_ExecuteEvaluate");
024    }
025    
026    /** {@inheritDoc} */
027    @Override
028    public void executeEvaluate(@Nonnull Base object) {
029        throw new RuntimeException("Not supported");
030    }
031    
032    /** {@inheritDoc} */
033    @Override
034    public BaseManager<? extends NamedBean> getManager() {
035        return InstanceManager.getDefault(AnalogActionManager.class);
036    }
037    
038    /** {@inheritDoc} */
039    @Override
040    public JPanel getConfigPanel(@Nonnull JPanel buttonPanel) throws IllegalArgumentException {
041        createPanel(null, buttonPanel);
042        return panel;
043    }
044    
045    /** {@inheritDoc} */
046    @Override
047    public JPanel getConfigPanel(@Nonnull Base object, @Nonnull JPanel buttonPanel) throws IllegalArgumentException {
048        createPanel(object, buttonPanel);
049        return panel;
050    }
051    
052    protected abstract void createPanel(@CheckForNull Base object, @Nonnull JPanel buttonPanel);
053    
054    /** {@inheritDoc} */
055    @Override
056    public String getExampleSystemName() {
057        return InstanceManager.getDefault(AnalogActionManager.class).getSystemNamePrefix() + "AA10";
058    }
059    
060    /** {@inheritDoc} */
061    @Override
062    public String getAutoSystemName() {
063        return InstanceManager.getDefault(AnalogActionManager.class).getAutoSystemName();
064    }
065    
066}