Comments (6)
I would try something like this:
class MyTreeCell < TreeCell
def updateItem(item, empty)
super(item, empty)
text = item unless item
end
end
#...in scenebuilding part of your code.
tree_view do
set_cell_factory do
MyTreeCell.new.tap do |tree_cell|
tree_cell.set_on_drag_detected do |mouse_event|
# ...
end
end
end
end
from jrubyfx.
I've tried this (https://gist.github.com/4678888), but that makes the textx not render, and I see no sign of dnd. I've found a more compicated (but more complete) sample of tree drag and drop in java. I'll see if I can make that work; do you want a pull request for a working sample if I do?
from jrubyfx.
I've tried to translate https://gist.github.com/4009620 to jrubyfx, but I keep tripping up on the event handler stuff. Any general pointers on how to approach this?
from jrubyfx.
I made a couple of tweaks to get (https://gist.github.com/4678888) working. I am unclear why MyTreeCell's super does not render the contents directly. It still seems like you want the method for updateItem I provided though (reversed unless to if and did self.text so we used text= method and not local variable text).
You will also notice I changed how tree_view and tree_item setup. This only works on master. After you reported this issue I decided to play with tree_view + tree_items and made some changes to have them behave more like the rest of the DSL.
FWIW, I don't know if set_on_drag_detected is all you need to do or not but I can see that method firing when I try to drag something. It just doesn't actually show any graphics of something being dragged...
from jrubyfx.
Look at this sample:
https://github.com/nahi/jrubyfx/blob/master/samples/javafx/tree_view.rb
It basically implements reasonable drag and drop support. The code you had used was partially dependent on other classes in a framework. This code is not quite the same since I changed some behavior and I think fixed several corner cases. This was surprisingly tedious but I wanted to include a more sophisticated example.
I am resolving this issue because this example should show more than enough examples of how to work with Java classes and define event handlers.
from jrubyfx.
Splendid! Still requires master, right? No probs, loving this!
from jrubyfx.
Related Issues (20)
- jrubyfx sensitive to number of spaces in fxml HOT 2
- Enhancement: Provide Ruby binding impls HOT 1
- Setting TableView items doesn't seem to work HOT 4
- Jar classpath issue on windows HOT 1
- jarify with fxml: no .jrubyfx_cache in the jarfile HOT 1
- jarify with fxml: cannot access the fxml files
- jarify with fxml: require_relative doesn't work from inside a jarfile
- jrubfx-jarify compiled jar does not laucnch HOT 5
- cannot run the hello world app HOT 2
- gem install jrubyfx gem not found HOT 1
- Permission denied for 'jrubyfx_cache' HOT 2
- Need more documentation for controller functions HOT 1
- jrubyfx não encaminhando HOT 2
- Is this project active ? HOT 3
- Path to jfxrt.jar loading issue with 1.8.0_202-ea-b03 HOT 1
- Would it be possible to add a screenshot-example to the main README here? HOT 1
- Use javafx 17 modules HOT 3
- Warning: SCENE3D? HOT 1
- More examples perhaps? TextArea specifically
- Classic OOP style? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jrubyfx.