本文整理汇总了Java中org.netbeans.modeler.specification.model.util.PModelerUtil类的典型用法代码示例。如果您正苦于以下问题:Java PModelerUtil类的具体用法?Java PModelerUtil怎么用?Java PModelerUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PModelerUtil类属于org.netbeans.modeler.specification.model.util包,在下文中一共展示了PModelerUtil类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnection
import org.netbeans.modeler.specification.model.util.PModelerUtil; //导入依赖的package包/类
public IEdgeWidget createConnection(IModelerScene scene, INodeWidget source, INodeWidget target) {
IEdgeWidget edgeWidget = null;
EdgeWidgetInfo edgeInfo = new EdgeWidgetInfo();
edgeInfo.setId("_" + NBModelerUtil.getAutoGeneratedId().toString());
edgeInfo.setName("");
if (target != null) {
edgeInfo.setSource(source.getNodeWidgetInfo().getId());
edgeInfo.setTarget(target.getNodeWidgetInfo().getId());
edgeInfo.setType(NBModelerUtil.getEdgeType(source, target, connectionContextToolId));
ModelerFile file = scene.getModelerFile();
if (!NBModelerUtil.isValidRelationship(file.getModelerDiagramModel().getRelationValidator(), source, target, edgeInfo.getType(), false)) {
return null;
}
edgeWidget = scene.createEdgeWidget(edgeInfo);
if (scene instanceof INModelerScene) {
((INModelerScene) scene).setEdgeWidgetSource(edgeInfo, source.getNodeWidgetInfo());
((INModelerScene) scene).setEdgeWidgetTarget(edgeInfo, target.getNodeWidgetInfo());
} else if (scene instanceof IPModelerScene) {
if (source instanceof IPNodeWidget && target instanceof IPNodeWidget) {
IPNodeWidget pSourceNodeWidget = (IPNodeWidget) source;
IPNodeWidget pTargetNodeWidget = (IPNodeWidget) target;
PModelerUtil modelerUtil = ((PModelerUtil) scene.getModelerFile().getModelerUtil());
((IPModelerScene) scene).setEdgeWidgetSource(edgeInfo, modelerUtil.getEdgeSourcePinWidget(pSourceNodeWidget, pTargetNodeWidget, edgeWidget));
((IPModelerScene) scene).setEdgeWidgetTarget(edgeInfo, modelerUtil.getEdgeTargetPinWidget(pSourceNodeWidget, pTargetNodeWidget, edgeWidget));
((IBaseElementWidget)edgeWidget.getSourceAnchor().getRelatedWidget()).onConnection();
((IBaseElementWidget)edgeWidget.getTargetAnchor().getRelatedWidget()).onConnection();
((IBaseElementWidget)edgeWidget).onConnection();
}
}
}
return edgeWidget;
}
示例2: getPModelerUtil
import org.netbeans.modeler.specification.model.util.PModelerUtil; //导入依赖的package包/类
public PModelerUtil getPModelerUtil() {
return (PModelerUtil) this.getModelerDiagramModel().getModelerUtil();
}