jmri.managers
Class ProxyLightManager

java.lang.Object
  extended by jmri.managers.AbstractProxyManager
      extended by jmri.managers.ProxyLightManager
All Implemented Interfaces:
LightManager, Manager

public class ProxyLightManager
extends AbstractProxyManager
implements LightManager

Implementation of a LightManager that can serves as a proxy for multiple system-specific implementations.

Author:
Bob Jacobsen Copyright (C) 2010, Dave Duchamp Copyright (C) 2004

Field Summary
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
ProxyLightManager()
           
 
Method Summary
 void activateAllLights()
          Activate the control mechanism for each Light controlled by this LightManager.
 boolean allowMultipleAdditions(String systemName)
          A method that determines if it is possible to add a range of lights in numerical order eg 11 thru 18, primarily used to show/not show the add range box in the add Light window
 String convertSystemNameToAlternate(String systemName)
          Convert a system name to an alternate format Locate a system specfic LightManager based on a system name.
 Light getBySystemName(String systemName)
          Locate an instance based on a system name.
 Light getByUserName(String userName)
          Locate an instance based on a user name.
 Light getLight(String name)
          Locate via user name, then system name if needed.
 int getXMLOrder()
           
protected  NamedBean makeBean(int i, String systemName, String userName)
          Defer creation of the proper type to the subclass
protected  AbstractManager makeInternalManager()
           
 Light newLight(String systemName, String userName)
          Return an instance with the specified system and user names.
 String normalizeSystemName(String systemName)
          Normalize a system name Locate a system specfic LightManager based on a system name.
 Light provideLight(String name)
          Locate via user name, then system name if needed.
 boolean supportsVariableLights(String systemName)
          Responds 'true' if Light Manager is for a System that supports variable Lights.
 boolean validSystemNameConfig(String systemName)
          Validate system name against the hardware configuration Locate a system specfic LightManager based on a system name.
 boolean validSystemNameFormat(String systemName)
          Validate system name format Locate a system specfic LightManager based on a system name.
 
Methods inherited from class jmri.managers.AbstractProxyManager
addManager, addPropertyChangeListener, deregister, dispose, getBeanBySystemName, getBeanByUserName, getManagerList, getMgr, getNamedBean, getSystemNameArray, getSystemNameList, getSystemPrefix, makeSystemName, match, matchTentative, newNamedBean, nMgrs, provideNamedBean, register, removePropertyChangeListener, systemLetter, typeLetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.LightManager
dispose, getSystemNameList
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, getBeanBySystemName, getSystemNameArray, getSystemPrefix, makeSystemName, register, removePropertyChangeListener, systemLetter, typeLetter
 

Constructor Detail

ProxyLightManager

public ProxyLightManager()
Method Detail

getXMLOrder

public int getXMLOrder()
Specified by:
getXMLOrder in interface Manager

makeInternalManager

protected AbstractManager makeInternalManager()
Specified by:
makeInternalManager in class AbstractProxyManager

getLight

public Light getLight(String name)
Locate via user name, then system name if needed.

Specified by:
getLight in interface LightManager
Parameters:
name -
Returns:
Null if nothing by that name exists

makeBean

protected NamedBean makeBean(int i,
                             String systemName,
                             String userName)
Description copied from class: AbstractProxyManager
Defer creation of the proper type to the subclass

Specified by:
makeBean in class AbstractProxyManager
Parameters:
i - Which manager to invoke

provideLight

public Light provideLight(String name)
Locate via user name, then system name if needed. If that fails, create a new Light: If the name is a valid system name, it will be used for the new Light. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.

Specified by:
provideLight in interface LightManager
Parameters:
name -
Returns:
Never null under normal circumstances

getBySystemName

public Light getBySystemName(String systemName)
Locate an instance based on a system name. Returns null if no instance already exists.

Specified by:
getBySystemName in interface LightManager
Returns:
requested Light object or null if none exists

getByUserName

public Light getByUserName(String userName)
Locate an instance based on a user name. Returns null if no instance already exists.

Specified by:
getByUserName in interface LightManager
Returns:
requested Turnout object or null if none exists

newLight

public Light newLight(String systemName,
                      String userName)
Return an instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Light object representing a given physical light and therefore only one with a specific system or user name.

This will always return a valid object reference for a valid request; a new object will be created if necessary. In that case:

Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating Lights when you should be looking them up.

Specified by:
newLight in interface LightManager
Returns:
requested Light object (never null)

validSystemNameFormat

public boolean validSystemNameFormat(String systemName)
Validate system name format Locate a system specfic LightManager based on a system name. Returns false if no manager exists. If a manager is found, return its determination of validity of system name format

Specified by:
validSystemNameFormat in interface LightManager

validSystemNameConfig

public boolean validSystemNameConfig(String systemName)
Validate system name against the hardware configuration Locate a system specfic LightManager based on a system name. Returns false if no manager exists. If a manager is found, return its determination of validity of system name relative to the hardware configuration

Specified by:
validSystemNameConfig in interface LightManager

normalizeSystemName

public String normalizeSystemName(String systemName)
Normalize a system name Locate a system specfic LightManager based on a system name. Returns "" if no manager exists. If a manager is found, return its determination of a normalized system name

Specified by:
normalizeSystemName in interface LightManager

convertSystemNameToAlternate

public String convertSystemNameToAlternate(String systemName)
Convert a system name to an alternate format Locate a system specfic LightManager based on a system name. Returns "" if no manager exists. If a manager is found, return its determination of an alternate system name

Specified by:
convertSystemNameToAlternate in interface LightManager

activateAllLights

public void activateAllLights()
Activate the control mechanism for each Light controlled by this LightManager. Relay this call to all LightManagers.

Specified by:
activateAllLights in interface LightManager

supportsVariableLights

public boolean supportsVariableLights(String systemName)
Responds 'true' if Light Manager is for a System that supports variable Lights. Returns false if no manager exists. If a manager is found, return its determination of support for variable lights.

Specified by:
supportsVariableLights in interface LightManager

allowMultipleAdditions

public boolean allowMultipleAdditions(String systemName)
A method that determines if it is possible to add a range of lights in numerical order eg 11 thru 18, primarily used to show/not show the add range box in the add Light window

Specified by:
allowMultipleAdditions in interface LightManager


Copyright © 1997 - 2011 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