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


Java CreateRequest.getSize方法代码示例

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


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

示例1: showTargetFeedback

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Factors feedback requests into two more specific methods.
 * 
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(Request)
 */
public void showTargetFeedback(Request request) {
	if (REQ_ADD.equals(request.getType())
			|| REQ_CLONE.equals(request.getType())
			|| REQ_MOVE.equals(request.getType())
			|| REQ_RESIZE_CHILDREN.equals(request.getType())
			|| REQ_CREATE.equals(request.getType()))
		showLayoutTargetFeedback(request);

	if (REQ_CREATE.equals(request.getType())) {
		CreateRequest createReq = (CreateRequest) request;
		if (createReq.getSize() != null) {
			showSizeOnDropFeedback(createReq);
		}
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:21,代码来源:LayoutEditPolicy.java

示例2: 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

示例3: 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

示例4: 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

示例5: getDropLocation

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
protected Point getDropLocation(CreateRequest request) {
	IFigure figure = getLayoutContainer();

	Point where = request.getLocation().getCopy();
	Dimension size = request.getSize();

	figure.translateToRelative(where);
	figure.translateFromParent(where);
	where.translate(getLayoutOrigin().getNegated());
	return where;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:12,代码来源:TableViewSectionEditPart.java

示例6: CreateCombinedFragmentNodeCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * @param editDomain
 * @param parentNodeModel
 * @param request
 */
public CreateCombinedFragmentNodeCommand(EditPart parentNodeEditPart, CreateRequest request, Rectangle createBounds) {
    this.editPart = parentNodeEditPart;
    this.parentNodeModel = (AbstractNode) editPart.getModel();
    this.request = request;
    this.createBounds = createBounds;
    this.size = request.getSize(); 
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:13,代码来源:CreateCombinedFragmentNodeCommand.java

示例7: 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

示例8: getCreateCommand

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

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

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

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

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

		for (Object child : editPart.getChildren()) {
			if (child instanceof NodeElementEditPart) {
				NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
				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:kozake,项目名称:ermaster-k,代码行数:45,代码来源:ERDiagramLayoutEditPolicy.java

示例9: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
    // #willanalyze what is this? by jflute
    //		if (getHost() instanceof ERModelEditPart) {
    //			ERModelEditPart editPart = (ERModelEditPart) this.getHost();
    //
    //			Point point = request.getLocation();
    //			editPart.getFigure().translateToRelative(point);
    //
    //			NodeElement element = (NodeElement) request.getNewObject();
    //			ERDiagram diagram = (ERDiagram) editPart.getModel();
    //
    //			Dimension size = request.getSize();
    //			List<NodeElement> enclosedElementList = new ArrayList<NodeElement>();
    //
    //			if (size != null) {
    //				ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
    //						.getHost().getRoot()).getZoomManager();
    //				double zoom = zoomManager.getZoom();
    //				size = new Dimension((int) (size.width / zoom),
    //						(int) (size.height / zoom));
    //
    //				for (Object child : editPart.getChildren()) {
    //					if (child instanceof NodeElementEditPart) {
    //						NodeElementEditPart nodeElementEditPart = (NodeElementEditPart) child;
    //						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);
    //		}
    final AbstractModelEditPart editPart = (AbstractModelEditPart) getHost();
    final Point point = request.getLocation();
    editPart.getFigure().translateToRelative(point);
    final DiagramWalker walker = (DiagramWalker) request.getNewObject(); // e.g. table, note, group
    final ERDiagram diagram = ERModelUtil.getDiagram(editPart);
    Dimension size = request.getSize();
    final List<DiagramWalker> enclosedElementList = new ArrayList<>();
    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 DiagramWalkerEditPart) {
                final DiagramWalkerEditPart nodeElementEditPart = (DiagramWalkerEditPart) 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((DiagramWalker) nodeElementEditPart.getModel());
                }
            }
        }
    }
    return new CreateElementCommand(diagram, walker, point.x, point.y, size, enclosedElementList);
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:67,代码来源:ERDiagramLayoutEditPolicy.java


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