Class GefService
- java.lang.Object
-
- org.eclipse.graphiti.ui.internal.services.impl.GefService
-
- All Implemented Interfaces:
IGefService
public class GefService extends java.lang.Object implements IGefService
A collection of static helper methods regarding GEF.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringPE
-
Constructor Summary
Constructors Constructor Description GefService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDimensioncalculateTextSize(java.lang.String text, Font font)Calculates and returns the size of the text ignoring any new line characters in the string.IDimensioncalculateTextSize(java.lang.String text, Font font, boolean handleMultiline)Calculates and returns the size of the text.org.eclipse.draw2d.geometry.PointcalculateTranslation(org.eclipse.gef.EditPart source, org.eclipse.gef.EditPart target)Returns the translation between the coordinate-systems of EditParts.org.eclipse.gef.EditPartfindEditPartAt(org.eclipse.gef.EditPartViewer viewer, org.eclipse.draw2d.geometry.Point location, boolean includeConnections)org.eclipse.draw2d.geometry.PointgetAbsolutePointOnConnection(Connection c, double distance)org.eclipse.draw2d.geometry.PointgetChopboxLocationOnBox(org.eclipse.draw2d.geometry.Point reference, org.eclipse.draw2d.geometry.Rectangle box)This method has to be kept in sync withChopboxAnchorFixed.getLocation(Point).org.eclipse.draw2d.geometry.PointgetConnectionPointAt(Connection c, double d)java.util.List<org.eclipse.gef.EditPart>getConnectionsContainedInEditPart(org.eclipse.gef.EditPart ep)Computes EditParts of the connections and related ConnectionDecorators which live inside the containment hierarchy of the given edit part.doublegetDistance(org.eclipse.draw2d.geometry.Point[] points)org.eclipse.draw2d.geometry.PointgetDistantPoint(int startX, int startY, int endX, int endY, double distance)org.eclipse.draw2d.geometry.PointgetDistantPoint(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double distance)java.util.List<org.eclipse.gef.EditPart>getEditPartChildren(org.eclipse.gef.EditPart editPart)Provides the direct children of the edit part.java.lang.ObjectgetLayoutConstraint(org.eclipse.gef.EditPart editPart)Returns the layout constraint for the given EditPart.org.eclipse.draw2d.geometry.PointgetPointAt(int startX, int startY, int endX, int endY, double d)org.eclipse.draw2d.geometry.PointgetPointAt(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double d)java.util.List<org.eclipse.gef.EditPart>getSelectedEditParts(org.eclipse.gef.EditPartViewer editPartViewer)Provides the selected edit parts of the viewer.java.util.List<org.eclipse.gef.GraphicalEditPart>getSourceConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)Provides the source connections of the graphical edit part.java.util.List<org.eclipse.gef.GraphicalEditPart>getTargetConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)Provides the target connections of the graphical edit part.voidmirrorArray(org.eclipse.draw2d.geometry.Point[] draw2dPoints)voidselectEditPart(org.eclipse.gef.EditPartViewer viewer, java.lang.Object modelObject)Selects the EditPart for the given model Object.
-
-
-
Field Detail
-
PE
protected static final java.lang.String PE
- See Also:
- Constant Field Values
-
-
Method Detail
-
selectEditPart
public void selectEditPart(org.eclipse.gef.EditPartViewer viewer, java.lang.Object modelObject)Description copied from interface:IGefServiceSelects the EditPart for the given model Object.- Specified by:
selectEditPartin interfaceIGefService- Parameters:
viewer- The viewer, which contains the EditParts.modelObject- The model Object, which EditPart to select.
-
calculateTranslation
public org.eclipse.draw2d.geometry.Point calculateTranslation(org.eclipse.gef.EditPart source, org.eclipse.gef.EditPart target)Description copied from interface:IGefServiceReturns the translation between the coordinate-systems of EditParts. It will translate from the coordinate-system of the source EditPart to the coordinate-system of the target EditPart. Both EditParts must be an instance of GraphicalEditPart. Otherwise it throws an Exception.- Specified by:
calculateTranslationin interfaceIGefService- Parameters:
source- The EditPart with the source coordinate-system.target- The EditPart with the target coordinate-system.- Returns:
- Returns the translation between the coordinate-systems of EditParts.
-
getLayoutConstraint
public java.lang.Object getLayoutConstraint(org.eclipse.gef.EditPart editPart)
Description copied from interface:IGefServiceReturns the layout constraint for the given EditPart. It returns null, if the constraint can not be determined, for example because the child has no parent or the parent has no LayoutManager.- Specified by:
getLayoutConstraintin interfaceIGefService- Parameters:
editPart- The EditPart for which to return the layout constraint.- Returns:
- Returns the layout constraint for the given EditPart.
-
findEditPartAt
public org.eclipse.gef.EditPart findEditPartAt(org.eclipse.gef.EditPartViewer viewer, org.eclipse.draw2d.geometry.Point location, boolean includeConnections)- Specified by:
findEditPartAtin interfaceIGefServicelocation- : the absolute location for the whole RootEditpart (if any, the scroll should be considered)- Returns:
-
getConnectionsContainedInEditPart
public java.util.List<org.eclipse.gef.EditPart> getConnectionsContainedInEditPart(org.eclipse.gef.EditPart ep)
Description copied from interface:IGefServiceComputes EditParts of the connections and related ConnectionDecorators which live inside the containment hierarchy of the given edit part.- Specified by:
getConnectionsContainedInEditPartin interfaceIGefService- Parameters:
ep- the EditPart whose inner connection and ConnectionDecorators should be computed
-
getConnectionPointAt
public org.eclipse.draw2d.geometry.Point getConnectionPointAt(Connection c, double d)
- Specified by:
getConnectionPointAtin interfaceIGefService- Returns:
-
getChopboxLocationOnBox
public org.eclipse.draw2d.geometry.Point getChopboxLocationOnBox(org.eclipse.draw2d.geometry.Point reference, org.eclipse.draw2d.geometry.Rectangle box)Description copied from interface:IGefServiceThis method has to be kept in sync withChopboxAnchorFixed.getLocation(Point).- Specified by:
getChopboxLocationOnBoxin interfaceIGefService
-
getAbsolutePointOnConnection
public org.eclipse.draw2d.geometry.Point getAbsolutePointOnConnection(Connection c, double distance)
- Specified by:
getAbsolutePointOnConnectionin interfaceIGefService- Returns:
-
getDistantPoint
public org.eclipse.draw2d.geometry.Point getDistantPoint(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double distance)- Specified by:
getDistantPointin interfaceIGefService
-
getDistantPoint
public org.eclipse.draw2d.geometry.Point getDistantPoint(int startX, int startY, int endX, int endY, double distance)- Specified by:
getDistantPointin interfaceIGefService
-
getPointAt
public org.eclipse.draw2d.geometry.Point getPointAt(int startX, int startY, int endX, int endY, double d)- Specified by:
getPointAtin interfaceIGefService- Returns:
-
getPointAt
public org.eclipse.draw2d.geometry.Point getPointAt(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double d)- Specified by:
getPointAtin interfaceIGefService
-
getDistance
public double getDistance(org.eclipse.draw2d.geometry.Point[] points)
- Specified by:
getDistancein interfaceIGefService
-
calculateTextSize
public IDimension calculateTextSize(java.lang.String text, Font font)
Description copied from interface:IGefServiceCalculates and returns the size of the text ignoring any new line characters in the string.- Specified by:
calculateTextSizein interfaceIGefService- Returns:
- the size of the text
- See Also:
IGefService.calculateTextSize(String, Font, boolean)
-
calculateTextSize
public IDimension calculateTextSize(java.lang.String text, Font font, boolean handleMultiline)
Description copied from interface:IGefServiceCalculates and returns the size of the text.- Specified by:
calculateTextSizein interfaceIGefServicehandleMultiline- 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 casefalsea new line character will be ignored.- Returns:
- the size of the text
-
mirrorArray
public void mirrorArray(org.eclipse.draw2d.geometry.Point[] draw2dPoints)
- Specified by:
mirrorArrayin interfaceIGefService
-
getEditPartChildren
public java.util.List<org.eclipse.gef.EditPart> getEditPartChildren(org.eclipse.gef.EditPart editPart)
Description copied from interface:IGefServiceProvides the direct children of the edit part.- Specified by:
getEditPartChildrenin interfaceIGefService- Returns:
- the direct child edit parts
-
getSourceConnections
public java.util.List<org.eclipse.gef.GraphicalEditPart> getSourceConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
Description copied from interface:IGefServiceProvides the source connections of the graphical edit part.- Specified by:
getSourceConnectionsin interfaceIGefService- Returns:
- the source connections of the graphical edit part
-
getTargetConnections
public java.util.List<org.eclipse.gef.GraphicalEditPart> getTargetConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
Description copied from interface:IGefServiceProvides the target connections of the graphical edit part.- Specified by:
getTargetConnectionsin interfaceIGefService- Returns:
- the target connections of the graphical edit part
-
getSelectedEditParts
public java.util.List<org.eclipse.gef.EditPart> getSelectedEditParts(org.eclipse.gef.EditPartViewer editPartViewer)
Description copied from interface:IGefServiceProvides the selected edit parts of the viewer.- Specified by:
getSelectedEditPartsin interfaceIGefService- Returns:
- the selected edit parts of the viewer
-
-