Class PathElement
- java.lang.Object
-
- com.nomagic.magicdraw.uml.MDElementImpl
-
- com.nomagic.magicdraw.uml.ElementImpl
-
- com.nomagic.magicdraw.uml.symbols.PresentationElement
-
- com.nomagic.magicdraw.uml.symbols.paths.PathConnector
-
- com.nomagic.magicdraw.uml.symbols.paths.PathElement
-
- All Implemented Interfaces:
BaseElement
,MDElement
,ModelElementProvider
,com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
,com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
,NameOwner
,java.beans.PropertyChangeListener
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
- Direct Known Subclasses:
com.nomagic.magicdraw.uml.symbols.paths.ContainerLinkView
,ContainmentLinkView
,LinkAttributeView
,NoteAnchorView
@OpenApi public abstract class PathElement extends PathConnector implements com.nomagic.magicdraw.uml.symbols.LineJumpDrawer, com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
Base class for all paths. Path is representation element which connects two other elements.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData, com.nomagic.magicdraw.uml.symbols.PresentationElement.StructureCache
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ARC
Radius of rounded path style corner.static java.lang.String
BEZIER
Bezier path line style.private java.awt.Rectangle
bounds
Calculated bounds of the path.private boolean
breakable
indicates whether link is breakable.private java.util.List<java.awt.Point>
breakPoints
Vector of break pointsprivate java.util.List<java.awt.Point>
cacheBreakPoints
private java.awt.Point
cacheClientDrawPoint
private java.awt.Point
cachedActualClientDrawPoint
private java.awt.Point
cachedActualSupplierDrawPoint
private java.awt.Point
cacheSupplierDrawPoint
private PresentationElement
client
2nd end of link (objectView)private java.awt.Point
clientPoint
Connection point of link and client.private boolean
clientTranslated
Flags indicates that client point was translated after shape changed boundsprivate java.awt.Point
customClientPoint
Custom client point for drawing relation ends.private java.awt.Point
customSupplierPoint
Custom supplier point for drawing relation ends.static java.util.List<java.lang.String>
LINE_STYLE
All possible path line styles.private com.nomagic.magicdraw.uml.symbols.LineJumpPlace
lineJumpPlace
Place of the line jump.private java.util.Map<java.awt.Point,java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo>>
lineJumps
Contains information about line jumps.private java.util.Map<java.awt.Point,java.lang.Double>
lineJumpStartAngle
Map of link points and start angle of the line jump.static java.lang.String
OBLIQUE
Polyline path line style.private com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter
pathPainter
static java.lang.String
RECTILINEAR
Path line style with rectilinear (90 degrees) breakpoint corners.private static int
SMART_LAYOUT_TOLERANCE
Controls when smart layout should be applied to rectilinear path breakpoints.private boolean
smartLayoutNeeded
Indicates if smart path layout is needed for this path element.private PresentationElement
supplier
1st end of link ( objectView )private java.awt.Point
supplierPoint
Connection point of link and supplier.private boolean
supplierTranslated
Flags indicates that supplier point was translated after shape changed bounds-
Fields inherited from class com.nomagic.magicdraw.uml.symbols.paths.PathConnector
showsProxy
-
Fields inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
DASHED_STROKE, DEFAULT_LINE_WIDTH, DOTTED_STROKE, HANDLE_SIZE, MAX_LINE_WIDTH, MIN_LINE_WIDTH, SHADOW_WIDTH, SOLID_STROKE
-
-
Constructor Summary
Constructors Constructor Description PathElement()
PathElement(PresentationElement parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
Method accepts visitor, and calls method visit<class name>(this) of visitor .boolean
addConnectedPathElement(PathElement link)
Method to add sub link to this link.void
addLineJumps(java.awt.geom.GeneralPath path, java.awt.Point segmentStartPoint, java.awt.Point startPoint, java.awt.Point endPoint)
Adds line jumps to the specified path.static void
applyStrokeForLineDrawing(PresentationElement pathElement, java.awt.Graphics2D g, boolean line, java.awt.BasicStroke stroke)
boolean
askDeleteDataConfirmation()
Return true, because while deleting link view user must be prompt about deleting datavoid
atInsert()
Inserts ends of link into shapes.void
breakPointsChanged(java.util.List<java.awt.Point> oldPoints, java.util.List<java.awt.Point> newPoints)
Moves all connection point for the links that are attached to this link middle point.protected void
cacheActualDrawPoints(java.awt.Point supplierDrawPoint, java.awt.Point clientDrawPoint, java.util.List<java.awt.Point> breakPoints)
protected void
cacheValues(java.awt.Point cachedActualSupplierDrawPoint, java.awt.Point cachedActualClientDrawPoint, java.awt.Point cacheSupplierDrawPoint, java.awt.Point cacheClientDrawPoint, java.util.List<java.awt.Point> cacheBreakPoints)
java.awt.Rectangle
calculatePathBounds(java.awt.Point supplier, java.awt.Point client, java.util.List<java.awt.Point> breaks)
boolean
canChangeClient()
boolean
canChangeLineStyle()
boolean
canChangeSupplier()
boolean
canClearBreakPoints()
private void
changeParentForTree(PresentationElement parent)
Move tree to other parent if all classes of this tree is in this new parentvoid
clearClientTranslation()
Clears client translated flag.void
clearRegisteredLineJumpInfos()
void
clearSupplierTranslation()
Clears client translated flag.PathElement
clone()
Returns a copy of theElement
.private java.util.List<java.awt.Point>
concatPoints(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.Collection<java.awt.Point> breakPoints)
boolean
coversPoint(int x, int y)
Checks if object covers provided pointprotected void
createSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
void
dispose()
Disconnect this link from shapes.private boolean
doRectilinear(java.util.List<java.awt.Point> points)
Makes rectilinear polyline from specified points.void
draw(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
abstract method for drawing ViewObject object used to draw object on graphicsvoid
draw(java.awt.Graphics2D g, java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakPoints)
Draws link from given point pt1 through break points to given point pt2.com.nomagic.magicdraw.ui.pathicon.PathIcon
dynamicPathIcon()
com.nomagic.magicdraw.ui.pathicon.PathIcon
dynamicPathIcon(com.nomagic.magicdraw.ui.pathicon.PathIcon pathIcon)
Element
findOtherExistingElement()
Finds and returns model element which meaning is the same as this link model element.java.awt.Point
getActualClientDrawPoint()
Returns actual client side draw point.java.awt.Point
getActualSupplierDrawPoint()
Returns actual supplier side draw point.java.util.List<java.awt.Point>
getAllBreakPoints()
Returns breaks points list with added supplier and client end point in the list as well.private java.util.List<java.awt.Point>
getBezierLinePoints()
private java.util.List<java.awt.Point>
getBezierLinePoints(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.Collection<java.awt.Point> breakpoints)
private java.util.List<java.awt.Point>
getBezierLinePoints(java.util.List<java.awt.Point> allBreakPoints)
java.awt.geom.GeneralPath
getBezierPath()
Calculates path for bezier curve drawing.java.awt.geom.GeneralPath
getBezierPath(java.util.List<java.awt.Point> points)
Calculates path from breakpoints for bezier curve drawing.java.awt.Rectangle
getBounds()
Calculates bounds of this link.private java.awt.geom.GeneralPath
getBoundsPath(java.util.List<java.awt.Point> points)
java.awt.Rectangle
getBoundsToRepaint()
Return bounds of the symbol that must be repainted.java.awt.Point
getBreakPoint(int pos)
Returns break point with given index.int
getBreakPointCount()
returns size of break point vectorjava.util.List<java.awt.Point>
getBreakPoints()
Returns break points of the path.java.awt.Point
getCachedActualClientDrawPoint()
java.awt.Point
getCachedActualSupplierDrawPoint()
PresentationElement
getClient()
Returns client of the path.int
getClientConnectionType()
java.awt.Point
getClientDrawPoint()
Returns point where path drawing should startjava.awt.Point
getClientPoint()
Returns point where path connects client end's element.java.awt.Point
getCustomClientPoint()
static com.nomagic.magicdraw.ui.pathicon.PathIcon
getCustomStereotypeIcon(Element element)
java.awt.Point
getCustomSupplierPoint()
Element
getDefaultParentForData()
Presentation element could suggest parent, which would be more acceptable, than adding to the client If returning null, general mechanism will workint
getIndexOfCoveredPath(int x, int y)
This method is used to get segment of path with witch given point has intersection.int
getIndexOfCoveredPathInternal(int x, int y, int width, int height)
This method is used to get segment of path with witch given rectangle has intersection.java.awt.Point
getIntersection(int x, int y, PathElement path)
private java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo>
getLineJumpInfos(java.awt.Point segmentStartPoint)
Returns list of line jump info objects for the specified start point of the link segment.double
getLineJumpStartAngle(java.awt.Point point)
java.lang.String
getLinkLineStyle()
java.awt.Point
getMiddlePoint()
Calculates and returns middle point of link.Line
getNearestLinkPart(int x, int y)
Returns nearest link part to specified point.java.awt.Point
getNearestPoint(java.awt.Point pt)
Returns first break point or client point if arg is supplier point.int
getNewBreakPointIndex(java.awt.Point point, java.util.List<java.awt.Point> brk)
Find the nearest breakpoints for new one and calculate the position of the new breakpoint in breakpoint vector.java.awt.Point
getNewPointByTheLink(java.util.List<java.awt.Point> oldBreaks, java.util.List<java.awt.Point> newBreaks, java.awt.Point oldLocation)
PresentationElement
getNextEnd(PresentationElement obj)
Returns other than given end.java.awt.Point
getNextPoint(java.awt.Point pt)
Returns next point to a given one.java.awt.Rectangle
getNotCopyBounds()
get not copy bounds of object throws NoRectangleDefinedExceptionprivate java.awt.geom.GeneralPath
getPath(java.util.List<java.awt.Point> points)
Returns a path for normal link drawing.com.nomagic.magicdraw.ui.pathicon.PathIcon
getPathIcon()
com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter<PathElement>
getPathPainter()
java.util.List<java.util.List<java.awt.Point>>
getPaths()
Returns only one path which consist of actual supplier draw point, break points of the path element and actual client draw point.private static java.awt.Point
getPoint(java.awt.Point p1, java.awt.Point p2, double away)
Gets point by the line.private static java.awt.Point
getPointOnBezierAtIndex(java.awt.Point supplierPoint, java.util.List<java.awt.Point> pointList, int index)
java.awt.Point
getPointOnPath(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakpoints, double coefficient)
private java.util.List<java.awt.Point>
getPointsList(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakpoints)
java.awt.Point
getPreviousPoint(java.awt.Point pt)
Returns previous point to given one.private java.awt.geom.GeneralPath
getRoundedPath(java.util.List<java.awt.Point> breakpoints)
Calculates path from breakpoints for rounded link drawing.PresentationElement
getSupplier()
Returns supplier of the path.int
getSupplierConnectionType()
java.awt.Point
getSupplierDrawPoint()
Returns point where path drawing should startjava.awt.Point
getSupplierPoint()
Returns point where path connects supplier end's element.java.lang.String
getSuspendShapeAutoResizeMode()
com.nomagic.magicdraw.commands.Command
handleRemoveBreaksAction()
protected boolean
hasClientPoint()
Check if client point is already not nullboolean
hasManipulator()
Returns true, if view has manipulator (is selectable)boolean
hasSharedData()
Returns true if data of this object can be shared.protected boolean
hasSupplierPoint()
Check if supplier point is already not nullvoid
internalApplyProperties(PropertyManager man)
Applies propertiesjava.awt.Shape
internalGetBoundsShape(ConverterToShape converterToShape)
java.awt.BasicStroke
internalGetPresentationElementStroke(boolean line, int width)
This method must be overridden, if you need to use DASHED_STROKE or another one.protected java.awt.BasicStroke
internalGetPresentationElementStroke(boolean line, int lineStyle, int width)
java.awt.BasicStroke
internalGetPresentationElementStroke(int width)
Return a stroke used to paint symbol's main partvoid
internalMovedAsToSelf(int dx, int dy)
This is an internal method to notify link that it was moved by connecting shape as link "to self"void
internalSilentApply()
Silently applies all properties after initializationprotected void
internalSnapToGrid(float step)
boolean
intersects(int x, int y, int width, int height)
Check if any line between breakpoints intersect with given points of rectangleboolean
intersectsInternal(int x, int y, int width, int height)
Check intersection with given rectangle.boolean
isAlwaysToSelf()
boolean
isBezier()
boolean
isBezierIntersects(int x, int y, int width, int height)
Check if it is bezier path intersection with rectangle.boolean
isBreakable()
shows whether link is breakable.boolean
isConnectable(PresentationElement supplier, PresentationElement client)
Checks if this path can connect given two elements.boolean
isConnectable(PresentationElement supplier, PresentationElement client, java.util.Map<java.lang.Object,java.lang.Object> options)
Checks if this path can connect given two elements.boolean
isDrawLineJumps()
Returns true if the path element wants to draw line jumps.private boolean
isElementEditableOrNoElement()
boolean
isFixed()
Returns if path element tied to it's supplier and client (cannot be reconnected)boolean
isOblique()
boolean
isRectilinear()
private static boolean
isRectilinearized(java.util.List<java.awt.Point> vct)
Checks whether points in specified vector make up rectilinear polyline.boolean
isRounded()
Returns value of the "Is Rounded" path symbol property.boolean
isSmartLayoutNeeded()
Returns smart layout needed flag.protected boolean
isSnapToGrid()
boolean
isToSelf()
boolean
isUseFlowLayoutLogic()
Indicates if smart path/shape edit should be used in this diagram.boolean
isVertical()
Indicates if path element is drawn in the diagram which has vertical orientation.void
makeRectilinear()
Makes link rectilinear.void
makeRectilinear(boolean notify)
Makes link rectilinear.private boolean
makeSmartFlowLayoutPath(java.util.List<java.awt.Point> breakpoints)
Adjusts breakpoints according smart flow layout rules.private void
moveConnectedElements()
void
moveLinkToClientParent(boolean simpleAdd)
protected void
movePathElement(PathElement link, PathConnector requestor)
Moves link.boolean
needsToMoveOtherEnd()
java.lang.String
nextStyle()
void
notifyBreakPointsChanged(java.util.List<java.awt.Point> oldPoints, java.util.List<java.awt.Point> newPoints)
Notifies about break point vector changesvoid
notifyRepaintManager(boolean boundsChanged)
Notifies the repaint manager about changes in bounds.protected void
notifyRepaintManager(java.util.List<java.awt.Point> oldBreakpoints, java.util.List<java.awt.Point> newBreakpoints)
void
optimizeLoops()
Removes loops from paths for example: path | ----------+ | | ------void
paintSelf(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
protected boolean
preDisposeOnUpdate()
Validate symbol against model and try to fix it before actual symbol update.boolean
prepareForFillDrawing(java.awt.Graphics2D g, int x1, int y1, int x2, int y2)
Prepares graphics for fill drawing.boolean
prepareForLineDrawing(java.awt.Graphics2D g, boolean line)
Prepares graphics for line drawing.private static int
recalculateArc(int arc, java.awt.Point p1, java.awt.Point p2)
void
registerLineJumpInfos(int pathIndex, java.awt.Point segmentStartPoint, java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> lineJumps)
void
registerLineJumpStartAngle(int pathIndex, java.awt.Point point, double lineJumpStartAngle)
boolean
removeBreakPoints()
private boolean
removeBreakPoints(java.awt.Rectangle rct, int n)
Removes break points from this link if they covered given rectangle.void
removeBreaks(java.util.List<java.awt.Point> points)
Removes all break points if they are covered by client or client bounds.void
removeRedundantBreakPoints(java.util.List<java.awt.Point> vct)
Removes redundant break points from link.void
removeUnnecessaryBreakPoints()
Removes unnecessary points from break point vector.protected void
resetCache()
void
resizeParent()
Do nothing, because path does not affect parent sizevoid
sAddBreakPoint(java.awt.Point pt)
Adds new break point.void
sClearBreakPoints()
Clear break points list.void
setBounds(java.awt.Rectangle r)
Moves link to new location.void
setBreakable(boolean value)
Sets breakable flag on/ off.void
setBreakPoints(java.util.List<java.awt.Point> vct)
Sets break point vector.protected void
setCachedPathBounds(java.awt.Rectangle r)
void
setClient(PresentationElement shape)
Sets client for this link.void
setClientPoint(java.awt.Point pt)
Sets client point.void
setCustomClientPoint(java.awt.Point point)
void
setCustomSupplierPoint(java.awt.Point point)
void
setLineJumpPlace(com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace)
Sets line jump place of the path element.void
setLinkLineStyle(java.lang.String style)
sets LINK_LINE_STYLE property value.protected void
setPathPainter(com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter)
void
setRectilinear()
Sets link rectilinear property value.void
setRounded(boolean rounded)
Sets value of the "Is Rounded" path symbol property.void
setSmartLayoutNeeded(boolean smartLayoutNeeded)
Sets smart layout needed flag.void
setSupplier(PresentationElement shape)
Sets supplier end for link.void
setSupplierPoint(java.awt.Point pt)
Sets 1st point.void
setSuspendShapeAutoResizeMode(java.lang.String mode)
void
simpleSetBounds(java.awt.Rectangle r)
calls break point vector changed method.private static boolean
smartRemoveRedundantBreakpoints(java.util.List<java.awt.Point> breakpoints)
Gets rid of small rectangular polyline corners on the path.void
sSetBounds(java.awt.Rectangle r)
Moves link to new location.void
sSetBreakable(boolean value)
Sets breakable flag on/ off.void
sSetBreakPoint(java.awt.Point pt, int pos)
Sets break point at the given position.void
sSetBreakPoints(java.util.List<java.awt.Point> vct)
Only sets break point vector.void
sSetClient(PresentationElement obj)
Sets client for this link.void
sSetClientPoint(java.awt.Point pt)
Sets client connection Point.void
sSetLinkLineStyle(java.lang.String style)
Change value of LINK_LINE_STYLE property.void
sSetParent(PresentationElement parent)
Sets parent for this view.void
sSetRounded(boolean rounded)
Sets value of the "Is Rounded" path symbol property.void
sSetSupplier(PresentationElement obj)
Sets supplier for this link.void
sSetSupplierPoint(java.awt.Point pt)
Sets supplier connection point.void
sSetSuspendShapeAutoResizeMode(java.lang.String mode)
void
swapEnds()
Swaps ends of the linkjava.awt.Point
translateClientPoint(java.awt.Rectangle old, java.awt.Rectangle newR)
java.awt.Point
translateSupplierPoint(java.awt.Rectangle old, java.awt.Rectangle newR)
private void
validateActualDrawPointsCache()
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.paths.PathConnector
checkShowsProxy, clearShowsProxy, disposeConnectedPaths, findSymbolForEnd, findSymbolForEnd, getConnectedPathElement, getConnectedPathElementCount, getConnectedPathElements, getConnectedPathElements, getConnectedPathElements, getPreferredArrowLength, isShowsProxy, movePathElement, movePathElements, removeConnectedPathElement, sAddConnectedPathElement, selectPathsForMoving, setParent, setVisibility, sRemoveConnectedPathElement, sSetConnectedPathElements, sSetVisibility
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
addPresentationElement, addPresentationElement, addPresentationElementWithoutResize, addProperty, adjustBoundsForMoving, adjustChildBounds, adjustChildBoundsForMoving, alwaysShowTooltip, applyProperties, atInsertChildren, autosizeAndResizeManipulatedParent, autosizeAndResizeParent, beforeDelete, boundsChanged, boundsChanged, canAddChild, canAddChild, canAddInstance, canAddInstance, canBeDisposedOnUpdate, canChangeElementParent, canChangeParent, canChangeParent, canFill, canHavePaths, changeProperties, changeProperty, changePropertyManager, checkElementParentOnAdd, checkProxyVisibility, childrenForMoving, clearAntialiasingState, collectSubManipulatedElements, collectSubPresentationElements, collectSubPresentationElements, collectSubShowingPresentationElements, constructChangePropertyCommand, createPropertyChangeListener, createPropertyManager, disposeChildren, disposeListener, drawBackground, drawSymbol, drawSymbolBackground, dynamicFillColor, dynamicLineColor, dynamicLineWidth, dynamicLineWidth, dynamicPaintShadow, dynamicStroke, dynamicStroke, dynamicStroke, dynamicStyleFillColor, dynamicStyleFillPaint, dynamicStyleLineColor, dynamicStyleTextColor, dynamicStyleTransparency, dynamicStyleTransparency, dynamicStyleValue, dynamicTextAlignment, dynamicTextColor, editName, editName, findParentForData, findPresentationElement, firePropertyChange, generateID, getActualElement, getActualProperty, getAdditionalRenderersToNotify, getAssignableModelElementsClasses, getBooleanPropertyValue, getBoundsShape, getBoundsWithChildrenOnEdge, getCenterlinePoint, getCenterlinePointX, getCenterlinePointY, getChildPresentationElementForContextMenu, getChildrenWithSymbolProperties, getConfiguration, getDiagramPresentationElement, getDiagramSurface, getDrawComparator, getDynamicConfigurations, getDynamicStyleOwner, getElement, getElementNumberDisplayMode, getElementsForLinkConnecting, getElementToConnectLink, getElementToMove, getExpectedDataParent, getFillColor, getFont, getFontHeight, getFontRenderContext, getHumanName, getHumanType, getLineColor, getLineWidth, getManipulatedElementAt, getManipulatedElementAt, getManipulatedIntersectionWith, getManipulatedIntersectionWith, getManipulatedParent, getManipulatedPresentationElements, getManipulationBounds, getManipulationPreferredDimension, getMiddlePoint, getMiddlePointX, getMiddlePointX, getMiddlePointY, getMiddlePointY, getMinimumDimension, getNotZoomedTolerance, getObjectParent, getParent, getParentSymbolPropertyOwner, getPreferredBounds, getPreferredDimension, getPreferredDimensionForAutosize, getPreferredSize, getPresentationElementAt, getPresentationElementAt, getPresentationElementAt, getPresentationElementCount, getPresentationElementIndex, getPresentationElements, getPresentationElementsAt, getPresentationElementsAt, getPresentationElementStroke, getPresentationElementStroke, getProjectImpl, getProperty, getPropertyManager, getPropertyManagerName, getRealPropertyManager, getRenderer, getSelected, getStereotypeColor, getStereotypeFont, getStringPropertyValue, getStroke, getStroke, getStroke, getStroke, getStroke, getStroke, getSymbolRenderer, getTextColor, getTolerance, getVisibility, getVisiblePresentationElements, handleModelDelete, hasDiagramSurface, hasManipulatedPresentationElements, initialize, initializeAndAutosize, internalBeforeUpdate, internalCreatePropertyChangeListener, internalGetElementsForLinkConnecting, internalGetElementToConnectLink, internalSnapToGrid, internalUpdatePresentationElement, invalidate, isCanChildrenChangeEdge, isChildVisible, isContentHidden, isCreateElementListener, isDetectable, isDisposed, isLayouting, isMovableByMoveManager, isNotNull, isParentOf, isParentOf, isPreserveProportionsWhenGrowing, isSelected, isShowElementTypeAsLabel, isSortable, isTestUpdateFlag, isTextEditable, isUseFillColor, isUseFillColorByProperty, isUseGradientForFill, isVisible, isVisibleInDiagram, isVisibleOrShrunken, movePathElementsRecursively, mustShowContextMenu, notifyCreated, notifyDiagramFrameSizeChange, onFind, onFind, onFontChange, paintAdornments, paintAdornmentsBackground, paintChildren, paintChildrenAndAdornments, paintChildrenBackground, paintSelfBackground, prepareForLineDrawing, prepareForShadowDrawing, prepareForTextDrawing, propertyChange, recreateListeners, recursiveAutosize, registerInSortManager, rememberBounds, rememberBounds, removeFromSortManager, removeItSelfOnUpdate, removePresentationElement, sAddPresentationElement, sAddPresentationElement, selectChildrenForMoving, selectObjectsForMoving, setAllSelected, setBounds, setCreateElementListener, setDiagramSurface, setDummyResizeMode, setElement, setFillColor, setFont, setFontProperty, setLayouting, setLineColor, setLineWidth, setLoadedVisibility, setLocation, setLocation, setNeedRecreateListeners, setPresentationElements, setPropertyManager, setPropertyManagerName, setSelected, setSelected, setSize, setSize, setSize, setStereotypeColor, setStereotypeFont, setStrokeIfNotTheSame, setTestUpdateFlag, setTextColor, setTextColorProperty, setTextEditable, setUseFillColor, setVisible, silentApply, silentApply, simpleSetBounds, snapToGrid, snapToGrid, snapViewToGrid, sortObjectsByX, sortObjectsByY, sRemovePresentationElement, sSetBounds, sSetElement, sSetLineWidth, sSetLocation, sSetLocation, sSetParentForAll, sSetPresentationElements, sSetSize, sSetSize, sSetSize, sSetVisible, tryToDeleteModelElementUponRemoval, update, updateAfterLoad, updateLabelsIgnoringSuspendableLater, updateLater, updateModelByView, updateModelByViewInternal, updateViewAfterPropertyChange, useParentProperties
-
Methods inherited from class com.nomagic.magicdraw.uml.MDElementImpl
accept, addPropertyChangeListener, canAdd, canAdd, canAddChild, canBeDeleted, canDeleteChild, compareTo, createSortKeys, getClassType, getCommandForAppending, getID, getName, getProject, getProjectProvider, getResourceID, getSortKeys, hasListeners, isEditable, removeAllChildren, removeAllParents, removeAllPropertyChangeListeners, removePropertyChangeListener, setID, setProjectProvider, sGetID, toString
-
-
-
-
Field Detail
-
RECTILINEAR
@OpenApi public static final java.lang.String RECTILINEAR
Path line style with rectilinear (90 degrees) breakpoint corners.- See Also:
- Constant Field Values
-
OBLIQUE
@OpenApi public static final java.lang.String OBLIQUE
Polyline path line style.- See Also:
- Constant Field Values
-
BEZIER
@OpenApi public static final java.lang.String BEZIER
Bezier path line style.- See Also:
- Constant Field Values
-
LINE_STYLE
@OpenApi public static final java.util.List<java.lang.String> LINE_STYLE
All possible path line styles.
-
SMART_LAYOUT_TOLERANCE
private static final int SMART_LAYOUT_TOLERANCE
Controls when smart layout should be applied to rectilinear path breakpoints.- See Also:
- Constant Field Values
-
ARC
private static final int ARC
Radius of rounded path style corner.- See Also:
- Constant Field Values
-
supplier
private PresentationElement supplier
1st end of link ( objectView )
-
client
private PresentationElement client
2nd end of link (objectView)
-
supplierPoint
private java.awt.Point supplierPoint
Connection point of link and supplier.
-
clientPoint
private java.awt.Point clientPoint
Connection point of link and client.
-
customSupplierPoint
private java.awt.Point customSupplierPoint
Custom supplier point for drawing relation ends. It used when need to change supplier point for intersection counting.
-
customClientPoint
private java.awt.Point customClientPoint
Custom client point for drawing relation ends. It used when need to change client point for intersection counting.
-
breakable
private boolean breakable
indicates whether link is breakable.
-
bounds
@CheckForNull private java.awt.Rectangle bounds
Calculated bounds of the path.
-
breakPoints
private java.util.List<java.awt.Point> breakPoints
Vector of break points
-
supplierTranslated
private boolean supplierTranslated
Flags indicates that supplier point was translated after shape changed bounds
-
clientTranslated
private boolean clientTranslated
Flags indicates that client point was translated after shape changed bounds
-
smartLayoutNeeded
private boolean smartLayoutNeeded
Indicates if smart path layout is needed for this path element.
-
lineJumps
@CheckForNull private java.util.Map<java.awt.Point,java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo>> lineJumps
Contains information about line jumps.
-
lineJumpStartAngle
@CheckForNull private java.util.Map<java.awt.Point,java.lang.Double> lineJumpStartAngle
Map of link points and start angle of the line jump.
-
lineJumpPlace
@CheckForNull private com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace
Place of the line jump.
-
cachedActualSupplierDrawPoint
@CheckForNull private java.awt.Point cachedActualSupplierDrawPoint
-
cachedActualClientDrawPoint
@CheckForNull private java.awt.Point cachedActualClientDrawPoint
-
cacheSupplierDrawPoint
@CheckForNull private java.awt.Point cacheSupplierDrawPoint
-
cacheClientDrawPoint
@CheckForNull private java.awt.Point cacheClientDrawPoint
-
cacheBreakPoints
@CheckForNull private java.util.List<java.awt.Point> cacheBreakPoints
-
pathPainter
private com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter
-
-
Constructor Detail
-
PathElement
public PathElement()
-
PathElement
public PathElement(@CheckForNull PresentationElement parent)
-
-
Method Detail
-
clearSupplierTranslation
public void clearSupplierTranslation()
Clears client translated flag.
-
clearClientTranslation
public void clearClientTranslation()
Clears client translated flag.
-
translateSupplierPoint
public final java.awt.Point translateSupplierPoint(java.awt.Rectangle old, java.awt.Rectangle newR)
-
translateClientPoint
public final java.awt.Point translateClientPoint(java.awt.Rectangle old, java.awt.Rectangle newR)
-
getNewPointByTheLink
@CheckForNull public java.awt.Point getNewPointByTheLink(java.util.List<java.awt.Point> oldBreaks, java.util.List<java.awt.Point> newBreaks, java.awt.Point oldLocation)
-
hasSharedData
public boolean hasSharedData()
Description copied from class:PresentationElement
Returns true if data of this object can be shared. If data is not shared data can be deleted with del key. Or it must be deleted with CRL+D- Returns:
- true, if link has shared data.
-
askDeleteDataConfirmation
public boolean askDeleteDataConfirmation()
Return true, because while deleting link view user must be prompt about deleting data- Returns:
- confirmation status -- true if asking is necessary, false otherwise
-
getPoint
private static java.awt.Point getPoint(java.awt.Point p1, java.awt.Point p2, double away)
Gets point by the line. Method calculates location of the point that should be away from the specified line.- Parameters:
p1
- first end of the vector.p2
- second end of the vector.away
- distance from the line.- Returns:
- point
-
setBreakable
public void setBreakable(boolean value)
Sets breakable flag on/ off. If flag is not set, link can not be broken. However link can have break points and be non breakable. This means that link has fixed points that can not be moved.- Parameters:
value
- flag value
-
sSetBreakable
public void sSetBreakable(boolean value)
Sets breakable flag on/ off. If flag is not set, link can not be broken. However link can have break points and be non breakable. This means that link has fixed points that can not be moved.- Parameters:
value
- flag value
-
isBreakable
public boolean isBreakable()
shows whether link is breakable.- Returns:
- true if link can be broken
-
isFixed
public boolean isFixed()
Returns if path element tied to it's supplier and client (cannot be reconnected)- Returns:
- true if can be reconnected, else false
-
getBreakPoints
@OpenApi public final java.util.List<java.awt.Point> getBreakPoints()
Returns break points of the path. The order of break points is from supplier to the client path's end. Use PresentationElementsManager to change the break points for the path.- Returns:
- break points list.Points in the list are not cloned, so do not modify them directly. List is unmodifiable.
- See Also:
PresentationElementsManager.changePathBreakPoints(com.nomagic.magicdraw.uml.symbols.paths.PathElement, java.util.List)
-
getAllBreakPoints
@OpenApi public final java.util.List<java.awt.Point> getAllBreakPoints()
Returns breaks points list with added supplier and client end point in the list as well. Use PresentationElementsManager to change the break points for the path.- Returns:
- supplier point + break points + client point. Points in the list are not cloned, so do not modify them directly. List is modifiable.
- See Also:
PresentationElementsManager.changePathBreakPoints(com.nomagic.magicdraw.uml.symbols.paths.PathElement, java.util.List)
-
concatPoints
private java.util.List<java.awt.Point> concatPoints(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.Collection<java.awt.Point> breakPoints)
-
setBreakPoints
public final void setBreakPoints(java.util.List<java.awt.Point> vct)
Sets break point vector.- Parameters:
vct
- new break point vector.
-
sClearBreakPoints
public final void sClearBreakPoints()
Clear break points list.
-
sSetBreakPoints
public final void sSetBreakPoints(java.util.List<java.awt.Point> vct)
Only sets break point vector.- Parameters:
vct
- new break point vector.
-
sAddBreakPoint
public final void sAddBreakPoint(java.awt.Point pt)
Adds new break point.- Parameters:
pt
- point to be added.
-
sSetBreakPoint
public final void sSetBreakPoint(java.awt.Point pt, int pos)
Sets break point at the given position.- Parameters:
pt
- point to be setpos
- position where it must be set
-
needsToMoveOtherEnd
public boolean needsToMoveOtherEnd()
- Returns:
- true if one end of links changed bounds and move link must be called for both ends.
-
getBreakPoint
public java.awt.Point getBreakPoint(int pos)
Returns break point with given index.- Parameters:
pos
- position where point resides.- Returns:
- point at position pos.
-
getBreakPointCount
public int getBreakPointCount()
returns size of break point vector- Returns:
- break point count
-
setBounds
public void setBounds(java.awt.Rectangle r)
Moves link to new location.- Parameters:
r
- new location of link.
-
simpleSetBounds
public void simpleSetBounds(java.awt.Rectangle r)
calls break point vector changed method.- Parameters:
r
- new bounding rectangle.
-
isToSelf
public boolean isToSelf()
- Returns:
- true if link is link to self
-
isAlwaysToSelf
public boolean isAlwaysToSelf()
-
sSetBounds
public void sSetBounds(java.awt.Rectangle r)
Moves link to new location.- Parameters:
r
- new location of link.
-
removeUnnecessaryBreakPoints
public void removeUnnecessaryBreakPoints()
Removes unnecessary points from break point vector. Checks if break point vector has useless points (covered by shape or invisible). Does not do anything if link can not be breakable. if it has removes them.
-
getPathIcon
@CheckForNull public com.nomagic.magicdraw.ui.pathicon.PathIcon getPathIcon()
-
dynamicPathIcon
@CheckForNull public com.nomagic.magicdraw.ui.pathicon.PathIcon dynamicPathIcon()
-
dynamicPathIcon
public com.nomagic.magicdraw.ui.pathicon.PathIcon dynamicPathIcon(@CheckForNull com.nomagic.magicdraw.ui.pathicon.PathIcon pathIcon)
-
getCustomStereotypeIcon
@CheckForNull public static com.nomagic.magicdraw.ui.pathicon.PathIcon getCustomStereotypeIcon(@CheckForNull Element element)
-
draw
public void draw(java.awt.Graphics2D g, java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakPoints)
Draws link from given point pt1 through break points to given point pt2.- Parameters:
g
- graphicssupplierPoint
- first pointclientPoint
- second pointbreakPoints
- points between supplier and client points, in that order
-
internalGetBoundsShape
@CheckForNull public java.awt.Shape internalGetBoundsShape(ConverterToShape converterToShape)
-
getBoundsPath
private java.awt.geom.GeneralPath getBoundsPath(java.util.List<java.awt.Point> points)
-
setLineJumpPlace
public void setLineJumpPlace(@CheckForNull com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace)
Sets line jump place of the path element.
NOTE: OnlyLineJumpManager
can set jump place of the link. SinceLineJumpManager
will reset line jump place on every repaint of a diagram then other invocations of the method will not have an effect.- Specified by:
setLineJumpPlace
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
- Parameters:
lineJumpPlace
- new line jump place.
-
registerLineJumpInfos
public void registerLineJumpInfos(int pathIndex, java.awt.Point segmentStartPoint, @CheckForNull java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> lineJumps)
- Specified by:
registerLineJumpInfos
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
-
clearRegisteredLineJumpInfos
public void clearRegisteredLineJumpInfos()
- Specified by:
clearRegisteredLineJumpInfos
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
-
registerLineJumpStartAngle
public void registerLineJumpStartAngle(int pathIndex, java.awt.Point point, double lineJumpStartAngle)
- Specified by:
registerLineJumpStartAngle
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
-
getLineJumpStartAngle
public double getLineJumpStartAngle(java.awt.Point point)
-
getRoundedPath
private java.awt.geom.GeneralPath getRoundedPath(java.util.List<java.awt.Point> breakpoints)
Calculates path from breakpoints for rounded link drawing.- Parameters:
breakpoints
- path breakpoints.- Returns:
- constructed path.
-
getPath
private java.awt.geom.GeneralPath getPath(java.util.List<java.awt.Point> points)
Returns a path for normal link drawing.- Parameters:
points
- list of break points of the path.- Returns:
- constructed path object.
-
getLineJumpInfos
@CheckForNull private java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> getLineJumpInfos(java.awt.Point segmentStartPoint)
Returns list of line jump info objects for the specified start point of the link segment.- Parameters:
segmentStartPoint
- start point of the link start segment.- Returns:
- line jump information.
-
addLineJumps
public void addLineJumps(java.awt.geom.GeneralPath path, java.awt.Point segmentStartPoint, java.awt.Point startPoint, @CheckForNull java.awt.Point endPoint)
Adds line jumps to the specified path.- Specified by:
addLineJumps
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
- Parameters:
path
- a path object.segmentStartPoint
- segment start point.startPoint
- start point from which to start adding the line jumps.endPoint
- point until which line jumps should be added.
-
isDrawLineJumps
public boolean isDrawLineJumps()
Returns true if the path element wants to draw line jumps.- Specified by:
isDrawLineJumps
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
- Returns:
- true if line jumps should be drawn for the path element.
-
getPaths
public java.util.List<java.util.List<java.awt.Point>> getPaths()
Returns only one path which consist of actual supplier draw point, break points of the path element and actual client draw point.- Specified by:
getPaths
in interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
- Returns:
- paths.
-
removeBreakPoints
private boolean removeBreakPoints(java.awt.Rectangle rct, int n)
Removes break points from this link if they covered given rectangle. does not do anything if link can not be broken.- Parameters:
rct
- rectangle which could cover linkn
- which end must remove break points ( 0- supplier, 1 - client )- Returns:
- true, if at least one break point was removed
-
setSupplierPoint
public void setSupplierPoint(java.awt.Point pt)
Sets 1st point. Sets new location for text boxes ( if point is changed, text boxes must be moved too ).- Parameters:
pt
- new 1st point.
-
sSetSupplierPoint
public void sSetSupplierPoint(java.awt.Point pt)
Sets supplier connection point.- Parameters:
pt
- new supplier point.
-
sSetClientPoint
public void sSetClientPoint(java.awt.Point pt)
Sets client connection Point.- Parameters:
pt
- new client point.
-
setClientPoint
public void setClientPoint(java.awt.Point pt)
Sets client point.- Parameters:
pt
- new client point.
-
breakPointsChanged
public final void breakPointsChanged(java.util.List<java.awt.Point> oldPoints, java.util.List<java.awt.Point> newPoints)
Moves all connection point for the links that are attached to this link middle point.- Parameters:
oldPoints
- old breakpoint vector.newPoints
- new breakpoint vector.
-
notifyRepaintManager
public void notifyRepaintManager(boolean boundsChanged)
Description copied from class:PresentationElement
Notifies the repaint manager about changes in bounds.
-
notifyRepaintManager
protected final void notifyRepaintManager(java.util.List<java.awt.Point> oldBreakpoints, java.util.List<java.awt.Point> newBreakpoints)
-
notifyBreakPointsChanged
public void notifyBreakPointsChanged(java.util.List<java.awt.Point> oldPoints, java.util.List<java.awt.Point> newPoints)
Notifies about break point vector changes- Parameters:
oldPoints
- old pointsnewPoints
- new points
-
getNearestLinkPart
public final Line getNearestLinkPart(int x, int y)
Returns nearest link part to specified point.- Parameters:
x
- x of pointy
- y of point- Returns:
- line
-
removeBreakPoints
public boolean removeBreakPoints()
-
getSupplierPoint
@OpenApi public final java.awt.Point getSupplierPoint()
Returns point where path connects supplier end's element.- Returns:
- supplier connection point. This method returns not cloned point, so do not modify it directly.
-
getClientPoint
@OpenApi public final java.awt.Point getClientPoint()
Returns point where path connects client end's element.- Returns:
- client point. This method returns not cloned point, so do not modify it directly.
-
getClientDrawPoint
public java.awt.Point getClientDrawPoint()
Returns point where path drawing should start- Returns:
- point
-
getActualClientDrawPoint
public java.awt.Point getActualClientDrawPoint()
Returns actual client side draw point.- Returns:
- actual client draw point.
-
getActualSupplierDrawPoint
public java.awt.Point getActualSupplierDrawPoint()
Returns actual supplier side draw point.- Returns:
- actual supplier draw point.
-
getSupplierDrawPoint
public java.awt.Point getSupplierDrawPoint()
Returns point where path drawing should start- Returns:
- point
-
getNextPoint
public final java.awt.Point getNextPoint(java.awt.Point pt)
Returns next point to a given one. If given point does not belong to the link, returns parameter point.- Parameters:
pt
- point for which next point is necessary- Returns:
- next point(not cloned)
-
getPreviousPoint
public final java.awt.Point getPreviousPoint(java.awt.Point pt)
Returns previous point to given one. If given point does not belong to the link, returns parameter point.- Parameters:
pt
- point for which previous point is necessary- Returns:
- previous point(not cloned)
-
getNearestPoint
public final java.awt.Point getNearestPoint(java.awt.Point pt)
Returns first break point or client point if arg is supplier point. Or returns last break point or client point if arg is client point.- Parameters:
pt
- given point- Returns:
- nearest point(not cloned)
-
sSetClient
public void sSetClient(@CheckForNull PresentationElement obj)
Sets client for this link.- Parameters:
obj
- new client.
-
sSetSupplier
public void sSetSupplier(@CheckForNull PresentationElement obj)
Sets supplier for this link.- Parameters:
obj
- new supplier.
-
setSupplier
public void setSupplier(PresentationElement shape)
Sets supplier end for link. Removes this link from old shape. Inserts this link to new shape. Method also sets supplier point to the middle point of shape.- Parameters:
shape
- new supplier.
-
getClient
@OpenApi public PresentationElement getClient()
Returns client of the path.- Returns:
- client element.
-
getSupplier
@OpenApi public PresentationElement getSupplier()
Returns supplier of the path.- Returns:
- supplier end element.
-
getNextEnd
public PresentationElement getNextEnd(PresentationElement obj)
Returns other than given end. If given end if supplier method returns client of this link. If given end is not supplier method returns supplier of this link.- Parameters:
obj
- given end- Returns:
- other opposite end
-
movePathElement
protected void movePathElement(PathElement link, @CheckForNull PathConnector requestor)
Moves link. Link can connect more links ( such as note anchors in UML class diagrams ). After link was moved positions of connected links must be updated. Method checks if moving link supplier is this link recalculates supplier point moving link, otherwise it calculates client point of moving link. Point is calculated to middle point of this link.- Parameters:
link
- link to move.requestor
- requestor
-
optimizeLoops
public void optimizeLoops()
Removes loops from paths for example: path | ----------+ | | ------ will be changed to | -----
-
clone
public PathElement clone()
Description copied from class:ElementImpl
Returns a copy of theElement
.- Specified by:
clone
in interfaceBaseElement
- Returns:
- the cloned object
-
coversPoint
public boolean coversPoint(int x, int y)
Checks if object covers provided point- Returns:
- true if object covers this point
-
intersects
public final boolean intersects(int x, int y, int width, int height)
Check if any line between breakpoints intersect with given points of rectangle- Returns:
- true if object and rectangle intersects
-
intersectsInternal
public boolean intersectsInternal(int x, int y, int width, int height)
Check intersection with given rectangle. Intersection is counted by getting index of segment in path.- Parameters:
x
- top left x point.y
- top left y point.width
- width of rectangle.height
- height of rectangle.- Returns:
- true if rectangle intersect with any line of path.
-
isBezierIntersects
public boolean isBezierIntersects(int x, int y, int width, int height)
Check if it is bezier path intersection with rectangle.- Parameters:
x
- top left x point of rectangle.y
- top left y point of rectangle.width
- width of rectangle.height
- height of rectangle.- Returns:
- true if bezier path intersects with rectangle.
-
getIndexOfCoveredPathInternal
public int getIndexOfCoveredPathInternal(int x, int y, int width, int height)
This method is used to get segment of path with witch given rectangle has intersection. It will be returned index starting from 1 of segment. This segment is counted using all breakpoints (including client and supplier point). If anybody needs end points of segments, you must take all breakpoints and take point of return index minus 1 and point of segment's index. If there is no intersection, this method return -1. For example: this method returns value 2. segmentIndex = 2; Point start and end point of this segment will be: Point startPoint = getAllBreakPoints().get(segmentIndex-1); Point endPoint = getAllBreakPoints().get(segmentIndex);- Parameters:
x
- top left x point of rectangle.y
- top left y point of rectangle.width
- width of rectangle.height
- height of rectangle.- Returns:
- index of segment in path with witch intersect given rectangle.
-
getIndexOfCoveredPath
public final int getIndexOfCoveredPath(int x, int y)
This method is used to get segment of path with witch given point has intersection. It will be returned index starting from 1 of segment. This segment is counted using all breakpoints (including client and supplier point). If anybody needs end points of segments, you must take all breakpoints and take point of return index minus 1 and point of segment's index. If there is no intersection, this method return -1. If renderer is set for path element, intersection will be counted depending on this renderer. For example: this method returns value 2. segmentIndex = 2; Point start and end point of this segment will be: Point startPoint = getAllBreakPoints().get(segmentIndex-1); Point endPoint = getAllBreakPoints().get(segmentIndex);- Parameters:
x
- point x value.y
- point y value.- Returns:
- index of segment of path which intersects with the given point.
-
getNewBreakPointIndex
public int getNewBreakPointIndex(java.awt.Point point, java.util.List<java.awt.Point> brk)
Find the nearest breakpoints for new one and calculate the position of the new breakpoint in breakpoint vector. Used for new breakpoint calculation for bezier curve.- Parameters:
point
- the new point.brk
- the breakpoint Vector.- Returns:
- position in that the new point must be inserted in a breakpoint vector.
-
isConnectable
@OpenApi public final boolean isConnectable(@CheckForNull PresentationElement supplier, @CheckForNull PresentationElement client)
Checks if this path can connect given two elements.- Parameters:
supplier
- candidate for path's supplier.client
- candidate for path's client.- Returns:
- true, if path can connect given elements.
-
isConnectable
public final boolean isConnectable(@CheckForNull PresentationElement supplier, @CheckForNull PresentationElement client, @CheckForNull java.util.Map<java.lang.Object,java.lang.Object> options)
Checks if this path can connect given two elements.- Parameters:
supplier
- candidate for path's supplier.client
- candidate for path's client.options
- options- Returns:
- true, if path can connect given elements.
-
getMiddlePoint
public java.awt.Point getMiddlePoint()
Calculates and returns middle point of link. For this link it is average between supplier's and client's points.- Overrides:
getMiddlePoint
in classPresentationElement
- Returns:
- middle point.
-
getPointOnPath
@OpenApi public java.awt.Point getPointOnPath(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakpoints, double coefficient)
- Parameters:
supplierPoint
- supplier end pointclientPoint
- client end pointbreakpoints
- list of breakpoints between supplier and client in that ordercoefficient
- ratio between 0 and 1 describing position relative to the paths length. Provide 0.5 for middle point.- Returns:
- point on path
-
getPointsList
private java.util.List<java.awt.Point> getPointsList(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> breakpoints)
-
getPointOnBezierAtIndex
private static java.awt.Point getPointOnBezierAtIndex(java.awt.Point supplierPoint, java.util.List<java.awt.Point> pointList, int index)
-
getBezierLinePoints
private java.util.List<java.awt.Point> getBezierLinePoints(java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.Collection<java.awt.Point> breakpoints)
-
getBezierLinePoints
private java.util.List<java.awt.Point> getBezierLinePoints()
-
getBezierLinePoints
private java.util.List<java.awt.Point> getBezierLinePoints(java.util.List<java.awt.Point> allBreakPoints)
-
dispose
public void dispose()
Disconnect this link from shapes.- Specified by:
dispose
in interfaceBaseElement
-
atInsert
public void atInsert()
Inserts ends of link into shapes.- Specified by:
atInsert
in interfaceBaseElement
-
addConnectedPathElement
public boolean addConnectedPathElement(PathElement link)
Method to add sub link to this link. If link is note anchor it will be added to this link. If link is not note anchor, it will be added to generalization tree.- Parameters:
link
- link to be added.- Returns:
- true if element was added
-
getBounds
public final java.awt.Rectangle getBounds()
Calculates bounds of this link. Returns minimal rectangle in which link can fit.- Overrides:
getBounds
in classPresentationElement
- Returns:
- bounds of this link.
- See Also:
PresentationElementsManager.reshapeShapeElement(com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement, java.awt.Rectangle)
-
getNotCopyBounds
public final java.awt.Rectangle getNotCopyBounds()
Description copied from class:PresentationElement
get not copy bounds of object throws NoRectangleDefinedException- Returns:
- rectangle of bounds
-
setCachedPathBounds
protected void setCachedPathBounds(@CheckForNull java.awt.Rectangle r)
-
calculatePathBounds
public java.awt.Rectangle calculatePathBounds(java.awt.Point supplier, java.awt.Point client, java.util.List<java.awt.Point> breaks)
-
accept
@OpenApi public void accept(Visitor visitor) throws java.lang.Exception
Description copied from interface:MDElement
Method accepts visitor, and calls method visit<class name>(this) of visitor . See Visitor pattern for more details.- Specified by:
accept
in interfaceMDElement
- Overrides:
accept
in classPathConnector
- Parameters:
visitor
- which visits this element.- Throws:
java.lang.Exception
-
setRectilinear
public void setRectilinear()
Sets link rectilinear property value.
-
isRectilinearized
private static boolean isRectilinearized(java.util.List<java.awt.Point> vct)
Checks whether points in specified vector make up rectilinear polyline.- Parameters:
vct
- - vector of points.- Returns:
- true if points in specified vector make up rectilinear polyline otherwise false.
-
isRectilinear
public boolean isRectilinear()
- Returns:
- true if link path style is rectilinear.
-
isOblique
public boolean isOblique()
- Returns:
- true if link path style is oblique.
-
makeRectilinear
public void makeRectilinear()
Makes link rectilinear.
-
makeRectilinear
public void makeRectilinear(boolean notify)
Makes link rectilinear.- Parameters:
notify
- notify about this change
-
moveConnectedElements
private void moveConnectedElements()
-
smartRemoveRedundantBreakpoints
private static boolean smartRemoveRedundantBreakpoints(java.util.List<java.awt.Point> breakpoints)
Gets rid of small rectangular polyline corners on the path.- Parameters:
breakpoints
- - a list of breakpoints to fix.- Returns:
- true if breakpoints have been changed, false otherwise.
-
removeRedundantBreakPoints
public void removeRedundantBreakPoints(java.util.List<java.awt.Point> vct)
Removes redundant break points from link. Removes breaks only from rectilinear link.- Parameters:
vct
- points
-
doRectilinear
private boolean doRectilinear(java.util.List<java.awt.Point> points)
Makes rectilinear polyline from specified points.- Parameters:
points
- vector of points.- Returns:
- vector of points. Points in the vector make up rectilinear polyline.
-
makeSmartFlowLayoutPath
private boolean makeSmartFlowLayoutPath(java.util.List<java.awt.Point> breakpoints)
Adjusts breakpoints according smart flow layout rules.- Parameters:
breakpoints
- - a list of current break points.- Returns:
- true if breakpoints have been adjusted.
-
isVertical
public boolean isVertical()
Indicates if path element is drawn in the diagram which has vertical orientation.- Returns:
- true if diagram is vertical, false otherwise.
-
removeBreaks
public void removeBreaks(java.util.List<java.awt.Point> points)
Removes all break points if they are covered by client or client bounds.- Parameters:
points
- points
-
swapEnds
public void swapEnds()
Swaps ends of the link
-
setClient
public void setClient(PresentationElement shape)
Sets client for this link. Changes parent object to the parent of client. Client's parent will always contain incoming links.- Parameters:
shape
- shape to check
-
moveLinkToClientParent
public void moveLinkToClientParent(boolean simpleAdd)
-
internalSnapToGrid
protected void internalSnapToGrid(float step)
-
isSnapToGrid
protected boolean isSnapToGrid()
-
canChangeSupplier
public boolean canChangeSupplier()
- Returns:
- true, if view can change supplier.
-
canChangeClient
public boolean canChangeClient()
- Returns:
- true, if view can change client
-
isElementEditableOrNoElement
private boolean isElementEditableOrNoElement()
-
canClearBreakPoints
public boolean canClearBreakPoints()
- Returns:
- true if link can be modified (all break points can be removed):
-
canChangeLineStyle
public boolean canChangeLineStyle()
- Returns:
- true if this link can change line style.
-
internalApplyProperties
public void internalApplyProperties(PropertyManager man)
Applies properties- Parameters:
man
- new properties
-
draw
public void draw(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
abstract method for drawing ViewObject object used to draw object on graphics- Parameters:
context
- Graphics on which object should be drawn
-
getIntersection
public java.awt.Point getIntersection(int x, int y, @CheckForNull PathElement path)
-
findOtherExistingElement
@CheckForNull public Element findOtherExistingElement()
Finds and returns model element which meaning is the same as this link model element. This method should be used for Generalization and (maybe)other links. Default behavior is to return model element of this link. This method should be overridden in generalization and (maybe) other links. Make sure that ends are set before calling this method.- Returns:
- element
-
getBezierPath
public java.awt.geom.GeneralPath getBezierPath()
Calculates path for bezier curve drawing.- Returns:
- bezier path
-
isBezier
public boolean isBezier()
- Returns:
- true if LINK_LINE_STYLE property value equals to BEZIER.
-
getLinkLineStyle
public java.lang.String getLinkLineStyle()
- Returns:
- LINK_LINE_STYLE property value
-
sSetLinkLineStyle
public void sSetLinkLineStyle(java.lang.String style)
Change value of LINK_LINE_STYLE property.- Parameters:
style
- the line style.
-
setLinkLineStyle
public void setLinkLineStyle(java.lang.String style)
sets LINK_LINE_STYLE property value.- Parameters:
style
- the line style.
-
internalSilentApply
public void internalSilentApply()
Description copied from class:PresentationElement
Silently applies all properties after initialization
-
handleRemoveBreaksAction
public com.nomagic.magicdraw.commands.Command handleRemoveBreaksAction()
-
nextStyle
public java.lang.String nextStyle()
- Returns:
- link style for TOGGLE LINK STYLE command.
-
getBezierPath
public java.awt.geom.GeneralPath getBezierPath(java.util.List<java.awt.Point> points)
Calculates path from breakpoints for bezier curve drawing.- Parameters:
points
- points- Returns:
- path
-
recalculateArc
private static int recalculateArc(int arc, java.awt.Point p1, java.awt.Point p2)
-
prepareForLineDrawing
public boolean prepareForLineDrawing(java.awt.Graphics2D g, boolean line)
Prepares graphics for line drawing. Calls super prepareForLineDrawing and sets stroke.- Parameters:
g
- graphicsline
- true if for line, false if for adornments also- Returns:
- stroke
-
applyStrokeForLineDrawing
public static void applyStrokeForLineDrawing(PresentationElement pathElement, java.awt.Graphics2D g, boolean line, java.awt.BasicStroke stroke)
-
internalGetPresentationElementStroke
public java.awt.BasicStroke internalGetPresentationElementStroke(boolean line, int width)
This method must be overridden, if you need to use DASHED_STROKE or another one.- Parameters:
line
- true if for line, false if for adornments alsowidth
- width- Returns:
- the stroke for line drawing ( by default SOLID_STROKE).
-
internalGetPresentationElementStroke
protected java.awt.BasicStroke internalGetPresentationElementStroke(boolean line, int lineStyle, int width)
-
changeParentForTree
private void changeParentForTree(PresentationElement parent)
Move tree to other parent if all classes of this tree is in this new parent- Parameters:
parent
- parent
-
getBoundsToRepaint
public java.awt.Rectangle getBoundsToRepaint() throws NoRectangleDefinedException
Description copied from class:PresentationElement
Return bounds of the symbol that must be repainted. throws NoRectangleDefinedException- Returns:
- rectangle of bounds
- Throws:
NoRectangleDefinedException
-
prepareForFillDrawing
public boolean prepareForFillDrawing(java.awt.Graphics2D g, int x1, int y1, int x2, int y2)
Description copied from class:PresentationElement
Prepares graphics for fill drawing. Sets fill color if useFill property is set. Sets gradient if useGradientForFill() method returns true.- Parameters:
g
- the given graphicsx1
- gradient first point xy1
- gradient first point yx2
- gradient second point xy2
- gradient second point y- Returns:
- true, if symbol can be filled
- See Also:
PresentationElement.isUseGradientForFill()
,PresentationElement.isUseFillColor()
-
internalGetPresentationElementStroke
public java.awt.BasicStroke internalGetPresentationElementStroke(int width)
Description copied from class:PresentationElement
Return a stroke used to paint symbol's main part- Parameters:
width
- a custom stroke width. Other stroke parameters will be specific to symbol- Returns:
- a stroke used to paint symbol's main part
-
paintSelf
public void paintSelf(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
-
getPathPainter
public com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter<PathElement> getPathPainter()
-
setPathPainter
protected final void setPathPainter(com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter)
-
getSupplierConnectionType
public int getSupplierConnectionType()
-
getClientConnectionType
public int getClientConnectionType()
-
getDefaultParentForData
@CheckForNull public Element getDefaultParentForData()
Presentation element could suggest parent, which would be more acceptable, than adding to the client If returning null, general mechanism will work- Returns:
- parent for data
-
hasClientPoint
protected boolean hasClientPoint()
Check if client point is already not null- Returns:
- true if client point is set
-
hasSupplierPoint
protected boolean hasSupplierPoint()
Check if supplier point is already not null- Returns:
- true if supplier point is set
-
isRounded
public boolean isRounded()
Returns value of the "Is Rounded" path symbol property.- Returns:
- value of the "Is Rounded" property.
-
setRounded
public void setRounded(boolean rounded)
Sets value of the "Is Rounded" path symbol property.- Parameters:
rounded
- - value of the "Is Rounded" property.
-
sSetRounded
public void sSetRounded(boolean rounded)
Sets value of the "Is Rounded" path symbol property.- Parameters:
rounded
- - value of the "Is Rounded" property.
-
isUseFlowLayoutLogic
public boolean isUseFlowLayoutLogic()
Indicates if smart path/shape edit should be used in this diagram.- Returns:
- true if smart symbol editing should be used, false otherwise.
-
isSmartLayoutNeeded
public boolean isSmartLayoutNeeded()
Returns smart layout needed flag.- Returns:
- value of smart layout needed flag.
-
setSmartLayoutNeeded
public void setSmartLayoutNeeded(boolean smartLayoutNeeded)
Sets smart layout needed flag.- Parameters:
smartLayoutNeeded
- - smart layout needed flag value.
-
resetCache
protected void resetCache()
-
cacheValues
protected void cacheValues(java.awt.Point cachedActualSupplierDrawPoint, java.awt.Point cachedActualClientDrawPoint, java.awt.Point cacheSupplierDrawPoint, java.awt.Point cacheClientDrawPoint, java.util.List<java.awt.Point> cacheBreakPoints)
-
cacheActualDrawPoints
protected void cacheActualDrawPoints(java.awt.Point supplierDrawPoint, java.awt.Point clientDrawPoint, java.util.List<java.awt.Point> breakPoints)
-
getCachedActualClientDrawPoint
public java.awt.Point getCachedActualClientDrawPoint()
-
getCachedActualSupplierDrawPoint
public java.awt.Point getCachedActualSupplierDrawPoint()
-
validateActualDrawPointsCache
private void validateActualDrawPointsCache()
-
resizeParent
public void resizeParent()
Do nothing, because path does not affect parent size
-
getCustomSupplierPoint
public java.awt.Point getCustomSupplierPoint()
-
setCustomSupplierPoint
public void setCustomSupplierPoint(java.awt.Point point)
-
getCustomClientPoint
public java.awt.Point getCustomClientPoint()
-
setCustomClientPoint
public void setCustomClientPoint(java.awt.Point point)
-
preDisposeOnUpdate
protected boolean preDisposeOnUpdate()
Description copied from class:PresentationElement
Validate symbol against model and try to fix it before actual symbol update. If symbol is not valid and can not be fixed, request symbol dispose by returning true. Check if symbol should be disposed, because model does not correspond to symbol. This may happen for example if path supplier or client in model is changed, but path still is connected to symbols of old ends.Method also can fix symbol if possible - for example reconnect path to other symbols in diagram and etc.
- Returns:
- true if symbol must be disposed
-
createSmartListenerConfig
protected void createSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
-
internalMovedAsToSelf
public void internalMovedAsToSelf(int dx, int dy)
This is an internal method to notify link that it was moved by connecting shape as link "to self"- Parameters:
dx
- delta xdy
- delta y
-
sSetParent
public void sSetParent(@CheckForNull PresentationElement parent)
Description copied from class:PresentationElement
Sets parent for this view. For adding symbols to other symbols usePresentationElement.addPresentationElement(PresentationElement)
orPresentationElement.sAddPresentationElement(PresentationElement)
}- Parameters:
parent
- parent view
-
hasManipulator
public boolean hasManipulator()
Description copied from class:PresentationElement
Returns true, if view has manipulator (is selectable)
-
getSuspendShapeAutoResizeMode
public java.lang.String getSuspendShapeAutoResizeMode()
- Specified by:
getSuspendShapeAutoResizeMode
in interfacecom.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
-
sSetSuspendShapeAutoResizeMode
public void sSetSuspendShapeAutoResizeMode(java.lang.String mode)
-
setSuspendShapeAutoResizeMode
public void setSuspendShapeAutoResizeMode(java.lang.String mode)
-
-