001package jmri.jmrit.logixng.implementation;
002
003import java.util.*;
004
005import jmri.InstanceManager;
006import jmri.JmriException;
007import jmri.jmrit.logixng.Base;
008import jmri.jmrit.logixng.Category;
009import jmri.jmrit.logixng.FemaleSocketListener;
010import jmri.jmrit.logixng.FemaleStringActionSocket;
011import jmri.jmrit.logixng.MaleStringActionSocket;
012import jmri.jmrit.logixng.MaleSocket;
013import jmri.jmrit.logixng.StringActionManager;
014
015/**
016 * Default implementation of the Female String Action socket
017 */
018public final class DefaultFemaleStringActionSocket
019        extends AbstractFemaleSocket
020        implements FemaleStringActionSocket {
021
022    public DefaultFemaleStringActionSocket(Base parent, FemaleSocketListener listener, String name) {
023        super(parent, listener, name);
024    }
025    
026    @Override
027    public boolean isCompatible(MaleSocket socket) {
028        return socket instanceof MaleStringActionSocket;
029    }
030    
031    @Override
032    public void setValue(String value) throws JmriException {
033        if (isConnected()) {
034            ((MaleStringActionSocket)getConnectedSocket()).setValue(value);
035        }
036    }
037
038    @Override
039    public String getShortDescription(Locale locale) {
040        return Bundle.getMessage(locale, "DefaultFemaleStringActionSocket_Short");
041    }
042
043    @Override
044    public String getLongDescription(Locale locale) {
045        return Bundle.getMessage(locale, "DefaultFemaleStringActionSocket_Long", getName());
046    }
047
048    @Override
049    public Map<Category, List<Class<? extends Base>>> getConnectableClasses() {
050        return InstanceManager.getDefault(StringActionManager.class).getActionClasses();
051    }
052
053    /** {@inheritDoc} */
054    @Override
055    public void disposeMe() {
056        // Do nothing
057    }
058
059}