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

Properties of a random component #37

Closed
Thomas-- opened this issue May 22, 2013 · 4 comments
Closed

Properties of a random component #37

Thomas-- opened this issue May 22, 2013 · 4 comments

Comments

@Thomas--
Copy link

I would like to evaluate properties of a random swing component within the robot framework, similar to the "Get Table Cell Property" keyword .
In particular I would like to access the background color of a JTextfield.

It would be great (for me:-) if you could create a keyword like "Get Component Property".

Thanks,
Thomas

@jussimalinen
Copy link
Member

How should this keyword work under the hood? Call the method getBackground? http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#getBackground()

Should this somehow use reflection to allow accessing functions starting with "get"?

Or do you want this to call the getClientProperty keyword? (But you would not get the background color in general case from there, would you?)

@Thomas--
Copy link
Author

In the meantime I'm using a custom keyword (the component under test actually is inherited from JTextfield and has further properties that I need to evaluate).
I /do/ use getBackground(). I'm not sure if that's the best way to do it because iirc some swing components have some weird set/getBackground bevaviour, but in my case, everything works as expected.

@jussimalinen
Copy link
Member

I think this does make sense. It could be something like:

Get property locale # calls getLocale()
Get property rectangle # calls getRectangle()

The toString method in the returned objects for the swing functions I took a look at seems sane enough to make this work. Cant promise when we get around making this, but in the meanwhile pull requests are appreciated :)

@jussimalinen
Copy link
Member

I think this has now been implemented in #65

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

No branches or pull requests

2 participants