public final class PeServiceImpl extends java.lang.Object implements IPeService
Constructor and Description |
---|
PeServiceImpl() |
Modifier and Type | Method and Description |
---|---|
BoxRelativeAnchor |
createBoxRelativeAnchor(AnchorContainer anchorContainer)
Creates a box relative anchor inside the given anchor container.
|
ChopboxAnchor |
createChopboxAnchor(AnchorContainer anchorContainer)
Creates a chop box anchor inside the given anchor container.
|
CompositeConnection |
createCompositeConnection(Diagram diagram)
Creates a composite connection (a connection that is made of several
other connections) inside the given diagram.
|
ConnectionDecorator |
createConnectionDecorator(Connection connection,
boolean active,
double location,
boolean isRelative)
Creates a connection decorator and adds it to the given connection.
|
ContainerShape |
createContainerShape(ContainerShape parentContainerShape,
boolean active)
Creates a container shape inside the given parent container shape.
|
CurvedConnection |
createCurvedConnection(double[] xy,
Diagram diagram)
Creates a curved connection (Bezier curve) inside the given diagram.
|
Diagram |
createDiagram(java.lang.String diagramTypeId,
java.lang.String diagramName)
Creates a diagram.
|
Diagram |
createDiagram(java.lang.String diagramTypeId,
java.lang.String diagramName,
boolean snap)
Creates a diagram.
|
Diagram |
createDiagram(java.lang.String diagramTypeId,
java.lang.String diagramName,
int gridUnit,
boolean snap)
Creates a diagram.
|
Diagram |
createDiagram(java.lang.String diagramTypeId,
java.lang.String diagramName,
int horizontalGridUnit,
int verticalGridUnit,
boolean snap)
Creates a diagram.
|
FixPointAnchor |
createFixPointAnchor(AnchorContainer anchorContainer)
Creates a fix point anchor inside the given anchor container.
|
FreeFormConnection |
createFreeFormConnection(Diagram diagram)
Creates a free form connection inside the given diagram.
|
ManhattanConnection |
createManhattanConnection(Diagram diagram)
Creates a manhattan connection inside the given diagram.
|
Shape |
createShape(ContainerShape parentContainerShape,
boolean active)
Creates a shape inside the given parent container shape.
|
void |
deletePictogramElement(PictogramElement pe)
Deletes the given pictogram element (and with it all aggregated
elements!).
|
void |
deletePictogramElementIgnoringCrossReferences(java.lang.Iterable<PictogramElement> pes)
Deletes the given pictogram elements (and with it all aggregated
elements!).
|
void |
deletePictogramElementIgnoringCrossReferences(PictogramElement pe)
Deletes the given pictogram element (and with it all aggregated
elements!).
|
PictogramElement |
getActiveContainerPe(GraphicsAlgorithm ga)
Gets the active container pe.
|
PictogramElement |
getActiveContainerPe(PictogramElement pictogramElement)
Gets the active container pe.
|
java.util.List<Connection> |
getAllConnections(Anchor anchor)
Returns all connections of an anchor.
|
java.util.List<Connection> |
getAllConnections(AnchorContainer anchorContainer)
Returns all connections of an anchor container.
|
java.util.Collection<PictogramElement> |
getAllContainedPictogramElements(PictogramElement pe)
Gets the all contained pictogram elements.
|
java.util.Collection<Shape> |
getAllContainedShapes(ContainerShape cs)
Returns all the contained container shapes.
|
Anchor |
getChopboxAnchor(AnchorContainer anchorContainer)
Gets the chopbox anchor.
|
ILocation |
getConnectionMidpoint(Connection c,
double d)
Gets the connection midpoint.
|
Diagram |
getDiagramForAnchor(Anchor anchor)
Returns the diagram for the given anchor.
|
Diagram |
getDiagramForPictogramElement(PictogramElement pe)
Returns the diagram for the given pictogram element.
|
Diagram |
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.
|
IRectangle |
getGaBoundsForAnchor(Anchor anchor)
Returns the bounds of the graphics algorithm, which is referenced by the
anchor.
|
java.util.List<Connection> |
getIncomingConnections(AnchorContainer anchorContainer)
Returns the incoming connections of an anchor container.
|
java.lang.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.
|
ILocationInfo |
getLocationInfo(Shape shape,
int x,
int y)
Returns the location info for a specific position inside a shape.
|
ILocation |
getLocationRelativeToDiagram(Anchor anchor)
Returns the location of the anchor relative to the diagram.
|
ILocation |
getLocationRelativeToDiagram(Shape shape)
Returns the location of the shape relative to the diagram.
|
java.util.List<Connection> |
getOutgoingConnections(AnchorContainer anchorContainer)
Returns the outgoing connections of an anchor container.
|
java.util.Collection<PictogramElement> |
getPictogramElementChildren(PictogramElement pe)
Returns a pictogram element's children.
|
PictogramElement |
getPictogramElementParent(PictogramElement pe)
Gets the pictogram element parent.
|
Property |
getProperty(PropertyContainer propertyContainer,
java.lang.String key)
Returns the property of a given property container for a specific key.
|
java.lang.String |
getPropertyValue(PropertyContainer propertyContainer,
java.lang.String key)
Returns the first element of the property values of a given property
container for a specific key.
|
void |
moveBendpoints(IExecutionInfo executionInfo)
Move bendpoints.
|
boolean |
removeProperty(PropertyContainer propertyContainer,
java.lang.String key)
Removes the property of a given property container for a specific key.
|
void |
sendToBack(Shape shape)
Reorders parent's children to make the given shape the backmost one.
|
void |
sendToFront(Shape shape)
Reorders parent's children to make the given shape the frontmost one.
|
void |
setPropertyValue(PropertyContainer propertyContainer,
java.lang.String key,
java.lang.String value)
Sets/modifies the property's value of a given property container for a
specific key.
|
public BoxRelativeAnchor createBoxRelativeAnchor(AnchorContainer anchorContainer)
IPeCreateService
createBoxRelativeAnchor
in interface IPeCreateService
anchorContainer
- the anchors parentpublic ChopboxAnchor createChopboxAnchor(AnchorContainer anchorContainer)
IPeCreateService
createChopboxAnchor
in interface IPeCreateService
anchorContainer
- the anchors parentpublic ConnectionDecorator createConnectionDecorator(Connection connection, boolean active, double location, boolean isRelative)
IPeCreateService
createConnectionDecorator
in interface IPeCreateService
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 midpointpublic ContainerShape createContainerShape(ContainerShape parentContainerShape, boolean active)
IPeCreateService
createContainerShape
in interface IPeCreateService
parentContainerShape
- the parent container shapeactive
- true
, if the created shape should be active,
false
otherwise. 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 its
PictogramElement
children, 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.
public Diagram createDiagram(java.lang.String diagramTypeId, java.lang.String diagramName)
IPeCreateService
createDiagram
in interface IPeCreateService
diagramTypeId
- the type id of the diagramdiagramName
- the name of the diagramIPeCreateService.createDiagram(String diagramTypeId, String diagramName, boolean
snap)
public Diagram createDiagram(java.lang.String diagramTypeId, java.lang.String diagramName, boolean snap)
IPeCreateService
createDiagram
in interface IPeCreateService
diagramTypeId
- the type id of the diagramdiagramName
- the name of the diagramsnap
- TRUE enables snap to gridIPeCreateService.createDiagram(String diagramTypeId, String diagramName, int
gridUnit, boolean snap)
public Diagram createDiagram(java.lang.String diagramTypeId, java.lang.String diagramName, int gridUnit, boolean snap)
IPeCreateService
createDiagram
in interface IPeCreateService
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 gridpublic Diagram createDiagram(java.lang.String diagramTypeId, java.lang.String diagramName, int horizontalGridUnit, int verticalGridUnit, boolean snap)
IPeCreateService
createDiagram
in interface IPeCreateService
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 gridpublic FixPointAnchor createFixPointAnchor(AnchorContainer anchorContainer)
IPeCreateService
createFixPointAnchor
in interface IPeCreateService
anchorContainer
- the anchors parentpublic FreeFormConnection createFreeFormConnection(Diagram diagram)
IPeCreateService
createFreeFormConnection
in interface IPeCreateService
diagram
- the diagrampublic ManhattanConnection createManhattanConnection(Diagram diagram)
IPeCreateService
createManhattanConnection
in interface IPeCreateService
diagram
- the diagrampublic CompositeConnection createCompositeConnection(Diagram diagram)
IPeCreateService
CompositeConnection
s
can be used to combine any number of CurvedConnection
s into one
semantical connection using its CompositeConnection.getChildren()
relation. Note that the composite connection itself needs to have an
associated GraphicsAlgorithm
(usually a Polyline
) for its
visualization, although it might be invisible and only the child
connections have a visible polyline as their visualization.createCompositeConnection
in interface IPeCreateService
diagram
- the diagrampublic CurvedConnection createCurvedConnection(double[] xy, Diagram diagram)
IPeCreateService
createCurvedConnection
in interface IPeCreateService
xy
- an array of double value pairs defining the control points
(two values - x and y - define the point) of the Bezier curvediagram
- the diagrampublic Shape createShape(ContainerShape parentContainerShape, boolean active)
IPeCreateService
createShape
in interface IPeCreateService
parentContainerShape
- the parent container shapeactive
- true
, if the created shape should be active,
false
otherwise. 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 its PictogramElement
children, 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.
public void deletePictogramElement(PictogramElement pe)
IPeService
IPeService.deletePictogramElementIgnoringCrossReferences(Iterable)
and
IPeService.deletePictogramElementIgnoringCrossReferences(PictogramElement)
instead.deletePictogramElement
in interface IPeService
pe
- The pictogram element to deletepublic void deletePictogramElementIgnoringCrossReferences(PictogramElement pe)
IPeService
IPeService.deletePictogramElement(PictogramElement)
. In case you need to
follow cross references as well and update them you will need to use
IPeService.deletePictogramElement(PictogramElement)
instead.deletePictogramElementIgnoringCrossReferences
in interface IPeService
pe
- The pictogram element to deletepublic void deletePictogramElementIgnoringCrossReferences(java.lang.Iterable<PictogramElement> pes)
IPeService
IPeService.deletePictogramElement(PictogramElement)
. In case you need to
follow cross references as well and update them you will need to use
IPeService.deletePictogramElement(PictogramElement)
instead.deletePictogramElementIgnoringCrossReferences
in interface IPeService
pes
- The pictogram elements to deletepublic PictogramElement getActiveContainerPe(GraphicsAlgorithm ga)
IPeService
getActiveContainerPe
in interface IPeService
ga
- the gapublic PictogramElement getActiveContainerPe(PictogramElement pictogramElement)
IPeService
getActiveContainerPe
in interface IPeService
pictogramElement
- the pictogram elementpublic java.util.List<Connection> getAllConnections(Anchor anchor)
IPeService
getAllConnections
in interface IPeService
anchor
- the anchorpublic java.util.List<Connection> getAllConnections(AnchorContainer anchorContainer)
IPeService
getAllConnections
in interface IPeService
anchorContainer
- the anchor containerpublic java.util.Collection<PictogramElement> getAllContainedPictogramElements(PictogramElement pe)
IPeService
getAllContainedPictogramElements
in interface IPeService
pe
- the pepublic java.util.Collection<Shape> getAllContainedShapes(ContainerShape cs)
IPeService
getAllContainedShapes
in interface IPeService
cs
- the container shapepublic Anchor getChopboxAnchor(AnchorContainer anchorContainer)
IPeService
getChopboxAnchor
in interface IPeService
anchorContainer
- the anchor containerpublic ILocation getConnectionMidpoint(Connection c, double d)
IPeLayoutService
getConnectionMidpoint
in interface IPeLayoutService
c
- the connectiond
- a relative location on the connection (must be between 0 and
1)public Diagram getDiagramForAnchor(Anchor anchor)
IPeService
getDiagramForAnchor
in interface IPeService
anchor
- the anchorpublic Diagram getDiagramForPictogramElement(PictogramElement pe)
IPeService
getDiagramForPictogramElement
in interface IPeService
pe
- the pepublic Diagram getDiagramForShape(Shape shape)
IPeService
getDiagramForShape
in interface IPeService
shape
- the shapepublic org.eclipse.emf.ecore.EObject[] getElementsNotInDiagram(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram)
IPeService
getElementsNotInDiagram
in interface IPeService
elements
- the elementsdiagram
- the diagpublic IRectangle getGaBoundsForAnchor(Anchor anchor)
IPeLayoutService
getGaBoundsForAnchor
in interface IPeLayoutService
anchor
- the anchorpublic java.util.List<Connection> getIncomingConnections(AnchorContainer anchorContainer)
IPeService
getIncomingConnections
in interface IPeService
anchorContainer
- the anchor containerpublic java.lang.Object[] getLinkedPictogramElements(org.eclipse.emf.ecore.EObject[] elements, Diagram diagram)
IPeService
getLinkedPictogramElements
in interface IPeService
elements
- the elementsdiagram
- the diagpublic ILocationInfo getLocationInfo(Shape shape, int x, int y)
IPeLayoutService
getLocationInfo
in interface IPeLayoutService
shape
- the shapex
- x coordinatey
- y coordinateILocationInfo
public ILocation getLocationRelativeToDiagram(Anchor anchor)
IPeLayoutService
getLocationRelativeToDiagram
in interface IPeLayoutService
anchor
- the given anchorpublic ILocation getLocationRelativeToDiagram(Shape shape)
IPeLayoutService
getLocationRelativeToDiagram
in interface IPeLayoutService
shape
- the given shapepublic java.util.List<Connection> getOutgoingConnections(AnchorContainer anchorContainer)
IPeService
getOutgoingConnections
in interface IPeService
anchorContainer
- the anchor containerpublic java.util.Collection<PictogramElement> getPictogramElementChildren(PictogramElement pe)
IPeService
getPictogramElementChildren
in interface IPeService
pe
- the given pictogram elementpublic PictogramElement getPictogramElementParent(PictogramElement pe)
IPeService
getPictogramElementParent
in interface IPeService
pe
- the pepublic Property getProperty(PropertyContainer propertyContainer, java.lang.String key)
IPeService
getProperty
in interface IPeService
propertyContainer
- The property container (e.g. PictogramElement or
GraphicsAlgorithm)key
- The property keypublic java.lang.String getPropertyValue(PropertyContainer propertyContainer, java.lang.String key)
IPeService
getPropertyValue
in interface IPeService
propertyContainer
- The property container (e.g. PictogramElement or
GraphicsAlgorithm)key
- The property keypublic void moveBendpoints(IExecutionInfo executionInfo)
IPeService
moveBendpoints
in interface IPeService
executionInfo
- the execution infopublic boolean removeProperty(PropertyContainer propertyContainer, java.lang.String key)
IPeService
removeProperty
in interface IPeService
propertyContainer
- The property container (e.g. PictogramElement or
GraphicsAlgorithm)key
- The property keypublic void sendToBack(Shape shape)
IPeService
sendToBack
in interface IPeService
shape
- shape to make the backmost onepublic void sendToFront(Shape shape)
IPeService
sendToFront
in interface IPeService
shape
- shape to make the frontmost onepublic void setPropertyValue(PropertyContainer propertyContainer, java.lang.String key, java.lang.String value)
IPeService
setPropertyValue
in interface IPeService
propertyContainer
- The property container (e.g. PictogramElement or
GraphicsAlgorithm)key
- The property keyvalue
- The new property value