|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.AbstractNamedBean
jmri.jmrit.display.LayoutBlock
public class LayoutBlock
A LayoutBlock is a group of track segments and turnouts on a LayoutEditor panel corresponding to a 'block'. LayoutBlock is a LayoutEditor specific extension of the JMRI Block object.
LayoutBlocks may have an occupancy Sensor. The getOccupancy method returns the occupancy state of the LayoutBlock - OCCUPIED, EMPTY, or UNKNOWN. If no occupancy sensor is provided, UNKNOWN is returned. The occupancy sensor if there is one, is the same as the occupancy sensor of the corresponding JMRI Block.
The name of each Layout Block is the same as that of the corresponding block as defined in Layout Editor . A corresponding JMRI Block object is created when a LayoutBlock is created. The JMRI Block uses the name of the block defined in Layout Editor as its user name and a unique IBnnn system name. The JMRI Block object and its associated Path objects are useful in tracking a train around the layout. Blocks may be viewed in the Block Table.
A LayoutBlock may have an associated Memory object. This Memory object contains a string representing the current "value" of the corresponding JMRI Block object. If the value contains a train name, for example, displaying Memory objects associated with LayoutBlocks, and displayed near each Layout Block can follow a train around the layout, displaying its name when it is in the . LayoutBlock.
LayoutBlocks are "cross-panel", similar to sensors and turnouts. A LayoutBlock may be used by more than one Layout Editor panel simultaneously. As a consequence, LayoutBlocks are saved with the configuration, not with a panel.
LayoutBlocks are used by TrackSegments, LevelXings, and LayoutTurnouts. LevelXings carry two LayoutBlock designations, which may be the same. LayoutTurnouts carry LayoutBlock designations also, one per turnout, except for double crossovers which can have up to four.
LayoutBlocks carry a use count. The use count counts the number of track segments, layout turnouts, and levelcrossings which use the LayoutBlock. Only LayoutBlocks which have a use count greater than zero are saved when the configuration is saved.
| Field Summary | |
|---|---|
String |
blockName
|
Color |
blockOccupiedColor
|
Color |
blockTrackColor
|
static int |
EMPTY
|
String |
memoryName
|
String |
occupancySensorName
|
static int |
OCCUPIED
|
int |
occupiedSense
|
static int |
UNKNOWN
|
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT |
| Constructor Summary | |
|---|---|
LayoutBlock(String sName,
String uName)
|
|
| Method Summary | |
|---|---|
void |
addLayoutEditor(LayoutEditor panel)
Keeps track of LayoutEditor panels that are using this LayoutBlock |
static String |
colorToString(Color color)
Utility methods for converting between string and color Note: These names are only used internally, so don't need a resource bundle |
void |
decrementUse()
|
void |
deleteLayoutEditor(LayoutEditor panel)
|
protected void |
editLayoutBlock(Component callingPane)
Edit a Layout Block |
Block |
getBlock()
Get the jmri.Block corresponding to this LayoutBlock |
Color |
getBlockColor()
Returns the color for drawing items in this block. |
Color |
getBlockOccupiedColor()
|
Color |
getBlockTrackColor()
|
String |
getID()
Accessor methods |
protected LayoutEditor |
getMaxConnectedPanel()
Get the Layout Editor panel with the highest connectivity to this Layout Block |
Memory |
getMemory()
Returns Memory |
String |
getMemoryName()
Returns Memory name |
int |
getOccupancy()
Test block occupancy |
Sensor |
getOccupancySensor()
Returns occupancy Sensor |
String |
getOccupancySensorName()
Returns occupancy Sensor name |
int |
getOccupiedSense()
Get/Set occupied sense |
int |
getState()
Provide generic access to internal state. |
int |
getUseCount()
|
void |
incrementUse()
|
boolean |
isActive()
"active" means that the object is still displayed, and should be stored. |
boolean |
isOnPanel(LayoutEditor panel)
|
void |
redrawLayoutBlockPanels()
Redraws panels using this layout block |
void |
setBlockOccupiedColor(Color color)
|
void |
setBlockTrackColor(Color color)
|
void |
setMemoryName(String name)
Add Memory by name |
void |
setOccupancySensorName(String name)
Add occupancy sensor by name |
void |
setOccupiedSense(int sense)
|
void |
setState(int i)
Provide generic access to internal state. |
static Color |
stringToColor(String string)
|
void |
updatePaths()
Check/Update Path objects for the attached jmri.Block If multiple panels are present, Paths are set according to the panel with the highest connectivity (most LayoutConnectivity objects); |
Memory |
validateMemory(String memName,
Component openFrame)
Validates that the memory name corresponds to an existing memory. |
Sensor |
validateSensor(String sensorName,
Component openFrame)
Validates that the supplied occupancy sensor name corresponds to an existing sensor and is unique among all blocks. |
| Methods inherited from class jmri.AbstractNamedBean |
|---|
addPropertyChangeListener, dispose, firePropertyChange, getComment, getNumPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setUserName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int OCCUPIED
public static final int EMPTY
public static final int UNKNOWN
public String blockName
public String occupancySensorName
public String memoryName
public int occupiedSense
public Color blockTrackColor
public Color blockOccupiedColor
| Constructor Detail |
|---|
public LayoutBlock(String sName,
String uName)
| Method Detail |
|---|
public String getID()
public Color getBlockTrackColor()
public void setBlockTrackColor(Color color)
public Color getBlockOccupiedColor()
public void setBlockOccupiedColor(Color color)
public void incrementUse()
public void decrementUse()
public int getUseCount()
public void addLayoutEditor(LayoutEditor panel)
public void deleteLayoutEditor(LayoutEditor panel)
public boolean isOnPanel(LayoutEditor panel)
public void redrawLayoutBlockPanels()
public Sensor validateSensor(String sensorName,
Component openFrame)
public Memory validateMemory(String memName,
Component openFrame)
public Color getBlockColor()
public Block getBlock()
public String getMemoryName()
public Memory getMemory()
public void setMemoryName(String name)
public String getOccupancySensorName()
public Sensor getOccupancySensor()
public void setOccupancySensorName(String name)
public int getOccupiedSense()
public void setOccupiedSense(int sense)
public int getOccupancy()
public int getState()
NamedBeanThis 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.
public void setState(int i)
NamedBeanThis 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.
protected LayoutEditor getMaxConnectedPanel()
public void updatePaths()
If multiple panels are present, Paths are set according to the panel with the highest connectivity (most LayoutConnectivity objects);
protected void editLayoutBlock(Component callingPane)
public static String colorToString(Color color)
public static Color stringToColor(String string)
public boolean isActive()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||