jmri
Interface NamedBean

Show UML class diagram
All Known Subinterfaces:
Audio, AudioBuffer, AudioListener, AudioSource, CatalogTree, Conditional, IdTag, Light, Logix, Memory, RailCom, Reporter, Route, Sensor, SignalGroup, SignalHead, SignalMast, SignalSystem, Timebase, Turnout
All Known Implementing Classes:
AbstractAudio, AbstractAudioBuffer, AbstractAudioListener, AbstractAudioSource, AbstractCatalogTree, AbstractIdTag, AbstractLight, AbstractMemory, AbstractNamedBean, AbstractReporter, AbstractSensor, AbstractSignalHead, AbstractSignalMast, AbstractTurnout, AbstractVariableLight, AcelaLight, AcelaSensor, AcelaSignalHead, AcelaTurnout, Block, CatalogTreeFS, CatalogTreeIndex, CbusSensor, CbusTurnout, CoreIdRfidReporter, CoreIdRfidSensor, Dcc4PcReporter, Dcc4PcSensor, DccSignalHead, DccSignalMast, DefaultConditional, DefaultIdTag, DefaultLogix, DefaultMemory, DefaultRailCom, DefaultRoute, DefaultSignalAppearanceMap, DefaultSignalGroup, DefaultSignalHead, DefaultSignalSystem, DestinationPoints, DoubleTurnoutSignalHead, EasyDccTurnout, EcosReporter, EcosSensor, EcosTurnout, EliteXNetTurnout, JavaSoundAudioBuffer, JavaSoundAudioListener, JavaSoundAudioSource, JMRIClientLight, JMRIClientReporter, JMRIClientSensor, JMRIClientTurnout, JoalAudioBuffer, JoalAudioListener, JoalAudioSource, LayoutBlock, LNCPSignalMast, LnLight, LnReporter, LnSensor, LnTurnout, LsDecSignalHead, MarklinSensor, MarklinTurnout, MergSD2SignalHead, NceLight, NceSensor, NceTurnout, NullAudioBuffer, NullAudioListener, NullAudioSource, OBlock, OlcbSensor, OlcbTurnout, QuadOutputSignalHead, RfidReporter, RfidSensor, RpsReporter, RpsSensor, SE8cSignalHead, SE8cSignalHead, Section, SensorGroupConditional, SerialLight, SerialLight, SerialLight, SerialLight, SerialLight, SerialLight, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSignalHead, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialTurnout, SerialX10Light, SignalHeadSignalMast, SimpleTimebase, SingleTurnoutSignalHead, SpecificInsteonLight, SpecificInsteonLight, SpecificLight, SpecificLight, SpecificX10Light, SpecificX10Light, SprogCSTurnout, SprogTurnout, SRCPSensor, SRCPTurnout, TamsTurnout, Transit, TripleTurnoutSignalHead, TurnoutSignalMast, VirtualSignalHead, VirtualSignalMast, Warrant, XNetLight, XNetSensor, XNetTurnout, XpaTurnout

public interface NamedBean

Provides common services for classes representing objects on the layout, and allows a common form of access by their Managers.

Each object has a two names. The "user" name is entirely free form, and can be used for any purpose. The "system" name is provided by the system-specific implementations, and provides a unique mapping to the layout control system (e.g. LocoNet, NCE, etc) and address within that system.


This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See Also:
Manager

Field Summary
static int INCONSISTENT
          Constant representing an "inconsistent" state, indicating that some inconsistency has been detected in the hardware readback.
static int UNKNOWN
          Constant representing an "unknown" state, indicating that the object's state is not necessarily that of the actual layout hardware.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addPropertyChangeListener(PropertyChangeListener l, String name, String listenerRef)
          Request a call-back when a bound property changes.
 void dispose()
          Deactivate this object, so that it releases as many resources as possible and no longer effects others.
 String getComment()
          Get associated comment text.
 String getDisplayName()
           
 String getListenerRef(PropertyChangeListener l)
          Get the textual reference for the specific listener
 ArrayList<String> getListenerRefs()
          Returns a list of all the listerners references
 int getNumPropertyChangeListeners()
          Number of current listeners.
 Object getProperty(Object key)
          Retrieve the value associated with a key.
 ArrayList<PropertyChangeListener> getPropertyChangeListeners(String name)
          Get a list of all the property change listeners that are registered using a specific name
 Set<Object> getPropertyKeys()
          Retrieve the complete current set of keys.
 int getState()
          Provide generic access to internal state.
 String getSystemName()
          Get a system-specific name.
 String getUserName()
           
 void removeProperty(Object key)
          Remove the key/value pair against the NamedBean.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a request for a call-back when a bound property changes.
 void setComment(String comment)
          Set associated comment text.
 void setProperty(Object key, Object value)
          Attach a key/value pair to the NamedBean, which can be retrieved later.
 void setState(int s)
          Provide generic access to internal state.
 void setUserName(String s)
           
 void updateListenerRef(PropertyChangeListener l, String newName)
           
 

Field Detail

UNKNOWN

static final int UNKNOWN
Constant representing an "unknown" state, indicating that the object's state is not necessarily that of the actual layout hardware. This is the initial state of a newly created object before communication with the layout.

See Also:
Constant Field Values

INCONSISTENT

static final int INCONSISTENT
Constant representing an "inconsistent" state, indicating that some inconsistency has been detected in the hardware readback.

See Also:
Constant Field Values
Method Detail

getUserName

String getUserName()

setUserName

void setUserName(String s)

getSystemName

String getSystemName()
Get a system-specific name. This encodes the hardware addressing information.


getDisplayName

String getDisplayName()

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener l,
                               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:
l - - Listener
name - - 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 another.
listenerRef - - A textual reference for the listener, that can be presented to the user when a delete is called

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener l)
Remove a request for a call-back when a bound property changes.


updateListenerRef

void updateListenerRef(PropertyChangeListener l,
                       String newName)

getListenerRef

String getListenerRef(PropertyChangeListener l)
Get the textual reference for the specific listener


getListenerRefs

ArrayList<String> getListenerRefs()
Returns a list of all the listerners references


getNumPropertyChangeListeners

int getNumPropertyChangeListeners()
Number of current listeners. May return -1 if the information is not available for some reason.


getPropertyChangeListeners

ArrayList<PropertyChangeListener> getPropertyChangeListeners(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

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 NamedBean contained.


setState

void setState(int s)
              throws JmriException
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 provided to make Jython script access easier to read.

Throws:
JmriException - general error when cant do the needed operation

getState

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 provided to make Jython script access easier to read.


getComment

String getComment()
Get associated comment text.


setComment

void setComment(String comment)
Set associated comment text.

Comments can be any valid text.

Parameters:
comment - Null means no comment associated.

setProperty

void setProperty(Object key,
                 Object value)
Attach a key/value pair to the NamedBean, which can be retrieved later. These are not bound properties as yet, and don't throw events on modification. Key must not be null.


getProperty

Object getProperty(Object key)
Retrieve the value associated with a key. If no value has been set for that key, returns null.


removeProperty

void removeProperty(Object key)
Remove the key/value pair against the NamedBean.


getPropertyKeys

Set<Object> getPropertyKeys()
Retrieve the complete current set of keys.



Copyright © 1997-2013 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads