use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.
the class PrintLocationsAction method printDetailsSelected.
private void printDetailsSelected() throws IOException {
List<Location> locations = manager.getLocationsByNameList();
String s = Bundle.getMessage("DetailedReport") + NEW_LINE;
writer.write(s);
for (Location location : locations) {
if (_location != null && location != _location) {
continue;
}
String name = location.getName();
// services train direction
int dir = location.getTrainDirections();
s = NEW_LINE + name + getDirection(dir);
writer.write(s);
// services car and engine types
s = getLocationTypes(location);
writer.write(s);
List<Track> yards = location.getTrackByNameList(Track.YARD);
if (yards.size() > 0) {
s = SPACE + Bundle.getMessage("YardName") + NEW_LINE;
writer.write(s);
printTrackInfo(location, yards);
}
List<Track> spurs = location.getTrackByNameList(Track.SPUR);
if (spurs.size() > 0) {
s = SPACE + Bundle.getMessage("SpurName") + NEW_LINE;
writer.write(s);
printTrackInfo(location, spurs);
}
List<Track> interchanges = location.getTrackByNameList(Track.INTERCHANGE);
if (interchanges.size() > 0) {
s = SPACE + Bundle.getMessage("InterchangeName") + NEW_LINE;
writer.write(s);
printTrackInfo(location, interchanges);
}
List<Track> stagings = location.getTrackByNameList(Track.STAGING);
if (stagings.size() > 0) {
s = SPACE + Bundle.getMessage("StagingName") + NEW_LINE;
writer.write(s);
printTrackInfo(location, stagings);
}
}
if (printAnalysis.isSelected()) {
writer.write(FORM_FEED);
}
}
use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.
the class CarSetFrame method updateFinalDestination.
protected void updateFinalDestination() {
if (finalDestinationBox.getSelectedItem() == null) {
finalDestTrackBox.removeAllItems();
} else {
log.debug("CarSetFrame sees final destination: {}", finalDestinationBox.getSelectedItem());
Location l = (Location) finalDestinationBox.getSelectedItem();
l.updateComboBox(finalDestTrackBox, _car, autoFinalDestTrackCheckBox.isSelected(), true);
if (_car != null && _car.getFinalDestination() != null && _car.getFinalDestination().equals(l) && _car.getFinalDestinationTrack() != null) {
finalDestTrackBox.setSelectedItem(_car.getFinalDestinationTrack());
}
}
}
use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.
the class CarSetFrame method updateReturnWhenEmpty.
protected void updateReturnWhenEmpty() {
if (destReturnWhenEmptyBox.getSelectedItem() == null) {
trackReturnWhenEmptyBox.removeAllItems();
} else {
log.debug("CarSetFrame sees return when empty: {}", destReturnWhenEmptyBox.getSelectedItem());
Location l = (Location) destReturnWhenEmptyBox.getSelectedItem();
l.updateComboBox(trackReturnWhenEmptyBox, getTestCar(_car), autoReturnWhenEmptyTrackCheckBox.isSelected(), true);
if (_car != null && _car.getReturnWhenEmptyDestination() != null && _car.getReturnWhenEmptyDestination().equals(l) && _car.getReturnWhenEmptyDestTrack() != null) {
trackReturnWhenEmptyBox.setSelectedItem(_car.getReturnWhenEmptyDestTrack());
}
}
}
use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.
the class SetTrainIconPositionFrame method comboBoxActionPerformed.
@Override
public void comboBoxActionPerformed(java.awt.event.ActionEvent ae) {
if (locationBox.getSelectedItem() == null) {
resetSpinners();
removeIcons();
} else {
Location l = (Location) locationBox.getSelectedItem();
loadSpinners(l);
}
}
use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.
the class SetTrainIconPositionFrame method placeTestIcons.
// place test markers on panel
private void placeTestIcons() {
removeIcons();
if (locationBox.getSelectedItem() == null) {
return;
}
Editor editor = PanelMenu.instance().getEditorByName(Setup.getPanelName());
if (editor == null) {
JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle.getMessage("LoadPanel"), new Object[] { Setup.getPanelName() }), Bundle.getMessage("PanelNotFound"), JOptionPane.ERROR_MESSAGE);
return;
}
Location l = (Location) locationBox.getSelectedItem();
if (l != null) {
// East icon
if ((Setup.getTrainDirection() & Setup.EAST) == Setup.EAST) {
_tIonEast = editor.addTrainIcon(Bundle.getMessage("East"));
_tIonEast.getTooltip().setText(l.getName());
_tIonEast.getTooltip().setBackgroundColor(Color.white);
_tIonEast.setLocoColor(Setup.getTrainIconColorEast());
_tIonEast.setLocation((Integer) spinTrainIconEastX.getValue(), (Integer) spinTrainIconEastY.getValue());
addIconListener(_tIonEast);
}
// West icon
if ((Setup.getTrainDirection() & Setup.WEST) == Setup.WEST) {
_tIonWest = editor.addTrainIcon(Bundle.getMessage("West"));
_tIonWest.getTooltip().setText(l.getName());
_tIonWest.getTooltip().setBackgroundColor(Color.white);
_tIonWest.setLocoColor(Setup.getTrainIconColorWest());
_tIonWest.setLocation((Integer) spinTrainIconWestX.getValue(), (Integer) spinTrainIconWestY.getValue());
addIconListener(_tIonWest);
}
// North icon
if ((Setup.getTrainDirection() & Setup.NORTH) == Setup.NORTH) {
_tIonNorth = editor.addTrainIcon(Bundle.getMessage("North"));
_tIonNorth.getTooltip().setText(l.getName());
_tIonNorth.getTooltip().setBackgroundColor(Color.white);
_tIonNorth.setLocoColor(Setup.getTrainIconColorNorth());
_tIonNorth.setLocation((Integer) spinTrainIconNorthX.getValue(), (Integer) spinTrainIconNorthY.getValue());
addIconListener(_tIonNorth);
}
// South icon
if ((Setup.getTrainDirection() & Setup.SOUTH) == Setup.SOUTH) {
_tIonSouth = editor.addTrainIcon(Bundle.getMessage("South"));
_tIonSouth.getTooltip().setText(l.getName());
_tIonSouth.getTooltip().setBackgroundColor(Color.white);
_tIonSouth.setLocoColor(Setup.getTrainIconColorSouth());
_tIonSouth.setLocation((Integer) spinTrainIconSouthX.getValue(), (Integer) spinTrainIconSouthY.getValue());
addIconListener(_tIonSouth);
}
}
}
Aggregations