001package jmri.jmrit.logixng.expressions.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.DigitalExpressionManager;
012import jmri.jmrit.logixng.MaleSocket;
013import jmri.jmrit.logixng.expressions.Not;
014
015/**
016 * Configures an Not object with a Swing JPanel.
017 * 
018 * @author Daniel Bergqvist Copyright (C) 2021
019 */
020public class NotSwing extends AbstractDigitalExpressionSwing {
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        Not expression = new Not(systemName, userName);
037        return InstanceManager.getDefault(DigitalExpressionManager.class).registerExpression(expression);
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("Not_Short");
050    }
051    
052    @Override
053    public void dispose() {
054    }
055    
056}