Java 类org.eclipse.draw2d.RectangleFigure 实例源码

项目:ForgedUI-Eclipse    文件:ChildElementResizableEditPolicy.java   
@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();*/
}
项目:ForgedUI-Eclipse    文件:AddStackElementEditPolicy.java   
@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){

    }

}
项目:NEXCORE-UML-Modeler    文件:ChangeNodeConstraintCommand.java   
/**
 * 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;
}
项目:statecharts    文件:TreeLayout.java   
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;

    }
项目:PDFReporter-Studio    文件:TableCellResizableEditPolicy.java   
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;
}
项目:limpet    文件:AxisEditPart.java   
@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;
}
项目:limpet    文件:AxisLandingPadEditPart.java   
@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;
}
项目:limpet    文件:SharedAxisEditPart.java   
@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;
}
项目:OpenSPIFe    文件:SplitFigure.java   
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);
  }
项目:xeda    文件:DepartmentNodeFigure.java   
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));
}
项目:relations    文件:ItemFigure.java   
/**
 * 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);
}
项目:cogtool    文件:FrameEditorMouseState.java   
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);
    }
}
项目:cogtool    文件:DesignEditorMouseState.java   
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();
}
项目:ForgedUI-Eclipse    文件:PickerFigure.java   
public PickerFigure() {
    super.setMargin(10);
    selection = new RectangleFigure();
    selection.setAlpha(50);
    selection.setBackgroundColor(ColorConstants.blue);
    //setLayoutManager(new PickerFigureLayout());
}
项目:NEXCORE-UML-Modeler    文件:LabelNodeEditPart.java   
/**
 * 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;
}
项目:NEXCORE-UML-Modeler    文件:LabelNodeFeedbackEditPolicy.java   
/**
 * getTargetPoint
 *  
 * @param nodeLabel
 * @return Point
 */
private Point getTargetPoint(LabelNode nodeLabel) {
    AbstractConnection abstractConnection = (AbstractConnection) nodeLabel.getParent();

    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 sourceAnchorLocation = new Point();
    Point targetAnchorLocation = new Point();
    sourceAnchorLocation = sourceAnchor.getLocation(targetAnchor.getReferencePoint());
    targetAnchorLocation = targetAnchor.getLocation(sourceAnchor.getReferencePoint());
    // sourceAnchorLocation = sourceAnchor.getReferencePoint();
    // targetAnchorLocation = targetAnchor.getReferencePoint();

    Point source = new Point(sourceAnchorLocation.x, sourceAnchorLocation.y);
    Point target = new Point(targetAnchorLocation.x, targetAnchorLocation.y);

    if (nodeLabel.getType().equals(LabelType.SOURCE_ROLE) || nodeLabel.getType().equals(LabelType.SOURCE_MULTIPLEX)) {
        return source;
    } else if (nodeLabel.getType().equals(LabelType.TARGET_ROLE)
        || nodeLabel.getType().equals(LabelType.TARGET_MULTIPLEX)) {
        return target;
    } else {
        return new Point((source.x + target.x) / 2, (source.y + target.y) / 2);
    }
}
项目:NEXCORE-UML-Modeler    文件:PackageFigure.java   
/**
 * PackageFigure
 * @param isDangling
 */
public PackageFigure(boolean isDangling) {
    setDangling(isDangling);

    setLayoutManager(new StackLayout() {
        @SuppressWarnings("unchecked")
        public void layout(IFigure figure) {
            Rectangle rectangle = figure.getClientArea();
            List children = figure.getChildren();
            IFigure child;
            org.eclipse.draw2d.geometry.Dimension dimension;
            int sizeValue = children.size();
            for (int i = 0; i < children.size(); i++) {
                if (!(children.get(i) instanceof RectangleFigure)) {
                    child = (IFigure) children.get(i);
                    dimension = child.getPreferredSize(rectangle.width, rectangle.height);
                    dimension.width = Math.min(dimension.width, rectangle.width);
                    dimension.height = Math.min(dimension.height, rectangle.height);
                    Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2,
                        rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height)
                            - (sizeValue * 3),
                        dimension.width,
                        dimension.height);
                    child.setBounds(childRect);
                }
            }
        }
    });

    setOpaque(true);

}
项目:NEXCORE-UML-Modeler    文件:DeleteSignFigure.java   
/**
 * DeleteSignFigure
 * @param string
 */
public DeleteSignFigure(String string) {
    setBorder(new LineBorder(ColorConstants.black));
    setLayoutManager(new StackLayout() {
        @SuppressWarnings("unchecked")
        public void layout(IFigure figure) {
            Rectangle rectangle = figure.getClientArea();
            List children = figure.getChildren();
            IFigure child;
            org.eclipse.draw2d.geometry.Dimension dimension;
            int sizeValue = children.size();
            for (int i = 0; i < children.size(); i++) {
                if (!(children.get(i) instanceof RectangleFigure)) {
                    child = (IFigure) children.get(i);
                    dimension = child.getPreferredSize(rectangle.width, rectangle.height);
                    dimension.width = Math.min(dimension.width, rectangle.width);
                    dimension.height = Math.min(dimension.height, rectangle.height);
                    Rectangle childRect = new Rectangle(rectangle.x + (rectangle.width - dimension.width) / 2,
                        rectangle.y + (rectangle.height - dimension.height) / 2 + (int) (i * dimension.height)
                            - (sizeValue * 3),
                        dimension.width,
                        dimension.height);
                    child.setBounds(childRect);
                }
            }
        }
    });

    Label nameLabel = new Label(string);
    add(nameLabel);
}
项目:NEXCORE-UML-Modeler    文件:TargetDiagramAnchor.java   
/**
 * createRectangleFigure
 * 
 * @param model
 * @return RectangleFigure
 */
public static RectangleFigure createRectangleFigure(AbstractNode model) {
    RectangleFigure figure = new RectangleFigure();
    figure.setLocation(new Point(model.getX(), model.getY()));
    figure.setSize(new Dimension(model.getWidth(), model.getHeight()));

    return figure;
}
项目:NEXCORE-UML-Modeler    文件:SourceDiagramAnchor.java   
/**
 * createRectangleFigure
 * 
 * @param model
 * @return RectangleFigure
 */
public static RectangleFigure createRectangleFigure(AbstractNode model) {
    RectangleFigure figure = new RectangleFigure();
    figure.setLocation(new Point(model.getX(), model.getY()));
    figure.setSize(new Dimension(model.getWidth(), model.getHeight()));

    return figure;
}
项目:NEXCORE-UML-Modeler    文件:ForkNodeFigure.java   
/**
 * ForkNodeFigure
 */
public ForkNodeFigure() {

    rectangle = new RectangleFigure();
    rectangle.setSize(width, height);
    // rectangle.setBackgroundColor(FigureUtil.getFigureImage());

    add(rectangle);
}
项目:NEXCORE-UML-Modeler    文件:JoinNodeFigure.java   
/**
 * JoinNodeFigure
 */
public JoinNodeFigure() {

    rectangle = new RectangleFigure();
    rectangle.setSize(width, height);
    // rectangle.setBackgroundColor(ColorConstants.lightGray);

    add(rectangle);
}
项目:NEXCORE-UML-Modeler    文件:LifeLineBehaviorEditPart.java   
/**
 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
 */
protected IFigure createFigure() {

    NotationNode notationNode = (NotationNode) getModel();
    RectangleFigure figure = new RectangleFigure();
    figure.setBackgroundColor(ColorConstants.lightBlue);
    figure.setForegroundColor(UiCorePlugin.getDefault().getColor(IConstantColorRegistry.Black));
    figure.setLineWidth(2);
    figure.setFill(true);
    figure.setLocation(new Point(notationNode.getX(), notationNode.getY()));
    figure.setSize(notationNode.getWidth(), notationNode.getHeight());
    return figure;

}
项目:NEXCORE-UML-Modeler    文件:MessageBendpointEditPolicy.java   
/**
 * 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;
}
项目:statecharts    文件:RegionFigure.java   
private void createContents() {
    nameLabel = new SyntaxColoringLabel();
    GridData data = GridDataFactory.fillDefaults().grab(true, false).getData();
    data.horizontalIndent = 5;
    nameLabel.setTextPlacement(PositionConstants.WEST);
    this.add(nameLabel, data);

    /** Compartment container **/
    compartmentPane = new RectangleFigure();
    compartmentPane.setOutline(false);
    compartmentPane.setLayoutManager(new StackLayout());
    compartmentPane.setFill(false);
    this.add(compartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData());
}
项目:PDFReporter-Studio    文件:StrokeWidget.java   
public StrokeWidget(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout());
    square = new Canvas(this, SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);

    lws = new J2DLightweightSystem();
    lws.setControl(square);
    parentFigure = new RectangleFigure() {

        @Override
        public void paint(Graphics graphics) {
            if (stroke != null) {
                int offset = (int) stroke.getLineWidth();
                int x = getBounds().x + offset;
                int y = getBounds().y + offset;
                int w = getBounds().width - 2 * offset - 10;
                int h = getBounds().height - 2 * offset - 10;
                graphics.setForegroundColor(ColorConstants.black);
                graphics.setBackgroundColor(ColorConstants.lightGray);

                Graphics2D g = ComponentFigure.getG2D(graphics);
                if (g != null) {
                    g.setStroke(stroke);
                    g.drawRect(x, y, w, h);
                }
            }
        }
    };
    lws.setContents(parentFigure);
    Display.getCurrent().asyncExec(new Runnable() {

        public void run() {
            setTBounds();
        }
    });
}
项目:PDFReporter-Studio    文件:CrosstabCellResizableEditPolicy.java   
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;
}
项目:PDFReporter-Studio    文件:ElementResizableEditPolicy.java   
/**
 * 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;
}
项目:PDFReporter-Studio    文件:StylesTemplateEditPart.java   
@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;
}
项目:limpet    文件:ChartPaneEditPart.java   
@Override
protected IFigure createFigure()
{
  final RectangleFigure figure = new RectangleFigure();
  figure.setOutline(false);
  final 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);
  return figure;
}
项目:limpet    文件:ChartsPanelEditPart.java   
@Override
protected IFigure createFigure()
{
  RectangleFigure rectangle = new RectangleFigure();
  rectangle.setOutline(false);
  GridLayout layout = new GridLayout();
  layout.marginHeight = 0;
  layout.marginWidth = 0;
  layout.horizontalSpacing = 10;
  layout.verticalSpacing = 10;
  rectangle.setLayoutManager(layout);
  rectangle.setBackgroundColor(Display.getDefault().getSystemColor(
      SWT.COLOR_WIDGET_BACKGROUND));
  return rectangle;
}
项目:limpet    文件:ChartSetEditPart.java   
@Override
protected IFigure createFigure()
{
  RectangleFigure rectangle = new RectangleFigure();
  rectangle.setOutline(false);
  GridLayout gridLayout = new GridLayout();
  gridLayout.marginHeight = 10;
  gridLayout.marginWidth = 10;
  rectangle.setLayoutManager(gridLayout);
  rectangle.setBackgroundColor(Display.getDefault().getSystemColor(
      SWT.COLOR_WIDGET_BACKGROUND));

  return rectangle;
}
项目:OpenSPIFe    文件:TimelineNodeMoveEditPolicy.java   
@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;
}
项目:gef-gwt    文件:NonResizableEditPolicy.java   
/**
 * 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;
}
项目:jive    文件:MessageFigure.java   
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));
}
项目:xeda    文件:QueueNodeFigure.java   
public QueueNodeFigure() {
    ToolbarLayout layout= new ToolbarLayout();
    layout.setHorizontal(false);
    layout.setSpacing(1);
    layout.setStretchMinorAxis(false);
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    setLayoutManager(layout);
    this.setBorder(new MarginBorder(5));

    Label entry = new Label();
    entry.setLabelAlignment(PositionConstants.CENTER);
    entry.setForegroundColor(ColorConstants.darkGreen);
    entry.setIcon(Activator.getDefault().getImageRegistry().get(Activator.QUEUE_NODE));
    entry.setText("Queue");
    add(entry);

    Figure line = new RectangleFigure();
    line.setBackgroundColor(ColorConstants.lightGray);
    line.setForegroundColor(ColorConstants.lightGray);
    line.setPreferredSize(1000, 1);
    add(line);

    nameLabel = new Label();
    nameLabel.setLabelAlignment(PositionConstants.CENTER);
    nameLabel.setForegroundColor(ColorConstants.darkGreen);
    add(nameLabel);
}
项目:xeda    文件:ActorNodeFigure.java   
public ActorNodeFigure() {
    ToolbarLayout layout= new ToolbarLayout();
    layout.setHorizontal(false);
    layout.setSpacing(1);
    layout.setStretchMinorAxis(false);
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    setLayoutManager(layout);
    this.setBorder(new MarginBorder(5));

    Label entry = new Label();
    entry.setLabelAlignment(PositionConstants.CENTER);
    entry.setForegroundColor(ColorConstants.darkGreen);
    entry.setIcon(Activator.getDefault().getImageRegistry().get(Activator.ACTOR_NODE));
    entry.setText("Actor");
    add(entry);

    Figure line = new RectangleFigure();
    line.setBackgroundColor(ColorConstants.lightGray);
    line.setForegroundColor(ColorConstants.lightGray);
    line.setPreferredSize(1000, 1);
    add(line);

    nameLabel = new Label();
    nameLabel.setLabelAlignment(PositionConstants.CENTER);
    nameLabel.setForegroundColor(ColorConstants.darkGreen);
    add(nameLabel);
}
项目:xeda    文件:TopicNodeFigure.java   
public TopicNodeFigure() {
    ToolbarLayout layout= new ToolbarLayout();
    layout.setHorizontal(false);
    layout.setSpacing(1);
    layout.setStretchMinorAxis(false);
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    setLayoutManager(layout);
    this.setBorder(new MarginBorder(5));

    Label entry = new Label();
    entry.setLabelAlignment(PositionConstants.CENTER);
    entry.setForegroundColor(ColorConstants.darkGreen);
    entry.setIcon(Activator.getDefault().getImageRegistry().get(Activator.TOPIC_NODE));
    entry.setText("Topic");
    add(entry);

    Figure line = new RectangleFigure();
    line.setBackgroundColor(ColorConstants.lightGray);
    line.setForegroundColor(ColorConstants.lightGray);
    line.setPreferredSize(1000, 1);
    add(line);

    nameLabel = new Label();
    nameLabel.setLabelAlignment(PositionConstants.CENTER);
    nameLabel.setForegroundColor(ColorConstants.darkGreen);
    add(nameLabel);
}
项目:lunifera-sharky-m2m    文件:ShapeEditPart.java   
/**
 * Return a IFigure depending on the instance of the current model element.
 * This allows this EditPart to be used for both sublasses of Shape.
 */
private IFigure createFigureForModel() {
    if (getModel() instanceof EllipticalShape) {
        return new Ellipse();
    } else if (getModel() instanceof RectangularShape) {
        return new RectangleFigure();
    } else {
        // if Shapes gets extended the conditions above must be updated
        throw new IllegalArgumentException();
    }
}
项目:lunifera-sharky-m2m    文件:HumanCircleFigure.java   
public HumanCircleFigure() {
    setLayoutManager(new XYLayout());
    rectangle = new RectangleFigure();
    add(rectangle);
    label = new Label();
    add(label);
}