You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/03/14 15:26:09 UTC

[jira] Updated: (HARMONY-2837) [classlib][swing] Changing of any property causes revalidation and repaint of swing components.

     [ https://issues.apache.org/jira/browse/HARMONY-2837?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-2837:
-------------------------------------

    Priority: Minor  (was: Major)

> [classlib][swing] Changing of any property causes revalidation and repaint of swing components.
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2837
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2837
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>            Priority: Minor
>
> 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.
-
You can reply to this email to add a comment to the issue online.