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


Java PolylineConnection.addFigureListener方法代码示例

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


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

示例1: createFigure

import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
 */
@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection() {
        @Override
        public void paintFigure(Graphics graphics) {
            graphics.setAntialias(SWT.ON);
            super.paintFigure(graphics);
        }
    };
    connection.addFigureListener(new FigureListener() {

        /**
         * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
         */
        @SuppressWarnings("unchecked")
        public void figureMoved(IFigure source) {
            Point sourcePoint = ((PolylineConnection) source).getStart();
            Point targetPoint = ((PolylineConnection) source).getEnd();

            RootEditPart rootEditPart = (RootEditPart) getParent();
            List<EditPart> diagramEditparts = new ArrayList<EditPart>();
            diagramEditparts = rootEditPart.getChildren();
            List<EditPart> editParts = new ArrayList<EditPart>();

            for (EditPart diagramEditPart : diagramEditparts) {
                editParts = diagramEditPart.getChildren();
                for (EditPart editpart : editParts) {
                    if (editpart.getModel() instanceof LabelNode) {
                        if (((LabelNode) editpart.getModel()).getOwner() == getModel())
                            if (editpart instanceof LabelNodeEditPart) {
                                ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
                            }
                    }
                }
            }
        }
    });
    // PolygonDecoration polygonDecoreation = new PolygonDecoration();
    // polygonDecoreation.setScale(10,5);
    // connection.setTargetDecoration(polygonDecoreation);
    // connection.setLineStyle(SWT.LINE_DOT);
    // connection.addRoutingListener(RoutingAnimator.getDefault());
    // connection.setConnectionRouter(new BendpointConnectionRouter());

    connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    PolygonDecoration polygonDecoreation = new PolygonDecoration();
    polygonDecoreation.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    polygonDecoreation.setScale(10, 5);
    connection.setLineStyle(SWT.LINE_DOT);
    connection.setTargetDecoration(polygonDecoreation);
    connection.addRoutingListener(RoutingAnimator.getDefault());
    connection.setConnectionRouter(new BendpointConnectionRouter());
    return connection;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:58,代码来源:RealizationEditPart.java

示例2: createFigure

import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
 */
@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection() {
        @Override
        public void paintFigure(Graphics graphics) {
            graphics.setAntialias(SWT.ON);
            super.paintFigure(graphics);
        }
    };
    connection.setLineStyle(Graphics.LINE_DOT);
    ArrowDecoration arrow = new ArrowDecoration();
    connection.setTargetDecoration(arrow);
    connection.addRoutingListener(RoutingAnimator.getDefault());
    connection.setConnectionRouter(new BendpointConnectionRouter());
    connection.addFigureListener(new FigureListener() {

        /**
         * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
         */
        @SuppressWarnings("unchecked")
        public void figureMoved(IFigure source) {
            Point sourcePoint = ((PolylineConnection) source).getStart();
            Point targetPoint = ((PolylineConnection) source).getEnd();

            RootEditPart rootEditPart = (RootEditPart) getParent();
            List<EditPart> diagramEditparts = new ArrayList<EditPart>();
            diagramEditparts = rootEditPart.getChildren();
            List<EditPart> editParts = new ArrayList<EditPart>();

            for (EditPart diagramEditPart : diagramEditparts) {
                editParts = diagramEditPart.getChildren();
                for (EditPart editpart : editParts) {
                    if (editpart.getModel() instanceof LabelNode) {
                        if (((LabelNode) editpart.getModel()).getOwner() == getModel())
                            if (editpart instanceof LabelNodeEditPart) {
                                ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
                            }
                    }
                }
            }
        }
    });

    return connection;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:49,代码来源:DependencyEditPart.java

示例3: createFigure

import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
 */
@Override
protected IFigure createFigure() {

    settingLineCondition();

    PolylineConnection polylineConnection = new PolylineConnection() {
        @Override
        public void paintFigure(Graphics graphics) {
            graphics.setAntialias(SWT.ON);
            super.paintFigure(graphics);
        }
    };
    polylineConnection.addFigureListener(new FigureListener() {

        /**
         * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
         */
        @SuppressWarnings("unchecked")
        public void figureMoved(IFigure source) {
            Point sourcePoint = ((PolylineConnection) source).getStart();
            Point targetPoint = ((PolylineConnection) source).getEnd();

            RootEditPart rootEditPart = (RootEditPart) getParent();
            List<EditPart> diagramEditparts = new ArrayList<EditPart>();
            diagramEditparts = rootEditPart.getChildren();
            List<EditPart> editParts = new ArrayList<EditPart>();

            for (EditPart diagramEditPart : diagramEditparts) {
                editParts = diagramEditPart.getChildren();
                for (EditPart editpart : editParts) {
                    if (editpart.getModel() instanceof LabelNode) {
                        if (((LabelNode) editpart.getModel()).getOwner() == getModel()) {
                            if (editpart instanceof LabelNodeEditPart) {
                                ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
                            }
                        }

                    }
                }
            }
        }
    });

    return drawDecoration(polylineConnection);

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:50,代码来源:AssociationEditPart.java

示例4: createFigure

import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
 */
@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection() {
        @Override
        public void paintFigure(Graphics graphics) {
            graphics.setAntialias(SWT.ON);
            super.paintFigure(graphics);
        }
    };
    connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    PolygonDecoration polygonDecoreation = new PolygonDecoration();
    connection.setTargetDecoration(polygonDecoreation);
    connection.addRoutingListener(RoutingAnimator.getDefault());
    connection.setConnectionRouter(new BendpointConnectionRouter());
    connection.addFigureListener(new FigureListener() {

        /**
         * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
         */
        @SuppressWarnings("unchecked")
        public void figureMoved(IFigure source) {
            Point sourcePoint = ((PolylineConnection) source).getStart();
            Point targetPoint = ((PolylineConnection) source).getEnd();

            RootEditPart rootEditPart = (RootEditPart) getParent();
            List<EditPart> diagramEditparts = new ArrayList<EditPart>();
            diagramEditparts = rootEditPart.getChildren();
            List<EditPart> editParts = new ArrayList<EditPart>();

            for (EditPart diagramEditPart : diagramEditparts) {
                editParts = diagramEditPart.getChildren();
                for (EditPart editpart : editParts) {
                    if (editpart.getModel() instanceof LabelNode) {
                        if (((LabelNode) editpart.getModel()).getOwner() == getModel())
                            ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
                    }
                }
            }
        }
    });
    return connection;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:46,代码来源:ControlFlowEditPart.java

示例5: createFigure

import org.eclipse.draw2d.PolylineConnection; //导入方法依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure()
 */
@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection() {
        @Override
        public void paintFigure(Graphics graphics) {
            graphics.setAntialias(SWT.ON);
            super.paintFigure(graphics);
        }
    };
    connection.addFigureListener(new FigureListener() {

        /**
         * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure)
         */
        @SuppressWarnings("unchecked")
        public void figureMoved(IFigure source) {
            Point sourcePoint = ((PolylineConnection) source).getStart();
            Point targetPoint = ((PolylineConnection) source).getEnd();

            RootEditPart rootEditPart = (RootEditPart) getParent();
            List<EditPart> diagramEditparts = new ArrayList<EditPart>();
            diagramEditparts = rootEditPart.getChildren();
            List<EditPart> editParts = new ArrayList<EditPart>();

            for (EditPart diagramEditPart : diagramEditparts) {
                editParts = diagramEditPart.getChildren();
                for (EditPart editpart : editParts) {
                    if (editpart.getModel() instanceof LabelNode) {
                        if (((LabelNode) editpart.getModel()).getOwner() == getModel()) {
                            if (editpart instanceof LabelNodeEditPart) {
                                ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint);
                            }
                        }
                    }
                }
            }
        }
    });

    connection.setTargetDecoration(new ArrowDecoration());
    connection.setLineStyle(Graphics.LINE_DOT);
    connection.addRoutingListener(RoutingAnimator.getDefault());
    connection.setConnectionRouter(new BendpointConnectionRouter());
    return connection;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:49,代码来源:IncludeEditPart.java


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