<commit_before>/*
 * $Id$
 *
 * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
package org.jdesktop.swingx;

import java.awt.event.ActionEvent;
import java.util.Locale;
import java.util.logging.Logger;

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

import org.jdesktop.swingx.action.AbstractActionExt;
import org.jdesktop.swingx.error.ErrorInfo;
import org.jdesktop.swingx.plaf.LookAndFeelAddons;

/**
 * Test to expose known issues around <code>Locale</code> setting.
 * 
 * Ideally, there would be at least one failing test method per open
 * Issue in the issue tracker. Plus additional failing test methods for
 * not fully specified or not yet decided upon features/behaviour.
 * 
 * @author <NAME>
 */
public class XLocalizeIssues extends InteractiveTestCase {
    private static final Logger LOG = Logger.getLogger(XLocalizeIssues.class
            .getName());
    private static final Locale DEFAULT_LOCALE = Locale.US;
    private static final Locale ALTERNATIVE_LOCALE = Locale.GERMAN;


    private Locale originalLocale;
    // test scope is static anyway...
    static {
        // force the addon to load
        LookAndFeelAddons.getAddon();
    }
    public static void main(String[] args) {
//      setSystemLF(true);
      XLocalizeIssues test = new XLocalizeIssues();
      try {
        test.runInteractiveTests();
//          test.runInteractiveTests("interactive.*File.*");
      } catch (Exception e) {
          System.err.println("exception when executing interactive tests:");
          e.printStackTrace();
      }

    }

    @Override
    protected void setUp() throws Exception {
        originalLocale = Locale.getDefault();
        super.setUp();
    }
    
    

    @Override
    protected void tearDown() throws Exception {
        Locale.setDefault(originalLocale);
        super.tearDown();
    }

    /**
     * Issue #459-swingx: JXTable setLocale doesn't update localized column
     * control properties.
     * 
     * Pass/fail expectation:
     * <ul>
     * <li> fails always with jdk5 independent of LookAndFeelAddon resource
     * bundle registration.
     * <li> fails with jdk6 and LookAndFeelAddon copy resource bundle values.
     * <li> passes with jdk6 and LookAndFeelAddon addResourceBundle.
     * </ul>
     */
    public void testLocaleColumnControl() {
       assertLocaleActionUpdate(JXTable.HORIZONTALSCROLL_ACTION_COMMAND);
       assertLocaleActionUpdate(JXTable.PACKALL_ACTION_COMMAND);
       assertLocaleActionUpdate(JXTable.PACKSELECTED_ACTION_COMMAND);
    }

    private void assertLocaleActionUpdate(String actionCommand) {<commit_msg>minor doc cosmetics in XLocalizeIssues<commit_after>/*
 * $Id$
 *
 * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
package org.jdesktop.swingx;

import java.awt.event.ActionEvent;
import java.util.Locale;
import java.util.logging.Logger;

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

import org.jdesktop.swingx.action.AbstractActionExt;
import org.jdesktop.swingx.error.ErrorInfo;
import org.jdesktop.swingx.plaf.LookAndFeelAddons;

/**
 * Test to expose known issues around <code>Locale</code> setting.
 * 
 * Ideally, there would be at least one failing test method per open
 * Issue in the issue tracker. Plus additional failing test methods for
 * not fully specified or not yet decided upon features/behaviour.
 * 
 * @author <NAME>
 */
public class XLocalizeIssues extends InteractiveTestCase {
    private static final Logger LOG = Logger.getLogger(XLocalizeIssues.class
            .getName());
    private static final Locale DEFAULT_LOCALE = Locale.US;
    private static final Locale ALTERNATIVE_LOCALE = Locale.GERMAN;


    private Locale originalLocale;
    // test scope is static anyway...
    static {
        // force the addon to load
        LookAndFeelAddons.getAddon();
    }
    public static void main(String[] args) {
//      setSystemLF(true);
      XLocalizeIssues test = new XLocalizeIssues();
      try {
        test.runInteractiveTests();
//          test.runInteractiveTests("interactive.*File.*");
      } catch (Exception e) {
          System.err.println("exception when executing interactive tests:");
          e.printStackTrace();
      }

    }

    @Override
    protected void setUp() throws Exception {
        originalLocale = Locale.getDefault();
        super.setUp();
    }
    
    

    @Override
    protected void tearDown() throws Exception {
        Locale.setDefault(originalLocale);
        super.tearDown();
    }

    /**
     * Issue #459-swingx: JXTable setLocale doesn't update localized column
     * control properties. <p>
     * 
     * Pass/fail expectation:
     * <ul>
     * <li> fails always with jdk5 independent of LookAndFeelAddon resource
     * bundle registration.
     * <li> fails with jdk6 and LookAndFeelAddon copy resource bundle values.
     * <li> passes with jdk6 and LookAndFeelAddon addResourceBundle.
     * </ul>
     */
    public void testLocaleColumnControl() {
       assertLocaleActionUpdate(JXTable.HORIZONTALSCROLL_ACTION_COMMAND);
       assertLocaleActionUpdate(JXTable.PACKALL_ACTION_COMMAND);
       assertLocaleActionUpdate(JXTable.PACKSELECTED_ACTION_COMMAND);
    }

    private void assertLocaleActionUpdate(String actionCommand) {
{'fraction_non_alphanumeric': 0.08165563846262143, 'fraction_numerical': 0.009010277347599606, 'mean_word_length': 3.3002421307506054, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '7551820', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1928, 'n_words': 665}