Search in sources :

Example 1 with Location

use of org.eclipse.gmf.runtime.notation.Location in project tdi-studio-se by Talend.

the class BusinessItemRelationshipNameViewFactory method createView.

/**
     * @generated
     */
public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
    Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
    Location location = (Location) view.getLayoutConstraint();
    IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
    location.setX(mapMode.DPtoLP(0));
    location.setY(mapMode.DPtoLP(40));
    return view;
}
Also used : Node(org.eclipse.gmf.runtime.notation.Node) IMapMode(org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode) Location(org.eclipse.gmf.runtime.notation.Location)

Example 2 with Location

use of org.eclipse.gmf.runtime.notation.Location in project tdi-studio-se by Talend.

the class DirectionalBusinessItemRelationshipNameViewFactory method createView.

/**
     * @generated
     */
public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
    Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
    Location location = (Location) view.getLayoutConstraint();
    IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
    location.setX(mapMode.DPtoLP(0));
    location.setY(mapMode.DPtoLP(40));
    return view;
}
Also used : Node(org.eclipse.gmf.runtime.notation.Node) IMapMode(org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode) Location(org.eclipse.gmf.runtime.notation.Location)

Example 3 with Location

use of org.eclipse.gmf.runtime.notation.Location in project tdi-studio-se by Talend.

the class BidirectionalBusinessItemRelationshipNameViewFactory method createView.

/**
     * @generated
     */
public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
    Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
    Location location = (Location) view.getLayoutConstraint();
    IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
    location.setX(mapMode.DPtoLP(0));
    location.setY(mapMode.DPtoLP(40));
    return view;
}
Also used : Node(org.eclipse.gmf.runtime.notation.Node) IMapMode(org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode) Location(org.eclipse.gmf.runtime.notation.Location)

Example 4 with Location

use of org.eclipse.gmf.runtime.notation.Location in project statecharts by Yakindu.

the class TransitionViewFactory method decorateView.

@SuppressWarnings("unchecked")
@Override
protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) {
    FontStyle fontStyle = NotationFactory.eINSTANCE.createFontStyle();
    view.getStyles().add(fontStyle);
    super.decorateView(containerView, view, element, semanticHint, index, persisted);
    Node label = FactoryUtils.createLabel(view, SemanticHints.TRANSITION_EXPRESSION);
    Location location = (Location) label.getLayoutConstraint();
    location.setX(0);
    location.setY(10);
}
Also used : FontStyle(org.eclipse.gmf.runtime.notation.FontStyle) Node(org.eclipse.gmf.runtime.notation.Node) Location(org.eclipse.gmf.runtime.notation.Location)

Example 5 with Location

use of org.eclipse.gmf.runtime.notation.Location in project statecharts by Yakindu.

the class SetLabelsOffsetOperation method updateGMFLabelsOffset.

/**
 * Update the offset ({@link Bounds}) of the labels {@link Node}. This method
 * must be called after setting the newPointList and the labelToUpdate. If the
 * methods {@link #setLabelsToUpdate(ConnectionEditPart)} or
 * {@link #setLabelsToUpdate(ConnectionEditPart, PointList)} are not called,
 * this method has no effect.
 */
public void updateGMFLabelsOffset() {
    if (labelsWithNewOffset != null) {
        // Update Bounds of the three labels Node (Center, Begin and End)
        Set<Entry<Node, Point>> entries = labelsWithNewOffset.entrySet();
        for (Entry<Node, Point> entry : entries) {
            LayoutConstraint layoutConstraint = entry.getKey().getLayoutConstraint();
            if (layoutConstraint instanceof Location) {
                Location bounds = (Location) layoutConstraint;
                bounds.setX(entry.getValue().x);
                bounds.setY(entry.getValue().y);
            }
        }
    }
}
Also used : Entry(java.util.Map.Entry) Node(org.eclipse.gmf.runtime.notation.Node) LayoutConstraint(org.eclipse.gmf.runtime.notation.LayoutConstraint) Point(org.eclipse.draw2d.geometry.Point) Location(org.eclipse.gmf.runtime.notation.Location)

Aggregations

Location (org.eclipse.gmf.runtime.notation.Location)6 Node (org.eclipse.gmf.runtime.notation.Node)6 IMapMode (org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode)3 Point (org.eclipse.draw2d.geometry.Point)2 LayoutConstraint (org.eclipse.gmf.runtime.notation.LayoutConstraint)2 Entry (java.util.Map.Entry)1 PointList (org.eclipse.draw2d.geometry.PointList)1 Edge (org.eclipse.gmf.runtime.notation.Edge)1 FontStyle (org.eclipse.gmf.runtime.notation.FontStyle)1 EdgeLabelQuery (org.yakindu.base.xtext.utils.gmf.routing.EdgeLabelQuery)1