public class UiLayoutService extends java.lang.Object implements IUiLayoutService
Constructor and Description |
---|
UiLayoutService() |
Modifier and Type | Method and Description |
---|---|
IDimension |
calculateSize(GraphicsAlgorithm ga)
Calculates the size of the given graphics algorithm.
|
IDimension |
calculateSize(GraphicsAlgorithm ga,
boolean considerLineWidth)
Calculates the size of the given graphics algorithm.
|
IDimension |
calculateTextSize(AbstractText text)
Calculates the width and height of the given text in the font of the
gievn text.
|
IDimension |
calculateTextSize(java.lang.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.
|
IDimension |
calculateTextSize(java.lang.String text,
Font font,
boolean handleMultiline)
Calculates the width and height of the given text in the given font.
|
ILocation |
getConnectionMidpoint(Connection c,
double d)
Gets the connection midpoint.
|
IRectangle |
getGaBoundsForAnchor(Anchor anchor)
Returns the bounds of the graphics algorithm, which is referenced by the
anchor.
|
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.
|
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.
|
public 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 IRectangle getGaBoundsForAnchor(Anchor anchor)
IPeLayoutService
getGaBoundsForAnchor
in interface IPeLayoutService
anchor
- the anchorpublic 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 IDimension calculateSize(GraphicsAlgorithm ga)
IGaLayoutService
calculateSize
in interface IGaLayoutService
ga
- graphics algorithmpublic IDimension calculateSize(GraphicsAlgorithm ga, boolean considerLineWidth)
IGaLayoutService
calculateSize
in interface IGaLayoutService
ga
- graphics algorithmconsiderLineWidth
- if TRUE, the line width will be considered in the dimensionpublic void setHeight(GraphicsAlgorithm ga, int height)
IGaLayoutService
setHeight
in interface IGaLayoutService
ga
- graphics algorithmheight
- the new heightpublic void setLocationAndSize(GraphicsAlgorithm ga, int x, int y, int width, int height)
IGaLayoutService
setLocationAndSize
in interface IGaLayoutService
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinatewidth
- the new widthheight
- the new heightpublic void setLocationAndSize(GraphicsAlgorithm ga, int x, int y, int width, int height, boolean avoidNegativeCoordinates)
IGaLayoutService
setLocationAndSize
in interface IGaLayoutService
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.public void setLocation(GraphicsAlgorithm ga, int x, int y)
IGaLayoutService
setLocation
in interface IGaLayoutService
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinatepublic void setLocation(GraphicsAlgorithm ga, int x, int y, boolean avoidNegativeCoordinates)
IGaLayoutService
setLocation
in interface IGaLayoutService
ga
- graphics algorithmx
- the new x coordinatey
- the new y coordinateavoidNegativeCoordinates
- if TRUE, a negative coordinate will automatically set to 0.public void setSize(GraphicsAlgorithm ga, int width, int height)
IGaLayoutService
setSize
in interface IGaLayoutService
ga
- graphics algorithmwidth
- the new widthheight
- the new heightpublic void setWidth(GraphicsAlgorithm ga, int width)
IGaLayoutService
setWidth
in interface IGaLayoutService
ga
- graphics algorithmwidth
- the new widthpublic IDimension calculateTextSize(java.lang.String text, Font font, boolean handleMultiline)
IUiLayoutService
calculateTextSize
in interface IUiLayoutService
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 case true
, a
new line character in the string will increase the size of the
returned dimensions by one line, in case false
a
new line character will be ignored.public IDimension calculateTextSize(java.lang.String text, Font font)
IUiLayoutService
calculateTextSize
in interface IUiLayoutService
text
- the string to calculate the rendering size forfont
- the font which should be considered for the stringIGaLayoutService.calculateSize(org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm,
boolean)
public IDimension calculateTextSize(AbstractText text)
IUiLayoutService
MultiText
new line
characters in the string will increase the height of the returned size,
otherwise (text is a Text
) any new line characters will be
ignored.calculateTextSize
in interface IUiLayoutService
text
- the AbstractText
to calculate the rendering size for