001package jmri.jmrit.whereused;
002
003import javax.swing.JTextArea;
004import jmri.NamedBean;
005import jmri.NamedBean.DisplayOptions;
006
007/**
008 * Find Audio references.
009 *
010 * @author Dave Sand Copyright (C) 2023
011 */
012
013public class AudioWhereUsed {
014
015    /**
016     * Populate a textarea with the where used content for the supplied Audio bean.
017     * @param audio The audio bean.
018     * @return a populated textarea.
019     */
020    static public JTextArea getWhereUsed(NamedBean audio) {
021        JTextArea textArea = new JTextArea();
022        String label = Bundle.getMessage("MakeLabel", Bundle.getMessage("BeanNameAudio"));  // NOI18N
023        textArea.append(Bundle.getMessage("ReferenceTitle", label, audio.getDisplayName(DisplayOptions.USERNAME_SYSTEMNAME)));  // NOI18N
024        textArea.append(Bundle.getMessage("ListenerCount", audio.getNumPropertyChangeListeners()));  // NOI18N
025
026        textArea.append(WhereUsedCollectors.checkAudio(audio));
027        textArea.append(WhereUsedCollectors.checkLogixConditionals(audio));
028        textArea.append(WhereUsedCollectors.checkLogixNGConditionals(audio));
029        textArea.append(WhereUsedCollectors.checkPanels(audio));
030        return textArea;
031    }
032}