Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node inspector #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

whitehat101
Copy link
Contributor

I was sad that calling #inspect on Java FX objects didn't return much useful information.

This pull only deals with #inspect on objects descended from Node. It is able to discover all the properties of just the top class. (It can be used for more custom inspections, see inspector_spec)

Java::JavafxSceneShape::Rectangle.new.inspect => 
  #<Java::JavafxSceneShape::Rectangle:0x64027866 x:0.0 y:0.0 width:0.0 height:0.0 arcWidth:0.0 arcHeight:0.0>

Lots of examples in the specs.

I'd like to get a useful inspect for Events as well, someday.

Enjoy!

dirty: https://github.com/whitehat101/jrubyfx/tree/inspector

@byteit101
Copy link
Member

Hey a fix for #40. In my quick scan over it looks fairly good except this:

+Java::JavafxScene::Node.send :include, JRubyFX::Utils::Inspector

just put it in node.rb.

@enebo
Copy link
Member

enebo commented Apr 20, 2013

I doubt anyone will ever call 'discover_properties' outside of inspect, but the logic below seems like it belongs (in some form) in discover_properties just in case something else ever wants that info. Otherwise each consumer needs to know to perform this ||'ing:

(self.class.instance_variable_get('@inspect_properties')||discover_properties). 

@byteit101
Copy link
Member

Hey wait a minute! Is there a reason you can't use toString?

 System.out.println(aGridObjectInJavaLand);
 Grid hgap=0.0, vgap=0.0, alignment=TOP_LEFT

is what I just got from debugging a hybrid jrubyfx/java app

@byteit101
Copy link
Member

@whitehat101 toString is quite variable in its coverage. If you update this pr to inject itself into the new precompilation phase (second half of dsl.rb) with all the reflected properties pre-computed, I'll pull it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants