本文整理汇总了Java中org.eclipse.draw2d.RectangleFigure类的典型用法代码示例。如果您正苦于以下问题:Java RectangleFigure类的具体用法?Java RectangleFigure怎么用?Java RectangleFigure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RectangleFigure类属于org.eclipse.draw2d包,在下文中一共展示了RectangleFigure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
IFigure figure = new RectangleFigure();
((RectangleFigure) figure).setXOR(true);
((RectangleFigure) figure).setFill(true);
figure.setBackgroundColor(ghostFillColor);
figure.setForegroundColor(ColorConstants.white);
figure.setBounds(getBounds());
figure.paint(graphics);
/*Image feedbackImage = new Image(Display.getCurrent(),
ghostImageData);
graphics.setAlpha(alpha);
graphics.setClip(getBounds().getCopy());
graphics.drawImage(feedbackImage, 0, 0, ghostImageData.width,
ghostImageData.height, getBounds().x, getBounds().y,
getBounds().width, getBounds().height);
feedbackImage.dispose();*/
}
示例2: 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){
}
}
示例3: getCenterPoint
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
/**
* getCenterPoint
*
* @param nodeLabel
* @return Point
*/
private Point getCenterPoint(LabelNode nodeLabel) {
AbstractConnection abstractConnection = (AbstractConnection) nodeLabel.getOwner();
AbstractNode sourceNode = (AbstractNode) abstractConnection.getSource();
AbstractNode targetNode = (AbstractNode) abstractConnection.getTarget();
RectangleFigure sourceFigure = new RectangleFigure();
sourceFigure.setSize(sourceNode.getWidth(), sourceNode.getHeight());
sourceFigure.setLocation(new Point(sourceNode.getX(), sourceNode.getY()));
RectangleFigure targetFigure = new RectangleFigure();
targetFigure.setSize(targetNode.getWidth(), targetNode.getHeight());
targetFigure.setLocation(new Point(targetNode.getX(), targetNode.getY()));
ChopboxAnchor sourceAnchor = new ChopboxAnchor(sourceFigure);
ChopboxAnchor targetAnchor = new ChopboxAnchor(targetFigure);
Point source = new Point(sourceAnchor.getReferencePoint().x, sourceAnchor.getReferencePoint().y);
Point target = new Point(targetAnchor.getReferencePoint().x, targetAnchor.getReferencePoint().y);
Point centerPoint = new Point((source.x + target.x) / 2, (source.y + target.y) / 2);
return centerPoint;
}
示例4: createRootTreeNode
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
protected TreeNode createRootTreeNode(IFigure parent) {
final List<IFigure> rootFigures = getGraphRootFigures(parent);
if (rootFigures.size() > 1) {
// initializes a "virtual" root
// tree level (needed for correct size calculations)
RectangleFigure rootFigure = new RectangleFigure();
rootFigure.setPreferredSize(1, 1);
rootFigure.setSize(1, 1);
setConstraint(rootFigure, new Rectangle(0, 0, 0, 0));
TreeNode rootTreeNode = new TreeNode(null, rootFigure);
for (IFigure figure : rootFigures) {
rootTreeNode.children.add(new TreeNode(null, figure));
}
return rootTreeNode;
} else if (rootFigures.size() == 1) {
return new TreeNode(null, rootFigures.get(0));
}
return null;
}
示例5: createDragSourceFeedbackFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
protected IFigure createDragSourceFeedbackFigure() {
RectangleFigure r = new FeedbackFigure();
r.setOpaque(false);
r.setAlpha(50);
r.setBackgroundColor(ColorConstants.gray);
r.setFill(false);
r.setBorder(new LineBorder(ColorConstants.gray, 1));
addFeedback(r);
return r;
}
示例6: createFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
@Override
protected IFigure createFigure()
{
RectangleFigure figure = new RectangleFigure();
figure.setBackgroundColor(BACKGROUND_COLOR);
Color borderCol = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
Border figureBorder = new LineBorder(borderCol, 2);
figure.setBorder(figureBorder);
figure.setOutline(false);
GridLayout layoutManager = new GridLayout();
// zero margin, in order to connect the dependent axes to the shared one
layoutManager.marginHeight = 0;
layoutManager.marginWidth = 0;
figure.setLayoutManager(layoutManager);
datasetsPane = new RectangleFigure();
datasetsPane.setOutline(false);
final SimpleLoweredBorder datasetBorder = new SimpleLoweredBorder(3);
datasetsPane.setBorder(datasetBorder);
GridLayout datasetsPaneLayout = new GridLayout();
datasetsPane.setLayoutManager(datasetsPaneLayout);
figure.add(datasetsPane);
arrowFigure = new ArrowFigure(false);
figure.add(arrowFigure);
axisNameLabel = new AxisNameFigure(this);
figure.add(axisNameLabel);
return figure;
}
示例7: createFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
@Override
protected IFigure createFigure()
{
final RectangleFigure figure = new RectangleFigure();
figure.setOutline(false);
final Color borderCol = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
final Border figureBorder = new LineBorder(borderCol, 2);
figure.setBorder(figureBorder);
figure.setLayoutManager(new GridLayout());
nameLabel = new DirectionalLabel(Activator.FONT_8);
final ChartPaneEditPart.AxisLandingPad pad =
(ChartPaneEditPart.AxisLandingPad) getModel();
nameLabel.setText(pad.pos == ChartPanePosition.MIN ? "Min Axis"
: "Max Axis");
figure.add(nameLabel);
figure.getLayoutManager().setConstraint(nameLabel, new GridData(
GridData.FILL, GridData.FILL, true, true));
return figure;
}
示例8: createFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
@Override
protected IFigure createFigure()
{
RectangleFigure rectangle = new RectangleFigure();
rectangle.setOutline(false);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
rectangle.setLayoutManager(gridLayout);
arrowFigure = new ArrowFigure(true);
rectangle.add(arrowFigure);
// and the text label
axisNameLabel = new DirectionalIconLabel(StackedchartsImages.getImage(
StackedchartsImages.DESC_AXIS));
axisNameLabel.getLabel().setTextAlignment(PositionConstants.TOP);
rectangle.add(axisNameLabel);
return rectangle;
}
示例9: SplitFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
public SplitFigure(int orientation) {
this.orientation = orientation;
setLayoutManager(new SplitFigureLayout());
dividerFigure = new RectangleFigure();
dividerFigure.setOutline(false);
dividerFigure.setBorder(new SimpleRaisedBorder());
switch(getOrientation()) {
case HORIZONTAL_SPLIT:
dividerFigure.setSize(5, 0);
dividerFigure.setPreferredSize(new Dimension(5, 0));
break;
case VERTICAL_SPLIT:
dividerFigure.setSize(0, 5);
dividerFigure.setPreferredSize(new Dimension(0, 5));
break;
}
add(dividerFigure, DIVIDER);
}
示例10: DepartmentNodeFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
public DepartmentNodeFigure() {
ToolbarLayout layout= new ToolbarLayout();
setLayoutManager(layout);
label = new Label();
label.setLabelAlignment(PositionConstants.LEFT);
label.setForegroundColor(ColorConstants.blue);
label.setIcon(Activator.getDefault().getImageRegistry().get(Activator.STATE_MACHINE));
label.setPreferredSize(700, 50);
label.setBorder(new MarginBorder(TOP_LEVEL_SPACE));
add(label);
Figure line = new RectangleFigure();
line.setBackgroundColor(ColorConstants.lightGray);
line.setForegroundColor(ColorConstants.lightGray);
line.setPreferredSize(700, 1);
add(line);
figure = new Figure();
figure.setLayoutManager(new XYLayout());
add(figure);
setBorder(new LineBorder(ColorConstants.lightGray, 1));
}
示例11: 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);
}
示例12: updateDynamicDuplicate
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
protected void updateDynamicDuplicate(int x, int y)
{
int dx = x - lastX;
int dy = y - lastY;
Iterator<RectangleFigure> frameFigs =
duplicatingDynamic.iterator();
while (frameFigs.hasNext()) {
RectangleFigure frameFig = frameFigs.next();
Point frameOrigin = frameFig.getLocation();
frameOrigin.x += dx;
frameOrigin.y += dy;
frameFig.setLocation(frameOrigin);
}
}
示例13: updateDynamicDuplicate
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
protected void updateDynamicDuplicate(int x, int y)
{
double dx = x - lastX;
double dy = y - lastY;
Iterator<RectangleFigure> frameFigs = duplicatingDynamic.iterator();
while (frameFigs.hasNext()) {
RectangleFigure frameFig = frameFigs.next();
Point frameOrigin = frameFig.getLocation();
frameOrigin.x += dx;
frameOrigin.y += dy;
frameFig.setLocation(frameOrigin);
}
ui.performRepaintUpdates();
}
示例14: PickerFigure
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
public PickerFigure() {
super.setMargin(10);
selection = new RectangleFigure();
selection.setAlpha(50);
selection.setBackgroundColor(ColorConstants.blue);
//setLayoutManager(new PickerFigureLayout());
}
示例15: getCenterPoint
import org.eclipse.draw2d.RectangleFigure; //导入依赖的package包/类
/**
* getCenterPoint
*
* @param nodeLabel
* @return Point
*/
private Point getCenterPoint(LabelNode nodeLabel) {
AbstractConnection abstractConnection = (AbstractConnection) nodeLabel.getParent();
AbstractNode sourceNode = (AbstractNode) abstractConnection.getSource();
AbstractNode targetNode = (AbstractNode) abstractConnection.getTarget();
RectangleFigure sourceFigure = new RectangleFigure();
if (sourceNode != null) {
sourceFigure.setSize(sourceNode.getWidth(), sourceNode.getHeight());
sourceFigure.setLocation(new Point(sourceNode.getX(), sourceNode.getY()));
}
RectangleFigure targetFigure = new RectangleFigure();
if (targetNode != null) {
targetFigure.setSize(targetNode.getWidth(), targetNode.getHeight());
targetFigure.setLocation(new Point(targetNode.getX(), targetNode.getY()));
}
ChopboxAnchor sourceAnchor = new ChopboxAnchor(sourceFigure);
ChopboxAnchor targetAnchor = new ChopboxAnchor(targetFigure);
Point source = new Point(sourceAnchor.getReferencePoint().x, sourceAnchor.getReferencePoint().y);
Point target = new Point(targetAnchor.getReferencePoint().x, targetAnchor.getReferencePoint().y);
Point centerPoint = new Point((source.x + target.x) / 2, (source.y + target.y) / 2);
return centerPoint;
}