Class UiLayoutService
java.lang.Object
org.eclipse.graphiti.ui.internal.services.impl.UiLayoutService
- All Implemented Interfaces:
IGaLayoutService
,ILayoutService
,IPeLayoutService
,IUiLayoutService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCalculates the size of the given graphics algorithm.calculateSize
(GraphicsAlgorithm ga, boolean considerLineWidth) Calculates the size of the given graphics algorithm.calculateTextSize
(String text, Font font) Calculates the width and height of the given text in the given font ignoring any new line characters in the string.calculateTextSize
(String text, Font font, boolean handleMultiline) Calculates the width and height of the given text in the given font.Calculates the width and height of the given text in the font of the gievn text.getConnectionMidpoint
(Connection c, double d) Gets the connection midpoint.getGaBoundsForAnchor
(Anchor anchor) Returns the bounds of the graphics algorithm, which is referenced by the anchor.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.void
setHeight
(GraphicsAlgorithm ga, int height) Sets the height of the given graphics algorithm.void
setLocation
(GraphicsAlgorithm ga, int x, int y) Sets the location of the given graphics algorithm.void
setLocation
(GraphicsAlgorithm ga, int x, int y, boolean avoidNegativeCoordinates) Sets the location of the given graphics algorithm.void
setLocationAndSize
(GraphicsAlgorithm ga, int x, int y, int width, int height) Sets location and size of the given graphics algorithm.void
setLocationAndSize
(GraphicsAlgorithm ga, int x, int y, int width, int height, boolean avoidNegativeCoordinates) Sets location and size of the given graphics algorithm.void
setSize
(GraphicsAlgorithm ga, int width, int height) Sets the size of the given graphics algorithm.void
setWidth
(GraphicsAlgorithm ga, int width) Sets the width of the given graphics algorithm.
-
Constructor Details
-
UiLayoutService
public UiLayoutService()
-
-
Method Details
-
getConnectionMidpoint
Description copied from interface:IPeLayoutService
Gets the connection midpoint.- Specified by:
getConnectionMidpoint
in interfaceIPeLayoutService
- Parameters:
c
- the connectiond
- a relative location on the connection (must be between 0 and 1)- Returns:
- the connection midpoint
-
getGaBoundsForAnchor
Description copied from interface:IPeLayoutService
Returns the bounds of the graphics algorithm, which is referenced by the anchor.- Specified by:
getGaBoundsForAnchor
in interfaceIPeLayoutService
- Parameters:
anchor
- the anchor- Returns:
- the bounds of the anchor graphics algorithm
-
getLocationInfo
Description copied from interface:IPeLayoutService
Returns 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:
getLocationInfo
in interfaceIPeLayoutService
- Parameters:
shape
- the shapex
- x coordinatey
- y coordinate- Returns:
- the location info
- See Also:
-
getLocationRelativeToDiagram
Description copied from interface:IPeLayoutService
Returns the location of the anchor relative to the diagram.- Specified by:
getLocationRelativeToDiagram
in interfaceIPeLayoutService
- Parameters:
anchor
- the given anchor- Returns:
- the relative location
-
getLocationRelativeToDiagram
Description copied from interface:IPeLayoutService
Returns the location of the shape relative to the diagram.- Specified by:
getLocationRelativeToDiagram
in interfaceIPeLayoutService
- Parameters:
shape
- the given shape- Returns:
- the relative location
-
calculateSize
Description copied from interface:IGaLayoutService
Calculates the size of the given graphics algorithm. If the graphics algorithm is a polyline or polygon then the size will be calculated. Otherwise the size of the graphics algorithm is simply returned.- Specified by:
calculateSize
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithm- Returns:
- the dimension of the given graphics algorithm
-
calculateSize
Description copied from interface:IGaLayoutService
Calculates the size of the given graphics algorithm. If the graphics algorithm is a polyline or polygon then the size will be calculated. Otherwise the size of the graphics algorithm is simply returned.- Specified by:
calculateSize
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmconsiderLineWidth
- if TRUE, the line width will be considered in the dimension- Returns:
- the dimension of the given graphics algorithm
-
setHeight
Description copied from interface:IGaLayoutService
Sets the height of the given graphics algorithm.- Specified by:
setHeight
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmheight
- the new height
-
setLocationAndSize
Description copied from interface:IGaLayoutService
Sets location and size of the given graphics algorithm.- Specified by:
setLocationAndSize
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinatewidth
- the new widthheight
- the new height
-
setLocationAndSize
public void setLocationAndSize(GraphicsAlgorithm ga, int x, int y, int width, int height, boolean avoidNegativeCoordinates) Description copied from interface:IGaLayoutService
Sets location and size of the given graphics algorithm.- Specified by:
setLocationAndSize
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinatewidth
- the new widthheight
- the new heightavoidNegativeCoordinates
- if TRUE, a negative coordinate will automatically set to 0.
-
setLocation
Description copied from interface:IGaLayoutService
Sets the location of the given graphics algorithm.- Specified by:
setLocation
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinate
-
setLocation
Description copied from interface:IGaLayoutService
Sets the location of the given graphics algorithm.- Specified by:
setLocation
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinateavoidNegativeCoordinates
- if TRUE, a negative coordinate will automatically set to 0.
-
setSize
Description copied from interface:IGaLayoutService
Sets the size of the given graphics algorithm.- Specified by:
setSize
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmwidth
- the new widthheight
- the new height
-
setWidth
Description copied from interface:IGaLayoutService
Sets the width of the given graphics algorithm.- Specified by:
setWidth
in interfaceIGaLayoutService
- Parameters:
ga
- graphics algorithmwidth
- the new width
-
calculateTextSize
Description copied from interface:IUiLayoutService
Calculates the width and height of the given text in the given font.- Specified by:
calculateTextSize
in interfaceIUiLayoutService
- Parameters:
text
- the string to calculate the rendering size forfont
- the font which should be considered for the stringhandleMultiline
- Defines if line breaks in the string should be used in the calculation of the size or not. In casetrue
, a new line character in the string will increase the size of the returned dimensions by one line, in casefalse
a new line character will be ignored.- Returns:
-
calculateTextSize
Description copied from interface:IUiLayoutService
Calculates the width and height of the given text in the given font ignoring any new line characters in the string.- Specified by:
calculateTextSize
in interfaceIUiLayoutService
- Parameters:
text
- the string to calculate the rendering size forfont
- the font which should be considered for the string- Returns:
- See Also:
-
calculateTextSize
Description copied from interface:IUiLayoutService
Calculates the width and height of the given text in the font of the gievn text. In case the given text is aMultiText
new line characters in the string will increase the height of the returned size, otherwise (text is aText
) any new line characters will be ignored.- Specified by:
calculateTextSize
in interfaceIUiLayoutService
- Parameters:
text
- theAbstractText
to calculate the rendering size for- Returns:
-