Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
CH.ifa.draw.standard.ChangeConnectionHandle Class Reference

ChangeConnectionHandle factors the common code for handles that can be used to reconnect connections. More...

Inheritance diagram for CH.ifa.draw.standard.ChangeConnectionHandle:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.standard.ChangeConnectionHandle:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void invokeStart (int x, int y, DrawingView view)
 Disconnects the connection.
void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view)
 Finds a new target of the connection.
void invokeEnd (int x, int y, int anchorX, int anchorY, DrawingView view)
 Connects the figure to the new target.
void draw (Graphics g)
 Draws this handle.
abstract Point locate ()
 Locates the handle on the figure.
void invokeStart (int x, int y, Drawing drawing)
 @ deprecated As of version 4.1, use invokeStart(x, y, drawingView) Tracks the start of the interaction.
void invokeStep (int dx, int dy, Drawing drawing)
 @ deprecated As of version 4.1, use invokeStep(x, y, anchorX, anchorY, drawingView)
void invokeEnd (int dx, int dy, Drawing drawing)
Figure owner ()
 Gets the handle's owner.
Rectangle displayBox ()
 Gets the display box of the handle.
boolean containsPoint (int x, int y)
 Tests if a point is contained in the handle.

Static Public Attributes

static final int HANDLESIZE = 8
 The standard size of a handle.

Protected Member Functions

 ChangeConnectionHandle (Figure owner)
 Initializes the change connection handle.
abstract Connector target ()
 Returns the target connector of the change.
abstract void disconnect ()
 Disconnects the connection.
abstract void connect (Connector c)
 Connect the connection with the given figure.
abstract void setPoint (int x, int y)
 Sets the location of the target point.
Connector source ()
 Gets the side of the connection that is unaffected by the change.
Connector findConnector (int x, int y, Figure f)

Protected Attributes

Connector fOriginalTarget
Figure fTarget
ConnectionFigure fConnection
Point fStart

Private Member Functions

Connector findConnectionTarget (int x, int y, Drawing drawing)
Figure findConnectableFigure (int x, int y, Drawing drawing)

Detailed Description

ChangeConnectionHandle factors the common code for handles that can be used to reconnect connections.

See also:
ChangeConnectionEndHandle
ChangeConnectionStartHandle

Definition at line 20 of file ChangeConnectionHandle.java.


Constructor & Destructor Documentation

Initializes the change connection handle.

Definition at line 30 of file ChangeConnectionHandle.java.

                                                   {
        super(owner);
        fConnection = (ConnectionFigure) owner();
        fTarget = null;
    }

Here is the call graph for this function:


Member Function Documentation

abstract void CH.ifa.draw.standard.ChangeConnectionHandle.connect ( Connector  c) [protected, pure virtual]

Connect the connection with the given figure.

Implemented in CH.ifa.draw.standard.ChangeConnectionEndHandle, and CH.ifa.draw.standard.ChangeConnectionStartHandle.

Here is the caller graph for this function:

boolean CH.ifa.draw.standard.AbstractHandle.containsPoint ( int  x,
int  y 
) [inline, inherited]

Tests if a point is contained in the handle.

Definition at line 124 of file AbstractHandle.java.

                                               {
        return displayBox().contains(x, y);
    }

Here is the call graph for this function:

abstract void CH.ifa.draw.standard.ChangeConnectionHandle.disconnect ( ) [protected, pure virtual]

Disconnects the connection.

Implemented in CH.ifa.draw.standard.ChangeConnectionEndHandle, and CH.ifa.draw.standard.ChangeConnectionStartHandle.

Here is the caller graph for this function:

Rectangle CH.ifa.draw.standard.AbstractHandle.displayBox ( ) [inline, inherited]

Gets the display box of the handle.

Definition at line 112 of file AbstractHandle.java.

                                  {
        Point p = locate();
        return new Rectangle(
                p.x - HANDLESIZE / 2,
                p.y - HANDLESIZE / 2,
                HANDLESIZE,
                HANDLESIZE);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.standard.ChangeConnectionHandle.draw ( Graphics  g) [inline]

Draws this handle.

Reimplemented from CH.ifa.draw.standard.AbstractHandle.

Definition at line 133 of file ChangeConnectionHandle.java.

                                 {
        Rectangle r = displayBox();

        g.setColor(Color.green);
        g.fillRect(r.x, r.y, r.width, r.height);

        g.setColor(Color.black);
        g.drawRect(r.x, r.y, r.width, r.height);
    }

Here is the call graph for this function:

Figure CH.ifa.draw.standard.ChangeConnectionHandle.findConnectableFigure ( int  x,
int  y,
Drawing  drawing 
) [inline, private]

Definition at line 143 of file ChangeConnectionHandle.java.

                                                                        {
        FigureEnumeration k = drawing.figuresReverse();
        while (k.hasMoreElements()) {
            Figure figure = k.nextFigure();
            if (!figure.includes(fConnection) && figure.canConnect()) {
                if (figure.containsPoint(x, y))
                    return figure;
            }
        }
        return null;
    }

Here is the caller graph for this function:

Connector CH.ifa.draw.standard.ChangeConnectionHandle.findConnectionTarget ( int  x,
int  y,
Drawing  drawing 
) [inline, private]

Definition at line 114 of file ChangeConnectionHandle.java.

                                                                          {
        Figure target = findConnectableFigure(x, y, drawing);

        if ((target != null) && target.canConnect()
             && target != fOriginalTarget
             && !target.includes(owner())
             && fConnection.canConnect(source().owner(), target)) {
                return findConnector(x, y, target);
        }
        return null;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Connector CH.ifa.draw.standard.ChangeConnectionHandle.findConnector ( int  x,
int  y,
Figure  f 
) [inline, protected]

Definition at line 126 of file ChangeConnectionHandle.java.

                                                              {
        return f.connectorAt(x, y);
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractHandle.invokeEnd ( int  dx,
int  dy,
Drawing  drawing 
) [inline, inherited]
Deprecated:
As of version 4.1, use invokeEnd(x, y, anchorX, anchorY, drawingView).

Tracks the end of the interaction.

Definition at line 100 of file AbstractHandle.java.

{ }
void CH.ifa.draw.standard.ChangeConnectionHandle.invokeEnd ( int  x,
int  y,
int  anchorX,
int  anchorY,
DrawingView  view 
) [inline]

Connects the figure to the new target.

If there is no new target the connection reverts to its original one.

Reimplemented from CH.ifa.draw.standard.AbstractHandle.

Definition at line 100 of file ChangeConnectionHandle.java.

                                                                                    {
        Connector target = findConnectionTarget(x, y, view.drawing());
        if (target == null)
            target = fOriginalTarget;

        setPoint(x, y);
        connect(target);
        fConnection.updateConnection();
        if (fTarget != null) {
            fTarget.connectorVisibility(false);
            fTarget = null;
        }
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.AbstractHandle.invokeStart ( int  x,
int  y,
Drawing  drawing 
) [inline, inherited]

@ deprecated As of version 4.1, use invokeStart(x, y, drawingView) Tracks the start of the interaction.

The default implementation does nothing.

Parameters:
xthe x position where the interaction started
ythe y position where the interaction started

Definition at line 47 of file AbstractHandle.java.

{ }

Here is the caller graph for this function:

void CH.ifa.draw.standard.ChangeConnectionHandle.invokeStart ( int  x,
int  y,
DrawingView  view 
) [inline]

Disconnects the connection.

Reimplemented from CH.ifa.draw.standard.AbstractHandle.

Definition at line 69 of file ChangeConnectionHandle.java.

                                                              {
        fOriginalTarget = target();
        fStart = new Point(x, y);
        disconnect();
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.AbstractHandle.invokeStep ( int  dx,
int  dy,
Drawing  drawing 
) [inline, inherited]

@ deprecated As of version 4.1, use invokeStep(x, y, anchorX, anchorY, drawingView)

Tracks a step of the interaction.

Parameters:
dxx delta of this step
dyy delta of this step

Definition at line 70 of file AbstractHandle.java.

{ }

Here is the caller graph for this function:

void CH.ifa.draw.standard.ChangeConnectionHandle.invokeStep ( int  x,
int  y,
int  anchorX,
int  anchorY,
DrawingView  view 
) [inline]

Finds a new target of the connection.

Reimplemented from CH.ifa.draw.standard.AbstractHandle.

Definition at line 78 of file ChangeConnectionHandle.java.

                                                                                      {
        Point p = new Point(x, y);
        Figure f = findConnectableFigure(x, y, view.drawing());
        // track the figure containing the mouse
        if (f != fTarget) {
            if (fTarget != null)
                fTarget.connectorVisibility(false);
            fTarget = f;
            if (fTarget != null)
                fTarget.connectorVisibility(true);
        }

        Connector target = findConnectionTarget(p.x, p.y, view.drawing());
        if (target != null)
            p = Geom.center(target.displayBox());
        setPoint(p.x, p.y);
    }

Here is the call graph for this function:

abstract Point CH.ifa.draw.standard.AbstractHandle.locate ( ) [pure virtual, inherited]

Locates the handle on the figure.

The handle is drawn centered around the returned point.

Implemented in CH.ifa.draw.standard.ChangeConnectionEndHandle, CH.ifa.draw.standard.ChangeConnectionStartHandle, and CH.ifa.draw.standard.LocatorHandle.

Here is the caller graph for this function:

Figure CH.ifa.draw.standard.AbstractHandle.owner ( ) [inline, inherited]

Gets the handle's owner.

Definition at line 105 of file AbstractHandle.java.

                          {
        return fOwner;
    }

Here is the caller graph for this function:

abstract void CH.ifa.draw.standard.ChangeConnectionHandle.setPoint ( int  x,
int  y 
) [protected, pure virtual]

Sets the location of the target point.

Implemented in CH.ifa.draw.standard.ChangeConnectionEndHandle, and CH.ifa.draw.standard.ChangeConnectionStartHandle.

Here is the caller graph for this function:

Connector CH.ifa.draw.standard.ChangeConnectionHandle.source ( ) [inline, protected]

Gets the side of the connection that is unaffected by the change.

Definition at line 60 of file ChangeConnectionHandle.java.

                                 {
        if (target() == fConnection.start())
            return fConnection.end();
        return fConnection.start();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

abstract Connector CH.ifa.draw.standard.ChangeConnectionHandle.target ( ) [protected, pure virtual]

Returns the target connector of the change.

Implemented in CH.ifa.draw.standard.ChangeConnectionEndHandle, and CH.ifa.draw.standard.ChangeConnectionStartHandle.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 24 of file ChangeConnectionHandle.java.

Definition at line 22 of file ChangeConnectionHandle.java.

Definition at line 25 of file ChangeConnectionHandle.java.

Definition at line 23 of file ChangeConnectionHandle.java.

final int CH.ifa.draw.standard.AbstractHandle.HANDLESIZE = 8 [static, inherited]

The standard size of a handle.

Definition at line 23 of file AbstractHandle.java.


The documentation for this class was generated from the following file: