Interface Base
- All Superinterfaces:
PropertyChangeProvider
- All Known Subinterfaces:
AnalogAction,AnalogActionBean,AnalogExpression,AnalogExpressionBean,ConditionalNG,Debugable,DigitalAction,DigitalActionBean,DigitalBooleanAction,DigitalBooleanActionBean,DigitalExpression,DigitalExpressionBean,FemaleAnalogActionSocket,FemaleAnalogExpressionSocket,FemaleAnySocket,FemaleDigitalActionSocket,FemaleDigitalBooleanActionSocket,FemaleDigitalExpressionSocket,FemaleGenericExpressionSocket,FemaleSocket,FemaleStringActionSocket,FemaleStringExpressionSocket,GlobalVariable,LogixNG,MaleAnalogActionSocket,MaleAnalogExpressionSocket,MaleDigitalActionSocket,MaleDigitalBooleanActionSocket,MaleDigitalExpressionSocket,MaleSocket,MaleStringActionSocket,MaleStringExpressionSocket,Module,StringAction,StringActionBean,StringExpression,StringExpressionBean
- All Known Implementing Classes:
AbstractAnalogAction,AbstractAnalogExpression,AbstractBase,AbstractDebuggerMaleSocket,AbstractDigitalAction,AbstractDigitalBooleanAction,AbstractDigitalExpression,AbstractFemaleSocket,AbstractMaleSocket,AbstractStringAction,AbstractStringExpression,ActionAtomicBoolean,ActionAudio,ActionAudioIcon,ActionBlock,ActionClearSlots,ActionClock,ActionClockRate,ActionCreateBeansFromTable,ActionDispatcher,ActionEntryExit,ActionFindTableRowOrColumn,ActionLayoutTurnout,ActionLight,ActionLightIntensity,ActionListenOnBeans,ActionListenOnBeansLocalVariable,ActionListenOnBeansTable,ActionLocalVariable,ActionMemory,ActionOBlock,ActionPositionable,ActionPositionableByClass,ActionPower,ActionReporter,ActionRequestUpdateAllSensors,ActionRequestUpdateOfSensor,ActionRequestUpdateOfTurnout,ActionScript,ActionSensor,ActionSetReporter,ActionShutDownTask,ActionSignalHead,ActionSignalMast,ActionSound,ActionTable,ActionThrottle,ActionThrottleFunction,ActionTimer,ActionTurnout,ActionTurnoutLock,ActionUpdateSlots,ActionWarrant,AnalogActionLightIntensity,AnalogActionMemory,AnalogExpressionAnalogIO,AnalogExpressionConstant,AnalogExpressionLocalVariable,AnalogExpressionMemory,AnalogFormula,AnalogMany,And,Antecedent,Break,ClipboardMany,ConnectionName,Continue,DebuggerMaleAnalogActionSocket,DebuggerMaleAnalogExpressionSocket,DebuggerMaleDigitalActionSocket,DebuggerMaleDigitalBooleanActionSocket,DebuggerMaleDigitalExpressionSocket,DebuggerMaleStringActionSocket,DebuggerMaleStringExpressionSocket,DefaultClipboard,DefaultConditionalNG,DefaultFemaleAnalogActionSocket,DefaultFemaleAnalogExpressionSocket,DefaultFemaleAnySocket,DefaultFemaleDigitalActionSocket,DefaultFemaleDigitalBooleanActionSocket,DefaultFemaleDigitalExpressionSocket,DefaultFemaleGenericExpressionSocket,DefaultFemaleStringActionSocket,DefaultFemaleStringExpressionSocket,DefaultGlobalVariable,DefaultLogixNG,DefaultMaleAnalogActionSocket,DefaultMaleAnalogExpressionSocket,DefaultMaleDigitalActionSocket,DefaultMaleDigitalBooleanActionSocket,DefaultMaleDigitalExpressionSocket,DefaultMaleStringActionSocket,DefaultMaleStringExpressionSocket,DefaultModule,DigitalBooleanLogixAction,DigitalBooleanMany,DigitalCallModule,DigitalCallModule,DigitalFormula,DigitalFormula,DigitalMany,DoAnalogAction,DoStringAction,EnableLogix,EnableLogixNG,Error,ExecuteAction,ExecuteDelayed,ExecuteProgram,Exit,ExpressionAudio,ExpressionBlock,ExpressionClock,ExpressionConditional,ExpressionDispatcher,ExpressionEntryExit,ExpressionLight,ExpressionLinuxLinePower,ExpressionLocalVariable,ExpressionMemory,ExpressionOBlock,ExpressionPower,ExpressionReference,ExpressionReporter,ExpressionScript,ExpressionSection,ExpressionSensor,ExpressionSensorEdge,ExpressionSignalHead,ExpressionSignalMast,ExpressionSlotUsage,ExpressionTransit,ExpressionTurnout,ExpressionWarrant,False,FileAsFlag,For,ForEach,ForEachWithDelay,Hold,IfThenElse,JsonDecode,LastResultOfDigitalExpression,LogData,LogData,Logix,LogLocalVariables,ModuleEditorMaleSocket,Not,NullBase,OperationsProStartAutomation,Or,ProgramOnMain,Publish,Return,RunOnce,SendMergCbusEvent,Sequence,SetLocalVariables,SetSpeedZero,ShowDialog,ShutdownComputer,SimulateTurnoutFeedback,StringActionMemory,StringActionStringIO,StringExpressionConstant,StringExpressionMemory,StringExpressionStringIO,StringFormula,StringMany,Subscribe,TableForEach,Timeout,Timer,TimeSinceMidnight,TriggerOnce,TriggerRoute,True,WebBrowser,WebRequest,WindowManagement
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringThe name of the property child count.static final StringThe name of the property child reorder.static final StringThe last result of the expression has changed.static final StringThe socket has been connected.static final StringThe socket has been disconnected.static final StringSeparator returned by enums toString() methods to get a separator in JComboBoxes.static final intConstant representing an "connected" state of the socketstatic final intConstant representing an "disconnected" state of the socket -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener listener, String name, String listenerRef) Request a call-back when a bound property changes.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener, String name, String listenerRef) Request a call-back when a bound property changes.Do a deep copy of children from the original to me.voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.default voiddoSocketOperation(int index, FemaleSocketOperation oper) Do an operation on a childdefault booleanDoes this item exists in the tree?default voidDo something on every item in the sub tree of this item.default voidDo something on every item in the sub tree of this item.Get the category.getChild(int index) Get a child of this itemintGet the number of children.Get associated comment text.Get the ConditionalNG of this item.Create a deep copy of myself and my children The item needs to try to lookup itself in both systemNames and userNames to see if the user has given a new system name and/or a new user name.If no new system name is given, an auto system name is used.Get the textual reference for the specific listenerReturns a list of all the listeners referencesvoidReturns a list of all the listeners references for this object and all its children.static StringgetListenString(boolean listen) Get the LogixNG of this item.default StringGet a long description of this item.getLongDescription(Locale locale) Get a long description of this item.default ModuleGet the Module of this item, if it's part of a module.static StringintNumber of current listeners.Get the parent.Get a list of all the property change listeners that are registered using a specific namegetRoot()Get the root of the tree that this item belongs to.default StringGet a short description of this item.getShortDescription(Locale locale) Get a short description of this item.Get the system name.voidgetUsageDetail(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Add a new NamedBeanUsageReport to the report list if there are any matches in this action or expresssion.voidgetUsageTree(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Navigate the LogixNG tree.Get the user name.default booleanDoes this item has the child b?booleanisActive()Is this item active?default booleanDetermines whether this object is enabled.default booleanisSocketOperationAllowed(int index, FemaleSocketOperation oper) Is the operation allowed on this child?default voidprintTree(PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.default voidprintTree(Locale locale, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.voidprintTree(Base.PrintTreeSettings settings, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.voidprintTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, String currentIndent, MutableInt lineNumber) Print the tree to a stream.voidprintTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.voidRegister listeners if this object needs that.voidsetComment(String comment) Set associated comment text.voidSet the parent.booleansetParentForAllChildren(List<String> errors) Set the parent for all the children.voidsetup()Setup this object and its children.voidGet the user name.voidUnregister listeners if this object needs that.voidupdateListenerRef(PropertyChangeListener l, String newName) voidMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
SEPARATOR
Separator returned by enums toString() methods to get a separator in JComboBoxes. SeeExpressionEntryExit.EntryExitStatefor an example.- See Also:
-
PROPERTY_CHILD_COUNT
The name of the property child count. To get the number of children, use the method getChildCount(). This constant is used in calls to firePropertyChange(). The class fires a property change then a child is added or removed.If children are removed, the field oldValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are removed from the list so that the listener can unregister itself as a listener of this female socket.
If children are added, the field newValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are added to the list so that the listener can register itself as a listener of this female socket.
- See Also:
-
PROPERTY_CHILD_REORDER
The name of the property child reorder. The number of children has remained the same, but the order of children has changed.The field newValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are reordered so that the listener can update the tree.
- See Also:
-
PROPERTY_SOCKET_CONNECTED
The socket has been connected. This constant is used in calls to firePropertyChange(). The socket fires a property change when it is connected or disconnected.- See Also:
-
PROPERTY_SOCKET_DISCONNECTED
The socket has been disconnected. This constant is used in calls to firePropertyChange(). The socket fires a property change when it is connected or disconnected.- See Also:
-
PROPERTY_LAST_RESULT_CHANGED
The last result of the expression has changed. This constant is used in calls to firePropertyChange().- See Also:
-
SOCKET_CONNECTED
Constant representing an "connected" state of the socket- See Also:
-
SOCKET_DISCONNECTED
Constant representing an "disconnected" state of the socket- See Also:
-
PRINT_LINE_NUMBERS_FORMAT
- See Also:
-
-
Method Details
-
getSystemName
Get the system name.- Returns:
- the system name
-
getUserName
Get the user name.- Returns:
- the user name
-
getComment
Get associated comment text. A LogixNG comment can have multiple lines, separated with \n.- Returns:
- the comment or null
-
setUserName
Get the user name.- Parameters:
s- the new user name- Throws:
NamedBean.BadUserNameException- when needed
-
getDeepCopy
Create a deep copy of myself and my children The item needs to try to lookup itself in both systemNames and userNames to see if the user has given a new system name and/or a new user name.If no new system name is given, an auto system name is used. If no user name is given, a null user name is used.- Parameters:
systemNames- a map of old and new system nameuserNames- a map of old system name and new user name- Returns:
- a deep copy
- Throws:
JmriException- in case of an error
-
deepCopyChildren
Base deepCopyChildren(Base original, Map<String, String> systemNames, Map<String, throws JmriExceptionString> userNames) Do a deep copy of children from the original to me.- Parameters:
original- the item to copy fromsystemNames- a map of old and new system nameuserNames- a map of old system name and new user name- Returns:
- myself
- Throws:
JmriException- in case of an error
-
setComment
Set associated comment text.Comments can be any valid text.
- Parameters:
comment- the comment or null to remove an existing comment
-
getShortDescription
Get a short description of this item.- Returns:
- a short description
-
getLongDescription
Get a long description of this item.- Returns:
- a long description
-
getShortDescription
Get a short description of this item.- Parameters:
locale- The locale to be used- Returns:
- a short description
-
getLongDescription
Get a long description of this item.- Parameters:
locale- The locale to be used- Returns:
- a long description
-
getModule
Get the Module of this item, if it's part of a module.- Returns:
- the Module that owns this item or null if it's owned by a ConditonalNG.
-
getConditionalNG
Get the ConditionalNG of this item.- Returns:
- the ConditionalNG that owns this item
-
getLogixNG
Get the LogixNG of this item.- Returns:
- the LogixNG that owns this item
-
getRoot
Get the root of the tree that this item belongs to.- Returns:
- the top most item in the tree
-
getParent
Get the parent.The following rules apply
- LogixNGs has no parent. The method throws an UnsupportedOperationException if called.
- Expressions and actions has the male socket that they are connected to as their parent.
- Male sockets has the female socket that they are connected to as their parent.
- The parent of a female sockets is the LogixNG, expression or action that has this female socket.
- The parent of a male sockets is the same parent as the expression or action that it contains.
- Returns:
- the parent of this object
-
setParent
Set the parent.The following rules apply
- ExecutionGroups has no parent. The method throws an UnsupportedOperationException if called.
- LogixNGs has the execution group as its parent.
- Expressions and actions has the male socket that they are connected to as their parent.
- Male sockets has the female socket that they are connected to as their parent.
- The parent of a female sockets is the LogixNG, expression or action that has this female socket.
- The parent of a male sockets is the same parent as the expression or action that it contains.
- Parameters:
parent- the new parent of this object
-
setParentForAllChildren
Set the parent for all the children.- Parameters:
errors- a list of potential errors- Returns:
- true if success, false otherwise
-
getChild
Get a child of this item- Parameters:
index- the index of the child to get- Returns:
- the child
- Throws:
IllegalArgumentException- if the index is less than 0 or greater or equal with the value returned by getChildCount()UnsupportedOperationException- when needed
-
getChildCount
int getChildCount()Get the number of children.- Returns:
- the number of children
-
isSocketOperationAllowed
Is the operation allowed on this child?- Parameters:
index- the index of the child to do the operation onoper- the operation to do- Returns:
- true if operation is allowed, false otherwise
-
doSocketOperation
Do an operation on a child- Parameters:
index- the index of the child to do the operation onoper- the operation to do
-
getCategory
Get the category.- Returns:
- the category
-
isActive
boolean isActive()Is this item active? If this item is enabled and all the parents are enabled, this item is active.- Returns:
- true if active, false otherwise.
-
setup
void setup()Setup this object and its children. This method is used to lookup system names for child sockets, turnouts, sensors, and so on. -
dispose
void dispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this object contained.
-
isEnabled
Determines whether this object is enabled.- Returns:
- true if the object is enabled, false otherwise
-
registerListeners
void registerListeners()Register listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not registered more than once.
-
unregisterListeners
void unregisterListeners()Unregister listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not unregistered more than once.
-
printTree
Print the tree to a stream.- Parameters:
writer- the stream to print the tree toindent- the indentation of each levellineNumber- the line number
-
printTree
void printTree(Base.PrintTreeSettings settings, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.- Parameters:
settings- settings for what to printwriter- the stream to print the tree toindent- the indentation of each levellineNumber- the line number
-
printTree
Print the tree to a stream.- Parameters:
locale- The locale to be usedwriter- the stream to print the tree toindent- the indentation of each levellineNumber- the line number
-
printTree
void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.- Parameters:
settings- settings for what to printlocale- The locale to be usedwriter- the stream to print the tree toindent- the indentation of each levellineNumber- the line number
-
printTree
void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, String currentIndent, MutableInt lineNumber) Print the tree to a stream.- Parameters:
settings- settings for what to printlocale- The locale to be usedwriter- the stream to print the tree toindent- the indentation of each levelcurrentIndent- the current indentationlineNumber- the line number
-
getListenString
-
getNoListenString
-
getUsageTree
Navigate the LogixNG tree.- Parameters:
level- The current recursion level for debugging.bean- The named bean that is the object of the search.report- A list of NamedBeanUsageReport usage reports.cdl- The current ConditionalNG bean. Null for Module searches since there is no conditional
-
getUsageDetail
Add a new NamedBeanUsageReport to the report list if there are any matches in this action or expresssion.NamedBeanUsageReport Usage keys:
- LogixNGAction
- LogixNGExpression
- Parameters:
level- The current recursion level for debugging.bean- The named bean that is the object of the search.report- A list of NamedBeanUsageReport usage reports.cdl- The current ConditionalNG bean. Null for Module searches since there is no conditional
-
addPropertyChangeListener
void addPropertyChangeListener(@Nonnull PropertyChangeListener listener, String name, String listenerRef) Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.- Parameters:
listener- The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internallyname- The name (either system or user) that the listener uses for this namedBean, this parameter is used to help determine when which listeners should be moved when the username is moved from one bean to anotherlistenerRef- A textual reference for the listener, that can be presented to the user when a delete is called
-
addPropertyChangeListener
void addPropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener, String name, String listenerRef) Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.- Parameters:
propertyName- The name of the property to listen tolistener- The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internallyname- The name (either system or user) that the listener uses for this namedBean, this parameter is used to help determine when which listeners should be moved when the username is moved from one bean to anotherlistenerRef- A textual reference for the listener, that can be presented to the user when a delete is called
-
updateListenerRef
-
vetoableChange
- Throws:
PropertyVetoException
-
getListenerRef
Get the textual reference for the specific listener- Parameters:
l- the listener of interest- Returns:
- the textual reference
-
getListenerRefs
Returns a list of all the listeners references- Returns:
- a list of textual references
-
getListenerRefsIncludingChildren
Returns a list of all the listeners references for this object and all its children.- Parameters:
list- a list of textual references
-
getNumPropertyChangeListeners
Number of current listeners. May return -1 if the information is not available for some reason.- Returns:
- the number of listeners.
-
getPropertyChangeListenersByReference
@CheckReturnValue @Nonnull PropertyChangeListener[] getPropertyChangeListenersByReference(@Nonnull String name) Get a list of all the property change listeners that are registered using a specific name- Parameters:
name- The name (either system or user) that the listener has registered as referencing this namedBean- Returns:
- empty list if none
-
forEntireTree
Do something on every item in the sub tree of this item.- Parameters:
r- the action to do on all items.
-
forEntireTreeWithException
Do something on every item in the sub tree of this item.- Parameters:
r- the action to do on all items.- Throws:
Exception- if an exception occurs
-
hasChild
Does this item has the child b?- Parameters:
b- the child- Returns:
- true if this item has the child b, false otherwise
-
existsInTree
Does this item exists in the tree?- Returns:
- true if the item exists in the tree, false otherwise
-