本文整理汇总了Java中org.eclipse.draw2d.Connection类的典型用法代码示例。如果您正苦于以下问题:Java Connection类的具体用法?Java Connection怎么用?Java Connection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Connection类属于org.eclipse.draw2d包,在下文中一共展示了Connection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshVisuals
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
@Override
protected void refreshVisuals() {
EdgeFigure figure = (EdgeFigure) getFigure();
GWEdge model = (GWEdge) getModel();
figure.setName(model.getName());
Connection connection = getConnectionFigure();
List<AbsoluteBendpoint> figureConstraint = new ArrayList<AbsoluteBendpoint>();
Iterator<Point> iter = ((GWLink) getModel()).getBendpointsIterator();
while(iter.hasNext()) {
Point p = iter.next();
figureConstraint.add(new AbsoluteBendpoint(p));
}
connection.setRoutingConstraint(figureConstraint);
figure.setTooltipText(this.getTooltipData());
figure.setBlockedOrGuarded(model.isBlocked(),model.getGuard().getSource());
figure.setActionScripted(model.getAction().getSource());
}
示例2: getDeepestTreeLevel
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
private static int getDeepestTreeLevel(ConnectionLayer connectionLayer,
IFigure figure) {
final List<Connection> connectionList = getOutgoingConnections(
connectionLayer, figure);
if (connectionList.size() > 0) {
final int[] ret = new int[connectionList.size()];
for (int i = 0; i < connectionList.size(); i++) {
ret[i] = 1 + getDeepestTreeLevel(connectionLayer,
connectionList.get(i).getTargetAnchor().getOwner());
}
int maxLevel = ret[0];
if (ret.length > 1) {
for (int i = 1; i < ret.length; i++) {
if (ret[i] > maxLevel) {
maxLevel = ret[i];
}
}
}
return maxLevel;
}
return 0;
}
示例3: getIncomingConnections
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
/**
* Returns incoming connection figures of the figure parameter.
*
* @param connectionLayer
* @param figure
* @return
*/
public static List<Connection> getIncomingConnections(
ConnectionLayer connectionLayer, IFigure figure) {
final List<Connection> incomingConnectionList = new ArrayList<Connection>();
for (final Object object : connectionLayer.getChildren()) {
if (object instanceof Connection) {
final Connection connection = (Connection) object;
if (connection.getTargetAnchor().getOwner() == figure) {
incomingConnectionList.add(connection);
}
}
}
return incomingConnectionList;
}
示例4: getOutgoingConnections
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
/**
* Returns outgoing connection figures of the figure parameter.
*
* @param connectionLayer
* @param figure
* @return
*/
public static List<Connection> getOutgoingConnections(
ConnectionLayer connectionLayer, IFigure figure) {
final List<Connection> outgoingConnectionList = new ArrayList<Connection>();
for (final Object object : connectionLayer.getChildren()) {
if (object instanceof Connection) {
final Connection connection = (Connection) object;
if (connection.getSourceAnchor().getOwner() == figure) {
outgoingConnectionList.add(connection);
}
}
}
return outgoingConnectionList;
}
示例5: getMoveBendpointCommand
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
/**
* This method creats and returns a command for changing the position of a {@link Bendpoint}.
*
* @return {@link ORMRelationMoveBendpointCommand}
*/
@Override
protected Command getMoveBendpointCommand(final BendpointRequest request) {
final ORMRelationMoveBendpointCommand command = new ORMRelationMoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point sourceP = conn.getSourceAnchor().getReferencePoint();
Point targetP = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(sourceP);
conn.translateToRelative(targetP);
command.setRelation((Relation) request.getSource().getModel());
command.setNewDimension(p.getDifference(sourceP), p.getDifference(targetP));
command.setIndex(request.getIndex());
return command;
}
示例6: getCreateBendpointCommand
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
protected Command getCreateBendpointCommand(BendpointRequest request) {
CreateBendpointCommand cmd = new CreateBendpointCommand();
Point p = request.getLocation();
Connection conn = (Connection) getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}
示例7: getMoveBendpointCommand
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
protected Command getMoveBendpointCommand(BendpointRequest request) {
MoveBendpointCommand cmd = new MoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((com.wt.studio.plugin.modeldesigner.editor.model.NodeConnection) request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}
示例8: getCreateBendpointCommand
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
protected Command getCreateBendpointCommand(BendpointRequest request) {
CreateBendpointCommand cmd = new CreateBendpointCommand();
Point p = request.getLocation();
Connection conn = (Connection) getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((ColumnConnection)request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}
示例9: getMoveBendpointCommand
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
protected Command getMoveBendpointCommand(BendpointRequest request) {
MoveBendpointCommand cmd = new MoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
cmd.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
cmd.setConnection((ColumnConnection) request.getSource()
.getModel());
cmd.setIndex(request.getIndex());
return cmd;
}
示例10: createConnection
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
private void createConnection ( final Figure connLayer, final Label label, final Figure figure )
{
final Connection c = new PolylineConnection ();
c.setSourceAnchor ( new ChopboxAnchor ( label ) );
c.setTargetAnchor ( new ChopboxAnchor ( figure ) );
c.setConnectionRouter ( new BendpointConnectionRouter () );
connLayer.add ( c );
}
示例11: refreshVisuals
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
@Override
protected void refreshVisuals() {
Connection connection = getConnectionFigure();
List<Point> modelConstraint = ((Link) getModel()).getbPoints();
List<AbsoluteBendpoint> figureConstraint = new ArrayList<AbsoluteBendpoint>();
for (Point p : modelConstraint) {
figureConstraint.add(new AbsoluteBendpoint(p));
}
connection.setRoutingConstraint(figureConstraint);
}
示例12: addEdge
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
public SWTBotGefConnectionEditPart addEdge(String name, SWTBotGefEditPart fromPart, SWTBotGefEditPart toPart) {
editor.activateTool(GW4EGraphicalEditorPalette.TOOL_EDGE_LABEL);
editor.click(fromPart);
syncWithUIThread();
editor.click(toPart);
syncWithUIThread();
SWTBotGefConnectionEditPart edgePart = fromPart.sourceConnections().get(0);
GWLink edge = (GWLink) (edgePart.part()).getModel();
Connection edgeFigure = (Connection) edgePart.part().getFigure();
edgePart.activateDirectEdit();
editor.directEditType(name);
assertEdge(name);
return edgePart;
}
示例13: clearRecordCountAtPort
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
/**
* Clear record count from job canvas after rerun or refresh.
*/
public void clearRecordCountAtPort(){
List<Figure> labels = new ArrayList<>();
Connection connection = (Connection) getFigure();
for(Object figure:connection.getChildren()){
if(figure instanceof Label){
labels.add((Figure) figure);
}
}
for (Figure label : labels) {
connection.remove(label);
}
}
示例14: createDummyConnection
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
@Override
protected Connection createDummyConnection(Request req) {
if (req instanceof CreateUnspecifiedTypeConnectionRequest) {
if (((CreateUnspecifiedTypeConnectionRequest) req).isDirectionReversed()) {
return new TransitionFigure(getMapMode(), true);
}
}
return new TransitionFigure(getMapMode());
}
示例15: getTreeLevels
import org.eclipse.draw2d.Connection; //导入依赖的package包/类
protected List<List<TreeNode>> getTreeLevels(List<TreeNode> treeNodeList,
int level) {
final List<List<TreeNode>> levelElements = new ArrayList<List<TreeNode>>();
final List<TreeNode> nextRankElements = new ArrayList<TreeNode>();
levelElements.add(new ArrayList<TreeNode>());
levelElements.get(0).addAll(treeNodeList);
for (final TreeNode treeNode : treeNodeList) {
// Set level of the treeNode
treeNode.level = level;
if (treeNode.children.isEmpty()) {
// calculate child GraphNodes in next Rank
final List<Connection> connectionList = TreeLayoutUtil
.getTreeFigureIncomingConnections(connectionLayer,
treeNode.getFigure());
for (int i = 0; i < connectionList.size(); i++) {
final Connection connection = connectionList.get(i);
if (connection.getSourceAnchor().getOwner() != null) {
final IFigure childFig = connection.getSourceAnchor()
.getOwner();
final TreeNode childTreeNode = new TreeNode(treeNode,
childFig);
treeNode.children.add(childTreeNode);
}
}
}
treeNode.children = sortTreeNodeList(treeNode.children);
nextRankElements.addAll(treeNode.children);
}
// add ranks for childTreeNodeList
if (!nextRankElements.isEmpty()) {
levelElements.addAll(getTreeLevels(nextRankElements, ++level));
}
return levelElements;
}