NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Visual API - Wiget has wrong location after resize

Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message

Joined: 18 Sep 2009
Posts: 201
Location: Houston

PostPosted: Wed Sep 30, 2009 5:35 pm    Post subject: Visual API - Wiget has wrong location after resize Reply with quote

This is for the Visual Library and even though I have sent a mail to
that group I may have someone here knowing this problem (as visual API
is part of the NetBeans API)

To help showing how this effect I have attached a fully working
example. (You will need to add the org-openide-util.jar and the
org-netbeans-api-visual.jar to your project)

1) When you move the square to the top left corner, the code will
print out more or less 0,0 as your final location after move -
expected and good. (see attached visual_move.png)

2) When you instead resize the square by dragging the top left corner
of the square and make that corner go all the way to the top left edge
of the window we have that
a) The intermediate suggested Location is correctly calculated
b) the getLocation after resize is showing the original location
prior resize - NOT good. (see attached visual_resize.png)

3) Even worse, if you now perform a new move on this resized widget
the locations are getting totally mixed up. - Still - the widget is
located nicely on the screen where it should be ?!?!?!

As much as I understand should the widget give me the 0,0 as
getLocation after resize to top left corner of the window, and not the
original value. - any ideas ?

Debugging done so far:
I have tried to check what happens in the ResizeAction of Visual API
and MoveAction (in org.netbeans.modules.visual.action). The MoveAction
performs for each move a "provider.setNewLocation(..)" - The
implementation I do is to set the widget.preferredLocation() in that
implementation and that works fine as the coordinates sent over are in
the Scene coordinate sys,

Now, the ResizeAction is performing a "widget.setPreferredBounds()" on
the return value of the ResizeStrategy.boundsSuggested - which will be
the current suggested resized Rectangle. (but in local coords) I
tried here to return Scene coords which was not very wise thing todo.

I tried to ad a widget.setPreferredLocation() in the ResizeAction
right after the setPreferredBounds, but the widget will jump to a for
me yet not understood location. The really confusing part is that when
I calculate the coordinates in Scene system in the implementation of
"boundsSuggested" - it correclty prints out the Scene coordinates of
the upper left corner (see attached application) - still - setting
those into the widget.setPreferredLocation within the bondsSelected
makes the widget really move wildly.


PS: Not directly related to this, but did you notice that the move
action does exclude
the 8 pixel border boxes while the resize does include them .... i.e.
the insets are honered with the ResizeAction of the Visual Lib but the
MoveAction does not. (bug?)

 Filesize:  30.81 KB
 Viewed:  1826 Time(s)


 Filesize:  82.03 KB
 Viewed:  1826 Time(s)


 Filesize:  7.33 KB
 Downloaded:  185 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo