You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Dmitry Irlyanov (JIRA)" <ji...@apache.org> on 2007/07/17 10:51:04 UTC

[jira] Created: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

[classlib][swing] Slider code is probably uneffective
-----------------------------------------------------

                 Key: HARMONY-4481
                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
            Reporter: Dmitry Irlyanov
            Priority: Trivial


JSlider code is quite uneffective.

Let's see for example the following function:

protected void calculateTrackBuffer() {
        if (slider.getPaintLabels()) {
            if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
                trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
                                                ? getWidthOfHighValueLabel() / 2
                                                : getWidthOfLowValueLabel() / 2;
           /**skipped**/
    }

it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:

protected int getWidthOfHighValueLabel() {
        return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
}




Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov closed HARMONY-4481.
------------------------------------


> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>         Attachments: H4481-BasicSliderUI.patch
>
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov updated HARMONY-4481:
-------------------------------------

    Attachment: H4481-BasicSliderUI.patch

> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>         Attachments: H4481-BasicSliderUI.patch
>
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko reassigned HARMONY-4481:
----------------------------------------

    Assignee: Alexey Petrenko

> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov updated HARMONY-4481:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>         Attachments: H4481-BasicSliderUI.patch
>
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Petrenko resolved HARMONY-4481.
--------------------------------------

    Resolution: Fixed

Dmitry,

I've slightly modified and committed your patch.
Please verify.

> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>         Attachments: H4481-BasicSliderUI.patch
>
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513237 ] 

Dmitry Irlyanov commented on HARMONY-4481:
------------------------------------------

Alexey,

I think my patch is quite easier to read, but anyway my solution isn't coincide with other methods code style.

All correct,
Thank you

> [classlib][swing] Slider code is probably uneffective
> -----------------------------------------------------
>
>                 Key: HARMONY-4481
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Assignee: Alexey Petrenko
>            Priority: Trivial
>         Attachments: H4481-BasicSliderUI.patch
>
>
> JSlider code is quite uneffective.
> Let's see for example the following function:
> protected void calculateTrackBuffer() {
>         if (slider.getPaintLabels()) {
>             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
>                 trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
>                                                 ? getWidthOfHighValueLabel() / 2
>                                                 : getWidthOfLowValueLabel() / 2;
>            /**skipped**/
>     }
> it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel() twice:
> protected int getWidthOfHighValueLabel() {
>         return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
> }
> Of course, without performance test results it's nothing. But performance test results definitely won't become worse if my patch have been applied.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.