Skip to content
Snippets Groups Projects
Commit 1d376eab authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

fixes for javafx, keyword search, and image gallery issue

parent 2f5c66c7
No related branches found
No related tags found
No related merge requests found
......@@ -263,6 +263,13 @@ private static void initJavaFx() {
//initialize java fx if exists
System.setProperty("javafx.macosx.embedded", "true");
try {
// Due to a lingering issue https://bugs.openjdk.org/browse/JDK-8223377 where glass.dll from java 8 gets loaded instead of the java 17 one.
String javaLibraryPath = "java.library.path";
String jvmBinPathStr = Paths.get(System.getProperty("java.home"), "bin").toAbsolutePath().toString();
String path = System.getProperty(javaLibraryPath);
System.setProperty(javaLibraryPath, StringUtils.isBlank(path) ? jvmBinPathStr : jvmBinPathStr + File.pathSeparator + path);
// Creating a JFXPanel initializes JavaFX
new JFXPanel();
Platform.setImplicitExit(false);
......
......@@ -55,6 +55,11 @@
*/
public class XMLUtil {
static {
// this is to ensure using xalan for the transformer factory: https://stackoverflow.com/a/64364531/2375948
System.setProperty("javax.xml.transform.TransformerFactory","com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
}
private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
// See JIRA-6958 for details about class loading and jaxb.
ClassLoader original = Thread.currentThread().getContextClassLoader();
......
......@@ -46,6 +46,7 @@
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -662,24 +663,25 @@ private class DrawableCell extends GridCell<Long> {
private final DrawableTile tile = new DrawableTile(GroupPane.this, controller);
DrawableCell() {
itemProperty().addListener((ObservableValue<? extends Long> observable, Long oldValue, Long newValue) -> {
if (oldValue != null) {
cellMap.remove(oldValue, DrawableCell.this);
tile.setFile(null);
protected final ChangeListener<Long> changeListener = (ObservableValue<? extends Long> observable, Long oldValue, Long newValue) -> {
if ((oldValue == null && newValue == null) || (oldValue != null && newValue != null && oldValue.equals(newValue))) {
// if no change, do nothing
return;
}
DrawableCell oldValueCell = oldValue == null ? null : cellMap.remove(oldValue);
if (oldValueCell != null) {
// remove change listener to get garbage collected
oldValueCell.itemProperty().removeListener(oldValueCell.changeListener);
}
if (newValue != null) {
if (cellMap.containsKey(newValue)) {
if (tile != null) {
// Clear out the old value to prevent out-of-date listeners
// from activating.
cellMap.get(newValue).tile.setFile(null);
}
}
cellMap.put(newValue, DrawableCell.this);
}
});
};
DrawableCell() {
itemProperty().addListener(changeListener);
setGraphic(tile);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment