<commit_before>package org.helioviewer.jhv.gui.components.statusplugins;

import java.awt.Dimension;

import javax.swing.BorderFactory;

import org.helioviewer.jhv.layers.LayersModel;

/**
 * Status panel for displaying the framerate for image series.
 * 
 * <p>
 * The information of this panel is always shown for the active layer.
 * 
 * <p>
 * This panel is not visible, if the active layer is not an image series.
 * 
 * @author <NAME>
 */
public class FramerateStatusPanel extends ViewStatusPanelPlugin {

    private static final long serialVersionUID = 1L;

    /**
     * Default constructor.
     */
    public FramerateStatusPanel() {
        setBorder(BorderFactory.createEtchedBorder());

        setPreferredSize(new Dimension(70, 20));
        setText("fps:");

        setVisible(true);
        LayersModel.getSingletonInstance().addLayersListener(this);
    }

    private void updateFramerate() {

        int idx = LayersModel.getSingletonInstance().getActiveLayer();

        if (LayersModel.getSingletonInstance().isValidIndex(idx)) {

            double fps = LayersModel.getSingletonInstance().getFPS(idx);
            String fpsString = Double.toString(fps);

            setVisible(true);
            setText("fps: " + fpsString);

        } else {

            setVisible(false);

        }

    }

    public void activeLayerChanged(int idx) {
        this.updateFramerate();
    }

    public void subImageDataChanged() {
        this.updateFramerate();
    }
}
<commit_msg>Update fps status from EventQueue<commit_after>package org.helioviewer.jhv.gui.components.statusplugins;

import java.awt.Dimension;
import java.awt.EventQueue;

import javax.swing.BorderFactory;

import org.helioviewer.jhv.layers.LayersModel;

/**
 * Status panel for displaying the framerate for image series.
 * 
 * <p>
 * The information of this panel is always shown for the active layer.
 * 
 * <p>
 * This panel is not visible, if the active layer is not an image series.
 * 
 * @author <NAME>
 */
public class FramerateStatusPanel extends ViewStatusPanelPlugin {

    private static final long serialVersionUID = 1L;

    /**
     * Default constructor.
     */
    public FramerateStatusPanel() {
        setBorder(BorderFactory.createEtchedBorder());

        setPreferredSize(new Dimension(70, 20));
        setText("fps:");

        setVisible(true);
        LayersModel.getSingletonInstance().addLayersListener(this);
    }

    private void updateFramerate() {
        int idx = LayersModel.getSingletonInstance().getActiveLayer();
        if (LayersModel.getSingletonInstance().isValidIndex(idx)) {
            double fps = LayersModel.getSingletonInstance().getFPS(idx);
            String fpsString = Double.toString(fps);

            setVisible(true);
            setText("fps: " + fpsString);
        } else {
            setVisible(false);
        }
    }

    private void updateFramerate_eq() {
        if (EventQueue.isDispatchThread()) {
            updateFramerate();
        } else {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    updateFramerate();
                }
            });
        }
    }

    public void activeLayerChanged(int idx) {
        updateFramerate_eq();
    }

    public void subImageDataChanged() {
        updateFramerate_eq();
    }

}

{'fraction_non_alphanumeric': 0.10091743119266056, 'fraction_numerical': 0.002959455460195324, 'mean_word_length': 2.5504201680672267, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5455877', 'n_tokens_mistral': 1004, 'n_tokens_neox': 943, 'n_words': 214}