本文整理汇总了Java中org.eclipse.draw2d.ConnectionLayer类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionLayer类的具体用法?Java ConnectionLayer怎么用?Java ConnectionLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionLayer类属于org.eclipse.draw2d包,在下文中一共展示了ConnectionLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: anchorMoved
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的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());
}
}
示例2: createMain
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
@Override
protected IFigure createMain ()
{
final Figure baseFigure = new LayeredPane ();
final Layer rootFigure = new Layer ();
this.connLayer = new ConnectionLayer ();
this.connLayer.setAntialias ( 1 );
this.connLayer.setConnectionRouter ( ConnectionRouter.NULL );
baseFigure.add ( this.connLayer );
baseFigure.add ( rootFigure );
rootFigure.setLayoutManager ( new BorderLayout () );
rootFigure.setBackgroundColor ( ColorConstants.white );
rootFigure.add ( createArrowFigure (), BorderLayout.RIGHT );
rootFigure.add ( createEntryGrid ( this.connLayer ), BorderLayout.CENTER );
return baseFigure;
}
示例3: getDeepestTreeLevel
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的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;
}
示例4: getIncomingConnections
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的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;
}
示例5: getOutgoingConnections
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的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;
}
示例6: activate
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
public void activate() {
super.activate();
ScalableRootEditPart root = (ScalableRootEditPart) getViewer().getRootEditPart();
ConnectionLayer connLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
GraphicalEditPart contentEditPart = (GraphicalEditPart) root.getContents();
FanRouter router = new FanRouter();
router.setSeparation(100);
ShortestPathConnectionRouter spRouter = new ShortestPathConnectionRouter(contentEditPart.getFigure());
router.setNextRouter(spRouter);
connLayer.setConnectionRouter(router);
GraphSelectionManager.ME.selectionPartChanged(this);
}
示例7: createFigure
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
@Override
protected IFigure createFigure() {
Figure f = new FreeformLayer();
f.setBorder(new MarginBorder(3));
f.setLayoutManager(new FreeformLayout());
// Create the static router for the connection layer
ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
connLayer.setConnectionRouter(new ManhattanConnectionRouter());
return f;
}
示例8: prepareZoomContributions
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
private void prepareZoomContributions(GraphicalViewer viewer) {
ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
// set clipping strategy for connection layer
ConnectionLayer connectionLayer = (ConnectionLayer) root
.getLayer(LayerConstants.CONNECTION_LAYER);
connectionLayer
.setClippingStrategy(new ViewportAwareConnectionLayerClippingStrategy(
connectionLayer));
List<String> zoomLevels = new ArrayList<String>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
root.getZoomManager().setZoomLevelContributions(zoomLevels);
IAction zoomIn = new ZoomInAction(root.getZoomManager());
IAction zoomOut = new ZoomOutAction(root.getZoomManager());
viewer.setRootEditPart(root);
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
//zoom on key strokes: ctrl++ and ctrl--
IHandlerService service =
(IHandlerService)getEditorSite().getService(IHandlerService. class);
service.activateHandler(zoomIn.getActionDefinitionId(),
new ActionHandler(zoomIn));
service.activateHandler(zoomOut.getActionDefinitionId(),
new ActionHandler(zoomOut));
// Scroll-wheel Zoom
getGraphicalViewer().setProperty(
MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
MouseWheelZoomHandler.SINGLETON);
}
示例9: refreshVisuals
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
protected void refreshVisuals() {
super.refreshVisuals();
ConnectionLayer connectionLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(figure));
if ((getViewer().getControl().getStyle() & SWT.MIRRORED) == 0) {
connectionLayer.setAntialias(SWT.ON);
}
Animation.run(400);
}
示例10: initializeGraphicalViewer
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.editor.AbstractDiagramEditor#initializeGraphicalViewer()
*/
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
// ManhattanConnectionRouter 설정
if ("true".equals(PreferenceUtil.INSTANCE.getValueOfStringFieldEditor(ManagerConstant.PREFERENCE_ACTIVITYDIAGRAM_CONNECTION_ROUTER_USE))) {
ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) viewer.getRootEditPart();
ConnectionLayer connLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
connLayer.setConnectionRouter(new ManhattanConnectionRouter());
}
}
示例11: TreeLayout
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
public TreeLayout(int rankSpacing, ConnectionLayer connectionLayer) {
super();
this.rankSpacing = rankSpacing;
this.connectionLayer = connectionLayer;
isVertical = true;
isTopLeftAlignment = true;
leafSpacing = 5;
maxTreeLevel = 0;
graphSize = new Dimension();
}
示例12: createPrintableLayers
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
/**
* Creates a layered pane and the layers that should be printed.
*
* @see org.eclipse.gef.print.PrintGraphicalViewerOperation
* @return a new LayeredPane containing the printable layers
*/
protected LayeredPane createPrintableLayers() {
FreeformLayeredPane layeredPane = new FreeformLayeredPane();
layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
return layeredPane;
}
示例13: registerVisuals
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
/**
*
* Setup the connection router
*
* @see org.eclipse.gef.editparts.AbstractEditPart#registerVisuals()
*/
protected void registerVisuals() {
ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
cLayer.setConnectionRouter(new UCMConnectionRouter(getViewer().getEditPartRegistry(), (UCMmap) getDiagram()));
super.registerVisuals();
}
示例14: disconnectRouter
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
public void disconnectRouter() {
ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
if (cLayer != null) {
if (cLayer.getConnectionRouter() instanceof UCMConnectionRouter) {
UCMConnectionRouter router = (UCMConnectionRouter) cLayer.getConnectionRouter();
router.dispose();
}
cLayer.setConnectionRouter(null);
}
}
示例15: registerVisuals
import org.eclipse.draw2d.ConnectionLayer; //导入依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#registerVisuals()
*/
protected void registerVisuals() {
ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
cLayer.setConnectionRouter(new BendpointConnectionRouter());
super.registerVisuals();
}