Java 类org.eclipse.draw2d.ConnectionLocator 实例源码

项目:FRaMED    文件:ORMConnectionFigureFactory.java   
/**
 * This method creates and returns the figure for {@link Relation}s from type cyclic, total, acyclic, reflexive and
 * irreflexive, which differs from relationshipConstraint to relationshipConstraint only in the
 * text of the {@link Label}. A cyclic, total, acyclic, reflexive or irreflexive figure is dashed line with a
 * {@link Label}.
 * 
 * @return conn org.eclipse.draw2d.PolylineConnection
 * */
private static Figure createRelationshipConstraintFigure(Relation relation, EditPart editpart) {
  ORMRelationshipConstraintEditPart editP = (ORMRelationshipConstraintEditPart) editpart;

  editP.getLabel().setText(relation.getName());
  editP.setTextInitial(relation.getName());

  PolylineConnection conn = new PolylineConnection();
  conn.setAntialias(SWT.ON);
  conn.setLineDash(new float[] {5.0f, 5.0f});
  conn.setLineStyle(SWT.LINE_CUSTOM);
  conn.setConnectionRouter(new BendpointConnectionRouter());

  // add label to the connection
  ConnectionLocator loc = new ConnectionLocator(conn, ConnectionLocator.MIDDLE);
  loc.setRelativePosition(PositionConstants.SOUTH);
  loc.setGap(5);
  // this is needed, because when the label would be just added the label text could be seen in
  // the rootModel
  if (editP.getRoot().getContents() instanceof ORMCompartmentEditPart) {
    conn.add(editP.getLabel(), loc);
  }
  return conn;
}
项目:FRaMED    文件:ORMRelationshipEditPart.java   
/**
 * {@inheritDoc} In case the figures of targetLabel and sourceLabel which are {@link NamedElement}
 * s.
 */
@Override
protected void addChildVisual(final EditPart childEditPart, final int index) {
  if (childEditPart instanceof ORMNamedElementEditPart) {
    ORMNamedElementEditPart labelEditPart = (ORMNamedElementEditPart) childEditPart;
    if (labelEditPart.getModel().equals(getRelationship().getSourceLabel())) {
      getRelationFigure().getLayoutManager().setConstraint(labelEditPart.getFigure(),
          getConnectionLocator(getRelationFigure(), false));
    } else {
      getRelationFigure().getLayoutManager().setConstraint(labelEditPart.getFigure(),
          getConnectionLocator(getRelationFigure(), true));
    }
  }

  if (childEditPart instanceof ORMSuperShapeEditPart) {
    ConnectionLocator loc = new ConnectionLocator(getRelationFigure(), ConnectionLocator.MIDDLE);
    getRelationFigure().getLayoutManager().setConstraint(
        ((ORMSuperShapeEditPart) childEditPart).getFigure(), loc);
  }
  super.addChildVisual(childEditPart, index);
}
项目:DarwinSPL    文件:DwParentChildConnectionEndpointEditPolicy.java   
@Override
protected List<Object> createSelectionHandles(){
    List<Object> list = new ArrayList<Object>();
    list.add(new ConnectionEndpointHandle((ConnectionEditPart) getHost(),
            ConnectionLocator.SOURCE));
    return list;
}
项目:gef-gwt    文件:ConnectionEndpointHandle.java   
/**
 * Creates and returns a new {@link ConnectionEndpointTracker}.
 * 
 * @return the new ConnectionEndpointTracker
 */
protected DragTracker createDragTracker() {
    if (isFixed())
        return null;
    ConnectionEndpointTracker tracker;
    tracker = new ConnectionEndpointTracker((ConnectionEditPart) getOwner());
    if (endPoint == ConnectionLocator.SOURCE) {
        tracker.setCommandName(RequestConstants.REQ_RECONNECT_SOURCE);
    } else {
        tracker.setCommandName(RequestConstants.REQ_RECONNECT_TARGET);
    }
    tracker.setDefaultCursor(getCursor());
    return tracker;
}
项目:gef-gwt    文件:ConnectionEndpointEditPolicy.java   
/**
 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#createSelectionHandles()
 */
protected List createSelectionHandles() {
    List list = new ArrayList();
    list.add(new ConnectionEndpointHandle((ConnectionEditPart) getHost(),
            ConnectionLocator.SOURCE));
    list.add(new ConnectionEndpointHandle((ConnectionEditPart) getHost(),
            ConnectionLocator.TARGET));
    return list;
}
项目:FRaMED    文件:ORMConnectionFigureFactory.java   
/**
  * {@link Relation}s from type relationship have as figure a drawn through line with two
  * {@link Label}s at both ends and Label in the middle for it's name. The {@link Label} are added
  * through child model elements( {@link NamedElements}).
  * 
  * @return conn org.eclipse.draw2d.PolylineConnection
  */ 
 private static Figure createRelationshipFigure(ORMRelationshipEditPart editPart) {
   //PolylineConnection connection = new PolylineConnection();
ORMConnectionMultiplePolyline connection = new ORMConnectionMultiplePolyline();
connection.setHasConstraint(true);
   connection.setConnectionRouter(new BendpointConnectionRouter());

   // add label to the connection
   ConnectionLocator locNameLabel = new ConnectionLocator(connection, ConnectionLocator.MIDDLE);
   locNameLabel.setRelativePosition(PositionConstants.NORTH);
   locNameLabel.setGap(5);

   ConnectionLocator locConstraintLabel = new ConnectionLocator(connection, ConnectionLocator.MIDDLE);
   locConstraintLabel.setRelativePosition(PositionConstants.SOUTH);
   locConstraintLabel.setGap(5);

   // this is needed, because when the label would be just added the label text could be seen in
   // the rootModel
   if (editPart.getRoot().getContents() instanceof ORMCompartmentEditPart) {

      editPart.getNameLabel().setText(editPart.getRelationship().getName());
      connection.add(editPart.getNameLabel(), locNameLabel);

      editPart.getConstraintLabel().setText(editPart.getRelationship().getName());
      connection.add(editPart.getConstraintLabel(), locConstraintLabel);
   }
   return connection;
 }
项目:seg.jUCMNav    文件:NodeConnectionEditPart.java   
/**
 * Given a connection, draw the TimeoutPathFigure on the node connection.
 * 
 * @param connection
 */
private void addTimeout(SplineConnection connection) {
    if (timeout != null)
        getFigure().remove(timeout);
    int index = getLink().getSource().getSucc().indexOf(getLink());
    if (index == 1) {
        NodeConnectionLocator constraint = new NodeConnectionLocator(connection, ConnectionLocator.MIDDLE);
        constraint.setRelativePosition(PositionConstants.CENTER);
        timeout = new TimeoutPathFigure();
        connection.add(timeout, constraint);
    }

}
项目:seg.jUCMNav    文件:KPIModelLinkRefConnection.java   
/**
 * Sets the decoration to be used at the middle of the {@link Connection}.
 * 
 * @param dec
 *            the new decoration
 */
public void setMiddleDecoration(RotatableDecoration dec) {
    if (middleDec == dec)
        return;
    if (middleDec != null)
        remove(middleDec);
    middleDec = dec;
    if (middleDec != null) {
        add(middleDec, new NodeConnectionLocator(this, ConnectionLocator.MIDDLE));
    }
}
项目:seg.jUCMNav    文件:LinkRefConnection.java   
/**
 * Sets the decoration to be used at the middle of the {@link Connection}.
 * 
 * @param dec
 *            the new decoration
 */
public void setMiddleDecoration(RotatableDecoration dec) {
    if (middleDec == dec)
        return;
    if (middleDec != null)
        remove(middleDec);
    middleDec = dec;
    if (middleDec != null) {
        add(middleDec, new NodeConnectionLocator(this, ConnectionLocator.MIDDLE));
    }
}
项目:gef-gwt    文件:ConnectionEndHandle.java   
/**
 * Creates a new ConnectionEndHandle.
 */
public ConnectionEndHandle() {
    super(ConnectionLocator.TARGET);
}
项目:gef-gwt    文件:ConnectionStartHandle.java   
/**
 * Creates a new ConnectionStartHandle.
 */
public ConnectionStartHandle() {
    super(ConnectionLocator.TARGET);
}
项目:simplified-bpmn-example    文件:MessageFlowNameEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:simplified-bpmn-example    文件:AssociationNameEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:simplified-bpmn-example    文件:SequenceFlowNameEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel6EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel8EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel7EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel5EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:AssociationNameEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabelEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel15EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:ModelEndpointName2EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel11EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel10EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:ModelEndpointNameEditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel13EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel14EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.TARGET;
}
项目:MMINT    文件:WrappingLabel12EditPart.java   
/**
 * @generated
 */
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel18EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel15EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel20EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel25EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel17EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel23EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.TARGET;
}
项目:MMINT    文件:WrappingLabel22EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel24EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel16EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel26EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.SOURCE;
}
项目:MMINT    文件:WrappingLabel21EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.MIDDLE;
}
项目:MMINT    文件:WrappingLabel19EditPart.java   
/**
* @generated
*/
public int getKeyPoint() {
    return ConnectionLocator.TARGET;
}