当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionAnchor类代码示例

本文整理汇总了Java中org.eclipse.draw2d.ConnectionAnchor的典型用法代码示例。如果您正苦于以下问题:Java ConnectionAnchor类的具体用法?Java ConnectionAnchor怎么用?Java ConnectionAnchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionAnchor类属于org.eclipse.draw2d包,在下文中一共展示了ConnectionAnchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: anchorMoved

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * Refreshes all outgoing or incoming connections if the super classes's anchors are moved.
 */
public void anchorMoved(ConnectionAnchor anchor) {

    ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);

    // jk (later): I'm not sure why we are refreshing all the connections; might want to try to reduce the scope.
    if (cLayer.getConnectionRouter() instanceof UCMConnectionRouter)
        ((UCMConnectionRouter) cLayer.getConnectionRouter()).refreshConnections();

    List toRefresh;
    // and forks have their outputs rearranged; therefore the connection's source are rearranged.
    if (getModel() instanceof AndFork)
        toRefresh = getModelSourceConnections();
    else
        toRefresh = getModelTargetConnections();

    // when one anchor is moved, we must inform the others as we are using mutually exclusive locations.
    for (Iterator iter = toRefresh.iterator(); iter.hasNext();) {
        NodeConnection element = (NodeConnection) iter.next();
        AndForkJoinConnectionAnchor anch = (getAnchor(element));
        if (anch != anchor)
            anch.ancestorMoved(getFigure());
    }

}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:28,代码来源:AndForkJoinEditPart.java

示例2: getConnectionCreateCommand

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
protected Command getConnectionCreateCommand(
		CreateConnectionRequest request) {

	LinkCommand command = new LinkCommand();
	command.setConnection(new Link());
	command.setSource(getComponentEditPart().getCastedModel());
	ConnectionAnchor ctor = getComponentEditPart().getSourceConnectionAnchor(
			request);
	if (ctor == null)
		return null;

	command.setSourceTerminal(getComponentEditPart()
			.mapConnectionAnchorToTerminal(ctor));

	request.setStartCommand(command);
	return command;

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:NodeConnectionEditPolicy.java

示例3: getConnectionCompleteCommand

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
protected Command getConnectionCompleteCommand(
		CreateConnectionRequest request) {

	LinkCommand command = (LinkCommand) request
			.getStartCommand();
	command.setTarget(getComponentEditPart().getCastedModel());
	ConnectionAnchor ctor = getComponentEditPart().getTargetConnectionAnchor(
			request);
	if (ctor == null)
		return null;


	command.setTargetTerminal(getComponentEditPart()
			.mapConnectionAnchorToTerminal(ctor));

	return command;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:NodeConnectionEditPolicy.java

示例4: getReconnectSourceCommand

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
protected Command getReconnectSourceCommand(
		ReconnectRequest request) {
	
	Link link=(Link)request.getConnectionEditPart().getModel();
	Component comp=getComponentEditPart().getCastedModel();
	
	LinkReconnectSourceCommand cmd=new LinkReconnectSourceCommand(link);
	cmd.setOldSource(link);
	cmd.setNewSource(comp);
	ConnectionAnchor anchor=getComponentEditPart().getSourceConnectionAnchor(request);
	if(anchor==null){
		return null;
	}
	cmd.setNewSourceTerminal(getComponentEditPart().mapConnectionAnchorToTerminal(anchor));
	

	return cmd;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:NodeConnectionEditPolicy.java

示例5: getReconnectTargetCommand

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
protected Command getReconnectTargetCommand(
		ReconnectRequest request) {
	Link link=(Link)request.getConnectionEditPart().getModel();
	Component component=getComponentEditPart().getCastedModel();
	ConnectionAnchor anchor=getComponentEditPart().getTargetConnectionAnchor(request);
	if(anchor==null){
		return null;
	}
	LinkReconnectTargetCommand command=new LinkReconnectTargetCommand(link);
	command.setOldTarget(link);
	command.setNewTarget(component);
	command.setNewTargetTerminal(getComponentEditPart().mapConnectionAnchorToTerminal(anchor));
	
	return command;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:NodeConnectionEditPolicy.java

示例6: makeConnection

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
private PolylineConnection makeConnection(IFigure contents, IFigure source, NodeFigure target, Color color) {
	PolylineConnection c = new PolylineConnection();
	ConnectionAnchor targetAnchor = new ChopboxAnchor(target);
	c.setTargetAnchor(targetAnchor);
	c.setSourceAnchor(new ChopboxAnchor(source));
	PolygonDecoration decoration = new PolygonDecoration();
	decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
	c.setTargetDecoration(decoration);
	c.setForegroundColor(color);
	ConnectionMouseListener listener = new ConnectionMouseListener(c);
	c.addMouseMotionListener(listener);
	c.addMouseListener(listener);
	c.setCursor(Cursors.HAND);
	contents.add(c);
	connections.add(c);
	return c;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:18,代码来源:GraphEditPart.java

示例7: getSourceConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ConnectionAnchor getSourceConnectionAnchor(final ConnectionEditPart editPart) {
    // if (!(editPart instanceof RelationEditPart)) {
    // return super.getSourceConnectionAnchor(editPart);
    // }

    final ConnectionElement connection = (ConnectionElement) editPart.getModel();

    final Rectangle bounds = getFigure().getBounds();

    final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());

    if (connection.getSourceXp() != -1 && connection.getSourceYp() != -1) {
        anchor.setLocation(new Point(bounds.x + (bounds.width * connection.getSourceXp() / 100), bounds.y + (bounds.height * connection.getSourceYp() / 100)));
    }

    return anchor;
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:22,代码来源:NodeElementEditPart.java

示例8: getTargetConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ConnectionAnchor getTargetConnectionAnchor(final ConnectionEditPart editPart) {
    // if (!(editPart instanceof RelationEditPart)) {
    // return new ChopboxAnchor(this.getFigure());
    // }

    final ConnectionElement connection = (ConnectionElement) editPart.getModel();

    final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());

    final Rectangle bounds = getFigure().getBounds();

    if (connection.getTargetXp() != -1 && connection.getTargetYp() != -1) {
        anchor.setLocation(new Point(bounds.x + (bounds.width * connection.getTargetXp() / 100), bounds.y + (bounds.height * connection.getTargetYp() / 100)));
    }

    return anchor;
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:22,代码来源:NodeElementEditPart.java

示例9: getSourceConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public ConnectionAnchor getSourceConnectionAnchor(
		ConnectionEditPart editPart) {
	// if (!(editPart instanceof RelationEditPart)) {
	// return super.getSourceConnectionAnchor(editPart);
	// }

	Category currentCategory = getDiagram().getCurrentCategory();

	ConnectionElement connection = (ConnectionElement) editPart.getModel();

	Rectangle bounds = this.getFigure().getBounds();

	XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());

	if (connection.getSourceXp(currentCategory) != -1
	 && connection.getSourceYp(currentCategory) != -1) {

		anchor.setLocation(new Point(
				bounds.x + (bounds.width  * connection.getSourceXp(currentCategory) / 100),
				bounds.y + (bounds.height * connection.getSourceYp(currentCategory) / 100)));
	}

	return anchor;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:28,代码来源:NodeElementEditPart.java

示例10: getTargetConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public ConnectionAnchor getTargetConnectionAnchor(
		ConnectionEditPart editPart) {
	// if (!(editPart instanceof RelationEditPart)) {
	// return new ChopboxAnchor(this.getFigure());
	// }
	Category currentCategory = getDiagram().getCurrentCategory();

	ConnectionElement connection = (ConnectionElement) editPart.getModel();

	XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());

	Rectangle bounds = this.getFigure().getBounds();

	if (connection.getTargetXp(currentCategory) != -1 && connection.getTargetYp(currentCategory) != -1) {
		anchor.setLocation(new Point(
				bounds.x + (bounds.width  * connection.getTargetXp(currentCategory) / 100), 
				bounds.y + (bounds.height * connection.getTargetYp(currentCategory) / 100)));
	}

	return anchor;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:25,代码来源:NodeElementEditPart.java

示例11: getSourceConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
 */
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
    if (connection instanceof AttachementEditPart) {
        return new ChopboxAnchor(getFigure());
    }

    if (connection.getTarget() != null && connection.getSource() != null) {
        LifeLineNode sourceNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getSource().getModel());
        LifeLineNode targetNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getTarget().getModel());
        if (sourceNode.equals(targetNode)) {
            Point point = new Point(sourceNode.getX() + sourceNode.getWidth() / 2,
                ((AbstractView) connection.getModel()).getY());
            connection.getFigure().translateToAbsolute(point);
            return new XYAnchor(point);
        } else {
            return new MessageOutgoingConnectionAnchor(getFigure(), connection);
        }
    } else {
        return new MessageOutgoingConnectionAnchor(getFigure(), connection);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:LifeLineBehaviorEditPart.java

示例12: getTargetConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
 */
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
    if (connection instanceof AttachementEditPart) {
        return new ChopboxAnchor(getFigure());
    }

    if (connection.getTarget() != null && connection.getSource() != null) {
        LifeLineNode sourceNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getSource().getModel());
        LifeLineNode targetNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getTarget().getModel());
        if (sourceNode.equals(targetNode)) {
            Point point = new Point(targetNode.getX() + targetNode.getWidth() / 2,
                ((AbstractView) connection.getModel()).getY() + 10);
            connection.getFigure().translateToAbsolute(point);
            return new XYAnchor(point);
        } else {
            return new MessageIncommingConnectionAnchor(getFigure(), connection);
        }
    } else {
        return new MessageIncommingConnectionAnchor(getFigure(), connection);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:LifeLineBehaviorEditPart.java

示例13: getSourceConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart editPart) {
    if (!(editPart instanceof RelationEditPart)) {
        return super.getSourceConnectionAnchor(editPart);
    }

    final Relationship relation = (Relationship) editPart.getModel();
    final Rectangle bounds = getFigure().getBounds();
    final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
    if (relation.getSourceXp() != -1 && relation.getSourceYp() != -1) {
        anchor.setLocation(new Point(bounds.x + (bounds.width * relation.getSourceXp() / 100),
                bounds.y + (bounds.height * relation.getSourceYp() / 100)));
    }

    return anchor;
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:17,代码来源:TableViewEditPart.java

示例14: getTargetConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart editPart) {
    if (!(editPart instanceof RelationEditPart)) {
        return super.getTargetConnectionAnchor(editPart);
    }

    final Relationship relation = (Relationship) editPart.getModel();
    final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
    final Rectangle bounds = getFigure().getBounds();
    if (relation.getTargetXp() != -1 && relation.getTargetYp() != -1) {
        anchor.setLocation(new Point(bounds.x + (bounds.width * relation.getTargetXp() / 100),
                bounds.y + (bounds.height * relation.getTargetYp() / 100)));
    }

    return anchor;
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:17,代码来源:TableViewEditPart.java

示例15: getSourceConnectionAnchor

import org.eclipse.draw2d.ConnectionAnchor; //导入依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
	Object model = connection.getModel();
	if (model instanceof BinaryTemporalConstraint) {
		BinaryTemporalConstraint r = (BinaryTemporalConstraint) model;
		return new TimepointConnectionAnchor(r.getPointA().getEndpoint(), getFigure());
	} else
	if (model instanceof TemporalChainLink) {
		return new TimepointConnectionAnchor(Timepoint.END, getFigure());
	} else
	if (model instanceof TemporalBoundLink) {
		PeriodicTemporalConstraint b = ((TemporalBoundLink)model).getTarget();
		return new TimepointConnectionAnchor(b.getPoint().getEndpoint(), getFigure());
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:TemporalNodeEditPart.java


注:本文中的org.eclipse.draw2d.ConnectionAnchor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。