001package jmri.jmrit.logixng.actions.swing;
002
003import java.util.List;
004
005import javax.annotation.CheckForNull;
006import javax.annotation.Nonnull;
007import javax.swing.JPanel;
008
009import jmri.InstanceManager;
010import jmri.jmrit.logixng.Base;
011import jmri.jmrit.logixng.DigitalActionManager;
012import jmri.jmrit.logixng.MaleSocket;
013import jmri.jmrit.logixng.actions.For;
014
015/**
016 * Configures an ActionTurnout object with a Swing JPanel.
017 * 
018 * @author Daniel Bergqvist Copyright 2021
019 */
020public class ForSwing extends AbstractDigitalActionSwing {
021
022    @Override
023    protected void createPanel(@CheckForNull Base object, @Nonnull JPanel buttonPanel) {
024        panel = new JPanel();
025    }
026    
027    /** {@inheritDoc} */
028    @Override
029    public boolean validate(@Nonnull List<String> errorMessages) {
030        return true;
031    }
032    
033    /** {@inheritDoc} */
034    @Override
035    public MaleSocket createNewObject(@Nonnull String systemName, @CheckForNull String userName) {
036        For action = new For(systemName, userName);
037        return InstanceManager.getDefault(DigitalActionManager.class).registerAction(action);
038    }
039    
040    /** {@inheritDoc} */
041    @Override
042    public void updateObject(@Nonnull Base object) {
043        // Do nothing
044    }
045    
046    /** {@inheritDoc} */
047    @Override
048    public String toString() {
049        return Bundle.getMessage("For_Short");
050    }
051    
052    @Override
053    public void dispose() {
054    }
055    
056}