From: Andrew W. <an...@tx...> - 2007-11-02 20:12:39
|
I found there is a property listed for my component named "visibleRec2D" with a value "java.awt.geom.Rectangle2D$Double[x=-10.0,y=-336.0,w= 833.1166666666667,h=720.8833333333333]". What I have found is that if the point I am trying to click/drag falls outside {X= (w + x) = (-10 + 833.1..) = 823}, {Y= (h + y) = (-336 +720.833) = 384.833} I get the error. I will need to click within the real window which in this case is (772 x 820). What is the best way to tackle this, now that it seems the issue is the theoretical visible rectangle? On 11/2/07, Timothy Wall <tw...@us...> wrote: > > > On Nov 2, 2007, at 11:50 AM, Andrew Walker wrote: > > > Timothy, > > > > See my responses below, > > > > On 11/2/07, Timothy Wall <tw...@us...> wrote: You may need a > > custom ComponentLocation object for the component, one > > that translates a semantic object location (such as "circle 0" or > > "footer-text") into a current pixel location. These are used for > > JTable, JTree, et al. to convert a cell location into a pixel > > location. > > > > I would need some help to get this done > > > > Alternatively, make sure your canvas is in a known scaling state when > > you ask for a given pixel on it. > > > > The Canvas is in a known scaling state, we do a "fit content to > > window" before attempting the click/drag. > > > > Can you tell if the point abbot is trying to reach is valid for the > > current canvas? > > > > The point if valid on the graph, it was acquired using the record > > feature. > > Sounds like Component.getVisibleRect() is not providing an accurate > result. Can you instantiate your graph in a standalone JUnit test > (ComponentTestFixture is provided for this purpose)? If you can do > so, it'll be easier to poke and prod at the component to see what's > unexpected in its responses. > > If you scale to fit, then the component size should match its visible > rect. You can always tweak the abbot source to provide the current > visible rect reported by the component in the error message. > > Basically, Abbot does this: > > a) get the current visible rect > b) get the desired point > c) if point is not within the current visible rect, call > scrollRectToVisible > d) if point is still not within the current visible rect, throw an > exception > > > > > Does the canvas behave normally within a scroll pane (like any other > > Swing component), or does it do some sort of on-the-fly scaling as > > you scroll? > > > > This is the interesting part. I'm not entirely sure because I don't > > have the source code to the component but I have a feeling that it > > is doing something that's not quite normal. The scrollbars expand > > as the component is scrolled and there is definitely some dynamic > > resizing as the image on the component is zoomed in and out. > > > > |