Class PeServiceImpl
- All Implemented Interfaces:
IPeCreateService,IPeLayoutService,IPeService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateBoxRelativeAnchor(AnchorContainer anchorContainer) Creates a box relative anchor inside the given anchor container.createChopboxAnchor(AnchorContainer anchorContainer) Creates a chop box anchor inside the given anchor container.createCompositeConnection(Diagram diagram) Creates a composite connection (a connection that is made of several other connections) inside the given diagram.createConnectionDecorator(Connection connection, boolean active, double location, boolean isRelative) Creates a connection decorator and adds it to the given connection.createContainerShape(ContainerShape parentContainerShape, boolean active) Creates a container shape inside the given parent container shape.createCurvedConnection(double[] xy, Diagram diagram) Creates a curved connection (Bezier curve) inside the given diagram.createDiagram(String diagramTypeId, String diagramName) Creates a diagram.createDiagram(String diagramTypeId, String diagramName, boolean snap) Creates a diagram.createDiagram(String diagramTypeId, String diagramName, int gridUnit, boolean snap) Creates a diagram.createDiagram(String diagramTypeId, String diagramName, int horizontalGridUnit, int verticalGridUnit, boolean snap) Creates a diagram.createFixPointAnchor(AnchorContainer anchorContainer) Creates a fix point anchor inside the given anchor container.createFreeFormConnection(Diagram diagram) Creates a free form connection inside the given diagram.createManhattanConnection(Diagram diagram) Creates a manhattan connection inside the given diagram.createShape(ContainerShape parentContainerShape, boolean active) Creates a shape inside the given parent container shape.voidDeletes the given pictogram element (and with it all aggregated elements!).voidDeletes the given pictogram elements (and with it all aggregated elements!).voidDeletes the given pictogram element (and with it all aggregated elements!).Gets the active container pe.getActiveContainerPe(PictogramElement pictogramElement) Gets the active container pe.getAllConnections(Anchor anchor) Returns all connections of an anchor.getAllConnections(AnchorContainer anchorContainer) Returns all connections of an anchor container.Gets the all contained pictogram elements.Returns all the contained container shapes.getChopboxAnchor(AnchorContainer anchorContainer) Gets the chopbox anchor.getConnectionMidpoint(Connection c, double d) Gets the connection midpoint.getDiagramForAnchor(Anchor anchor) Returns the diagram for the given anchor.Returns the diagram for the given pictogram element.getDiagramForShape(Shape shape) Returns the diagram for the given shape.org.eclipse.emf.ecore.EObject[]getElementsNotInDiagram(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram) From the given elements, returns all elements that are not linked by a PictogramLink in the given Diagram.getGaBoundsForAnchor(Anchor anchor) Returns the bounds of the graphics algorithm, which is referenced by the anchor.getIncomingConnections(AnchorContainer anchorContainer) Returns the incoming connections of an anchor container.Object[]getLinkedPictogramElements(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram) Return all the pictogram elements of the given Diagram which have at least one link to one of the given elements.getLocationInfo(Shape shape, int x, int y) Returns the location info for a specific position inside a shape.getLocationRelativeToDiagram(Anchor anchor) Returns the location of the anchor relative to the diagram.Returns the location of the shape relative to the diagram.getOutgoingConnections(AnchorContainer anchorContainer) Returns the outgoing connections of an anchor container.Returns a pictogram element's children.Gets the pictogram element parent.getProperty(PropertyContainer propertyContainer, String key) Returns the property of a given property container for a specific key.getPropertyValue(PropertyContainer propertyContainer, String key) Returns the first element of the property values of a given property container for a specific key.protected static intReturns the location of the given pictogram element - more exactly the location of the pictogram element's graphics algorithm.protected static intReturns the location of the given pictogram element - more exactly the location of the pictogram element's graphics algorithm.voidmoveBendpoints(IExecutionInfo executionInfo) Move bendpoints.booleanremoveProperty(PropertyContainer propertyContainer, String key) Removes the property of a given property container for a specific key.voidsendToBack(Shape shape) Reorders parent's children to make the given shape the backmost one.voidsendToFront(Shape shape) Reorders parent's children to make the given shape the frontmost one.voidsetPropertyValue(PropertyContainer propertyContainer, String key, String value) Sets/modifies the property's value of a given property container for a specific key.
-
Constructor Details
-
PeServiceImpl
public PeServiceImpl()
-
-
Method Details
-
createBoxRelativeAnchor
Description copied from interface:IPeCreateServiceCreates a box relative anchor inside the given anchor container.- Specified by:
createBoxRelativeAnchorin interfaceIPeCreateService- Parameters:
anchorContainer- the anchors parent- Returns:
- the new box relative anchor
-
createChopboxAnchor
Description copied from interface:IPeCreateServiceCreates a chop box anchor inside the given anchor container.- Specified by:
createChopboxAnchorin interfaceIPeCreateService- Parameters:
anchorContainer- the anchors parent- Returns:
- the new chop box anchor
-
createConnectionDecorator
public ConnectionDecorator createConnectionDecorator(Connection connection, boolean active, double location, boolean isRelative) Description copied from interface:IPeCreateServiceCreates a connection decorator and adds it to the given connection.- Specified by:
createConnectionDecoratorin interfaceIPeCreateService- Parameters:
connection- the connectionactive- TRUE, if decorator is active, FALSE otherwiselocation- location of the decorator (must be between 0 and 1)isRelative- true if the decorator should be positioned relative to the connection's midpoint- Returns:
- the new connection decorator
-
createContainerShape
Description copied from interface:IPeCreateServiceCreates a container shape inside the given parent container shape.- Specified by:
createContainerShapein interfaceIPeCreateService- Parameters:
parentContainerShape- the parent container shapeactive-true, if the created shape should be active,falseotherwise. An active shape can be selected in the diagram editor and it is also relevant for layouting: an active shape opens a coordinate system relative to its next active parent which can be used for layouting itsPictogramElementchildren, while an inactive one uses the coordinate system of its next direct parent for layouting its children.By default all shapes should be active, inactive shapes should be used for grouping purposes or for linking a group of graphical objects to the domain world only.
For those familiar with GEF: only for active shapes a GEF EditPart will be created by the Graphiti framework, not for inactive ones.
- Returns:
- the new container shape
-
createDiagram
Description copied from interface:IPeCreateServiceCreates a diagram. Snapping to the grid is disabled by default.- Specified by:
createDiagramin interfaceIPeCreateService- Parameters:
diagramTypeId- the type id of the diagramdiagramName- the name of the diagram- Returns:
- the new diagram
- See Also:
-
createDiagram
Description copied from interface:IPeCreateServiceCreates a diagram.- Specified by:
createDiagramin interfaceIPeCreateService- Parameters:
diagramTypeId- the type id of the diagramdiagramName- the name of the diagramsnap- TRUE enables snap to grid- Returns:
- the new diagram
- See Also:
-
createDiagram
Description copied from interface:IPeCreateServiceCreates a diagram.- Specified by:
createDiagramin interfaceIPeCreateService- Parameters:
diagramTypeId- the type id of the diagramdiagramName- the name of the diagramgridUnit- grid size (in both directions) in pixel; if 0 then no grid will be drawnsnap- TRUE enables snap to grid- Returns:
- the new diagram
-
createDiagram
public Diagram createDiagram(String diagramTypeId, String diagramName, int horizontalGridUnit, int verticalGridUnit, boolean snap) Description copied from interface:IPeCreateServiceCreates a diagram.- Specified by:
createDiagramin interfaceIPeCreateService- Parameters:
diagramTypeId- the type id of the diagramdiagramName- the name of the diagramhorizontalGridUnit- horizontal grid size in pixel; if 0 then no grid will be drawnverticalGridUnit- vertical grid size in pixel; if 0 then no grid will be drawnsnap- TRUE enables snap to grid- Returns:
- the new diagram
-
createFixPointAnchor
Description copied from interface:IPeCreateServiceCreates a fix point anchor inside the given anchor container.- Specified by:
createFixPointAnchorin interfaceIPeCreateService- Parameters:
anchorContainer- the anchors parent- Returns:
- the new fix point anchor
-
createFreeFormConnection
Description copied from interface:IPeCreateServiceCreates a free form connection inside the given diagram.- Specified by:
createFreeFormConnectionin interfaceIPeCreateService- Parameters:
diagram- the diagram- Returns:
- the new free form connection
-
createManhattanConnection
Description copied from interface:IPeCreateServiceCreates a manhattan connection inside the given diagram.- Specified by:
createManhattanConnectionin interfaceIPeCreateService- Parameters:
diagram- the diagram- Returns:
- the new free form connection
-
createCompositeConnection
Description copied from interface:IPeCreateServiceCreates a composite connection (a connection that is made of several other connections) inside the given diagram.CompositeConnections can be used to combine any number ofCurvedConnections into one semantical connection using itsCompositeConnection.getChildren()relation. Note that the composite connection itself needs to have an associatedGraphicsAlgorithm(usually aPolyline) for its visualization, although it might be invisible and only the child connections have a visible polyline as their visualization.
Note that this is an experimental API and might change without further notice.- Specified by:
createCompositeConnectionin interfaceIPeCreateService- Parameters:
diagram- the diagram- Returns:
- the new composite connection
-
createCurvedConnection
Description copied from interface:IPeCreateServiceCreates a curved connection (Bezier curve) inside the given diagram.- Specified by:
createCurvedConnectionin interfaceIPeCreateService- Parameters:
xy- an array of double value pairs defining the control points (two values - x and y - define the point) of the Bezier curvediagram- the diagram- Returns:
- the new curved connection
-
createShape
Description copied from interface:IPeCreateServiceCreates a shape inside the given parent container shape.- Specified by:
createShapein interfaceIPeCreateService- Parameters:
parentContainerShape- the parent container shapeactive-true, if the created shape should be active,falseotherwise. An active shape can be selected in the diagram editor and it is also relevant for layouting: an active shape opens a coordinate system which can be used for layouting itsPictogramElementchildren, while an inactive one does not provide one but uses the coordinate system of its next active parent for layouting its children.By default all shapes should be active, inactive shapes should be used for grouping purposes or for linking a group of graphical objects to the domain world only.
For those familiar with GEF: only for active shapes a GEF EditPart will be created by the Graphiti framework, not for inactive ones.
- Returns:
- the new shape
-
deletePictogramElement
Description copied from interface:IPeServiceDeletes the given pictogram element (and with it all aggregated elements!). This method will also follow all cross references which might for large models cause performance issues. In case you suffer from that you might check to useIPeService.deletePictogramElementIgnoringCrossReferences(Iterable)andIPeService.deletePictogramElementIgnoringCrossReferences(PictogramElement)instead.- Specified by:
deletePictogramElementin interfaceIPeService- Parameters:
pe- The pictogram element to delete
-
deletePictogramElementIgnoringCrossReferences
Description copied from interface:IPeServiceDeletes the given pictogram element (and with it all aggregated elements!). This method will not follow cross references which might for large models have performance advantages over usingIPeService.deletePictogramElement(PictogramElement). In case you need to follow cross references as well and update them you will need to useIPeService.deletePictogramElement(PictogramElement)instead.- Specified by:
deletePictogramElementIgnoringCrossReferencesin interfaceIPeService- Parameters:
pe- The pictogram element to delete
-
deletePictogramElementIgnoringCrossReferences
Description copied from interface:IPeServiceDeletes the given pictogram elements (and with it all aggregated elements!). This method will not follow cross references which might for large models have performance advantages over usingIPeService.deletePictogramElement(PictogramElement). In case you need to follow cross references as well and update them you will need to useIPeService.deletePictogramElement(PictogramElement)instead.- Specified by:
deletePictogramElementIgnoringCrossReferencesin interfaceIPeService- Parameters:
pes- The pictogram elements to delete
-
getActiveContainerPe
Description copied from interface:IPeServiceGets the active container pe.- Specified by:
getActiveContainerPein interfaceIPeService- Parameters:
ga- the ga- Returns:
- the active container pe
-
getActiveContainerPe
Description copied from interface:IPeServiceGets the active container pe.- Specified by:
getActiveContainerPein interfaceIPeService- Parameters:
pictogramElement- the pictogram element- Returns:
- the active container pe
-
getAllConnections
Description copied from interface:IPeServiceReturns all connections of an anchor.- Specified by:
getAllConnectionsin interfaceIPeService- Parameters:
anchor- the anchor- Returns:
- list of connections
-
getAllConnections
Description copied from interface:IPeServiceReturns all connections of an anchor container.- Specified by:
getAllConnectionsin interfaceIPeService- Parameters:
anchorContainer- the anchor container- Returns:
- list of connections
-
getAllContainedPictogramElements
Description copied from interface:IPeServiceGets the all contained pictogram elements.- Specified by:
getAllContainedPictogramElementsin interfaceIPeService- Parameters:
pe- the pe- Returns:
- the all contained pictogram elements
-
getAllContainedShapes
Description copied from interface:IPeServiceReturns all the contained container shapes. Dives through the whole shapes tree.- Specified by:
getAllContainedShapesin interfaceIPeService- Parameters:
cs- the container shape- Returns:
- all the contained container shapes
-
getChopboxAnchor
Description copied from interface:IPeServiceGets the chopbox anchor.- Specified by:
getChopboxAnchorin interfaceIPeService- Parameters:
anchorContainer- the anchor container- Returns:
- The chopbox anchor of the anchor container if one exist, otherwise null
-
getConnectionMidpoint
Description copied from interface:IPeLayoutServiceGets the connection midpoint.- Specified by:
getConnectionMidpointin interfaceIPeLayoutService- Parameters:
c- the connectiond- a relative location on the connection (must be between 0 and 1)- Returns:
- the connection midpoint
-
getDiagramForAnchor
Description copied from interface:IPeServiceReturns the diagram for the given anchor.- Specified by:
getDiagramForAnchorin interfaceIPeService- Parameters:
anchor- the anchor- Returns:
- the diagram
-
getDiagramForPictogramElement
Description copied from interface:IPeServiceReturns the diagram for the given pictogram element.- Specified by:
getDiagramForPictogramElementin interfaceIPeService- Parameters:
pe- the pe- Returns:
- the diagram
-
getDiagramForShape
Description copied from interface:IPeServiceReturns the diagram for the given shape.- Specified by:
getDiagramForShapein interfaceIPeService- Parameters:
shape- the shape- Returns:
- the diagram
-
getElementsNotInDiagram
public org.eclipse.emf.ecore.EObject[] getElementsNotInDiagram(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram) Description copied from interface:IPeServiceFrom the given elements, returns all elements that are not linked by a PictogramLink in the given Diagram.- Specified by:
getElementsNotInDiagramin interfaceIPeService- Parameters:
elements- the elementsdiagram- the diag- Returns:
- the elements not in diagram
-
getGaBoundsForAnchor
Description copied from interface:IPeLayoutServiceReturns the bounds of the graphics algorithm, which is referenced by the anchor.- Specified by:
getGaBoundsForAnchorin interfaceIPeLayoutService- Parameters:
anchor- the anchor- Returns:
- the bounds of the anchor graphics algorithm
-
getIncomingConnections
Description copied from interface:IPeServiceReturns the incoming connections of an anchor container.- Specified by:
getIncomingConnectionsin interfaceIPeService- Parameters:
anchorContainer- the anchor container- Returns:
- list of incoming connections
-
getLinkedPictogramElements
public Object[] getLinkedPictogramElements(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram) Description copied from interface:IPeServiceReturn all the pictogram elements of the given Diagram which have at least one link to one of the given elements.- Specified by:
getLinkedPictogramElementsin interfaceIPeService- Parameters:
elements- the elementsdiagram- the diag- Returns:
- the linked pictogram elements
-
getLocationInfo
Description copied from interface:IPeLayoutServiceReturns the location info for a specific position inside a shape. The location info contains the shape and the graphics algorithm at the given position.- Specified by:
getLocationInfoin interfaceIPeLayoutService- Parameters:
shape- the shapex- x coordinatey- y coordinate- Returns:
- the location info
- See Also:
-
getLocationRelativeToDiagram
Description copied from interface:IPeLayoutServiceReturns the location of the anchor relative to the diagram.- Specified by:
getLocationRelativeToDiagramin interfaceIPeLayoutService- Parameters:
anchor- the given anchor- Returns:
- the relative location
-
getLocationRelativeToDiagram
Description copied from interface:IPeLayoutServiceReturns the location of the shape relative to the diagram.- Specified by:
getLocationRelativeToDiagramin interfaceIPeLayoutService- Parameters:
shape- the given shape- Returns:
- the relative location
-
getOutgoingConnections
Description copied from interface:IPeServiceReturns the outgoing connections of an anchor container.- Specified by:
getOutgoingConnectionsin interfaceIPeService- Parameters:
anchorContainer- the anchor container- Returns:
- list of outgoing connections
-
getPictogramElementChildren
Description copied from interface:IPeServiceReturns a pictogram element's children.
Some Examples: returns all connections of a diagram, all shapes of a container shape, all decorators of a connection, all anchors of an anchor container- Specified by:
getPictogramElementChildrenin interfaceIPeService- Parameters:
pe- the given pictogram element- Returns:
- all the pictogram element's children
-
getPictogramElementParent
Description copied from interface:IPeServiceGets the pictogram element parent.- Specified by:
getPictogramElementParentin interfaceIPeService- Parameters:
pe- the pe- Returns:
- the pictogram element parent
-
getProperty
Description copied from interface:IPeServiceReturns the property of a given property container for a specific key.- Specified by:
getPropertyin interfaceIPeService- Parameters:
propertyContainer- The property container (e.g. PictogramElement or GraphicsAlgorithm)key- The property key- Returns:
- The property for the key
-
getPropertyValue
Description copied from interface:IPeServiceReturns the first element of the property values of a given property container for a specific key.- Specified by:
getPropertyValuein interfaceIPeService- Parameters:
propertyContainer- The property container (e.g. PictogramElement or GraphicsAlgorithm)key- The property key- Returns:
- The fist value of the property values for the key
-
getXOfPictogramElement
Returns the location of the given pictogram element - more exactly the location of the pictogram element's graphics algorithm.- Parameters:
pe- the given pictogram element- Returns:
- the location
-
getYOfPictogramElement
Returns the location of the given pictogram element - more exactly the location of the pictogram element's graphics algorithm.- Parameters:
pe- the given pictogram element- Returns:
- the location
-
moveBendpoints
Description copied from interface:IPeServiceMove bendpoints.- Specified by:
moveBendpointsin interfaceIPeService- Parameters:
executionInfo- the execution info
-
removeProperty
Description copied from interface:IPeServiceRemoves the property of a given property container for a specific key.- Specified by:
removePropertyin interfaceIPeService- Parameters:
propertyContainer- The property container (e.g. PictogramElement or GraphicsAlgorithm)key- The property key- Returns:
- True, if the property existed
-
sendToBack
Description copied from interface:IPeServiceReorders parent's children to make the given shape the backmost one. This is a convenient service to modify the z order. The z order of shapes in their containers can also be modified by changing the order of the children in the corresponding container shape directly. The last element in the list will be painted on top.- Specified by:
sendToBackin interfaceIPeService- Parameters:
shape- shape to make the backmost one
-
sendToFront
Description copied from interface:IPeServiceReorders parent's children to make the given shape the frontmost one. This is a convenient service to modify the z order. The z order of shapes in their containers can also be modified by changing the order of the children in the corresponding container shape directly. The last element in the list will be painted on top.- Specified by:
sendToFrontin interfaceIPeService- Parameters:
shape- shape to make the frontmost one
-
setPropertyValue
Description copied from interface:IPeServiceSets/modifies the property's value of a given property container for a specific key.
The property object will be created if it does not exist.- Specified by:
setPropertyValuein interfaceIPeService- Parameters:
propertyContainer- The property container (e.g. PictogramElement or GraphicsAlgorithm)key- The property keyvalue- The new property value
-