ergerodr / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

difficulties to click a jtree leaf #311

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

I want to doubleclick the leaf of a jtree in our application.

I tried myTreeFixture.selectPath(myPath).doubleclick() but the doubleclick
method first moves the mouse pointer to the center of the jtree component
and clicks into space.

I suggest that the doubleclick method should not move the mouse,
respectively when a path in a jtree is selected, then the mouse should
click the selected path.

Thanx.

Original issue reported on code.google.com by bjoern.e...@gmail.com on 11 Feb 2009 at 2:38

GoogleCodeExporter commented 8 years ago

Original comment by Alex.Rui...@gmail.com on 11 Feb 2009 at 8:05

GoogleCodeExporter commented 8 years ago
Hi guys,

JTreeFixture#doubleClick() is really an implementation of
MouseInputSimulationFixture#doubleClick, which is meant to double-click the 
fixture's
component.
I believe it would be wrong to "break" the contract of the interface.

This also seems to me like a loss of original context in the fluent interface. 
See
issue 115. The following code
    frame.tree().selectPath("path/to/node").doubleClick()
simply doesn't read like "double-click the selected path," and
    frame.tree().doubleClick(),
which by the way is also valid, even less so.

There's also the question of what would happen if there weren't any selection.

Instead, I would recommend clickPath(String path), doubleClickPath(String path) 
and
similar methods, in the spirit of JPopupMenuFixture#showPopupMenuAt(String 
path).

Or even better, why not implement a fixture for a path? It could have methods 
like
select, click, doubleClick, and showPopupMenu. See issue 170 and issue 185.

This would save us the trouble of bloated method names with the word "Path" at 
the
end. It would also "read right" from a DSL point of view.

Just like the "statement"
    frame.tree().showPopupMenuAt("path/to/node").menuItemWithPath("...").click()
sounds right, so would
    frame().tree().path("path/to/node").doubleClick().

To put it more precisely, in the first case it is clear that menuItemWithPath 
refers
to the JMenuItemFixture created by showPopupMenuAt, and in the second case, that
doubleClick refers to the path specified by path.

As a comment on issue 115, I don't think that it's necessarily a problem to 
introduce
a new context in the same DSL statement, so long as the statement as a whole 
"reads
right."

Thanks,
Csabi

Original comment by csaba.ju...@gmail.com on 11 Feb 2009 at 11:02

GoogleCodeExporter commented 8 years ago
Hi Csabi,

I agree. We don't want to break the current contract of the 'doubleClick' 
method.
Fixing issue 185 and adding actions to a JTreePathFixture object is the best 
option.

I think it makes sense to merge this issue with issue 185.

Thanks,
-Alex

Original comment by Alex.Rui...@gmail.com on 12 Feb 2009 at 7:40

GoogleCodeExporter commented 8 years ago

Original comment by Alex.Rui...@gmail.com on 12 Feb 2009 at 7:40

GoogleCodeExporter commented 8 years ago
Hi Alex,

What do you think about a fixture for table cells? (See issue 170.)

Regards,
Csabi

Original comment by csaba.ju...@gmail.com on 12 Feb 2009 at 1:21