jmri.jmrit.operations.rollingstock.engines
Class EngineManager

java.lang.Object
  extended by jmri.jmrit.operations.rollingstock.RollingStockManager
      extended by jmri.jmrit.operations.rollingstock.engines.EngineManager

public class EngineManager
extends RollingStockManager

Manages the engines.

Author:
Daniel Boudreau Copyright (C) 2008

Field Summary
protected  Hashtable<String,Consist> _consistHashTable
           
static String CONSISTLISTLENGTH_CHANGED_PROPERTY
           
 
Fields inherited from class jmri.jmrit.operations.rollingstock.RollingStockManager
_hashTable, BY_BUILT, BY_COLOR, BY_DESTINATION, BY_LOCATION, BY_MOVES, BY_NUMBER, BY_OWNER, BY_RFID, BY_ROAD, BY_TRAIN, BY_TYPE, BY_VALUE, LISTLENGTH_CHANGED_PROPERTY
 
Constructor Summary
EngineManager()
           
 
Method Summary
 void deleteConsist(String name)
           
 List<String> getAvailableTrainList(Train train)
          return a list available engines (no assigned train) engines are ordered least recently moved to most recently moved.
 List<String> getByConsistList()
          Sort by engine consist
 Engine getById(String id)
          Get rolling stock by id
 List<String> getByModelList()
          Sort by engine model
 Engine getByRoadAndNumber(String engineRoad, String engineNumber)
          Get rolling stock by road and number
 Consist getConsistByName(String name)
           
 JComboBox getConsistComboBox()
          Creates a combo box containing all of the consist names
 List<String> getConsistNameList()
           
 List<String> getEngineRoadNames(String model)
          Get a list of engine road names.
 int[] getEnginesFrameTableColumnWidths()
           
protected  Object getRsAttribute(RollingStock rs, int attribute)
           
static EngineManager instance()
           
 Consist newConsist(String name)
          Creates a new consist if needed
 Engine newEngine(String engineRoad, String engineNumber)
          Finds an existing engine or creates a new engine if needed requires engine's road and number
 void options(Element values)
           
 void setEnginesFrameTableColumnWidths(int[] tableColumnWidths)
           
 Element store()
          Create an XML element to represent this Entry.
 void updateConsistComboBox(JComboBox box)
           
 
Methods inherited from class jmri.jmrit.operations.rollingstock.RollingStockManager
addPropertyChangeListener, deleteAll, deregister, dispose, firePropertyChange, getByBuiltList, getByColorList, getByDestinationList, getByIdList, getByList, getByLocationList, getByMovesList, getByNumberList, getByOwnerList, getByRfid, getByRfidList, getByRoadNameList, getByTrainList, getByTrainList, getByTypeAndRoad, getByTypeList, getByTypeList, getByValueList, getNumEntries, register, removePropertyChangeListener, sortList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_consistHashTable

protected Hashtable<String,Consist> _consistHashTable

CONSISTLISTLENGTH_CHANGED_PROPERTY

public static final String CONSISTLISTLENGTH_CHANGED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

EngineManager

public EngineManager()
Method Detail

instance

public static EngineManager instance()

getById

public Engine getById(String id)
Description copied from class: RollingStockManager
Get rolling stock by id

Overrides:
getById in class RollingStockManager
Returns:
requested Engine object or null if none exists

getByRoadAndNumber

public Engine getByRoadAndNumber(String engineRoad,
                                 String engineNumber)
Description copied from class: RollingStockManager
Get rolling stock by road and number

Overrides:
getByRoadAndNumber in class RollingStockManager
Parameters:
engineRoad - RollingStock road
engineNumber - RollingStock number
Returns:
requested RollingStock object or null if none exists

newEngine

public Engine newEngine(String engineRoad,
                        String engineNumber)
Finds an existing engine or creates a new engine if needed requires engine's road and number

Parameters:
engineRoad -
engineNumber -
Returns:
new engine or existing engine

newConsist

public Consist newConsist(String name)
Creates a new consist if needed

Parameters:
name - of the consist
Returns:
consist

deleteConsist

public void deleteConsist(String name)

getConsistByName

public Consist getConsistByName(String name)

getConsistComboBox

public JComboBox getConsistComboBox()
Creates a combo box containing all of the consist names

Returns:
a combo box with all of the consist names

updateConsistComboBox

public void updateConsistComboBox(JComboBox box)

getConsistNameList

public List<String> getConsistNameList()

getByModelList

public List<String> getByModelList()
Sort by engine model

Returns:
list of engine ids ordered by engine model

getByConsistList

public List<String> getByConsistList()
Sort by engine consist

Returns:
list of engine ids ordered by engine consist

getRsAttribute

protected Object getRsAttribute(RollingStock rs,
                                int attribute)
Overrides:
getRsAttribute in class RollingStockManager

getAvailableTrainList

public List<String> getAvailableTrainList(Train train)
return a list available engines (no assigned train) engines are ordered least recently moved to most recently moved.

Overrides:
getAvailableTrainList in class RollingStockManager
Parameters:
train -
Returns:
Ordered list of engine ids not assigned to a train

getEngineRoadNames

public List<String> getEngineRoadNames(String model)
Get a list of engine road names.

Returns:
List of engine road names.

getEnginesFrameTableColumnWidths

public int[] getEnginesFrameTableColumnWidths()
Returns:
get an array of table column widths for the trains frame

setEnginesFrameTableColumnWidths

public void setEnginesFrameTableColumnWidths(int[] tableColumnWidths)

options

public void options(Element values)

store

public Element store()
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-locations.dtd.

Returns:
Contents in a JDOM Element


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