Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid excessive repaint operations when figure is not modified #250

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

ptziegler
Copy link
Contributor

@ptziegler ptziegler commented Aug 21, 2023

When updating the border or the background/foreground color of a figure,
it may happen what we whole figure is repainted, even though it hasn't
been modified.
Additional checks have been added to check for equality in the setter
methods, to limit the amount of times repaint() and revalidate() is
called.

@ptziegler
Copy link
Contributor Author

Objects.equals() was added with Java 7. There's a pretty good chance the code predates this method.
With older versions the equality check would look a lot more complicated, so it's probably like this simply for the sake of simplicity.

@github-actions
Copy link

github-actions bot commented Aug 21, 2023

Unit Test Results

    9 files      9 suites   20s ⏱️
320 tests 318 ✔️ 2 💤 0
960 runs  954 ✔️ 6 💤 0

Results for commit 78926c5.

♻️ This comment has been updated with latest results.

@ptziegler
Copy link
Contributor Author

ptziegler commented Aug 21, 2023

Why were none of the test results uploaded? 🤔

@ptziegler ptziegler marked this pull request as draft August 22, 2023 05:23
@ptziegler
Copy link
Contributor Author

I'll try to create some tests today, to make sure that everything is still running as it should.

@ptziegler ptziegler force-pushed the avoid-excessive-color-repaint branch from 6cb7f64 to 1c7cd7d Compare August 24, 2023 20:26
@ptziegler ptziegler changed the title Avoid excessive repaint call when updating figure color with null Avoid excessive repaint operations when figure is not modified Aug 24, 2023
When updating the border or the background/foreground color of a figure,
it may happen what we whole figure is repainted, even though it hasn't
been modified.
Additional checks have been added to check for equality in the setter
methods, to limit the amount of times repaint() and revalidate() is
called.
@ptziegler ptziegler force-pushed the avoid-excessive-color-repaint branch from 1c7cd7d to 78926c5 Compare August 24, 2023 20:36
@ptziegler ptziegler marked this pull request as ready for review August 25, 2023 04:06
@ptziegler
Copy link
Contributor Author

@azoitl Your thoughts on this one?

I'm currently in the process of cleaning up the duplicate code in our own Figure implementation and noticed that we have some additional checks in our setBounds() and setForeground/BackgroundColor() methods that might be worth being merged into GEF itself.

@azoitl
Copy link
Contributor

azoitl commented Aug 25, 2023

@ptziegler during debugging GEF applications a always noticed lots of notifications on different levels. I mostly thought it is due to my lack of understanding or correctly using GEF. So bringing down repaints and notifications is something that seems desireable for me. If @Phillipus also agrees I would merge it.

@Phillipus
Copy link
Contributor

If @Phillipus also agrees I would merge it.

It looks good to me, and there's a lot of work gone into creating new tests.

(In fact, thanks to @ptziegler it reminds me that I need to make more use of Objects.equals() in my own code.)

@azoitl
Copy link
Contributor

azoitl commented Aug 25, 2023

If @Phillipus also agrees I would merge it.

It looks good to me, and there's a lot of work gone into creating new tests.

Thx for the feedback. Yes I agree the tests are amazing.

(In fact, thanks to @ptziegler it reminds me that I need to make more use of Objects.equals() in my own code.)

Me too.

@azoitl azoitl merged commit 196bee5 into eclipse:master Aug 25, 2023
4 checks passed
@azoitl azoitl added this to the 3.17.0 milestone Aug 25, 2023
@ptziegler ptziegler deleted the avoid-excessive-color-repaint branch December 18, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants