Package jmri.jmrix.openlcb
Class OlcbStringIO
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractStringIO
-
- jmri.jmrix.openlcb.OlcbStringIO
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>,PropertyChangeProvider,NamedBean,StringIO
public class OlcbStringIO extends AbstractStringIO
Send a message to the OpenLCB/LCC network
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classOlcbStringIO.EWPListener-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) EventTable.EventTableEntryHolderactiveEventTableEntryHolder(package private) OlcbAddressaddrActive(package private) BitProducerConsumerpc-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description OlcbStringIO(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancutLongStrings()Cut long strings instead of throwing an exception?(package private) voidfinishLoad()Helper function that will be invoked after construction once the properties have been loaded.EventIDgetEventID(boolean isActive)java.lang.StringgetEventName(boolean isActive)Computes the display name of a given event to be entered into the Event Table.intgetMaximumLength()Get the maximum length of string that this StringIO can handle.java.lang.StringgetRecommendedToolTip()Get a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table.voidrequestUpdateFromLayout()Request an update on status by sending an OpenLCB message.protected voidsendStringToLayout(java.lang.String value)Sends the string to the layout.voidsetUserName(java.lang.String s)Updates event table entries when the user name changes.-
Methods inherited from class jmri.implementation.AbstractStringIO
compareSystemNameSuffix, getBeanType, getCommandedStringValue, getKnownStringValue, getState, setCommandedStringValue, setState, setString
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, describeState, dispose, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, toString, toStringSuffix, updateListenerRef, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareTo, describeState, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
addrActive
OlcbAddress addrActive
-
activeEventTableEntryHolder
EventTable.EventTableEntryHolder activeEventTableEntryHolder
-
-
Constructor Detail
-
OlcbStringIO
public OlcbStringIO(java.lang.String prefix, java.lang.String address, CanSystemConnectionMemo memo)
-
-
Method Detail
-
finishLoad
void finishLoad()
Helper function that will be invoked after construction once the properties have been loaded. Used specifically for preventing double initialization when loading StringIO from XML.
-
getEventName
public java.lang.String getEventName(boolean isActive)
Computes the display name of a given event to be entered into the Event Table.- Parameters:
isActive- left over from interface for Turnout and Sensor, this is ignored- Returns:
- user-visible string to represent this event.
-
getEventID
public EventID getEventID(boolean isActive)
-
getRecommendedToolTip
@CheckReturnValue @Nonnull public java.lang.String getRecommendedToolTip()
Description copied from interface:NamedBeanGet a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table. By default, this is the comment from the NamedBean, on the theory that the system name and/or user name are being displayed directly. Specific system implementations may override that.- Returns:
- empty String if no recommendation.
-
setUserName
@OverridingMethodsMustInvokeSuper public void setUserName(java.lang.String s) throws NamedBean.BadUserNameException
Updates event table entries when the user name changes.- Specified by:
setUserNamein interfaceNamedBean- Overrides:
setUserNamein classAbstractNamedBean- Parameters:
s- new user name- Throws:
NamedBean.BadUserNameException- seeNamedBean
-
requestUpdateFromLayout
public void requestUpdateFromLayout()
Request an update on status by sending an OpenLCB message.
-
sendStringToLayout
protected void sendStringToLayout(java.lang.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.For systems that don't provide another form of feedback, this call is responsible for setting the known state to the new commanded state, and firing all listeners.
- Specified by:
sendStringToLayoutin classAbstractStringIO- Parameters:
value- the desired string value- Throws:
JmriException- general error when setting the value fails
-
getMaximumLength
public int getMaximumLength()
Get the maximum length of string that this StringIO can handle.- Returns:
- the maximum length or 0 if arbitrary lengths are accepted.
-
cutLongStrings
protected 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.- Specified by:
cutLongStringsin classAbstractStringIO- Returns:
- true if long strings should be cut
-
-