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

Generate Clarification tab GUI Issues on both Linux and Windows #1024

Open
johnbrvc opened this issue Dec 12, 2024 · 4 comments · May be fixed by #1041
Open

Generate Clarification tab GUI Issues on both Linux and Windows #1024

johnbrvc opened this issue Dec 12, 2024 · 4 comments · May be fixed by #1041
Assignees
Labels
bug Something isn't working high priority Bugs that are high priority (to fix) NEXT Contest Consider fixing for next contet One Approval A very low risk and low LOE PR/Change Primary CCS Required for PC2 to act as primary CCS

Comments

@johnbrvc
Copy link
Collaborator

Describe the issue:
With the addition of the "announcement" feature in PR #920 (and Issue #221), a checked list box was added to the tab. If "Specific Team(s)" is chosen as the Destination, and there are teams with wide names, the checked list box is virtually unusable on the Linux GUI desktop. You can click on select "Group(s)" then go back to "Specific Team(s)" and sometimes you can make the check list usable. The same problem exists for "Group(s)" (See images below)

In addition, the size of the checkbox list box appears to change when different things are selected. See images below
Also, the checkbox that allows you to select an announcement "Generate Announcement" is chopped off so it reads "Genenerate Announ..." (see images below)

To Reproduce:

  1. Load a contest that has longer team names (like PacNW Fall 2024) and many of them (> 10 so that it fills the list box)
  2. Start the contest.
  3. Bring up a judge client.
  4. Go to the "Generate Clarification" tab.
  5. Choose "Generate Announ..."
  6. Select "Specific Team(s)"
  7. Note the left side of the list box does not show the check boxes and there is no way to see the full team name.
  8. Select "Group(s)"
  9. Select "Specific Team(s)" again, and you can see the checkboxes in the list box, and a scroll bar along the bottom.

Expected behavior:
The checkbox list box should operate properly and accommodate wide team names. It should fill the "Group(s)" group box (container box). If there are wide teams (or groups), there should be a scrollbar along the bottom to allow the user to scroll left or right, but, by default, the checkboxes should be visible on first appearance, and whenever selecting "Specific Team(s)" (or "Group(s)" in the case of groups.

Actual behavior:
Checkbox list box is virtually useless if there are wide teams and/or groups. See images below.

Environment: please complete the following information:

Ubuntu 24.02
openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)
OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)

Log Info:

Screenshots:

image image

Additional context:
This can be observed by bringing up the PacNW AWS machine, logging in using remote desktop, starting the server (StartServer), then starting a judge (StartJudge).

@johnbrvc johnbrvc added bug Something isn't working high priority Bugs that are high priority (to fix) NEXT Contest Consider fixing for next contet One Approval A very low risk and low LOE PR/Change Primary CCS Required for PC2 to act as primary CCS labels Dec 12, 2024
@clevengr
Copy link
Contributor

clevengr commented Jan 20, 2025

This issue was subsequently also raised in duplicate issue #1037, which has since been Closed as "Duplicate". However, there are a few differences between Issue #1037 and this issue:

  • This issue references "Linux", but issue Judge "Announcement Destination" GUI teams/groups lists display incorrectly #1037 was demonstrated on Windows -- so the problem is not Linux-specific.
  • The "workaround" suggested in this Issue (switch to the "Groups" destination and then back to the "Specific Teams" destination) does not appear to work reliably, if at all -- at least, under Windows. It's possible that THIS aspect is different between Windows and Linux.
  • The issue can be reproduced (at least, under Windows 11) using the PC2 "sample/contests/mini" contest; it doesn't require using an external contest such as PacNW2024.

Also, possibly relevant, is the following comment from Issue #1037:

This is just a suspicion, but I suspect the issue has something to do with the fact that the code is changing the underlying Model which is loaded into the JList (actually, JCheckBoxJList, which is a subclass of JList) which is the "client" of the JScrollPane. Perhaps some kind of collision is happening between multiple Swing AWT-Thread events, or between the AWT thread and some other thread (although I don't know what that other thread would be). The fact that I've seen this bug manifest even when I wasn't touching the keyboard leads me to believe that the JVM (probably the AWT thread) is triggering some change that causing the problem.
I wonder if "synchronizing" the code which actually changes the underlying model would help?

Also, possibly relevant, is the discussion about JList models found in the Java JList API documentation.

@clevengr clevengr changed the title Generate Clarification tab GUI Issues on Linux Generate Clarification tab GUI Issues on both Linux and Windows Jan 20, 2025
@clevengr
Copy link
Contributor

clevengr commented Jan 21, 2025

I just noticed something I think is interesting and might be relevant to this issue.

  • Start a contest with many teams having long names (e.g. load the PC2 "mini" contest)
  • Start an Admin. Note that the timer on the Admin is accurate to the "seconds" level.
  • Start a judge. Note that the timer on the Judge is only accurate to the "minutes" level (this is because, years ago, none of us wanted to try to figure out how to sync client times to the second...).
  • Open the Generate Clarification screen on the judge.
  • Enable (check) "Generate Announcement".
  • Select "Groups" in the "Destination" dropdown.
  • Verify that the Groups dislay is correct -- i.e. that it DOES show full group names WITH CHECKBOXES.
    • If not, reselect "All Teams" and then reselect "Groups", until you get a correct groups display (with checkboxes).
  • Select "Specific Team(s)" in the "Destination" dropdown.
  • Verify that the Specific Teams display is correct -- i.e. that is does show full team names, WITH SCROLLBARS and CHECKBOXES.
    • If not, repeat the above until you get a valid "Specific Teams" display, with checkboxes.
  • DO NOTHING -- don't touch the keyboard or the mouse.
  • Watch the second-by-second countdown display on the Admin. When it approaches "zero seconds" (i.e., it's about to switch to the next minute), watch the time display and the Specific Teams listbox on the judge.

When the Judge timer decrements by one (minute), the Specific Teams display goes wonky -- at exactly the moment the timer changes!

I've tried this over a dozen times, and every time the Judge display goes wonky when the Judge timer decrements.

This tells me that the Swing Timer is waking up the AWT event thread, and something is happening on that thread that's corrupting the judge display. (I don't know what that "something" is... but maybe this is a clue that will help us find the issue...)

So far I have not seen the timer cause the Groups display to corrupt... but once the Specific Teams display is corrupted (every one minute), switching back to "Groups" shows a corrupted display. Switching back to "All Teams" and then "Groups" (and then "Specific Teams" produces correct displays... until a minute elapses. Don't know if that's another clue or just a side-effect...

Another interesting clue: if you show a valid "Specific Teams" display, then wait for the time to corrupt it, then switch to the Groups display, you'll see it is also corrupted. But if you just wait for one more minute until the timer ticks again, **the Groups display will magically correct itself!**

Another point of note: the class which is being used as the List client for the JScrollPane is an instance of JCheckBoxJList. I initially -- incorrectly -- assumed this was a built-in Java class. But it's NOT; it's a PC2-defined class (edu.csus.ecs.pc2.ui.JCheckBoxJList). More interestingly, that class uses a self-defined Listener which implements MouseListener, KeyListener -- meaning, it is responding to mouse and keyboard events. I don't know if this is what's causing the problem, but it might be. (That JCheckBoxJList class is also used in a variety of other places -- but maybe the Judge Announcement class ("SubmitClarification") is the first place where there's been an attempt to change the underlying model inside a JScrollPane on the fly... ?)

p.s. I was doing this under Windows 11, but it wouldn't surprise me to be told the same thing happens under Linux...

@clevengr
Copy link
Contributor

I strongly believe the underlying issue here is some kind of interaction between the AWT thread and the switching of the client model in the JScrollPane. If someone is going to work on this, I believe we should first separate the single JScrollPane into two separate JScrollPanes -- because users need to be able to select both "Groups" and "Specific Team(s)". Currently, if they try to select one (say, "Groups"), and then switch to and select the other ("Specific Teams") the "Groups" selection will be lost. Having two separate JScrollPanes, one showing Groups and another showing Teams at the same time will allow the user to select from both lists AND is highly likely to cure the "corruption" problem (because it will eliminate the need to switch the underlying client models).

@clevengr
Copy link
Contributor

clevengr commented Feb 3, 2025

I have working code as a part of Issue #1030 that I believe will completely fix (eliminate) the problems described in this issue. (Specifically, I had to implement "separate JScrollpanes for teams and groups" in order to test the fixes for #1030.) I would suggest holding off doing any work on this issue until I can submit a PR for #1030, since I believe that will fix this issue as well.

@clevengr clevengr linked a pull request Feb 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Bugs that are high priority (to fix) NEXT Contest Consider fixing for next contet One Approval A very low risk and low LOE PR/Change Primary CCS Required for PC2 to act as primary CCS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants