本文整理匯總了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 );
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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());
}
示例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++;
}
}
示例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;
}
示例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);
}