本文整理汇总了Java中org.eclipse.draw2d.RectangleFigure.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java RectangleFigure.setBounds方法的具体用法?Java RectangleFigure.setBounds怎么用?Java RectangleFigure.setBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.RectangleFigure
的用法示例。
在下文中一共展示了RectangleFigure.setBounds方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showLayoutTargetFeedback
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
@Override
protected void showLayoutTargetFeedback(Request request) {
eraseLayoutTargetFeedback(request);
if (request instanceof ChangeBoundsRequest || (request instanceof CreateRequest
&& acceptCreate((CreateRequest) request))){
targetFeedback = new RectangleFigure();
Rectangle parentBounds = ((ElementEditPart)getHost()).getBounds();
translateToAbsolute(getContainerFigure(), parentBounds);
Rectangle lineBounds = parentBounds.getCopy();
lineBounds.height = 4;
lineBounds.y--;
targetFeedback.setForegroundColor(ColorConstants.green);
targetFeedback.setBackgroundColor(ColorConstants.green);
if (isInsertAfter((DropRequest) request)){
lineBounds.y += parentBounds.height;
}
targetFeedback.setBounds(lineBounds);
addFeedback(targetFeedback);
} else if (request instanceof ChangeBoundsRequest){
}
}
示例2: adjustUnderline
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
/**
* Adjust the underline figure to the proper size and position of the text.
* This is needed for that the figure looks like a hyperlink to signal that
* the figure is clickable.
*
* @param inUnderline
* RectangleFigure the figure to adjust.
* @param inLabel
* Label the label containing the text to underline, used for
* calculating the underline's width.
* @param inFont
* Font the font to adjust the underline for, used for
* calculating the underline's y position.
*/
private void adjustUnderline(final RectangleFigure inUnderline, final Label inLabel, final Font inFont) {
int lWidth = inLabel.getPreferredSize(LABEL_WIDTH, RelationsConstants.ITEM_HEIGHT).width;
if (lWidth >= LABEL_WIDTH) {
lWidth -= 5;
}
// y position is calculated from the figures y position
final int yPosFigure = getBounds().y;
final int yPos = (int) (Math
.round((double) (inFont.getFontData()[0].getHeight() + RelationsConstants.ITEM_HEIGHT) / 2))
+ (yPosFigure == 0 ? 1 : yPosFigure + 2);
// x position is taken from the underline's old x position, width is
// adjusted to the label width
final Rectangle lUnderlineBounds = new Rectangle(inUnderline.getBounds().x, yPos, lWidth, 1);
inUnderline.setBounds(lUnderlineBounds);
}
示例3: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
/**
* Creates the figure used for feedback.
*
* @return the new feedback figure
*/
protected IFigure createDragSourceFeedbackFigure() {
// Use a ghost rectangle for feedback
RectangleFigure r = new RectangleFigure();
FigureUtilities.makeGhostShape(r);
r.setLineStyle(Graphics.LINE_DOT);
r.setForegroundColor(ColorConstants.white);
r.setBounds(getInitialFeedbackBounds());
addFeedback(r);
return r;
}
示例4: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
/**
* Creates the figure used for feedback.
*
* @return the new feedback figure
*/
protected IFigure createDragSourceFeedbackFigure() {
// Use a ghost rectangle for feedback
RectangleFigure r = new ElementFeedbackFigure();
// FigureUtilities.makeGhostShape(r);
r.setLineStyle(Graphics.LINE_DOT);
r.setForegroundColor(ColorConstants.black);
r.setBounds(getInitialFeedbackBounds().resize(-1, -1));// new Rectangle(ifb.x, ifb.y, ifb.width -100,
// ifb.height));
addFeedback(r);
return r;
}
示例5: createFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
@Override
protected IFigure createFigure() {
RectangleFigure f = new RectangleFigure() {
@Override
protected void outlineShape(Graphics graphics) {
}
};
GridLayout lm = new GridLayout(2, true);
lm.horizontalSpacing = 10;
lm.verticalSpacing = 10;
f.setLayoutManager(lm);
f.setBounds(new Rectangle(10, 10, 600, 600));
f.setBorder(null);
//Event to refresh the editor when a styles is added or removed
getModel().getPropertyChangeSupport().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
//To avoid to refresh removed elements
if (getViewer() != null){
refresh();
} else {
getModel().getPropertyChangeSupport().removePropertyChangeListener(this);
}
}
});
return f;
}
示例6: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
@Override
protected IFigure createDragSourceFeedbackFigure() {
// Use a ghost rectangle for feedback
RectangleFigure r = new RectangleFigure();
r.setFill(false);
r.setLineStyle(Graphics.LINE_DOT);
r.setForegroundColor(ColorConstants.black);
r.setLineWidth(1);
r.setBounds(getInitialFeedbackBounds());
addFeedback(r);
return r;
}
示例7: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
/**
* Creates the figure used for feedback.
*
* @return the new feedback figure
*/
protected IFigure createDragSourceFeedbackFigure() {
// Use a ghost rectangle for feedback
RectangleFigure r = new RectangleFigure();
FigureUtilities.makeGhostShape(r);
r.setLineStyle(Graphics.LINE_DOT);
r.setForegroundColor(ColorConstants.white);
r.setBounds(getInitialFeedbackBounds());
addFeedback(r);
return r;
}
示例8: addBreak
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
protected void addBreak()
{
final RectangleFigure messageBreak = new RectangleFigure();
messageBreak.setBackgroundColor(ColorConstants.white);
messageBreak.setOutline(false);
final Rectangle bounds = Rectangle.SINGLETON;
bounds.x = -1;
bounds.y = -1;
bounds.width = 4;
bounds.height = 13;
messageBreak.setBounds(bounds);
messageBreak.setBorder(MessageFigure.MESSAGE_BREAK_BORDER);
add(messageBreak, new MidpointLocator(this, 0));
}
示例9: showSelectionArea
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
protected void showSelectionArea(RectangleFigure rf, Rectangle bds)
{
rf.setBounds(bds);
rf.setOutline(true);
rf.setFill(false);
//add new rectangle object to the array list
duplicatingDynamic.add(rf);
ui.getViewEditor().addInteractionFigure(rf);
}
示例10: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入方法依赖的package包/类
protected IFigure createDragSourceFeedbackFigure() {
// Use an invisible rectangle
RectangleFigure r = new RectangleFigure() {
@Override
public void paintClientArea(Graphics g) {
// g.setForegroundColor(ColorConstants.green);
// Rectangle currentBounds = getBounds();
String text = getFeedbackText();
if (g == null)
return;
Rectangle clientArea = getClientArea();
Graphics2D gr = ((J2DGraphics) g).getGraphics2D();
// Stroke oldStroke = graphics2d.getStroke();
// gr.setStroke(J2DUtils.getInvertedZoomedStroke(oldStroke, g.getAbsoluteScale()));
// draw the line
gr.setColor(Color.gray);
// Draw the label...
gr.fillOval(clientArea.x + (clientArea.width) / 2 - 3, clientArea.y - 3, 7, 7);
gr.fillOval(clientArea.x + (clientArea.width) / 2 - 3, clientArea.y + clientArea.height - 4, 7, 7);
if (clientArea.width < 20 || clientArea.height < 20) {
gr.drawLine(clientArea.x + (clientArea.width) / 2, // Half X
clientArea.y, // Half Y
clientArea.x + (clientArea.width) / 2, // Half X
clientArea.y + clientArea.height); // Up to the top of the label...
return;
}
FontMetrics fm = gr.getFontMetrics();
Rectangle2D textBounds = fm.getStringBounds(text, gr);
java.awt.Rectangle textBgBounds = new java.awt.Rectangle(clientArea.x - 30 + (clientArea.width + 60) / 2
- (int) textBounds.getWidth() / 2 - 10, clientArea.y - 30 + (clientArea.height + 60) / 2
- (int) textBounds.getHeight() / 2 - 2, (int) textBounds.getWidth() + 20, (int) textBounds.getHeight() + 4);
gr.setColor(new Color(30, 30, 30, 128));
gr.fillRoundRect(textBgBounds.x, textBgBounds.y, textBgBounds.width, textBgBounds.height, 20, 20);
/*
* gr.drawLine(clientArea.x-30, // X clientArea.y-30 + (clientArea.height+60)/2, // Half Y clientArea.x-30 +
* (clientArea.width+60 -textBgBounds.width)/ 2, // Up to the right side of the label clientArea.y-30 +
* (clientArea.height+60)/2); // Same Y...
*
* gr.drawLine(clientArea.x-30 + (clientArea.width+60 + textBgBounds.width)/ 2, // From the left side of the
* label clientArea.y-30 + (clientArea.height+60)/2, // Half Y clientArea.x-30 + clientArea.width+60, // Up to
* the full width clientArea.y-30 + (clientArea.height+60)/2); // Same Y...
*/
gr.drawLine(clientArea.x - 30 + (clientArea.width + 60) / 2, // Half X
clientArea.y - 30, // Half Y
clientArea.x - 30 + (clientArea.width + 60) / 2, // Half X
clientArea.y - 30 + (clientArea.height + 60 - textBgBounds.height) / 2); // Up to the top of the label...
gr.drawLine(clientArea.x - 30 + (clientArea.width + 60) / 2, // Half X
clientArea.y - 30 + (clientArea.height + 60 + textBgBounds.height) / 2, // // Up to the bottom of the
// label...
clientArea.x - 30 + (clientArea.width + 60) / 2, // Half X
clientArea.y - 30 + clientArea.height + 60); // Up to the bounds height...
gr.setColor(Color.white);
gr.drawString(text, textBgBounds.x + 10, textBgBounds.y + fm.getAscent());
}
};
r.setOpaque(false);
r.setFill(false);
r.setBounds(getInitialFeedbackBounds());
addFeedback(r);
return r;
}