Ask a Question

Dragging of Jtable cell data on to other object

SOLVED
TestQA1
Frequent Contributor

Dragging of Jtable cell data on to other object

Hi,

 

I am struggling a lot to use the coordinates with Drag method. The desktop application does not support copy/paste action on the object and we have to drag the data on it.

I have attached an image. So, we have two objects in image, On top right, the object 1 jtable has few rows and we need to drag data from row 1...5 and col 1. (mean all cells in the first col). The height of each cell is 20 i.e each jtable cell is 20 + 20 + 20 and so on.

Now the problem is I am unable to quite understand the parameters in the drag method. Four parameters are required, the first two seems to be working, but last two creating problems in combination with the first two parameters.

 

I'm looking for a solution based on some equation using ScreenLeft and ScreenTop of both objects.

Can anyone help by suggesting an equation by looking at the attached image please. This is something I need to proceed with my next scenarios.

I'm using scripts and BDD scenarios.

 

Thanks in advance. 

8 REPLIES 8
Marsha_R
Community Hero

If you use Object Spy on the top right box, can you see the text that you need in one of the fields?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
TestQA1
Frequent Contributor

No I don't see the text. Unfortunately the table cells are not editable and neither we can paste data in them. So the AWTComponentAccessibleName is empty.

 

But, for some other objects (where we want to drag something), the AWTComponentAccessibleName stores its title/label.

 

 

It doesn't have to be editable. Just looking for any object property that has the text you want. Post a screenshot of the Extended object spy please and let's take a look.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
TestQA1
Frequent Contributor

Great , thanks Marsha. I will get back. Much appreciated.

TestQA1
Frequent Contributor

So as in attached image, there's just one Extended property for the Jtable that contains the text.

However, I have an idea but don't know how to quickly implement this and if it will affect any thing in java application code.

So the idea is to extract the text of the table cell by using any getText method available. And once the text is stored in a variable, use that variable to set the text to the object in which we want to attach that text. But, the problem is if its possible to change or update the text of the java object and if that's something which won't cause any issues in the functionality.

 

 

Okay, so now you have the needed text in a variable, good!

 

As far as changing the value of the second object, that was going to happen with drag and drop too.  You may be able to use Keys on the field where the data goes rather than SetText. If neither one of those works, then explore this second window with ObjectSpy and lets see where the data is going to be entered.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
TestQA1
Frequent Contributor

Thank you for your help so far.

 

I will try the methods we discussed. Meanwhile, can you please help me understand the difference between the parameters of the Drag action. TestObj.Drag(ClientXClientYtoXtoYShift), I cannot really understand how ClientX is different from toX and same for Y parameters. If you could use the image I attached as an reference, that would make it much easier for me to understand.

 

Thanks very much!

Client X and Client Y are the position where your original value is. It clicks there, then drags the object to the new position toX and toY.

 

Marsha_R_0-1658764093128.png

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: