當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。