<commit_before>package com.github.sunnybat.paxchecker.gui;

import com.github.sunnybat.paxchecker.check.TicketChecker;
import com.github.sunnybat.paxchecker.check.CheckShowclix;
import com.github.sunnybat.paxchecker.check.CheckPaxsite;
import com.github.sunnybat.paxchecker.Email;
import com.github.sunnybat.paxchecker.Audio;
import com.github.sunnybat.paxchecker.PAXChecker;
import com.github.sunnybat.paxchecker.check.CheckSetup;
import com.github.sunnybat.paxchecker.browser.Browser;
import com.github.sunnybat.paxchecker.browser.TwitterReader;
import com.github.sunnybat.paxchecker.preferences.Preference;
import com.github.sunnybat.paxchecker.preferences.PreferenceHandler;

/**
 *
 * @author SunnyBat
 */
public class Setup extends javax.swing.JFrame {

  public java.util.ArrayList<ExtraPhonePanel> extraPhonePanelList = new java.util.ArrayList<>();
  //private final ErrorWindow twitterDisabledWindow = new ErrorWindow();

  /**
   * Creates new form Setup
   */
  public Setup() {
//    twitterDisabledWindow.setTitleText("Twitter Disabled?");
//    twitterDisabledWindow.setErrorText("Why is Twitter Disabled?");
//    twitterDisabledWindow.setInformationText("Twitter is disabled because the Twitter API is not able to be secured in an open-source application.\nIf you want to check Twitter, follow the instructions here: https://redd.it/2nct50");
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        initComponents();
        customComponents();
      }
    });
  }

  private void customComponents() {
    setTitle("Setup :: PAXChecker v" + PAXChecker.VERSION);
    if (PreferenceHandler.getBooleanPreference(Preference.TYPES.SAVE_PREFS)) {
      JCBSavePreferences.setSelected(true);
      JCBSaveCellnum.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CELLNUM).shouldSave());
      JCBSaveCheckPax.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_PAX).shouldSave());
      JCBSaveCheckShowclix.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_SHOWCLIX).shouldSave());
      JCBSaveCheckTwitter.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_TWITTER).shouldSave());
      JCBSaveEvent.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.EVENT).shouldSave());
      JCBSavePlayAlarm.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.PLAY_ALARM).shouldSave());
      JCBSaveRefreshTime.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.REFRESHTIME).shouldSave());
      JCBSaveEmail.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.EMAIL).shouldSave());
      JCBUseBeta.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.USE_BETA));
      JCBLoadNotifications.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.LOAD_NOTIFICATIONS));
      JCBCheckUpdates.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.LOAD_UPDATES));
      JCBSaveTwitterKeys.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.TWITTER_CONSUMER_KEY).shouldSave());
    } else {
      JCBSavePreferences.setSelected(false);
      JCBSaveCellnum.setEnabled(false);
      JCBSaveCheckPax.setEnabled(false);
      JCBSaveCheckShowclix.setEnabled(false);
      JCBSaveCheckTwitter.setEnabled(false);
      JCBSaveEvent.setEnabled(false);
      JCBSavePlayAlarm.setEnabled(false);
      JCBSaveRefreshTime.setEnabled(false);
      JCBSaveEmail.setEnabled(false);
      JCBUseBeta.setEnabled(false);
      JCBCheckUpdates.setEnabled(false);
      JCBLoadNotifications.setEnabled(false);
      JCBSaveTwitterKeys.setEnabled(false);
    }
    JTPExtra.setText(loadHtml("/paxchecker/gui/Extra.html"));
    JTPExtra.setCaretPosition(0);
    JTPInstructions.setText(loadHtml("/paxchecker/gui/Instructions.html"));
    JTPInstructions.setCaretPosition(0);
  }

  public void loadProgramSettings() {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override<commit_msg>Fixed Setup issue<commit_after>package com.github.sunnybat.paxchecker.gui;

import com.github.sunnybat.paxchecker.check.TicketChecker;
import com.github.sunnybat.paxchecker.check.CheckShowclix;
import com.github.sunnybat.paxchecker.check.CheckPaxsite;
import com.github.sunnybat.paxchecker.Email;
import com.github.sunnybat.paxchecker.Audio;
import com.github.sunnybat.paxchecker.PAXChecker;
import com.github.sunnybat.paxchecker.check.CheckSetup;
import com.github.sunnybat.paxchecker.browser.Browser;
import com.github.sunnybat.paxchecker.browser.TwitterReader;
import com.github.sunnybat.paxchecker.preferences.Preference;
import com.github.sunnybat.paxchecker.preferences.PreferenceHandler;

/**
 *
 * @author SunnyBat
 */
public class Setup extends javax.swing.JFrame {

  public java.util.ArrayList<ExtraPhonePanel> extraPhonePanelList = new java.util.ArrayList<>();
  //private final ErrorWindow twitterDisabledWindow = new ErrorWindow();

  /**
   * Creates new form Setup
   */
  public Setup() {
//    twitterDisabledWindow.setTitleText("Twitter Disabled?");
//    twitterDisabledWindow.setErrorText("Why is Twitter Disabled?");
//    twitterDisabledWindow.setInformationText("Twitter is disabled because the Twitter API is not able to be secured in an open-source application.\nIf you want to check Twitter, follow the instructions here: https://redd.it/2nct50");
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        initComponents();
        customComponents();
      }
    });
  }

  private void customComponents() {
    setTitle("Setup :: PAXChecker v" + PAXChecker.VERSION);
    if (PreferenceHandler.getBooleanPreference(Preference.TYPES.SAVE_PREFS)) {
      JCBSavePreferences.setSelected(true);
      JCBSaveCellnum.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CELLNUM).shouldSave());
      JCBSaveCheckPax.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_PAX).shouldSave());
      JCBSaveCheckShowclix.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_SHOWCLIX).shouldSave());
      JCBSaveCheckTwitter.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.CHECK_TWITTER).shouldSave());
      JCBSaveEvent.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.EVENT).shouldSave());
      JCBSavePlayAlarm.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.PLAY_ALARM).shouldSave());
      JCBSaveRefreshTime.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.REFRESHTIME).shouldSave());
      JCBSaveEmail.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.EMAIL).shouldSave());
      JCBUseBeta.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.USE_BETA));
      JCBLoadNotifications.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.LOAD_NOTIFICATIONS));
      JCBCheckUpdates.setSelected(PreferenceHandler.getBooleanPreference(Preference.TYPES.LOAD_UPDATES));
      JCBSaveTwitterKeys.setSelected(PreferenceHandler.getPreferenceObject(Preference.TYPES.TWITTER_CONSUMER_KEY).shouldSave());
    } else {
      JCBSavePreferences.setSelected(false);
      JCBSaveCellnum.setEnabled(false);
      JCBSaveCheckPax.setEnabled(false);
      JCBSaveCheckShowclix.setEnabled(false);
      JCBSaveCheckTwitter.setEnabled(false);
      JCBSaveEvent.setEnabled(false);
      JCBSavePlayAlarm.setEnabled(false);
      JCBSaveRefreshTime.setEnabled(false);
      JCBSaveEmail.setEnabled(false);
      JCBUseBeta.setEnabled(false);
      JCBCheckUpdates.setEnabled(false);
      JCBLoadNotifications.setEnabled(false);
      JCBSaveTwitterKeys.setEnabled(false);
    }
    JTPExtra.setText(loadHtml("/com/github/sunnybat/paxchecker/gui/Extra.html"));
    JTPExtra.setCaretPosition(0);
    JTPInstructions.setText(loadHtml("/com/github/sunnybat/paxchecker/gui/Instructions.html"));
    JTPInstructions.setCaretPosition(0);
  }

  public void loadProgramSettings() {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override
{'fraction_non_alphanumeric': 0.10536681437715412, 'fraction_numerical': 0.0012309207287050715, 'mean_word_length': 5.5052041633306645, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1454578', 'n_tokens_mistral': 2561, 'n_tokens_neox': 2522, 'n_words': 271}