This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122092 - Anchor/ConnectionWidget: need support for target point location in anchor
Summary: Anchor/ConnectionWidget: need support for target point location in anchor
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks: 105060
  Show dependency tree
 
Reported: 2007-11-16 09:12 UTC by Sergey Petrov
Modified: 2007-11-19 17:19 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Petrov 2007-11-16 09:12:15 UTC
currently target anchor is created by createTargetAnchor (targetWidget); method and can count on target and opposite
anchor location only, I need toi stick target anchor to pint closest to mouse position instead of point closest to
opposite anchor of some fixed point, so need smth like createTargetAnchor (targetWidget,targetPoint)
Comment 1 Sergey Petrov 2007-11-16 12:59:10 UTC
correction:
it should be not create with point, but compute method with point and usage of such compute in routers
Comment 2 Sergey Petrov 2007-11-16 13:01:43 UTC
->p2 because seems to need a lot of work on usage side, and also calculateRouting where compute seems to be used is
final so I can't override it in my links at least easily
Comment 3 David Kaspar 2007-11-16 13:21:08 UTC
The particular API is not available. To do it - we would have to create a new ConnectProvider interface as well as a new
ConnectAction implementation to pass the scene and sceneLocation parameters.
Or there could additional parameter to ActionFactory.createConnectAction method. The parameter would be
"SceneMouseLocator" interface with "sceneMouseLocationChanged(Widget,Point)" method to notify the it everytime the
action is in "locked" state and a mouse event is processing by the action.
Comment 4 David Kaspar 2007-11-16 13:22:21 UTC
Copying from Sergey in issue #122093:
i.e. 

    public ConnectorState isTargetWidget(Widget sourceWidget, Widget targetWidget,Point sourcePoint,Point targetPoint);
    public boolean isSourceWidget(Widget sourceWidget,Point sourcePoint);
    public void createConnection(Widget sourceWidget, Widget targetWidget,Point startingPoint,Point finishPoint);

methods, because sometimes it's possible to make connection only to/from specific point of target/source widget
Comment 5 David Kaspar 2007-11-16 13:22:28 UTC
*** Issue 122093 has been marked as a duplicate of this issue. ***
Comment 6 Sergey Petrov 2007-11-16 15:14:47 UTC
this issue about introduction of method like compute(entry,location) to anchors and corresponding support in routers,
connectionwidgets
for example I need to create tagetanchor for square and stick to left or right side depending on current mouse position
and independent on opposite anchor position(currently all anchors seems to use opposite anchor position)
Comment 7 Sergey Petrov 2007-11-16 15:18:25 UTC
may be it can be moved to actions(don't see yet how), because such anchors are usable mostly for creation and after
connection is created it's possible to use some kind  of fixed, standard anchor or add "pin" to appropriate side of box
and connect to pin etc If you have ideas how to move it to ConnectAction it may be closed again
Comment 8 David Kaspar 2007-11-16 15:39:33 UTC
I see - I totally misunderstand it.

This feature can be created even right with current API.
Create an WidgetAction which overrides mouseMoved method.
The mouseMoved method implementation will store/change an anchor on your ConnectionWidget.
Or you may create a custom MouseMovementSensitiveAnchor (with MouseSensitiveAction parameter in constructor) and the
Anchor would listen on cursor scene-location changes and invokes Anchor.revalidation method in case that cursor is changed.

Anyway I am decreasing the issue priority to P3 since the feature can be built easily with current API.

Let me know if you would like to have an example.
Comment 9 Sergey Petrov 2007-11-16 15:49:46 UTC
ok I'll try, I just searched usages of compute and find it in final method of connectionwidget,
As I understand you suggest to make several anchors like LeftStickAnchor and Right|StickAnchor and change them in
mouseMoved method, I'll try.
Comment 10 David Kaspar 2007-11-16 16:02:13 UTC
Yes. The mouseMoved method is at WidgetAction class. The action should be registered using:
Scene.getPriorActions().addAction(new MyMouseMoveAction());
Comment 11 Sergey Petrov 2007-11-19 17:19:25 UTC
Ok, it works and it's easy, may be not very structured because of two level anchor calciulation in caonnectaction(in my
case it's in mouseDrag section) and in anchor itself