環境:Eclipse 3.4.1 (eclipse-modeling-ganymede-SR1-incubation-win32)
GMFのコネクション制御を行うEditPart基底クラス。
org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart extends AbstractConnectionEditPart
protected void refreshVisuals() {
super.refreshVisuals();
refreshVisibility();
refreshForegroundColor();
refreshRoutingStyles();
refreshSmoothness();
refreshJumplinks();
refreshBendpoints();
refreshFont();
}
フィガーの作成・・・いちいちテンプレートメソッド・・・
final protected IFigure createFigure() {
return createConnectionFigure();
}
abstract protected Connection createConnectionFigure();
installRouterメソッド内で、Styleに設定したルーティングより使用するルーティングクラスが決定する。
ルーティングクラスはレイヤーより取得している・・・
org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx extends ConnectionLayer
protected void installRouter() {
ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
RoutingStyle style = (RoutingStyle) ((View) getModel())
.getStyle(NotationPackage.Literals.ROUTING_STYLE);
if (style != null && cLayer instanceof ConnectionLayerEx) {
ConnectionLayerEx cLayerEx = (ConnectionLayerEx) cLayer;
Routing routing = style.getRouting();
if (Routing.MANUAL_LITERAL == routing) {
getConnectionFigure().setConnectionRouter(
cLayerEx.getObliqueRouter());
} else if (Routing.RECTILINEAR_LITERAL == routing) {
getConnectionFigure().setConnectionRouter(
cLayerEx.getRectilinearRouter());
} else if (Routing.TREE_LITERAL == routing) {
getConnectionFigure().setConnectionRouter(
cLayerEx.getTreeRouter());
}
}
refreshRouterChange();
}
例えば
org.eclipse.gmf.runtime.draw2d.ui.internal.routers.RectilinearRouter
org.eclipse.gmf.runtime.draw2d.ui.internal.routers.BorderItemRectilinearRouter
とか
refreshBendpoints内でモデルから制約を取得してルーターにセットしている
最終更新:2009年01月08日 14:19