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 intARCRadius of rounded path style corner.static java.lang.StringBEZIERBezier path line style.private java.awt.RectangleboundsCalculated bounds of the path.private booleanbreakableindicates whether link is breakable.private java.util.List<java.awt.Point>breakPointsVector of break pointsprivate java.util.List<java.awt.Point>cacheBreakPointsprivate java.awt.PointcacheClientDrawPointprivate java.awt.PointcachedActualClientDrawPointprivate java.awt.PointcachedActualSupplierDrawPointprivate java.awt.PointcacheSupplierDrawPointprivate PresentationElementclient2nd end of link (objectView)private java.awt.PointclientPointConnection point of link and client.private booleanclientTranslatedFlags indicates that client point was translated after shape changed boundsprivate java.awt.PointcustomClientPointCustom client point for drawing relation ends.private java.awt.PointcustomSupplierPointCustom supplier point for drawing relation ends.static java.util.List<java.lang.String>LINE_STYLEAll possible path line styles.private com.nomagic.magicdraw.uml.symbols.LineJumpPlacelineJumpPlacePlace of the line jump.private java.util.Map<java.awt.Point,java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo>>lineJumpsContains information about line jumps.private java.util.Map<java.awt.Point,java.lang.Double>lineJumpStartAngleMap of link points and start angle of the line jump.static java.lang.StringOBLIQUEPolyline path line style.private com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainterpathPainterstatic java.lang.StringRECTILINEARPath line style with rectilinear (90 degrees) breakpoint corners.private static intSMART_LAYOUT_TOLERANCEControls when smart layout should be applied to rectilinear path breakpoints.private booleansmartLayoutNeededIndicates if smart path layout is needed for this path element.private PresentationElementsupplier1st end of link ( objectView )private java.awt.PointsupplierPointConnection point of link and supplier.private booleansupplierTranslatedFlags 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 voidaccept(Visitor visitor)Method accepts visitor, and calls method visit<class name>(this) of visitor .booleanaddConnectedPathElement(PathElement link)Method to add sub link to this link.voidaddLineJumps(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 voidapplyStrokeForLineDrawing(PresentationElement pathElement, java.awt.Graphics2D g, boolean line, java.awt.BasicStroke stroke)booleanaskDeleteDataConfirmation()Return true, because while deleting link view user must be prompt about deleting datavoidatInsert()Inserts ends of link into shapes.voidbreakPointsChanged(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 voidcacheActualDrawPoints(java.awt.Point supplierDrawPoint, java.awt.Point clientDrawPoint, java.util.List<java.awt.Point> breakPoints)protected voidcacheValues(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.RectanglecalculatePathBounds(java.awt.Point supplier, java.awt.Point client, java.util.List<java.awt.Point> breaks)booleancanChangeClient()booleancanChangeLineStyle()booleancanChangeSupplier()booleancanClearBreakPoints()private voidchangeParentForTree(PresentationElement parent)Move tree to other parent if all classes of this tree is in this new parentvoidclearClientTranslation()Clears client translated flag.voidclearRegisteredLineJumpInfos()voidclearSupplierTranslation()Clears client translated flag.PathElementclone()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)booleancoversPoint(int x, int y)Checks if object covers provided pointprotected voidcreateSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)voiddispose()Disconnect this link from shapes.private booleandoRectilinear(java.util.List<java.awt.Point> points)Makes rectilinear polyline from specified points.voiddraw(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)abstract method for drawing ViewObject object used to draw object on graphicsvoiddraw(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.PathIcondynamicPathIcon()com.nomagic.magicdraw.ui.pathicon.PathIcondynamicPathIcon(com.nomagic.magicdraw.ui.pathicon.PathIcon pathIcon)ElementfindOtherExistingElement()Finds and returns model element which meaning is the same as this link model element.java.awt.PointgetActualClientDrawPoint()Returns actual client side draw point.java.awt.PointgetActualSupplierDrawPoint()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.GeneralPathgetBezierPath()Calculates path for bezier curve drawing.java.awt.geom.GeneralPathgetBezierPath(java.util.List<java.awt.Point> points)Calculates path from breakpoints for bezier curve drawing.java.awt.RectanglegetBounds()Calculates bounds of this link.private java.awt.geom.GeneralPathgetBoundsPath(java.util.List<java.awt.Point> points)java.awt.RectanglegetBoundsToRepaint()Return bounds of the symbol that must be repainted.java.awt.PointgetBreakPoint(int pos)Returns break point with given index.intgetBreakPointCount()returns size of break point vectorjava.util.List<java.awt.Point>getBreakPoints()Returns break points of the path.java.awt.PointgetCachedActualClientDrawPoint()java.awt.PointgetCachedActualSupplierDrawPoint()PresentationElementgetClient()Returns client of the path.intgetClientConnectionType()java.awt.PointgetClientDrawPoint()Returns point where path drawing should startjava.awt.PointgetClientPoint()Returns point where path connects client end's element.java.awt.PointgetCustomClientPoint()static com.nomagic.magicdraw.ui.pathicon.PathIcongetCustomStereotypeIcon(Element element)java.awt.PointgetCustomSupplierPoint()ElementgetDefaultParentForData()Presentation element could suggest parent, which would be more acceptable, than adding to the client If returning null, general mechanism will workintgetIndexOfCoveredPath(int x, int y)This method is used to get segment of path with witch given point has intersection.intgetIndexOfCoveredPathInternal(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.PointgetIntersection(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.doublegetLineJumpStartAngle(java.awt.Point point)java.lang.StringgetLinkLineStyle()java.awt.PointgetMiddlePoint()Calculates and returns middle point of link.LinegetNearestLinkPart(int x, int y)Returns nearest link part to specified point.java.awt.PointgetNearestPoint(java.awt.Point pt)Returns first break point or client point if arg is supplier point.intgetNewBreakPointIndex(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.PointgetNewPointByTheLink(java.util.List<java.awt.Point> oldBreaks, java.util.List<java.awt.Point> newBreaks, java.awt.Point oldLocation)PresentationElementgetNextEnd(PresentationElement obj)Returns other than given end.java.awt.PointgetNextPoint(java.awt.Point pt)Returns next point to a given one.java.awt.RectanglegetNotCopyBounds()get not copy bounds of object throws NoRectangleDefinedExceptionprivate java.awt.geom.GeneralPathgetPath(java.util.List<java.awt.Point> points)Returns a path for normal link drawing.com.nomagic.magicdraw.ui.pathicon.PathIcongetPathIcon()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.PointgetPoint(java.awt.Point p1, java.awt.Point p2, double away)Gets point by the line.private static java.awt.PointgetPointOnBezierAtIndex(java.awt.Point supplierPoint, java.util.List<java.awt.Point> pointList, int index)java.awt.PointgetPointOnPath(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.PointgetPreviousPoint(java.awt.Point pt)Returns previous point to given one.private java.awt.geom.GeneralPathgetRoundedPath(java.util.List<java.awt.Point> breakpoints)Calculates path from breakpoints for rounded link drawing.PresentationElementgetSupplier()Returns supplier of the path.intgetSupplierConnectionType()java.awt.PointgetSupplierDrawPoint()Returns point where path drawing should startjava.awt.PointgetSupplierPoint()Returns point where path connects supplier end's element.java.lang.StringgetSuspendShapeAutoResizeMode()com.nomagic.magicdraw.commands.CommandhandleRemoveBreaksAction()protected booleanhasClientPoint()Check if client point is already not nullbooleanhasManipulator()Returns true, if view has manipulator (is selectable)booleanhasSharedData()Returns true if data of this object can be shared.protected booleanhasSupplierPoint()Check if supplier point is already not nullvoidinternalApplyProperties(PropertyManager man)Applies propertiesjava.awt.ShapeinternalGetBoundsShape(ConverterToShape converterToShape)java.awt.BasicStrokeinternalGetPresentationElementStroke(boolean line, int width)This method must be overridden, if you need to use DASHED_STROKE or another one.protected java.awt.BasicStrokeinternalGetPresentationElementStroke(boolean line, int lineStyle, int width)java.awt.BasicStrokeinternalGetPresentationElementStroke(int width)Return a stroke used to paint symbol's main partvoidinternalMovedAsToSelf(int dx, int dy)This is an internal method to notify link that it was moved by connecting shape as link "to self"voidinternalSilentApply()Silently applies all properties after initializationprotected voidinternalSnapToGrid(float step)booleanintersects(int x, int y, int width, int height)Check if any line between breakpoints intersect with given points of rectanglebooleanintersectsInternal(int x, int y, int width, int height)Check intersection with given rectangle.booleanisAlwaysToSelf()booleanisBezier()booleanisBezierIntersects(int x, int y, int width, int height)Check if it is bezier path intersection with rectangle.booleanisBreakable()shows whether link is breakable.booleanisConnectable(PresentationElement supplier, PresentationElement client)Checks if this path can connect given two elements.booleanisConnectable(PresentationElement supplier, PresentationElement client, java.util.Map<java.lang.Object,java.lang.Object> options)Checks if this path can connect given two elements.booleanisDrawLineJumps()Returns true if the path element wants to draw line jumps.private booleanisElementEditableOrNoElement()booleanisFixed()Returns if path element tied to it's supplier and client (cannot be reconnected)booleanisOblique()booleanisRectilinear()private static booleanisRectilinearized(java.util.List<java.awt.Point> vct)Checks whether points in specified vector make up rectilinear polyline.booleanisRounded()Returns value of the "Is Rounded" path symbol property.booleanisSmartLayoutNeeded()Returns smart layout needed flag.protected booleanisSnapToGrid()booleanisToSelf()booleanisUseFlowLayoutLogic()Indicates if smart path/shape edit should be used in this diagram.booleanisVertical()Indicates if path element is drawn in the diagram which has vertical orientation.voidmakeRectilinear()Makes link rectilinear.voidmakeRectilinear(boolean notify)Makes link rectilinear.private booleanmakeSmartFlowLayoutPath(java.util.List<java.awt.Point> breakpoints)Adjusts breakpoints according smart flow layout rules.private voidmoveConnectedElements()voidmoveLinkToClientParent(boolean simpleAdd)protected voidmovePathElement(PathElement link, PathConnector requestor)Moves link.booleanneedsToMoveOtherEnd()java.lang.StringnextStyle()voidnotifyBreakPointsChanged(java.util.List<java.awt.Point> oldPoints, java.util.List<java.awt.Point> newPoints)Notifies about break point vector changesvoidnotifyRepaintManager(boolean boundsChanged)Notifies the repaint manager about changes in bounds.protected voidnotifyRepaintManager(java.util.List<java.awt.Point> oldBreakpoints, java.util.List<java.awt.Point> newBreakpoints)voidoptimizeLoops()Removes loops from paths for example: path | ----------+ | | ------voidpaintSelf(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)protected booleanpreDisposeOnUpdate()Validate symbol against model and try to fix it before actual symbol update.booleanprepareForFillDrawing(java.awt.Graphics2D g, int x1, int y1, int x2, int y2)Prepares graphics for fill drawing.booleanprepareForLineDrawing(java.awt.Graphics2D g, boolean line)Prepares graphics for line drawing.private static intrecalculateArc(int arc, java.awt.Point p1, java.awt.Point p2)voidregisterLineJumpInfos(int pathIndex, java.awt.Point segmentStartPoint, java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> lineJumps)voidregisterLineJumpStartAngle(int pathIndex, java.awt.Point point, double lineJumpStartAngle)booleanremoveBreakPoints()private booleanremoveBreakPoints(java.awt.Rectangle rct, int n)Removes break points from this link if they covered given rectangle.voidremoveBreaks(java.util.List<java.awt.Point> points)Removes all break points if they are covered by client or client bounds.voidremoveRedundantBreakPoints(java.util.List<java.awt.Point> vct)Removes redundant break points from link.voidremoveUnnecessaryBreakPoints()Removes unnecessary points from break point vector.protected voidresetCache()voidresizeParent()Do nothing, because path does not affect parent sizevoidsAddBreakPoint(java.awt.Point pt)Adds new break point.voidsClearBreakPoints()Clear break points list.voidsetBounds(java.awt.Rectangle r)Moves link to new location.voidsetBreakable(boolean value)Sets breakable flag on/ off.voidsetBreakPoints(java.util.List<java.awt.Point> vct)Sets break point vector.protected voidsetCachedPathBounds(java.awt.Rectangle r)voidsetClient(PresentationElement shape)Sets client for this link.voidsetClientPoint(java.awt.Point pt)Sets client point.voidsetCustomClientPoint(java.awt.Point point)voidsetCustomSupplierPoint(java.awt.Point point)voidsetLineJumpPlace(com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace)Sets line jump place of the path element.voidsetLinkLineStyle(java.lang.String style)sets LINK_LINE_STYLE property value.protected voidsetPathPainter(com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter)voidsetRectilinear()Sets link rectilinear property value.voidsetRounded(boolean rounded)Sets value of the "Is Rounded" path symbol property.voidsetSmartLayoutNeeded(boolean smartLayoutNeeded)Sets smart layout needed flag.voidsetSupplier(PresentationElement shape)Sets supplier end for link.voidsetSupplierPoint(java.awt.Point pt)Sets 1st point.voidsetSuspendShapeAutoResizeMode(java.lang.String mode)voidsimpleSetBounds(java.awt.Rectangle r)calls break point vector changed method.private static booleansmartRemoveRedundantBreakpoints(java.util.List<java.awt.Point> breakpoints)Gets rid of small rectangular polyline corners on the path.voidsSetBounds(java.awt.Rectangle r)Moves link to new location.voidsSetBreakable(boolean value)Sets breakable flag on/ off.voidsSetBreakPoint(java.awt.Point pt, int pos)Sets break point at the given position.voidsSetBreakPoints(java.util.List<java.awt.Point> vct)Only sets break point vector.voidsSetClient(PresentationElement obj)Sets client for this link.voidsSetClientPoint(java.awt.Point pt)Sets client connection Point.voidsSetLinkLineStyle(java.lang.String style)Change value of LINK_LINE_STYLE property.voidsSetParent(PresentationElement parent)Sets parent for this view.voidsSetRounded(boolean rounded)Sets value of the "Is Rounded" path symbol property.voidsSetSupplier(PresentationElement obj)Sets supplier for this link.voidsSetSupplierPoint(java.awt.Point pt)Sets supplier connection point.voidsSetSuspendShapeAutoResizeMode(java.lang.String mode)voidswapEnds()Swaps ends of the linkjava.awt.PointtranslateClientPoint(java.awt.Rectangle old, java.awt.Rectangle newR)java.awt.PointtranslateSupplierPoint(java.awt.Rectangle old, java.awt.Rectangle newR)private voidvalidateActualDrawPointsCache()-
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:PresentationElementReturns 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: OnlyLineJumpManagercan set jump place of the link. SinceLineJumpManagerwill reset line jump place on every repaint of a diagram then other invocations of the method will not have an effect.- Specified by:
setLineJumpPlacein 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:
registerLineJumpInfosin interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
-
clearRegisteredLineJumpInfos
public void clearRegisteredLineJumpInfos()
- Specified by:
clearRegisteredLineJumpInfosin interfacecom.nomagic.magicdraw.uml.symbols.LineJumpDrawer
-
registerLineJumpStartAngle
public void registerLineJumpStartAngle(int pathIndex, java.awt.Point point, double lineJumpStartAngle)- Specified by:
registerLineJumpStartAnglein 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:
addLineJumpsin 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:
isDrawLineJumpsin 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:
getPathsin 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:PresentationElementNotifies 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:ElementImplReturns a copy of theElement.- Specified by:
clonein 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:
getMiddlePointin 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:
disposein interfaceBaseElement
-
atInsert
public void atInsert()
Inserts ends of link into shapes.- Specified by:
atInsertin 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:
getBoundsin 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:PresentationElementget 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:MDElementMethod accepts visitor, and calls method visit<class name>(this) of visitor . See Visitor pattern for more details.- Specified by:
acceptin interfaceMDElement- Overrides:
acceptin 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:PresentationElementSilently 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 NoRectangleDefinedExceptionDescription copied from class:PresentationElementReturn 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:PresentationElementPrepares 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:PresentationElementReturn 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:PresentationElementValidate 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:PresentationElementSets 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:PresentationElementReturns true, if view has manipulator (is selectable)
-
getSuspendShapeAutoResizeMode
public java.lang.String getSuspendShapeAutoResizeMode()
- Specified by:
getSuspendShapeAutoResizeModein interfacecom.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
-
sSetSuspendShapeAutoResizeMode
public void sSetSuspendShapeAutoResizeMode(java.lang.String mode)
-
setSuspendShapeAutoResizeMode
public void setSuspendShapeAutoResizeMode(java.lang.String mode)
-
-