harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Khaschansky (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2837) [classlib][swing] Changing of any property causes revalidation and repaint of swing components.
Date Thu, 21 Dec 2006 13:14:24 GMT
[classlib][swing] Changing of any property causes revalidation and repaint of swing components.
-----------------------------------------------------------------------------------------------

                 Key: HARMONY-2837
                 URL: http://issues.apache.org/jira/browse/HARMONY-2837
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Oleg Khaschansky


The initial problem is quite simple: a compatibility issue. Harmony throws unspecified NPE
for
javax.swing.plaf.basic.BasicSliderUI.PropertyChangeHandler.propertyChange(PropertyChangeEvent
e) while RI works silently if the name of the changed property is unknown (no special handling
for it in the component UI). This is also applicable to javax.swing.plaf.basic.BasicScrollPaneUI.PropertyChangeHandler.propertyChange().
But the main reason is the different design of Harmony and RI implementation. It seems like
RI checks the property name and does something meaningful for known properties but simply
returns if the property is unknown. Harmony tends to call revalidate and repaint for all the
properties, even for those that don't require this. Obviously, listing explicitely properties
for which we do something and doing nothing for other properties is better than call revalidate/repaint
for all.

The following tests demonstrate this behavior:
--------------------------------------------------------------------------------------
import junit.framework.TestCase;

import javax.swing.plaf.metal.MetalScrollPaneUI;
import javax.swing.plaf.metal.MetalSliderUI;
import javax.swing.table.JTableHeader;
import java.beans.PropertyChangeEvent;
import java.security.acl.AclNotFoundException;

public class Test0 extends TestCase {
    public void testcase0()
    {
        PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(
                new JTableHeader(),
                "aaa",
                null,
                null
        );
        try {
            new MetalScrollPaneUI().new PropertyChangeHandler().propertyChange(localPropertyChangeEvent);
            System.out.println("No Exception!");
        } catch (NullPointerException unexpectedException) {
            unexpectedException.printStackTrace();
            fail("Unspecified exception thrown:" + unexpectedException);
        }
    }

    public void testcase1()
    {
        PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(
                new JTableHeader(),
                "model",
                null,
                null
        );
        try {
            new MetalScrollPaneUI().new PropertyChangeHandler().propertyChange(localPropertyChangeEvent);
            fail("No Exception!");
        } catch (NullPointerException e) {
            System.out.println("Exception thrown:" + e);
        }
    }

    public void testcase2() {
        try {
            new MetalSliderUI().new PropertyChangeHandler().propertyChange(
                    new PropertyChangeEvent(
                            new AclNotFoundException(),
                            "aaa",
                            null,
                            null
                    )
            );
            System.out.println("No Exception!");
        } catch (NullPointerException unexpectedException) {
            fail("Unexpected "+unexpectedException + " was thrown");
        }
    }

    public void testcase3() {
        try {
            new MetalSliderUI().new PropertyChangeHandler().propertyChange(
                    new PropertyChangeEvent(
                            new AclNotFoundException(),
                            "model",
                            null,
                            null
                    )
            );
            fail("No Exception!");
        } catch (NullPointerException e) {
            System.out.println("Exception thrown:" + e);
        }
    }
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message