<commit_before>/*
 * Created on 06.10.2005
 *
 */
package org.jdesktop.swingx.rollover;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.KeyStroke;
import javax.swing.ListModel;
import javax.swing.table.TableModel;

import org.jdesktop.swingx.InteractiveTestCase;
import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.JXTree;
import org.jdesktop.swingx.JXTreeTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.CompoundHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate;
import org.jdesktop.swingx.renderer.DefaultTreeRenderer;
import org.jdesktop.swingx.treetable.FileSystemModel;
import org.jdesktop.test.AncientSwingTeam;
import org.jdesktop.test.TestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


@RunWith(JUnit4.class)
public class RolloverTest extends InteractiveTestCase {

    
    /**
     * @param args
     */
    public static void main(String[] args) {
        RolloverTest test = new RolloverTest();
        try {
            test.runInteractiveTests();
         //   test.runInteractiveTests("interactive.*Rend.*");
          } catch (Exception e) {
              System.err.println("exception when executing interactive tests:");
              e.printStackTrace();
          } 

    }

    private TableModel sortableTableModel;
    private Highlighter backgroundHighlighter;
    private Highlighter foregroundHighlighter;
    private ListModel listModel;
    private FileSystemModel treeTableModel;

//---------------------------- interactive tests of rollover effects

    
    /**
     * Issue #1193-swingx: rollover state not updated on scrolling/mouseWheel
     * 
     * visualize behaviour on 
     * - scrolling (with mouse wheel)
     * - resizing (added custom actions)
     */
    public void interactiveTreeRolloverScroll() {
        final JXTree table = new JXTree(new FileSystemModel());
        table.setCellRenderer(new DefaultTreeRenderer());
        table.setRolloverEnabled(true);
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
        final JXFrame frame = getResizableFrame(table);
        show(frame);
    }

    /**
     * Issue #1193-swingx: rollover state not updated on scrolling/mouseWheel
     * 
     * visualize behaviour on 
     * - scrolling (with mouse wheel)
     * - resizing (added custom actions)
     */
    public void interactiveListRolloverScroll() {
        final JXList table = new JXList(AncientSwingTeam.createNamedColorListModel());
        table.setRolloverEnabled(true);
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
        final JXFrame frame = getResizableFrame(table);<commit_msg>Issue #1249-swingx: RolloverProducer asynch coordinates on edits added visual test case to expose<commit_after>/*
 * Created on 06.10.2005
 *
 */
package org.jdesktop.swingx.rollover;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.logging.Logger;

import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.KeyStroke;
import javax.swing.ListModel;
import javax.swing.table.TableModel;

import org.jdesktop.swingx.InteractiveTestCase;
import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.JXTree;
import org.jdesktop.swingx.JXTreeTable;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.CompoundHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate;
import org.jdesktop.swingx.renderer.DefaultTreeRenderer;
import org.jdesktop.swingx.treetable.FileSystemModel;
import org.jdesktop.test.AncientSwingTeam;
import org.jdesktop.test.TestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


@RunWith(JUnit4.class)
public class RolloverTest extends InteractiveTestCase {

    @SuppressWarnings("unused")
    private static final Logger LOG = Logger.getLogger(RolloverTest.class
            .getName());
    
    /**
     * @param args
     */
    public static void main(String[] args) {
        RolloverTest test = new RolloverTest();
        try {
//            test.runInteractiveTests();
            test.runInteractiveTests("interactive.*Exit.*");
          } catch (Exception e) {
              System.err.println("exception when executing interactive tests:");
              e.printStackTrace();
          } 

    }

    private TableModel sortableTableModel;
    private Highlighter backgroundHighlighter;
    private Highlighter foregroundHighlighter;
    private ListModel listModel;
    private FileSystemModel treeTableModel;

//---------------------------- interactive tests of rollover effects

    /**
     * Issue #1249-swingx: RolloverProducer clears rollover point when inserting child
     * 
     * Happens f.i. when starting an edit.
     * 
     */
    public void interactiveExitToChild() {
        JXTable table = new JXTable(new AncientSwingTeam());
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, 
                Color.MAGENTA, null, Color.MAGENTA, null));
        JXFrame frame = wrapWithScrollingInFrame(table, "rollover child");
        addStatusMessage(frame, "edit under mouse, move");
        show(frame);
    }
    
    /**
     * Issue #1193-swingx: rollover state not updated on scrolling/mouseWheel
     * 
     * visualize behaviour on 
     * - scrolling (with mouse wheel)
     * - resizing (added custom actions)
     */
    public void interactiveTreeRolloverScroll() {
        final JXTree table = new JXTree(new FileSystemModel());
        table.setCellRenderer(new DefaultTreeRenderer());
        table.setRolloverEnabled(true);
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
        final JXFrame frame = getResizableFrame(table);
        show(frame);
    }

    /**
     * Issue #1193-swingx: rollover state not updated on scrolling/mouseWheel
     * 
     * visualize behaviour on 
     * - scrolling (with mouse wheel)
     * - resizing (added custom actions)
     */
    public void interactiveListRolloverScroll() {
        final JXList table = new JXList(AncientSwingTeam.createNamedColorListModel());
        table.setRolloverEnabled(true);
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
        final JXFrame frame = getResizableFrame(table);
{'fraction_non_alphanumeric': 0.10018852679773768, 'fraction_numerical': 0.005925127928898465, 'mean_word_length': 3.536957849725107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4889025', 'n_tokens_mistral': 2273, 'n_tokens_neox': 2133, 'n_words': 451}