001package jmri.jmrit.whereused;
002
003import javax.swing.JTextArea;
004import jmri.NamedBean;
005import jmri.NamedBean.DisplayOptions;
006
007/**
008 * Find turnout references.
009 *
010 * @author Dave Sand Copyright (C) 2020
011 */
012
013public class TurnoutWhereUsed {
014
015    /**
016     * Populate a textarea with the where used content for the supplied turnout.
017     * @param turnout The turnout bean.
018     * @return a populated textarea.
019     */
020    static public JTextArea getWhereUsed(NamedBean turnout) {
021        JTextArea textArea = new JTextArea();
022        String label = Bundle.getMessage("MakeLabel", Bundle.getMessage("BeanNameTurnout"));  // NOI18N
023        textArea.append(Bundle.getMessage("ReferenceTitle", label, turnout.getDisplayName(DisplayOptions.USERNAME_SYSTEMNAME)));  // NOI18N
024        textArea.append(Bundle.getMessage("ListenerCount", turnout.getNumPropertyChangeListeners()));  // NOI18N
025
026        textArea.append(WhereUsedCollectors.checkLights(turnout));
027        textArea.append(WhereUsedCollectors.checkRoutes(turnout));
028        textArea.append(WhereUsedCollectors.checkBlocks(turnout));
029        textArea.append(WhereUsedCollectors.checkSignalHeadLogic(turnout));
030        textArea.append(WhereUsedCollectors.checkSignalMastLogic(turnout));
031        textArea.append(WhereUsedCollectors.checkSignalGroups(turnout));
032        textArea.append(WhereUsedCollectors.checkSignalHeads(turnout));
033        textArea.append(WhereUsedCollectors.checkSignalMasts(turnout));
034        textArea.append(WhereUsedCollectors.checkOBlocks(turnout));
035        textArea.append(WhereUsedCollectors.checkLogixConditionals(turnout));
036        textArea.append(WhereUsedCollectors.checkLogixNGConditionals(turnout));
037        textArea.append(WhereUsedCollectors.checkPanels(turnout));
038        textArea.append(WhereUsedCollectors.checkCTC(turnout));
039        return textArea;
040    }
041}