How to retreive custom property for JavaFX control

Class library usage, coding and language questions.
bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

How to retreive custom property for JavaFX control

Post by bk_tester » Fri Aug 04, 2017 11:51 am

Hello,

I have custom table based on JavaFX TreeTable. Ranorex Spy recognizes it well. And indexes of selected TreeItems are indentified on Advanced tab under SelectionModel property, SelectedIndicies sub-property as a array of integers, like [2,3,5,7].
How can I get that values?

Thanks,
Bohdan

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retreive custom property for JavaFX control

Post by odklizec » Fri Aug 04, 2017 12:14 pm

Hi,

Could you please upload a Ranorex snapshot (not screenshot) of the problematic element? Without (at very least) snapshot, there is not much anyone here can do or suggest.

Generally speaking, obtaining processable data from Java elements is often a pain in the... ;) My guess is, that in order to obtain the values you are after, you will most probably have to parse the property via custom code.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Fri Aug 04, 2017 12:21 pm

Sure please find it here https://www.dropbox.com/s/ii58066l7gfpq ... rxsnp?dl=0

Thanks,
Bohdan

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retreive custom property for JavaFX control

Post by odklizec » Fri Aug 04, 2017 12:32 pm

Thanks. Now please post an xpath pointing to the problematic element, which stores its values in an array. I can't find anything like you described. Each visible TreeItem contains list of cells, and those cells with text have correctly filled property Text. I just don't see property SelectionModel?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Fri Aug 04, 2017 12:43 pm

xPath for the TreeTable is /form[@title='Notifications']/container[@name='mainView']/?/?/container[@name='resourceBoxesPane']//container[@styleclass='mint-resource-notification-boxes-section']/container[@name='boxes']/?/?/container[@styleclass='body-area']/?/?/container[@name='outbox']/container[@name='outboxMasterPane']/container/container[2]/?/?/tree[@styleclass='tree-table-view mint-notification-table']

and maybe for better understanding i've attached screenshot:
https://www.dropbox.com/s/9hm38gfsuv893 ... X.png?dl=0

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retreive custom property for JavaFX control

Post by odklizec » Fri Aug 04, 2017 1:15 pm

Thanks. Now I see and understand. The problem is, that SelectionMode property is not expandable in saved snapshot ;)
SelectionMode_not_expandable.png
Anyway, as I mentioned, you will have to process this info via code.

What I found interesting, that the individual TreeItems have Selected property.
Selected_prop.png
So in a theory, if the TreeItem is selected, its property should be set to True...except it is not :D I would suggest to discuss this behavior with your AUT developers. If the Selected property would be set correctly, it should be easy for you to create a list of treeitems, then go thought that list and evaluate Selected property of each treeitem. Otherwise, you need to process the SelectionModel>>SelectedIndicies property and somehow match the obtained values with selected TreeItems (probaly via element index?).
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Fri Aug 04, 2017 1:41 pm

Thanks for your replay!
Actually i dive into custom property to identify somehow what treeitems is selected. Becease Selected property is not working well at this place.
I'm just wondering how Ranorex Spy retreive information into SelectionModel (SelectionIndicies []) property... if this info is available in Spy i guess it must be possible to retreive it in Ranorex code module. Am i right?

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: How to retreive custom property for JavaFX control

Post by Aracknid » Fri Aug 04, 2017 2:23 pm

Are you asking for this?

Object.Element.GetAttributeValueText("name_in_spy_tool")

E.g.

YourTreeObj.Element.GetAttributeValueText("SelectionModel")

Aracknid

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Tue Aug 08, 2017 12:42 pm

Hi Aracknid,

Thanks for you replay.
To retreive list of SelectionModel sub-properties i use this code:

Code: Select all

object oSelectionModel = treeAdapter.GetAttributeValue<object>("SelectionModel");
PropertyInfo piPropertyNames = oSelectionModel.GetType().GetProperty("PropertyNames");
but i have no idea how to get sub-properties values. Any ideas?

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retreive custom property for JavaFX control

Post by odklizec » Tue Aug 08, 2017 1:04 pm

Hi,

I think this post could help with accessing Dynamic properties?...
https://www.ranorex.com/forum/accessing ... tml#p44581
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Tue Aug 08, 2017 3:59 pm

thanks odklizec!! it helps and made my day! :)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to retreive custom property for JavaFX control

Post by odklizec » Wed Aug 09, 2017 8:13 am

Hi,

I'm glad it helped! Any chance you can post the code you put together? I think more examples like this would help other people too ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

bk_tester
Posts: 26
Joined: Thu Dec 29, 2016 5:37 pm

Re: How to retreive custom property for JavaFX control

Post by bk_tester » Wed Aug 09, 2017 10:49 am

This piece of code resolved my problem:

Code: Select all

Tree treeAdapter = treeTableInfo.FindAdapter<Tree>();
JavaObjectWrapper selectionModelWrapper = treeAdapter.GetAttributeValue<JavaObjectWrapper>("SelectionModel");
string selectedIndices = selectionModelWrapper.GetObjectProperty("SelectedIndices").ToString();
Thanks for help!
Bohdan