• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HandleBounds类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.gef.handles.HandleBounds的典型用法代码示例。如果您正苦于以下问题:Java HandleBounds类的具体用法?Java HandleBounds怎么用?Java HandleBounds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	Rectangle tempRect = figure.getBounds();
	if (figure instanceof HandleBounds)
		tempRect = ((HandleBounds) figure).getHandleBounds();
	Graphics2D g = ComponentFigure.getG2D(graphics);
	if (g != null) {
		Stroke oldStroke = g.getStroke();
		g.setStroke(new BasicStroke(0.1f));

		if (getColor() != null)
			g.setColor((J2DGraphics.toAWTColor(getColor())));
		g.drawRect(tempRect.x, tempRect.y, tempRect.width - 1, tempRect.height - 1);

		g.setStroke(oldStroke);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:ElementLineBorder.java


示例2: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void paint(Graphics graphics) {
	Rectangle b = (this instanceof HandleBounds) ? ((HandleBounds) this).getHandleBounds() : this.getBounds();
	try {
		graphics.translate(b.x, b.y);
		Graphics2D graphics2d = getG2D(graphics);
		if (graphics2d != null) {
			if (drawVisitor != null) {
				drawVisitor.setGraphics2D(graphics2d);

				draw(drawVisitor, jrElement);
			} else
				graphics2d.drawRect(b.x, b.y, b.width, b.height);
		} else {
			System.out.println("not a 2d");
		}
	} catch (Exception e) {
		// when a font is missing exception is thrown by DrawVisitor
		// FIXME: maybe draw something, else?
		e.printStackTrace();
	} finally {
		graphics.translate(-b.x, -b.y);
	}
	paintBorder(graphics);
	paintDecorators(graphics);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:ComponentFigure.java


示例3: PreferredSizeSquareHandle

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
public PreferredSizeSquareHandle(GraphicalEditPart editpart) {
	super(editpart, new RelativeLocator(getHostFigure(), 0.75, 1) {
		protected Rectangle getReferenceBox() {
			IFigure f = getReferenceFigure();
			if (f instanceof HandleBounds)
				return ((HandleBounds) f).getHandleBounds();
			return super.getReferenceBox();
		}
	});
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:11,代码来源:PreferredSizeHandlerEditPolicy.java


示例4: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void paint(Graphics graphics) {
	Rectangle b = (this instanceof HandleBounds) ? ((HandleBounds) this).getHandleBounds() : this.getBounds();

	Graphics2D g = ComponentFigure.getG2D(graphics);
	if (g != null) {
		g.setPaint(tp);
		g.fillRect(b.x, b.y, b.width - 1, b.height - 1);
	}
	paintBorder(graphics);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:12,代码来源:EmptyCellFigure.java


示例5: relocate

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void relocate(IFigure target) {
	IFigure reference = getReferenceFigure();
	Rectangle referenceBox = ((HandleBounds) reference).getHandleBounds();
	Rectangle targetBounds = new PrecisionRectangle(referenceBox.getResized(-1, -1));
	reference.translateToAbsolute(targetBounds);
	target.translateToRelative(targetBounds);
	targetBounds.resize(1, 1);

	int w = 2;
	int h = 2;
	switch (direction & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		w = targetBounds.width;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((h / 2))) + 1;
		break;
	case PositionConstants.SOUTH:
		w = targetBounds.width;
		targetBounds.y += (int) (targetBounds.height * relativeY - (h / 2)) - 1;
		targetBounds.x += -1;
		break;
	}
	switch (direction & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		h = targetBounds.height;
		targetBounds.y += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (w / 2)) - 1;
		break;
	case PositionConstants.EAST:
		h = targetBounds.height;
		targetBounds.y += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (w / 2) - 1);
		break;
	}

	targetBounds.setSize(w, h);
	target.setBounds(targetBounds);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:39,代码来源:CellResizeHandleLocator.java


示例6: getConstraintFor

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
	// if (child instanceof IContainerPart) {
	// return ((IContainerPart) child).getConstraintFor(request, child);
	// }
	// If we are dragging a band, we need to check the bounds and suggest a
	// proper
	// new location accordingly with the max and min band size.
	IFigure figure = child.getFigure();
	Rectangle bounds = figure.getBounds();
	if (figure instanceof HandleBounds) {
		bounds = ((HandleBounds) figure).getHandleBounds();
		// if (request.getResizeDirection() == PositionConstants.NORTH
		// || request.getResizeDirection() == PositionConstants.SOUTH)
		bounds.width--;
		// if (request.getResizeDirection() == PositionConstants.EAST
		// || request.getResizeDirection() == PositionConstants.WEST)
		bounds.height--;
	}
	Rectangle rect = new PrecisionRectangle(bounds);
	figure.translateToAbsolute(rect);
	rect = request.getTransformedRectangle(rect);
	figure.translateToRelative(rect);
	rect.translate(getLayoutOrigin().getNegated());
	if (request.getSizeDelta().width == 0 && request.getSizeDelta().height == 0) {
		Rectangle cons = getCurrentConstraintFor(child);
		if (cons != null) // Bug 86473 allows for unintended use of this method
			rect.setSize(cons.width, cons.height);
	} else { // resize
		Dimension minSize = getMinimumSizeFor(child);
		if (rect.width < minSize.width) {
			rect.width = minSize.width;
		}
		if (rect.height < minSize.height) {
			rect.height = minSize.height;
		}
	}
	return getConstraintFor(rect);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:40,代码来源:PageLayoutEditPolicy.java


示例7: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
public void paint(IFigure figure, Graphics graphics, Insets insets) {

		Graphics2D g = ComponentFigure.getG2D(graphics);
		if (g != null) {
			org.eclipse.draw2d.geometry.Rectangle bounds = figure.getBounds();
			if (figure instanceof HandleBounds)
				bounds = ((HandleBounds) figure).getHandleBounds();

			paintShadowBorder(g, bounds.x - insets.left, bounds.y - insets.top, bounds.width + insets.right + insets.left,
					bounds.height + insets.top + insets.bottom);
		}

	}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:14,代码来源:ShadowBorder.java


示例8: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	Rectangle bounds = figure.getBounds();
	if (figure instanceof HandleBounds)
		bounds = ((HandleBounds) figure).getHandleBounds();

	Graphics2D g = ComponentFigure.getG2D(graphics);
	if (g != null) {
		Stroke oldStroke = g.getStroke();

		g.setStroke(new BasicStroke(0.1f));

		if (getColor() != null)
			g.setColor((J2DGraphics.toAWTColor(getColor())));

		int bottom = bounds.y + bounds.height - 1;
		int right = bounds.x + bounds.width - 1;

		// top left
		g.drawLine(bounds.x, bounds.y, bounds.x + o, bounds.y);
		g.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + o);
		// top right
		g.drawLine(right - o, bounds.y, right, bounds.y);
		g.drawLine(right, bounds.y, right, bounds.y + o);
		// bottom left
		g.drawLine(bounds.x, bottom, bounds.x + o, bottom);
		g.drawLine(bounds.x, bottom, bounds.x, bottom - o);
		// bottom right
		g.drawLine(right - o, bottom, right, bottom);
		g.drawLine(right, bottom, right, bottom - o);
		if (bounds.width > 50) {
			g.drawLine(bounds.x + bounds.width / 2 - o / 2, bounds.y, bounds.x + bounds.width / 2 + o / 2, bounds.y);
			g.drawLine(bounds.x + bounds.width / 2 - o / 2, bottom, bounds.x + bounds.width / 2 + o / 2, bottom);
		}
		g.setStroke(oldStroke);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:38,代码来源:CornerBorder.java


示例9: paint

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	org.eclipse.draw2d.geometry.Rectangle bounds = figure.getBounds();
	if (figure instanceof HandleBounds)
		bounds = ((HandleBounds) figure).getHandleBounds();

	paintShadowBorder(graphics, bounds.x - insets.left, bounds.y - insets.top, bounds.width + insets.right
			+ insets.left, bounds.height + insets.top + insets.bottom);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:9,代码来源:SimpleShadowBorder.java


示例10: showFocus

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
/**
 * Shows a focus rectangle around the host's figure. The focus rectangle is
 * expanded by 5 pixels from the figure's bounds.
 * 
 * @see org.eclipse.gef.editpolicies.SelectionEditPolicy#showFocus()
 */
protected void showFocus() {
	focusRect = new AbstractHandle((GraphicalEditPart) getHost(),
			new Locator() {
				public void relocate(IFigure target) {
					IFigure figure = getHostFigure();
					Rectangle r;
					if (figure instanceof HandleBounds)
						r = ((HandleBounds) figure).getHandleBounds()
								.getCopy();
					else
						r = getHostFigure().getBounds().getResized(-1, -1);
					getHostFigure().translateToAbsolute(r);
					target.translateToRelative(r);
					target.setBounds(r.expand(5, 5).resize(1, 1));
				}
			}) {
		{
			setBorder(new FocusBorder());
		}

		protected DragTracker createDragTracker() {
			return null;
		}
	};
	addFeedback(focusRect);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:33,代码来源:NonResizableEditPolicy.java


示例11: relocate

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
@Override
public void relocate(IFigure target) {
	IFigure reference = getReferenceFigure();
	Rectangle referenceBox = ((HandleBounds) reference).getHandleBounds();
	Rectangle targetBounds = new PrecisionRectangle(referenceBox.getResized(-1, -1));
	reference.translateToAbsolute(targetBounds);
	target.translateToRelative(targetBounds);
	targetBounds.resize(1, 1);

	double xzoom = GEFUtil.getZoom(editPart);

	Dimension targetSize = target.getPreferredSize();
	Dimension d = targetSize;
	if (editPart instanceof IContainerPart) {
		d = ((IContainerPart) editPart).getContaierSize();
		// Commented for back-compatibility in 3.6. 
		// Replaced with the following 3 lines.
		// d = d.getCopy().setHeight(d.height + 18).scale(xzoom);
		Dimension dcopy = d.getCopy();
		dcopy.height = d.height + 18;
		d = dcopy.scale(xzoom);
	}

	int w = 4;
	int h = 4;
	switch (direction & PositionConstants.NORTH_SOUTH) {
	case PositionConstants.NORTH:
		w = d.width + 1;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((targetSize.height)));// + 1;
		targetBounds.x = (int) Math.floor(10 * xzoom);
		break;
	case PositionConstants.SOUTH:
		w = d.width + 1;
		targetBounds.y += (int) (targetBounds.height * relativeY - ((targetSize.height))) - 1;// + 1) / 2)) + 1;
		targetBounds.x = (int) Math.floor(10 * xzoom);
		break;
	}
	switch (direction & PositionConstants.EAST_WEST) {
	case PositionConstants.WEST:
		h = d.height - (int) Math.floor(10 * xzoom);
		targetBounds.y = (int) Math.floor(7 * xzoom);// += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (targetSize.width));// + 1;// + 1;
		break;
	case PositionConstants.EAST:
		h = d.height - (int) Math.floor(10 * xzoom);
		targetBounds.y = (int) Math.floor(7 * xzoom);// += (int) relativeY - 1;
		targetBounds.x += (int) (targetBounds.width * relativeX - (targetSize.width)) - 1;// / 2);// + 1;
		break;
	}
	targetBounds.setSize(w + 1, h + 1);
	target.setBounds(targetBounds);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:53,代码来源:CellResizeHandleLocator2.java


示例12: TextOverlay

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
public TextOverlay() {
	super((GraphicalEditPart) getHost(), new MoveHandleLocator(getHostFigure()) {

		@Override
		public void relocate(IFigure target) {
			if (!getHostFigure().isShowing() 
					|| nodeText == null || nodeText.length() == 0) {
				super.relocate(target);
				return;
			}

			Rectangle figureBounds;
			if (getReference() instanceof HandleBounds) {
				figureBounds = ((HandleBounds)getReference()).getHandleBounds();
			} else {
				figureBounds = getReference().getBounds();
			}
			figureBounds = new Rectangle(figureBounds.getResized(-1, -1));
			
			int xInset = 3;
			switch (getDesiredAlignment()) {
			case TRUNCATE:
				figureBounds.x += xInset;
				figureBounds.width = figureBounds.width - 2*xInset;
				break;
			case LEFT:
				figureBounds.x += xInset;
				figureBounds.width = textSize.width + 2*xInset;
				break;
			case CENTER:
				figureBounds.x = figureBounds.x + figureBounds.width/2 - textSize.width/2;
				figureBounds.width = textSize.width + 2*xInset;
				break;
			case RIGHT:
				figureBounds.x = figureBounds.x + figureBounds.width - textSize.width - xInset;
				figureBounds.width = textSize.width + 2*xInset;
				break;
			case TRAILING:
				figureBounds.x = figureBounds.x + figureBounds.width + xInset;
				figureBounds.width = textSize.width + 2*xInset;
				break;
			}
			figureBounds.y = figureBounds.y + figureBounds.height/2 - textSize.height/2;
			
			Insets insets = target.getInsets();
			figureBounds.translate(-insets.left, -insets.top);
			figureBounds.resize(insets.getWidth() + 1, insets.getHeight() + 1);
			if (!CommonUtils.equals(target.getBounds(), figureBounds)) {
				target.setBounds(figureBounds);
			}
		}
		
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:55,代码来源:TemporalNodeDecoratorTextEditPolicy.java


示例13: getInitialFeedbackBounds

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
/**
 * Returns the bounds of the host's figure by reference to be used to
 * calculate the initial location of the feedback. The returned Rectangle
 * should not be modified. Uses handle bounds if available.
 * 
 * @return the host figure's bounding Rectangle
 */
protected Rectangle getInitialFeedbackBounds() {
	if (((GraphicalEditPart) getHost()).getFigure() instanceof HandleBounds)
		return ((HandleBounds) ((GraphicalEditPart) getHost()).getFigure())
				.getHandleBounds();
	return ((GraphicalEditPart) getHost()).getFigure().getBounds();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:14,代码来源:NonResizableEditPolicy.java


示例14: getFigureBounds

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
/**
 * Returns the rectangular contribution for the given editpart. This is the
 * rectangle with which snapping is performed.
 * 
 * @since 3.0
 * @param part
 *            the child
 * @return the rectangular guide for that part
 */
protected Rectangle getFigureBounds(GraphicalEditPart part) {
	IFigure fig = part.getFigure();
	if (fig instanceof HandleBounds)
		return ((HandleBounds) fig).getHandleBounds();
	return fig.getBounds();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:16,代码来源:SnapToGeometry.java


示例15: getInitialFeedbackBounds

import org.eclipse.gef.handles.HandleBounds; //导入依赖的package包/类
/**
 * Returns the bounds of the host's figure by reference to be used to
 * calculate the initial location of the feedback. The returned Rectangle
 * should not be modified. Uses handle bounds if available.
 * 
 * @return the host figure's bounding Rectangle
 */
protected Rectangle getInitialFeedbackBounds() {
    if (((GraphicalEditPart) getHost()).getFigure() instanceof HandleBounds)
        return ((HandleBounds) ((GraphicalEditPart) getHost()).getFigure()).getHandleBounds();
    return ((GraphicalEditPart) getHost()).getFigure().getBounds();
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:13,代码来源:MessageBendpointEditPolicy.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IndexedSeq类代码示例发布时间:2022-05-22
下一篇:
Java KRADUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap