tornadofx icon indicating copy to clipboard operation
tornadofx copied to clipboard

Selection Bug DataGrid JDK13 TornadoFX 2.0 SNAPSHOT

Open deggers opened this issue 4 years ago • 7 comments

Hey guys,

i am using openjdk13 and tornadofx 2.0 snapshot - most things i tried so far are working fine.

Except for the DataGrid. When i try this simple code there is no selection happening. Is this a known bug? I didnt find anything about it except the thread about jdk11 where that person did not used the snapshot of tornadofx.

class DatagridTest : View() {
	val numbers = (1..10).toList()
	override val root: Parent = datagrid(numbers) {
		singleSelect = true
	}
}

with the following style.css which is set in the App() constructor

	init {
		datagridCell {
			backgroundColor = multi(Color.RED)
			and(selected) {
				padding = box(10.pt)
				backgroundColor = multi(Color.BLACK)
			}
		}
}

The Cells are actually displayed Red like i would expect. Just when i click on them, nothing happens - tried on X11 and Wayland - neither worked.

deggers avatar Apr 15 '20 20:04 deggers

Does anybody has some tips on how i could try to find out myself whats going wrong here? I do not get any error message - thats leaves me kind of clueless. How would you try to find the reason? I set actionHandler on the cells and the mousclick is recognised - but the selectionmodel stays empty

deggers avatar Apr 19 '20 08:04 deggers

https://github.com/edvin/tornadofx/tree/jdk10#tornadofx-and-jdk-9 performed this action?

--add-opens javafx.controls/javafx.scene.control.skin=module-name

SchweinchenFuntik avatar Apr 20 '20 10:04 SchweinchenFuntik

Thank you i am finally gettin somehwere... when i run "gradle run" instead of the intellij task of building the project i actually saw now a module problem

java.lang.reflect.InaccessibleObjectException: Unable to make protected void javafx.scene.control.skin.VirtualFlow.rebuildCells() accessible: module javafx.controls does not "opens javafx.scene.control.skin" to unnamed module @704921a5

I have in my setting.gradle a rootProject.name set. So it should not find it as unnamed? Anyway i try some things from here ..

Edit: No, I cannot get it working. Does it work for you?

following i set in my build script

application {
    applicationDefaultJvmArgs = listOf(
        "--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED"
    )
}

though i have in my settings.gradle.kts rootProject.name = "BootstrapTornadoFX2" but when i start it complain that java.lang.reflect.InaccessibleObjectException: Unable to make protected void javafx.scene.control.skin.VirtualFlow.rebuildCells() accessible: module javafx.controls does not "opens javafx.scene.control.skin" to unnamed module @4fcd19b3 and this error disappears when i open it to ALL-UNNAMED

any other suggestions?

deggers avatar Apr 20 '20 13:04 deggers

Hi @deggers,

JPMS is a difficult topic :)

Basically, if your application is running on class-path instead of module-path, then it is called as unnamed module by JPMS.

Therefore, exporting the package to ALL-UNNAMED module is the correct thing to do here.

abhinayagarwal avatar Apr 24 '20 11:04 abhinayagarwal

Hi!

I'm having the same issue, nothing happens when I click on my elements.

When I try to call selectionModel.select(index = 0) by hand, it throws:

SEVERE: Uncaught error
kotlin.TypeCastException: null cannot be cast to non-null type tornadofx.DataGridSkin<T>

Same versions of JDK and tornadofx as @deggers, I also have the --add-opens params set. Has anyone found anything to help with that?

Naliwe avatar Jun 09 '20 18:06 Naliwe

Thank you i am finally gettin somehwere... when i run "gradle run" instead of the intellij task of building the project i actually saw now a module problem

java.lang.reflect.InaccessibleObjectException: Unable to make protected void javafx.scene.control.skin.VirtualFlow.rebuildCells() accessible: module javafx.controls does not "opens javafx.scene.control.skin" to unnamed module @704921a5

I have in my setting.gradle a rootProject.name set. So it should not find it as unnamed? Anyway i try some things from here ..

Edit: No, I cannot get it working. Does it work for you?

following i set in my build script

application {
    applicationDefaultJvmArgs = listOf(
        "--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED"
    )
}

though i have in my settings.gradle.kts rootProject.name = "BootstrapTornadoFX2" but when i start it complain that java.lang.reflect.InaccessibleObjectException: Unable to make protected void javafx.scene.control.skin.VirtualFlow.rebuildCells() accessible: module javafx.controls does not "opens javafx.scene.control.skin" to unnamed module @4fcd19b3 and this error disappears when i open it to ALL-UNNAMED

any other suggestions?

    applicationDefaultJvmArgs = [
           "--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED"
    ]

works for me

liugangnhm avatar Nov 11 '20 10:11 liugangnhm

Yeah, seems to be working with JDK11 but not 13, right?

deggers avatar Nov 13 '20 19:11 deggers