javaswingqtpjxtreetablejtreetable

JXTreeTable - manipulating checkboxes from an external application - possible?


Using Java code, I am tying to manipulate another, external Java swing application, for which I have no access to any information about how it was coded. Specifically, I am trying to manipulate a JXTreeTable. One of the columns, of type Boolean, contains checkboxes.

One thing I've tried to do, is to do code a double-click-then-space-bar action, which has worked. However, my manager would like me to figure out a way to toggle the checkboxes without using the spacebar.

I'm wondering – does anyone know a way to toggle the checkboxes using Java methods, despite me being blind to the original application's design? I've tried to use setCellData() with a Boolean parameter. Oddly, calling getCellData() onto the cell right after returns the value I modified it to, but the checkbox itself does not get toggled – plus, when submitting the form, it's the value reflected by the checkbox that's sent in, not the Boolean in the cell.

In addition, the checkboxes in the Boolean column carry labels. I have a feeling these labels are generated by the TableRenderer, but how can I grab the values on the labels?

Note: I am executing all the Java code through an automating testing script that I am writing (in QTP, to be exact). So, I am limited in a lot of the approaches I can use (e.g. I can't code my own custom Java classes)


Solution

  • Assuming that the column data is backed by a boolean value in the data model, change the values in the data model.

    Just make use you fire the required table changed event so that the UI can update.