jsynoptic.builtin
Class ConnectionShape

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by jsynoptic.builtin.Abstract1DShape
          extended by jsynoptic.builtin.ConnectionShape
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, ContextualActionProvider, Linkable, SelectionContextualActionProvider, AffineTransformData.Listener, DataSourceListener, EndNotificationListener, LineShapeInterface, Resizable, SelectableShapeInterface, NamedProperties

public class ConnectionShape
extends Abstract1DShape
implements Resizable, LineShapeInterface, java.io.Serializable

Connection Shape

Author:
Claude Cazenave
See Also:
Serialized Form

Nested Class Summary
static class ConnectionShape.ConnectionShapePropertiesNames
           
 class ConnectionShape.SelectedConnectionShape
           
 
Nested classes/interfaces inherited from class jsynoptic.builtin.Abstract1DShape
Abstract1DShape.Abstract1DShapePropertiesNames
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
protected  double[] _xv
          x vertices
protected  double[] _yv
          y vertices
protected  boolean displayFirstNarrow
          Deprecated.  
protected  boolean displayLastNarrow
          Deprecated.  
protected  java.awt.geom.AffineTransform firstArrowTransform
          First arrow transfrom used to draw the arrow polygon
protected  java.awt.geom.AffineTransform lastArrowTransform
          Last arrow transfrom used to draw the arrow polygon
 
Fields inherited from class jsynoptic.builtin.Abstract1DShape
allowResize, bounds2D, delegateEndNotificationListener, dirty, dirtyDrawColor, dirtyRectangle, drawColor, drawDynamicColor, drawMapper, drawMapperIndex, drawMapperSource, fixedRatio, link, MIN_SIZE, ratio, resources, stroke, strokeParams, transform
 
Fields inherited from class simtools.shapes.AbstractShape
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD
 
Fields inherited from interface jsynoptic.base.ContextualActionProvider
EDITOR_CONTEXT, MOUSE_OUT_CONTEXT, MOUSE_OVER_CONTEXT, MOUSE_PRESSED_CONTEXT, SHAPELIST_CONTEXT, SOURCELIST_CONTEXT
 
Constructor Summary
ConnectionShape(double[] xs, double[] ys)
           
ConnectionShape(int x, int y, int w, int h)
          Constructs a new Link instance
 
Method Summary
protected  AbstractShape cloneShape()
          Performs a copy of the shape This method has to be overriden to deal with concrete shapes
 boolean contains(double x, double y)
           
 JPropertiesPanel createPanel()
           
 DiagramSelectedShape createSelectedShape(int ox, int oy)
          If the shape contains point at coordinates ox,oy then return a DiagramSelectedShape to manage the selection of this shape
 DiagramSelectedShape createSelectedShape(java.awt.Point point)
          Return the DiagramSelectedShape to manage the selection of this shape
 DiagramSelectedShape createSelectedShape(java.awt.geom.Rectangle2D bounds2D)
          If the shape is contained in the bounds then return a DiagramSelectedShape to manage the selection of this shape
 void draw(java.awt.Graphics2D g)
          Draws the shape
protected  java.awt.Shape getDelegateShape()
           
 java.lang.String[] getPropertyNames()
          Get the list of property names
 java.lang.Object getPropertyValue(java.lang.String name)
          Get the value of the property named name
 int getX(int index)
          Get point coordinates
 int getY(int index)
          Get point coordinates
 boolean intersects(double x, double y, double w, double h)
           
 int intersects(int ox, int oy, int fx, int fy)
          return the first segment number wich intersects with the provided rectangle or -1 if none
 int pointsNumber()
           
 void resize(int dx, int dy)
          Resize the component
protected  void setBounds()
           
 void setPropertyValue(java.lang.String name, java.lang.Object value)
          Assigns value to the property named name
 void translate(int x, int y)
          Translates the shape
 void translatePoint(int index, int dx, int dy)
          Translate a point
 
Methods inherited from class jsynoptic.builtin.Abstract1DShape
canDoAction, canResize, contains, contains, contains, createPanel, DataSourceIndexRangeChanged, DataSourceInfoChanged, DataSourceOrderChanged, DataSourceReplaced, DataSourceValueChanged, DataSourceValueRangeChanged, doAction, doCollectiveAction, drawHook, getActions, getBounds, getBounds2D, getCollectiveActions, getDelegateEndNotificationListener, getDrawColor, getDx, getDy, getLink, getPathIterator, getPathIterator, intersects, notificationEnd, setAnchor, setDelegateEndNotificationListener, setLink, updateBounds, updateTransform
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, getAnchor, getInnerProperties, getMax, getMaxTranslated, getMin, notifyChange, notifyChange, refresh, removeListener, setAnchor, setProperties, wipeOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_xv

protected double[] _xv
x vertices


_yv

protected double[] _yv
y vertices


displayLastNarrow

protected boolean displayLastNarrow
Deprecated. 
Display an arrow on last extremity


displayFirstNarrow

protected boolean displayFirstNarrow
Deprecated. 
Display an arrow on first extremity


firstArrowTransform

protected java.awt.geom.AffineTransform firstArrowTransform
First arrow transfrom used to draw the arrow polygon


lastArrowTransform

protected java.awt.geom.AffineTransform lastArrowTransform
Last arrow transfrom used to draw the arrow polygon

Constructor Detail

ConnectionShape

public ConnectionShape(int x,
                       int y,
                       int w,
                       int h)
Constructs a new Link instance


ConnectionShape

public ConnectionShape(double[] xs,
                       double[] ys)
Method Detail

cloneShape

protected AbstractShape cloneShape()
Description copied from class: Abstract1DShape
Performs a copy of the shape This method has to be overriden to deal with concrete shapes

Overrides:
cloneShape in class Abstract1DShape
Returns:
a copy of the shape

createPanel

public JPropertiesPanel createPanel()
Overrides:
createPanel in class Abstract1DShape

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Description copied from class: AbstractShape
Get the value of the property named name

Specified by:
getPropertyValue in interface NamedProperties
Overrides:
getPropertyValue in class Abstract1DShape
Parameters:
name - the name of the property to get
Returns:
the property value
See Also:
AbstractShape.getPropertyValue(String)

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
Description copied from class: AbstractShape
Assigns value to the property named name

Specified by:
setPropertyValue in interface NamedProperties
Overrides:
setPropertyValue in class Abstract1DShape
Parameters:
name - the name of the property to get
value - its new value
See Also:
AbstractShape.setPropertyValue(String, Object)

translate

public void translate(int x,
                      int y)
Description copied from class: AbstractShape
Translates the shape

Overrides:
translate in class Abstract1DShape

resize

public void resize(int dx,
                   int dy)
Description copied from interface: Resizable
Resize the component

Specified by:
resize in interface Resizable
Overrides:
resize in class Abstract1DShape
Parameters:
dx - value on x axis
dy - value on y axis

setBounds

protected void setBounds()

intersects

public int intersects(int ox,
                      int oy,
                      int fx,
                      int fy)
return the first segment number wich intersects with the provided rectangle or -1 if none


contains

public boolean contains(double x,
                        double y)
Specified by:
contains in interface java.awt.Shape
Overrides:
contains in class Abstract1DShape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Specified by:
intersects in interface java.awt.Shape
Overrides:
intersects in class Abstract1DShape

draw

public void draw(java.awt.Graphics2D g)
Description copied from class: AbstractShape
Draws the shape

Overrides:
draw in class Abstract1DShape
Parameters:
g - the graphics context

pointsNumber

public int pointsNumber()
Specified by:
pointsNumber in interface LineShapeInterface
Returns:
number of points for this line (minimum is 2)

getX

public int getX(int index)
Description copied from interface: LineShapeInterface
Get point coordinates

Specified by:
getX in interface LineShapeInterface
Parameters:
index - the index of the point between 0 and pointsNumber
Returns:
the x coordinate

getY

public int getY(int index)
Description copied from interface: LineShapeInterface
Get point coordinates

Specified by:
getY in interface LineShapeInterface
Parameters:
index - the index of the point between 0 and pointsNumber
Returns:
the y coordinate

translatePoint

public void translatePoint(int index,
                           int dx,
                           int dy)
Description copied from interface: LineShapeInterface
Translate a point

Specified by:
translatePoint in interface LineShapeInterface
Parameters:
index - the index of the point between 0 and pointsNumber
dx - the x value for the translation
dy - the y value for the translation

getDelegateShape

protected java.awt.Shape getDelegateShape()
Specified by:
getDelegateShape in class Abstract1DShape

createSelectedShape

public DiagramSelectedShape createSelectedShape(int ox,
                                                int oy)
Description copied from interface: SelectableShapeInterface
If the shape contains point at coordinates ox,oy then return a DiagramSelectedShape to manage the selection of this shape

Specified by:
createSelectedShape in interface SelectableShapeInterface
Parameters:
ox - x coordinate
oy - y coordinate
Returns:
a DiagramSelectedShape or null if not selected

createSelectedShape

public DiagramSelectedShape createSelectedShape(java.awt.geom.Rectangle2D bounds2D)
Description copied from interface: SelectableShapeInterface
If the shape is contained in the bounds then return a DiagramSelectedShape to manage the selection of this shape

Specified by:
createSelectedShape in interface SelectableShapeInterface
Parameters:
bounds2D - the bounds
Returns:
a DiagramSelectedShape or null if not selected

createSelectedShape

public DiagramSelectedShape createSelectedShape(java.awt.Point point)
Description copied from interface: SelectableShapeInterface
Return the DiagramSelectedShape to manage the selection of this shape

Specified by:
createSelectedShape in interface SelectableShapeInterface
Parameters:
point - the selection origin
Returns:
a DiagramSelectedShape

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from interface: NamedProperties
Get the list of property names

Specified by:
getPropertyNames in interface NamedProperties
Overrides:
getPropertyNames in class Abstract1DShape