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


Java Rectangle类代码示例

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


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

示例1: XYContainerController

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
public XYContainerController ( final SymbolController controller, final XYContainer element, final BasicViewElementFactory factory ) throws Exception
{
    this.figure = new Layer ();
    this.figure.setOpaque ( false );

    this.figure.setLayoutManager ( new XYLayout () );

    for ( final XYChild child : element.getChildren () )
    {
        final Controller elementController = factory.create ( controller, child.getElement () );
        final IFigure childFigure = elementController.getFigure ();

        final Rectangle rect = factory.create ( child.getPosition (), child.getDimension () );
        controller.addRawElement ( child.getName (), new XYChildController ( childFigure, rect ) );
        this.figure.add ( childFigure, rect );
    }

    controller.addElement ( element, this );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:20,代码来源:XYContainerController.java

示例2: drawPropertyStatus

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
/**
 * Draws the status image to right corner of the component
 * 
 * @param graphics
 */
private void drawPropertyStatus(Graphics graphics) {
	Rectangle rectangle = getBounds().getCopy();
	if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.WARN.name())) {
		statusImage = ImagePathConstant.COMPONENT_WARN_ICON.getImageFromRegistry();
	} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.ERROR.name())) {
		statusImage = ImagePathConstant.COMPONENT_ERROR_ICON.getImageFromRegistry();
	} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(Constants.UPDATE_AVAILABLE)) {
		statusImage = ImagePathConstant.COMPONENT_UPDATE_ICON.getImageFromRegistry();
	} else if (StringUtils.isNotBlank(getPropertyStatus()) && getPropertyStatus().equals(ValidityStatus.VALID.name())){
		statusImage=null;
	}
	logger.trace("Component has {} property status.", getPropertyStatus());
	if (statusImage != null && !statusImage.isDisposed()) {
		graphics.drawImage(statusImage, new Point(rectangle.width - 25, 8 + componentLabelMargin));
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:ComponentFigure.java

示例3: rebuildFigure

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
public void rebuildFigure() {
	getDisplay().setForegroundColor(ColorConstants.black);
	add(getDisplay());
	setConstraint(getDisplay(), new Rectangle(10, 10, -1, -1));
	setOpaque(true);
	setVisible(true);
	setForegroundColor(ServiceNode.FONT_COLOR);
	if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.PROVIDED.name()))
		setBackgroundColor(ColorConstants.green);
	else if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.REQUIRED.name()))
		setBackgroundColor(ColorConstants.orange);
	else
		setBackgroundColor(ServiceNode.DEF_COLOR);
	TooltipFigure tooltip = new TooltipFigure();
	tooltip.setMessage("Service");
	setToolTip(tooltip);
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:19,代码来源:ServiceFigure.java

示例4: getAnchor

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
public Point getAnchor(Point curr, int level) {
	int x = 0, y = 0;
	switch (level) {
	case 0:
		return curr;
	case 1:
		Rectangle lArect = getParent().getConstraints();
		x = curr.x - lArect.x;
		y = curr.y - lArect.y;
		return new Point(x, y);
	case 2:
		Rectangle lBpRect = getParent().getConstraints();
		Rectangle lBgpRect = getParent().getParent().getConstraints();
		x = curr.x - (lBpRect.x + lBgpRect.x);
		y = curr.y - (lBpRect.y + lBgpRect.y);
		return new Point(x, y);
	case 3:
		Rectangle lCpRect = getParent().getConstraints();
		Rectangle lCgpRect = getParent().getParent().getConstraints();
		Rectangle lCggpRect = getParent().getParent().getParent().getConstraints();
		x = curr.x - (lCpRect.x + lCpRect.x + lCggpRect.x);
		y = curr.y - (lCgpRect.y + lCgpRect.y + lCggpRect.y);
		return new Point(x, y);
	}
	return curr;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:27,代码来源:Node.java

示例5: getAbsolute

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
public Point getAbsolute(Point curr, int level) {
	int x = 0, y = 0;
	switch (level) {
	case 0:
		return new Point(x, y);
	case 1:
		Rectangle lArect = getParent().getConstraints();
		x = curr.x + lArect.x;
		y = curr.y + lArect.y;
		return new Point(x, y);
	case 2:
		Rectangle lBpRect = getParent().getConstraints();
		Rectangle lBgpRect = getParent().getParent().getConstraints();
		x = curr.x + (lBpRect.x + lBgpRect.x);
		y = curr.y + (lBpRect.y + lBgpRect.y);
		return new Point(x, y);
	case 3:
		Rectangle lCpRect = getParent().getConstraints();
		Rectangle lCgpRect = getParent().getParent().getConstraints();
		Rectangle lCggpRect = getParent().getParent().getParent().getConstraints();
		x = curr.x + (lCpRect.x + lCpRect.x + lCggpRect.x);
		y = curr.y + (lCgpRect.y + lCgpRect.y + lCggpRect.y);
		return new Point(x, y);
	}
	return curr;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:27,代码来源:Node.java

示例6: getCreateCommand

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的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

示例7: relocate

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
public void relocate(CellEditor celleditor) {
	Text text = (Text) celleditor.getControl();
	Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	Rectangle rect = nameLabel.getTextBounds().getCopy();
	nameLabel.translateToAbsolute(rect);
	text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:VertextCellEditorLocator.java

示例8: getCreateCommand

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的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

示例9: duplicate

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
public Vertex duplicate(GWGraph graph, int X , int Y, String name) {
	UUID uuid = UUID.randomUUID();
	if (name==null) {
		name = "v_" + ID.getId();
	}
	Vertex vertex = new SharedVertex (this.getGraph(),uuid,name,uuid.toString(),this.getSharedName());
	vertex.setBlocked(this.isBlocked());
	vertex.setGraph(this.getGraph());
	vertex.setInitScript((InitScript)this.getInitScript().clone());
	vertex.setLabel(this.getLabel());
	vertex.setRequirement((Requirement)this.getRequirement().clone());
	vertex.setShared(this.isShared());
	vertex.setStart(false);
	vertex.setProperties(this.getProperties());
	vertex.setLayout(new Rectangle(
               					X,
               					Y,
               					getLayout().width,
               					getLayout().height)
					);
	return vertex;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:23,代码来源:SharedVertex.java

示例10: createChangeConstraintCommand

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
	if (child instanceof TableEditPart && constraint instanceof Rectangle) {
		return new TableLayoutCommand((Table) child.getModel(), request, (Rectangle) constraint);
	}
	return super.createChangeConstraintCommand(request, child, constraint);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:SchemaXYLayoutEditPolicy.java

示例11: getToolTipLocation

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
private org.eclipse.swt.graphics.Point getToolTipLocation(org.eclipse.swt.graphics.Point reletiveMouseLocation,
		org.eclipse.swt.graphics.Point mouseLocation, Rectangle rectangle) {
	int subtractFromMouseX, addToMouseY;

	subtractFromMouseX = reletiveMouseLocation.x - rectangle.x;
	addToMouseY = (rectangle.y + rectangle.height) - reletiveMouseLocation.y;

	return new org.eclipse.swt.graphics.Point((mouseLocation.x - subtractFromMouseX),
			(mouseLocation.y + addToMouseY));
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:ComponentFigure.java

示例12: paintFigure

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
protected void paintFigure(Graphics g) {
	super.paintFigure(g);
	g.setForegroundColor(ColorConstants.gray);
	Rectangle r = getBounds();
	g.drawLine(r.getTopLeft(), r.getBottomRight());
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:8,代码来源:ValueFigure.java

示例13: setLocation

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
public void setLocation(Rectangle rect) {
	this.node.setConstraints(rect);
	int i = 1;
	for (Node child : node.getChild()) {
		child.setConstraints(new Rectangle(i * 50, i * 50, DynamicTriggerInstanceTerminalNode.DEF_WIDTH, DynamicTriggerInstanceTerminalNode.DEF_HEIGHT));
		i++;
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:9,代码来源:TriggerInstanceCreateCommand.java

示例14: createChangeConstraintCommand

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
	AbstractLayoutCommand command = null;
	if (child instanceof VertexPart) {
		command = new VertexChangeLayoutCommand();
	}  
	if (command == null) {
		ResourceManager.logException(new Exception(""), "Dont know how to get comand for " + child.getClass().getName());
		return UnexecutableCommand.INSTANCE;
	}
	command.setModel(child.getModel());
	command.setConstraint((Rectangle) constraint);
	return command;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:GW4EEditLayoutPolicy.java

示例15: rebuildFigure

import org.eclipse.draw2d.geometry.Rectangle; //导入依赖的package包/类
@Override
public void rebuildFigure() {
	getDisplay().setForegroundColor(ColorConstants.black);
	add(getDisplay());
	setConstraint(getDisplay(), new Rectangle(10, 10, -1, -1));
	setOpaque(true);
	setVisible(true);
	setForegroundColor(TriggerInstanceNode.FONT_COLOR);
	setBackgroundColor(TriggerInstanceNode.DEF_COLOR);
	TooltipFigure tooltip = new TooltipFigure();
	tooltip.setMessage("TriggerInstance");
	setToolTip(tooltip);
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:14,代码来源:TriggerInstanceFigure.java


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