Class AbstractStringIO

    • Constructor Detail

      • AbstractStringIO

        public AbstractStringIO​(@Nonnull
                                String systemName)
        Abstract constructor for new StringIO with system name
        Parameters:
        systemName - StringIO system name
      • AbstractStringIO

        public AbstractStringIO​(@Nonnull
                                String systemName,
                                String userName)
        Abstract constructor for new StringIO with system name and user name
        Parameters:
        systemName - StringIO system name
        userName - StringIO user name
    • Method Detail

      • sendStringToLayout

        protected abstract void sendStringToLayout​(@Nonnull
                                                   String value)
                                            throws JmriException
        Sends the string to the layout. The string [u]must not[/u] be longer than the value of getMaximumLength() unless that value is zero. Some microcomputers have little memory and it's very important that this method is never called with too long strings.
        Parameters:
        value - the desired string value
        Throws:
        JmriException - general error when setting the value fails
      • setString

        protected void setString​(@Nonnull
                                 String newValue)
        Set the string of this StringIO. Called from the implementation class when the layout updates this StringIO.
        Parameters:
        newValue - new value to set
      • getKnownStringValue

        public String getKnownStringValue()
        Query the known string value. This is a bound parameter, so you can also register a listener to be informed of changes. A result is always returned; if no other feedback method is available, the commanded value will be used.
        Specified by:
        getKnownStringValue in interface StringIO
        Returns:
        the known string value
      • cutLongStrings

        protected abstract boolean cutLongStrings()
        Cut long strings instead of throwing an exception? For example, if the StringIO is a display, it could be desired to accept too long strings. On the other hand, if the StringIO is used to send a command, a too long string is an error.
        Returns:
        true if long strings should be cut
      • getState

        public int getState()
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (e.g. getCommandedState in Turnout). This is provided to make scripts easier to read.

        Specified by:
        getState in interface NamedBean
        Returns:
        the state
      • setState

        public void setState​(int newState)
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (e.g. setCommandedState in Turnout). This is provided to make scripts access easier to read.

        Specified by:
        setState in interface NamedBean
        Parameters:
        newState - the state
      • getBeanType

        @Nonnull
        public String getBeanType()
        For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.
        Specified by:
        getBeanType in interface NamedBean
        Returns:
        a string of the bean type, eg Turnout, Sensor etc