JavaFX TableColumns' headers not aligned with cells due to vertical scrollbar - javafx-8

after having spent the last few hours searching the web for this issue I decided that I need your help.
The issue is similar to this topic: Javafx: Tableview header is not aligned with rows
No answer has been provided there and also, I think, my case is slightly different:
I have a properly setup TableView with reused CellFactories and CellValueFactories. Data-wise, everything works 100% the way I intended. However once I populated my table with more rows than my view can show it naturally started to show a vertical scrollbar. From that moment on (see first screenshot) the column headers weren't aligned with the columns anymore. It appears that it is exactly the width of the scrollbar that distorted the widths distribution (I'm using ConstraintResizePolicy with a few fixed width columns and the rest relying on computed width, again, otherwise working flawlessly).
As soon as I scroll with the mouse wheel, click on an entry, tab into focus or resize the window/view, the headers snap into place (see second screenshot).
Based on the topic posted in the beginning, I think this is a bug and I'm therefore not only looking for a solution (which might not exist) but also for a workaround. I tried:
table.scrollTo()
table.scrollToColumnIndex()
table.layout()
table.requestFocus()
table.requestLayout()
table.refresh()
I know not all of those make sense but still I tried and none of them made the column headers be in line with their columns on application launch.
Every suggestion is welcomed.
I don't feel that sharing code helps here, but ask if you want something specific. The view was built with SceneBuilder 8 and consists of an AnchorPane, a TableView in the middle, and 6 TableColumns, nothing else.
Thank you very much!

I've had the same problem. It seems a bug. Try this. It works for me
Platform.runLater(() -> tableView.refresh());

I know this is an old message but I tried everything to get the headers aligned and nothing was working until I stepped away from the problem. I then tried this and it worked. Headers jump but I am ok with that. I hope this helps someone else.
Task<Boolean> task = new Task<Boolean>() {
#Override protected Boolean call() throws Exception {
Thread.sleep(300) // needs this to make sure the table is displayed
table.refresh();
table.scrollTo(0);
return true;
}
};
new Thread(task).start();

I also have the situation of TableColumns' Headers not aligend with cells.But I am not because Scrollbar.I am because of setting a border color for cells.After the CSS modified, I got the correct result.
Incorrect CSS:
.table-row-cell {
-fx-border-color: black;
}
changed to:
.table-row-cell {
-fx-table-cell-border-color: black;
}
Reference documentation: https://community.oracle.com/tech/developers/discussion/2505963/tableview-column-headers-do-not-line-up-with-rows

None of the other solutions worked for me. I noticed that the issue only occurs when the horizontal scrollbar is on the far right and then the table is cleared (table.getItems().clear()) while other content changes didn't cause the bug even if the scrollbar disappears and reappears.
I checked this bug report https://bugs.openjdk.java.net/browse/JDK-8149615 (and the linked changeset) and at first dismissed the workaround because scrolling to the first column (table.scrollToColumnIndex(0)) wasn't working for me either.
But it started working once I called scrollToColumnIndex before clearing the table with getItems().clear().
The bug report suggests reacting to the visibility change of the placeholder node. I didn't test this because I had already solved it (hopefully) and no sample code is provided. But if I ever need to revisit this I would try writing a listener for the placeholder visibility as an alternative solution.

Related

Mouse is offset only in one particular GUI in Unity

I have 3 different GUI containers/sections, one for showing resources, one for building, and one for inventory. Clicking anything in the resource and building sections works completely fine, the mouse is where it needs to be and clicking/hovering over a button will actually click/hover over the button.
The problem is only in the inventory GUI. I'm not sure how it's any different, so I don't know what I need to provide here for anyone to help me out, so please ask me for any extra info if you need it in the comments. I'm not sure if this is an issue with the code or the UI elements, or whatever else it might be. I'm going to provide some examples of this happening, though.
Here is a gif of what it looks like in the inventory (ignore the items not doing what they are supposed to): https://s3.gifyu.com/images/ezgif.com-gif-maker-37b00e5b2a1c164b2.gif
Here is a gift of me just hovering/clicking around in the inventory: https://s3.gifyu.com/images/ezgif.com-gif-maker97b27b8783d784c6.gif
Here is a gif of this working in the "Building" section: https://s9.gifyu.com/images/ezgif.com-gif-maker-287d7a9723f9db2b1.gif
Here is a gif of this working in the "Resources" section: https://s3.gifyu.com/images/ezgif.com-gif-maker-18662e4229ebd27a2.gif
Here are some images that might be useful. Here is the layout:
There is no difference when I select, for example, Building and Inventory. Here is a comparison:
I have looked around on Google for about 30 minutes, but I couldn't find anything related to this.
I have found the issue. The issue was with the slot prefab that was in the inventory screen, as it had text that was way bigger than it was: https://prnt.sc/uDRXz2Kr4kQr
I initially hadn't noticed this as simply clicking on the prefab itself shows that it's the right size: https://prnt.sc/BXQqAzMD-kWX
Resizing the text seems to fix the issue.

QGIS - layers disappear after loading pre-saved style

First time here, I hope I'm doing it right and I hope I'm allowed to ask this here.
I'm making buffer layers out of points in QGIS 3.8.1 Zanzibar, it's 5 point layers and I need to generate the 5 corresponding buffers. They come out alright, but after I load a previously saved style for the layers the geometries simply disappear.
I have:
Ticked layer off and on, still gone.
Deactivated any other layer and make sure it's not hidden behind something else.
Zoomed to layer, not the problem, it zooms where they should be, they're just not visible
Checked for SRC, it's all good, all of them are the same.
Open attribute table, all the data is there and it's correct.
Left click on layer/layer visibility and made sure it is unchecked as it should, I also tried checking it to no avail.
Made the layers all over again, same result.
Went to Properties/Source/Query Builder and wrote this (I saw this in a vid where it worked):
"FIELD" LIKE "FIELD"
Where "FIELD" is a field of my attribute table, tested it correctly and applied...didn't work either.
Just one seemed to come out alright before doing all this, but I followed the exact same procedure for all of them.
Any ideas? Do I have to re-do the style all over again manually for every layer?
Thanks in advance!
I just found out what was wrong, I hope this helps someone in the future:
The style I saved was classifying data based on a particular column, wich of course, must exist and have the exact same name in the other layers in order to work. I just forgot to generate said column on the rest of the layers.
Cheers and thanks to the editor.

Custom PickerView froze up (With sample project)

Background: I have been wanting a PickerView that is exactly matches that of Safari. I looked through many Gits and found none that work quite as exactly. I decided to build my own. It is complete now, but there is a bug that would not go away.
Problem: If you run the sample project you will be greeted with 2 text fields.
Tap on one of the textfields - it brings up the BTPickerView. Everything works just as you would expect.
Choose the fourth choice, then press done.
Tap on the same textfield. This time, the debug log will show you that you have executed an infinite loop, which freezes the app.
Question: What did I do to cause it? And how do I fix it?
I have tried everything to boil it down. It comes down to this and I could not go any further. Please advise.
Edit: Here is the sample code you can download in case anyone missed the blue link above.
The issue seems to be with the constraints in BTPickerLabel. If you temporarily disable the constraints from BTPickerLabel, code works fine. Enforcing constraint might trigger the reloading of entire picker view infinitely. I hope it should help you to fix the problem.

Facebook like box is suddenly right-aligned

I manage/webmaster half a dozen websites that have facebook like boxes on their index pages. These were all working fine until yesterday, when suddenly they all began to display to the right of the page (where previously they had been centered). No changes have been made to any of these pages in the last day or two, so I can't think of any reason why they would all suddenly right-align.
Some of these scripts are between "center" tags, Others are inside centered tables. But they're still displaying to the right of the page. I've tried everything I can think of to get them to display in the middle of the page again, but nothing I've tried works. I'm also curious to know why they would all suddenly lose their center alignment.
Anyone have any ideas?
Any help would be very much appreciated.
You can see an example of what I'm talking about at holisticspain-dot-net
.fb-like-box.fb_iframe_widget *
{
text-align: left !important;
}
This worked as a temporary fix as well.
We already apply some styling to our button (it is surrounded in <li> tags, but we found we had to change the style for this.
We previously had this style applied
.fb-tool {position:relative;left:8px;}
We changed it to this.
.fb-tool {position:relative;left:8px; text-align:left;}
Just a short answer - might help perhaps. I changed the display property of .fb_iframe_widget to relative with !important and it fixed the sudden leftiness.
Following Harold Neal and Sergei S's suggestions, you can add text-align:left; to the default style="background-color:#000000;" portion of the tag.

Issue with scrolling in iOS 5 using -webkit-overflow-scrolling

I have an HTML page with a fixed-height div which should be scrollable (only vertically). In iOS 5 this can be achieved using:
overflow-y: auto;
-webkit-overflow-scrolling: touch;
The div contains an unordered list with about 10 items.
The scrolling works, but sometimes it scrolls only if I swipe my finger diagonally or even horizontally and not vertically as it should be.
I'm wondering if anyone has encountered this issue. I don't want to think that it is a bug in iOS5, but I can't figure out what I'm doing wrong because most of the time it works fine.
I had exactly the same issue. The problem turned out to be caused by two zero size iframes my site used to track history changes and load scripts. Removing these fixed the issue. I filed a bug with apple, waiting to hear back from them.
Check to see if you have any iframes on your page they could be the cause.
I have found a hacky solution but it needs javascript...
I stumbled upon that problem while loading scrollable nodes via ajax and appending them with js.
I found out that resetting the -webkit-overflow-scrolling property with js saved the day
JS CODE:
var myDiv = $('.myDiv');
myDiv.css('-webkit-overflow-scrolling','auto');
function fn(){
myDiv.css('-webkit-overflow-scrolling','touch');
}
setTimeout(fn,500);
It really sucks that we have to call the setTimeout method but that's the only way I could think of...
EDIT : Watch out for display:none
Webkit overflow scrolling touch CSS bug on iPad
You need to put this css setting in your css file - the one you load using the content_css configuration variable:
body {
-webkit-transform: translate3d(0, 0, 0);
}
The other option is to set the css directly from code on tinymce initialization:
$(tinymce.activeEditor.getBody()).css('-webkit-transform', translate3d(0, 0, 0));
I had the same problem in iOS 5.1.1 and it turned out to be due to an ::after pseudo-element with position: fixed that was on an element that contained the scrollable list exhibiting the "wrong scroll axis" behavior. Details here.