<commit_before>package view;

import hochberger.utilities.application.session.BasicSession;
import hochberger.utilities.gui.UndecoratedEDTSafeFrame;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import modules.CustosModule;
import modules.VisibleCustosModule;
import net.miginfocom.swing.MigLayout;
import controller.SystemMessage;
import controller.SystemMessageMemory;

public class CustosMainFrame extends UndecoratedEDTSafeFrame {

    private final List<VisibleCustosModule> modules;
    private final ColorProvider colorProvider;
    private final SystemMessageLabel systemMessageLabel;
    private final SystemMessageDialog systemMessageDialog;

    public CustosMainFrame(final BasicSession session, final ColorProvider colorProvider, final SystemMessageMemory messageMemory) {
        super(session.getProperties().title());
        this.colorProvider = colorProvider;
        this.modules = new CopyOnWriteArrayList<>();
        this.systemMessageLabel = new SystemMessageLabel(colorProvider);
        session.getEventBus().register(this.systemMessageLabel, SystemMessage.class);
        this.systemMessageDialog = new SystemMessageDialog(colorProvider, messageMemory);
        session.getEventBus().register(this.systemMessageDialog, SystemMessage.class);
    }

    @Override
    protected void buildUI() {
        exitOnClose();
        center();
        frame().getContentPane().setBackground(this.colorProvider.backgroundColor());
        useLayoutManager(new MigLayout("wrap 3", "20[]:push[]:push[]20", "20[]20[]20[]push"));
        frame().setAlwaysOnTop(true);
        this.systemMessageLabel.build();
        this.systemMessageDialog.build();

        this.systemMessageLabel.getLabel().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(final MouseEvent arg0) {
                CustosMainFrame.this.systemMessageDialog.show();
            }
        });

        for (final CustosModule module : this.modules) {
            add(module.getWidget().getComponent(), module.getWidget().getLayoutConstraints());
        }
        add(this.systemMessageLabel.getLabel(), "dock south, gapleft 5, gapright 5, gapbottom 5");
        maximize();<commit_msg>fixes #22<commit_after>package view;

import hochberger.utilities.application.session.BasicSession;
import hochberger.utilities.gui.UndecoratedEDTSafeFrame;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import modules.CustosModule;
import modules.VisibleCustosModule;
import net.miginfocom.swing.MigLayout;
import controller.SystemMessage;
import controller.SystemMessageMemory;

public class CustosMainFrame extends UndecoratedEDTSafeFrame {

    private final List<VisibleCustosModule> modules;
    private final ColorProvider colorProvider;
    private final SystemMessageLabel systemMessageLabel;
    private final SystemMessageDialog systemMessageDialog;

    public CustosMainFrame(final BasicSession session, final ColorProvider colorProvider, final SystemMessageMemory messageMemory) {
        super(session.getProperties().title());
        this.colorProvider = colorProvider;
        this.modules = new CopyOnWriteArrayList<>();
        this.systemMessageLabel = new SystemMessageLabel(colorProvider);
        session.getEventBus().register(this.systemMessageLabel, SystemMessage.class);
        this.systemMessageDialog = new SystemMessageDialog(colorProvider, messageMemory);
        session.getEventBus().register(this.systemMessageDialog, SystemMessage.class);
    }

    @Override
    protected void buildUI() {
        exitOnClose();
        center();
        frame().getContentPane().setBackground(this.colorProvider.backgroundColor());
        useLayoutManager(new MigLayout("wrap 3", "20[400!, left]:push[400!, center]:push[400!, right]20", "20[200!, top]20[200!, center]20[200!, bottom]push"));
        frame().setAlwaysOnTop(true);
        this.systemMessageLabel.build();
        this.systemMessageDialog.build();

        this.systemMessageLabel.getLabel().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(final MouseEvent arg0) {
                CustosMainFrame.this.systemMessageDialog.show();
            }
        });

        for (final CustosModule module : this.modules) {
            add(module.getWidget().getComponent(), module.getWidget().getLayoutConstraints());
        }
        add(this.systemMessageLabel.getLabel(), "dock south, gapleft 5, gapright 5, gapbottom 5");
        maximize();
{'fraction_non_alphanumeric': 0.10098206660973527, 'fraction_numerical': 0.01067463706233988, 'mean_word_length': 4.12582056892779, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '98580', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1197, 'n_words': 232}