jmri.jmrit.display
Class LayoutBlockManager

java.lang.Object
  extended by jmri.AbstractManager
      extended by jmri.jmrit.display.LayoutBlockManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, Manager

public class LayoutBlockManager
extends AbstractManager

Implementation of a Manager to handle LayoutBlocks Note: that the same LayoutBlocks may appear in multiple LayoutEditor panels.

This manager does not enforce any particular system naming convention.

LayoutBlocks are usually addressed by userName. The systemName is hidden from the user for the most part.

Author:
Dave Duchamp Copyright (C) 2007

Field Summary
 
Fields inherited from class jmri.AbstractManager
_tsys, _tuser
 
Constructor Summary
LayoutBlockManager()
           
 
Method Summary
 void addBadBeanError()
           
 LayoutBlock createNewLayoutBlock(String systemName, String userName)
          Method to create a new LayoutBlock if the LayoutBlock does not exist Returns null if a LayoutBlock with the same systemName or userName already exists, or if there is trouble creating a new LayoutBlock.
 void deleteLayoutBlock(LayoutBlock block)
          Remove an existing LayoutBlock.
 LayoutBlock getBlockWithSensorAssigned(Sensor s)
          Method to find a LayoutBlock with a specified Sensor assigned as its occupancy sensor.
 LayoutBlock getBySystemName(String name)
           
 LayoutBlock getByUserName(String key)
           
 SignalHead getFacingSignalHead(Block facingBlock, Block protectedBlock)
          Method to return the Signal Head facing into a specified Block from a specified protected Block.
 LayoutBlock getLayoutBlock(String name)
          Method to get an existing LayoutBlock.
 void initializeLayoutBlockPaths()
          Initializes/checks the Paths of all Blocks associated with LayoutBlocks.
static LayoutBlockManager instance()
           
 char systemLetter()
           
 void turnOffWarning()
           
 char typeLetter()
           
 boolean warn()
          Controls switching off incompatible block connectivity messages Warnings are always on when program starts up.
 
Methods inherited from class jmri.AbstractManager
addPropertyChangeListener, deregister, dispose, firePropertyChange, getInstanceBySystemName, getInstanceByUserName, getSystemNameList, makeSystemName, propertyChange, register, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutBlockManager

public LayoutBlockManager()
Method Detail

systemLetter

public char systemLetter()
Returns:
The system-specific prefix letter for a specific implementation

typeLetter

public char typeLetter()
Returns:
The type letter for a specific implementation

createNewLayoutBlock

public LayoutBlock createNewLayoutBlock(String systemName,
                                        String userName)
Method to create a new LayoutBlock if the LayoutBlock does not exist Returns null if a LayoutBlock with the same systemName or userName already exists, or if there is trouble creating a new LayoutBlock. Note that since the userName is used to address LayoutBlocks, the user name must be present. If the user name is not present, the new LayoutBlock is not created, and null is returned.


deleteLayoutBlock

public void deleteLayoutBlock(LayoutBlock block)
Remove an existing LayoutBlock.


getLayoutBlock

public LayoutBlock getLayoutBlock(String name)
Method to get an existing LayoutBlock. First looks up assuming that name is a User Name. If this fails looks up assuming that name is a System Name. If both fail, returns null.


getBySystemName

public LayoutBlock getBySystemName(String name)

getByUserName

public LayoutBlock getByUserName(String key)

instance

public static LayoutBlockManager instance()

getBlockWithSensorAssigned

public LayoutBlock getBlockWithSensorAssigned(Sensor s)
Method to find a LayoutBlock with a specified Sensor assigned as its occupancy sensor. Returns the block or null if no existing LayoutBlock has the Sensor assigned.


initializeLayoutBlockPaths

public void initializeLayoutBlockPaths()
Initializes/checks the Paths of all Blocks associated with LayoutBlocks.

This routine should be called when loading panels, after all Layout Editor panels have been loaded.


addBadBeanError

public void addBadBeanError()

getFacingSignalHead

public SignalHead getFacingSignalHead(Block facingBlock,
                                      Block protectedBlock)
Method to return the Signal Head facing into a specified Block from a specified protected Block.

This method is primarily designed for use with scripts to get information initially residing in a Layout Editor panel. If either of the input Blocks is null, or if the two blocks do not join at a block boundary, or if either of the input Blocks are not Layout Editor panel blocks, an error message is logged, and "null" is returned. If the signal at the block boundary has two heads--is located at the facing point of a turnout-- the Signal Head that applies for the current setting of turnout (THROWN or CLOSED) is returned. If the turnout state is UNKNOWN or INCONSISTENT, an error message is logged, and "null" is returned.


warn

public boolean warn()
Controls switching off incompatible block connectivity messages

Warnings are always on when program starts up. Once stopped by the user, these messages may not be switched on again until program restarts.


turnOffWarning

public void turnOffWarning()


Copyright © 1997 - 2008 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: SourceForge_Logo