Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ImageFigure


    }
   
    private IFigure feedbackFigure = null;
    private IFigure getFeedbackFigure() {
        if (feedbackFigure == null) {
            feedbackFigure = new ImageFigure(SharedImages.getImage("icons/insertion_cursor.gif"));
            feedbackFigure.setSize(ActionGraphUtils.ACTION_SIZE, ActionGraphUtils.ACTION_SIZE);
        }
        return feedbackFigure;
    }
View Full Code Here


*/
public class NonVisualComponentEditPart extends NodeEditPart
{
    protected IFigure createFigure()
    {
        IFigure figure_ = new ImageFigure(getTagConverter().getVisualImage())
        {

            protected void paintFigure(Graphics graphics) {
                super.paintFigure(graphics);
               
                if (getImage() == null)
                    return;

                Rectangle srcRect = new Rectangle(getImage().getBounds());
                graphics.drawImage(getImage(), srcRect, getClientArea());
            }
           
        };
       
        figure_.setMinimumSize(new Dimension(0,0));
        return figure_;
    }
View Full Code Here

    }
    final Image img = new Image(display, id);

    image.dispose();

    final ImageFigure fig = new ImageFigure(img);
    final Rectangle bounds = img.getBounds();
    fig.setBounds(new org.eclipse.draw2d.geometry.Rectangle(bounds));
    fig.setLayoutManager(new XYLayout());
    fig.setAlignment(PositionConstants.NORTH | PositionConstants.WEST);
    return fig;
  }
View Full Code Here

   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
   */
  @Override
  protected IFigure createFigure() {
    _image = CalibratorUIActivator.getImageDescriptor("icons/cross.png").createImage(); //$NON-NLS-1$
    final ImageFigure fig = new ImageFigure(_image);
    final Rectangle bounds = _image.getBounds();
    fig.setBounds(new org.eclipse.draw2d.geometry.Rectangle(bounds));
    final net.sf.myway.base.db.Point p = (net.sf.myway.base.db.Point) getModel();
    if (p != null)
      fig.setLocation(new Point(p.getX(), p.getY()));
    return fig;
  }
View Full Code Here

   */
  @Override
  protected IFigure createFigure() {
    final ScannedMap m = (ScannedMap) getModel();
    final Image image = new Image(Display.getDefault(), m.getFileName());
    final ImageFigure fig = new ImageFigure(image);
    final Rectangle bounds = image.getBounds();
    fig.setBounds(new org.eclipse.draw2d.geometry.Rectangle(bounds));
    fig.setLayoutManager(new XYLayout());
    fig.setAlignment(PositionConstants.NORTH | PositionConstants.WEST);
    if (m.getUpperleft().equals(m.getUpperright()) && m.getUpperleft().equals(m.getLowerleft())) {
      m.setUpperleft(new Point(25, 25));
      m.setUpperright(new Point(bounds.width - 25, 25));
      m.setLowerleft(new Point(25, bounds.height - 25));
      m.setLowerright(new Point(bounds.width - 25, bounds.height - 25));
View Full Code Here

    final ImageDescriptor desc = EditUIPlugin.getImageDescriptor("/icons/" + symbol + ".png"); //$NON-NLS-1$ //$NON-NLS-2$
    if (desc == null)
      throw new IllegalArgumentException("Icon for " + obj.getType() + " not found! " //$NON-NLS-1$ //$NON-NLS-2$
        + symbol);
    final Image img = desc.createImage();
    final ImageFigure fig = new ImageFigure(img);
    final Rectangle bounds = img.getBounds();
    final CoordinateSystem cs = getCoordinateSystem();
    final Point p = cs.toPoint(obj.getCenter().getNode().getPosition());
    bounds.x = p.x - bounds.width / 2;
    bounds.y = p.y - bounds.height / 2;
    fig.setBounds(new org.eclipse.draw2d.geometry.Rectangle(bounds));
    fig.setLayoutManager(new XYLayout());
    return fig;
  }
View Full Code Here

 
  protected IFigure createFigureForMarker(IMarker marker) {
    Image image = getImage(marker);
    String text = getText(marker);
    if (image != null) {
      ImageFigure imageFigure = new ImageFigure(image);
      if (text != null) {
        imageFigure.setToolTip(new Label(text));
      }
      return imageFigure;
    }
    return null;
  }
View Full Code Here

        builder.append("\no ").append(text);
      }
    }
       
    if (image != null) {
      ImageFigure imageFigure = new ImageFigure(image);
      imageFigure.setToolTip(new Label( builder.toString() ));
      return imageFigure;
    }
    return null;
  }
View Full Code Here

  }

  @Override
  protected IFigure createTitleFigure() {
    mainTrayTitleFigure = new MainTrayTitleFigure();
    mainTrayTitleFigure.add(new ImageFigure(getLabelProvider().getImage(getModel())));
    nameLabel = new Label(getLabelProvider().getText(getModel()));
    mainTrayTitleFigure.add(nameLabel);
    decorator = createEditPartMarkerDecorator();
    return decorator.createFigure(mainTrayTitleFigure);
  }
View Full Code Here

   */
  protected class TitleLayout extends AbstractLayout {
    private static final int SPACING = 2;
    public void layout(IFigure container) {
      List elements = container.getChildren();
      ImageFigure icon = (ImageFigure)elements.get(0);
      Label text = (Label)elements.get(1);
      Figure removeButton = (Figure)elements.get(2);
      Figure addButton = (Figure)elements.get(3);
     
      Rectangle containerBounds = container.getBounds();
      int x = containerBounds.x + SPACING;
      int y = containerBounds.y;
      int height = containerBounds.height;
     
      Dimension size = icon.getPreferredSize();
      Rectangle bounds = new Rectangle(x, y, size.width, height);
      icon.setBounds(bounds);
     
      size = removeButton.getPreferredSize();
      x = (containerBounds.x + containerBounds.width) - size.width;
      bounds = new Rectangle(x, y, size.width, height);
      removeButton.setBounds(bounds);

      size = addButton.getPreferredSize();
      x = x - size.width;
      bounds = new Rectangle(x, y, size.width, height);
      addButton.setBounds(bounds);

      x = icon.getBounds().x + icon.getBounds().width;
      x = x + SPACING;
      int width = containerBounds.width - (icon.getBounds().width + removeButton.getBounds().width + addButton.getBounds().width);
      bounds = new Rectangle(x, y, width, height);
      text.setBounds(bounds);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.ImageFigure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.