GateNLP / gate-core

The GATE Embedded core API and GATE Developer application
GNU Lesser General Public License v3.0
75 stars 29 forks source link

Odd truncation of Token type names in the GUI #135

Open johann-petrak opened 3 years ago

johann-petrak commented 3 years ago

Running GATE 9.0-SNAPSHOT 0db9ddb on Windows 10 using AdoptOpenJDK 15.0.1

The annotation tree pane on the right of the GUI shows the annotation types truncated even though there would be plenty more space to show the whole type name (see screenshot)

johann-petrak commented 3 years ago

Screenshot 2021-01-21 132200

johann-petrak commented 3 years ago

May be related to HiDPI on my laptop running Windows 10, never seen this happen anywhere else.

I also tested if this is related to the Font and Font size used and discovered another problem: when I change the fonts in the configuration for all three possible element groups (text, menu, other), the font of the type names in that pane are unaffected.

greenwoodma commented 3 years ago

My guess (I'll go digging shortly) is that when the checkbox is initially configured it's either given no prototype or a small one, and so once it's configured the size no longer updates properly.

johann-petrak commented 3 years ago

Tested this now on two different laptops, both running Windows 10 on a HiDPI display with the following resolutions and settings:

Same symptoms on both.

johann-petrak commented 3 years ago

Also tested on Windows 10 with a 1366x768 screen and 100% recommended scaling and it works fine there.

When setting to 125% the text gets truncated, so apparently no matter if the scaling is set to > 100% before or after the pane is shown the type name will be truncated.

johann-petrak commented 3 years ago

(BTW, just to assert that this issue also existed already in GATE 8.6.1 with Java 15)

greenwoodma commented 3 years ago

I realised I should probably have not closed it via the commit message given the way I was reproducing it was slightly different, so if it still doesn't work for you @johann-petrak feel free to reopen.

johann-petrak commented 3 years ago

Tested with 9532ab9, problem is still there.

greenwoodma commented 3 years ago

If you manually select some text and add an annotation with a stupidly long type does it extend the column or truncate it as well? Just wondering if there is a difference in how it gets calculated for things added by an app versus added manually. There shouldn't be but if you could double check for me.

johann-petrak commented 3 years ago

So far I tested this by running ANNIE on a tiny test document and the "SpaceToken" type name gets truncated.

I now added a new annotation with a much longer type name still. This made the coloured table entries longer so that "SpaceToken" is not visible, but the long type name is truncated. (situation A)

At that point the coloured texts still did not fill the whole width of the pane. So I added an even longer type at which point the name became longer than the width, a horizontal scroll bar appeared and that newest, longest type name now got shown fully, without truncation.

However when I just make the pane smaller after situation A, the name stays truncated.

greenwoodma commented 3 years ago

all very weird. if I'm reading that right it means it's still broken but better than before?

It sounds as if it's still not getting the width right which is odd. I'm now calculating the width by getting the font from the label and asking explicitly how wide the text is in that font and then setting that as the minimum column width. I wonder if that doesn't include the borders and so is still causing truncation on the longest case. It doesn't for me (on a HiDPI screen) but I'm not sure how my scaling is set in comparison to yours, plus I know from previous experience the scaling in Java is broken anyway so chances are it's reporting the wrong size for the text and hence messing up the table. This is probably one of those "I've fixed it as much as I can" issues, but I'll keep digging.

johann-petrak commented 3 years ago

The tests I have done before and after the change show exactly the same behaviour on Windows 10 / HiDPI, so no improvement. I just added the info about the additional tests I only did now in case it may help understand what is going on.

I now also tried to test this on Linux with a HiDPI screen but there the GATE app does not get scaled at all (so the truncation problem does not exist there, but everything is tiny)

greenwoodma commented 3 years ago

Weird. I'll possibly roll that change back then as there is no point calculating widths if they don't help as they'll just slow the UI down.

greenwoodma commented 3 years ago

no I didn't close it, I reverted a comment with close in the comment, sigh