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