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