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


Java CreateRequest.getLocation方法代码示例

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


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

示例1: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ModuleInstancePropertyNode.class) && getHost().getModel() instanceof ModuleInstanceNode) {
		ModuleInstancePropertyCreateCommand cmd = new ModuleInstancePropertyCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 2);
		cmd.setNode((ModuleInstancePropertyNode) node);
		cmd.setParent((ModuleInstanceNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ModuleInstancePropertyNode.DEF_WIDTH, ModuleInstancePropertyNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:ModuleInstanceLayoutPolicy.java

示例2: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ModuleOperationParameterNode.class) && (getHost().getModel() instanceof ModuleOperationNode)) {
		ModuleOperationNode par = (ModuleOperationNode) getHost().getModel();
		if (!(par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name()))) {
			ModuleOperationParameterCreateCommand cmd = new ModuleOperationParameterCreateCommand();
			Node node = (Node) request.getNewObject();
			node.setParent((Node) getHost().getModel());
			Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
			Point viewSize = vp.getViewLocation();
			Point p = request.getLocation();
			p.setX(p.x + viewSize.x);
			p.setY(p.y + viewSize.y);
			p = node.getAnchor(p, 2);
			cmd.setNode((ModuleOperationParameterNode) node);
			cmd.setParent((ModuleOperationNode) node.getParent());
			cmd.setLocation(new Rectangle(p.x, p.y, ModuleOperationParameterNode.DEF_WIDTH, ModuleOperationParameterNode.DEF_HEIGHT));
			ret = cmd;
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:24,代码来源:ModuleOperationLayoutPolicy.java

示例3: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ComputingNodeConfigurationNode.class) && (getHost().getModel() instanceof PlatformConfigurationNode)) {
		ComputingNodeConfigurationCreateCommand cmd = new ComputingNodeConfigurationCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((ComputingNodeConfigurationNode) node);
		cmd.setParent((PlatformConfigurationNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ComputingNodeConfigurationNode.DEF_WIDTH, ComputingNodeConfigurationNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:PlatformConfigurationLayoutPolicy.java

示例4: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalComputingPlatformNode.class) && (getHost().getModel() instanceof LogicalSystemNode)) {
		LogicalComputingPlatformCreateCommand cmd = new LogicalComputingPlatformCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		cmd.setNode((LogicalComputingPlatformNode) node);
		cmd.setParent((LogicalSystemNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingPlatformNode.DEF_WIDTH, LogicalComputingPlatformNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:20,代码来源:LogicalSystemLayoutPolicy.java

示例5: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalProcessorsNode.class) && (getHost().getModel() instanceof LogicalComputingNode)) {
		LogicalProcessorsCreateCommand cmd = new LogicalProcessorsCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 2);
		cmd.setNode((LogicalProcessorsNode) node);
		cmd.setParent((LogicalComputingNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalProcessorsNode.DEF_WIDTH, LogicalProcessorsNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:LogicalComputingLayoutPolicy.java

示例6: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(LogicalComputingNode.class) && (getHost().getModel() instanceof LogicalComputingPlatformNode)) {
		LogicalComputingCreateCommand cmd = new LogicalComputingCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((LogicalComputingNode) node);
		cmd.setParent((LogicalComputingPlatformNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingNode.DEF_WIDTH, LogicalComputingNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:LogicalComputingPlatformLayoutPolicy.java

示例7: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command ret = null;
	if (request.getNewObjectType().equals(ComponentPropertyNode.class) && (getHost().getModel() instanceof ComponentNode)) {
		ComponentPropertyNodeCreateCommand cmd = new ComponentPropertyNodeCreateCommand();
		Node node = (Node) request.getNewObject();
		node.setParent((Node) getHost().getModel());
		Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
		Point viewSize = vp.getViewLocation();
		Point p = request.getLocation();
		p.setX(p.x + viewSize.x);
		p.setY(p.y + viewSize.y);
		p = node.getAnchor(p, 1);
		cmd.setNode((ComponentPropertyNode) node);
		cmd.setParent((ComponentNode) node.getParent());
		cmd.setLocation(new Rectangle(p.x, p.y, ComponentPropertyNode.DEF_WIDTH, ComponentPropertyNode.DEF_HEIGHT));
		ret = cmd;
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:21,代码来源:ComponentNodeLayoutPolicy.java

示例8: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
@Override
protected Command getCreateCommand(CreateRequest request) {
    diagramEditDomain = (DiagramEditDomain) getHost().getViewer().getEditDomain();
    Point location = new Point(request.getLocation());
    getHostFigure().translateToRelative(location);

    // 파티션안에 파티션 생성. 계층 구조 생성.
    // if (request.getNewObject() instanceof ContainerNode) {
    // return new ActivityCreateContainerNodeCommand(diagramEditDomain,
    // getHost().getModel(), request, location);
    // }
    if (request.getNewObject() instanceof NotationNode) {
        return new ActivityCreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
    } else {
        return null;
    }

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

示例9: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
@Override
protected Command getCreateCommand(CreateRequest request) {
    diagramEditDomain = (DiagramEditDomain) getHost().getViewer().getEditDomain();
    Point location = new Point(request.getLocation());
    getHostFigure().translateToRelative(location);

    if (request.getNewObject() instanceof ContainerNode) {
        return new ActivityCreateContainerNodeCommand(diagramEditDomain, getHost(), request, location);
    } else if (request.getNewObject() instanceof NotationNode) {
        return new ActivityCreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
    } else {
        return null;
    }

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

示例10: enforceConstraintsForSizeOnDropCreate

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Ensures size constraints (by default minimum and maximum) are respected
 * by the given request. May be overwritten by clients to enforce additional
 * constraints.
 * 
 * @since 3.7
 */
protected void enforceConstraintsForSizeOnDropCreate(CreateRequest request) {
	CreateRequest createRequest = (CreateRequest) getTargetRequest();
	if (createRequest.getSize() != null) {
		// ensure create request respects minimum and maximum size
		// constraints
		PrecisionRectangle constraint = new PrecisionRectangle(
				createRequest.getLocation(), createRequest.getSize());
		((GraphicalEditPart) getTargetEditPart()).getContentPane()
				.translateToRelative(constraint);
		constraint.setSize(Dimension.max(constraint.getSize(),
				getMinimumSizeFor(createRequest)));
		constraint.setSize(Dimension.min(constraint.getSize(),
				getMaximumSizeFor(createRequest)));
		((GraphicalEditPart) getTargetEditPart()).getContentPane()
				.translateToAbsolute(constraint);
		createRequest.setSize(constraint.getSize());
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:CreationTool.java

示例11: placeComponentOnCanvasByDoubleClickOnPalette

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private void placeComponentOnCanvasByDoubleClickOnPalette(
		CreateRequest componentRequest) {
	GraphicalViewer graphViewer = graphicalViewer;

	ComponentCreateCommand createComponent = new ComponentCreateCommand(
			(hydrograph.ui.graph.model.Component) componentRequest
					.getNewObject(),
			(Container) graphViewer.getContents().getModel(),
			new Rectangle(componentRequest.getLocation(), componentRequest
					.getSize()));

	graphViewer.getEditDomain().getCommandStack().execute(createComponent);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:14,代码来源:PaletteContainerListener.java

示例12: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	if (request.getNewObjectType() == Table.class && getHost().getModel() instanceof Schema) {
		return new TableCreateCommand((Table) request.getNewObject(), (Schema) getHost().getModel(), request.getLocation());
	}
	return null;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:SchemaXYLayoutEditPolicy.java

示例13: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected Command getCreateCommand(final CreateRequest request) {
    final ERDiagramEditPart editPart = (ERDiagramEditPart) getHost();

    final Point point = request.getLocation();
    editPart.getFigure().translateToRelative(point);

    final NodeElement element = (NodeElement) request.getNewObject();
    final ERDiagram diagram = (ERDiagram) editPart.getModel();

    Dimension size = request.getSize();
    final List<NodeElement> enclosedElementList = new ArrayList<NodeElement>();

    if (size != null) {
        final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
        final double zoom = zoomManager.getZoom();
        size = new Dimension((int) (size.width / zoom), (int) (size.height / zoom));

        for (final Object child : editPart.getChildren()) {
            if (child instanceof NodeElementEditPart) {
                final NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
                final Rectangle bounds = nodeElementEditPart.getFigure().getBounds();

                if (bounds.x > point.x && bounds.x + bounds.width < point.x + size.width && bounds.y > point.y && bounds.y + bounds.height < point.y + size.height) {
                    enclosedElementList.add((NodeElement) nodeElementEditPart.getModel());
                }
            }
        }
    }

    return new CreateElementCommand(diagram, element, point.x, point.y, size, enclosedElementList);
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:36,代码来源:ERDiagramLayoutEditPolicy.java

示例14: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
@Override
protected Command getCreateCommand(CreateRequest request) {
    diagramEditDomain = (DiagramEditDomain) getHost().getViewer().getEditDomain();
    Point location = new Point(request.getLocation());
    getHostFigure().translateToRelative(location);

    if( DiagramType.SEQUENCE_DIAGRAM.equals(diagramEditDomain.getDiagram().getType()) && getHost().getModel() instanceof ContainerNode ) {
        UiUtil.eraseFeedback(getHost());
        return null;
    }
    return new CreateNotationNodeCommand(diagramEditDomain, getHost(), request, location);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:16,代码来源:DiagramLayoutEditPolicy.java

示例15: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @see ContainerEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
protected Command getCreateCommand(CreateRequest request) {
	Object newObject = request.getNewObject();
	MFrom parent = null;
	if (getHost() instanceof QueryEditPart) {
		MSQLRoot mroot = ((QueryEditPart) getHost()).getModel();
		parent = Util.getKeyword(mroot, MFrom.class);
	}
	if (getHost().getModel() instanceof MFrom)
		parent = (MFrom) getHost().getModel();
	if (parent != null)
		if (newObject instanceof Collection<?>) {
			Rectangle r = new Rectangle(10, 10, 100, 100);
			if (request.getLocation() != null) {
				r.setLocation(request.getLocation().getCopy());
				GraphicalEditPart ep = (GraphicalEditPart) getHost();
				if (getHost() instanceof QueryEditPart) {
					r.translate(-20, -20);
				} else {
					Rectangle ca = ep.getFigure().getClientArea();
					r.translate(-ca.x, -ca.y);
				}
			}
			if (request.getSize() != null) {
				r.width = request.getSize().width;
				r.height = request.getSize().height;
			}
			return new AddTableCommand(parent, (Collection<MSqlTable>) newObject, r);
		}
	return null;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:34,代码来源:FromContainerEditPolicy.java


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