Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.FigureCanvas


            data.top = new FormAttachment(100, -100);
            data.left = new FormAttachment(100, -100);
            data.right = new FormAttachment(100, 0);
            data.bottom = new FormAttachment(100, 0);

            thumbnail = new FigureCanvas(parent, SWT.NONE);
            thumbnail.setBackground(ColorConstants.white);
            thumbnail.setLayoutData(data);

            tb = new ScrollableThumbnail();
            tb.setBorder(new LineBorder(1));
View Full Code Here


      removeSelectionChangedListener(listener);
      _htmlViewerListeners.remove(listener);
  }

  public Viewport getViewport() {
    FigureCanvas canvas = this.getFigureCanvas();
    if (canvas != null) {
      return canvas.getViewport();
    }
        return null;
  }
View Full Code Here

   */
  public void exposeArea(Rectangle rect) {
    if (_viewer == null) {
      return;
    }
    FigureCanvas canvas = (FigureCanvas) _viewer.getControl();
    Viewport port = _viewer.getViewport();

    if (port == null) {
      return;
    }
    Rectangle exposeRegion = rect.getCopy();
    Rectangle portBounds = port.getBounds().getCopy();
    Point viewLocation = port.getViewLocation();
    Dimension diff = calculateDiff(portBounds, exposeRegion);
    if (diff != null) {
      viewLocation.x -= diff.width;
      viewLocation.y -= diff.height;
      canvas.scrollSmoothTo(viewLocation.x, viewLocation.y);
    }
  }
View Full Code Here

  private void exposeVertical(int offset) {
    if (_viewer == null) {
      return;
    }
    FigureCanvas canvas = (FigureCanvas) _viewer.getControl();
    Viewport port = _viewer.getViewport();

    if (port == null) {
      return;
    }
    Point viewLocation = port.getViewLocation();
    viewLocation.y += offset;
    canvas.scrollSmoothTo(viewLocation.x, viewLocation.y);
  }
View Full Code Here

  private void exposeHorizontal(int offset) {
    if (_viewer == null) {
      return;
    }
    FigureCanvas canvas = (FigureCanvas) _viewer.getControl();
    Viewport port = _viewer.getViewport();

    if (port == null) {
      return;
    }
    Point viewLocation = port.getViewLocation();
    viewLocation.x += offset;
    canvas.scrollSmoothTo(viewLocation.x, viewLocation.y);
  }
View Full Code Here

      removeSelectionChangedListener(listener);
      _htmlViewerListeners.remove(listener);
  }

  public Viewport getViewport() {
    FigureCanvas canvas = this.getFigureCanvas();
    if (canvas != null) {
      return canvas.getViewport();
    }
        return null;
  }
View Full Code Here

      protected Command getCreateCommand(final CreateRequest request) {
        final Object no = request.getNewObject();
        if (no instanceof MapObject) {
          final AddObjectCommand cmd = new AddObjectCommand();
          cmd.setObject((MapObject) no);
          final FigureCanvas control = (FigureCanvas) EditMapEditPart.this.getViewer()
            .getControl();
          final Point loc = request.getLocation();
          if (control.getVerticalBar() != null)
            loc.y += control.getVerticalBar().getSelection();
          if (control.getHorizontalBar() != null)
            loc.x += control.getHorizontalBar().getSelection();
          cmd.setLocation(loc);
          cmd.setTarget(EditMapEditPart.this);
          return cmd;
        }
        if (no instanceof MapNode) {
          final List<EditPart> sel = getViewer().getSelectedEditParts();
          if (sel.isEmpty())
            return null;
          final MapObject mo = getFirstMapObject(sel);
          if (mo == null)
            return null;
          final AddNodeCommand cmd = new AddNodeCommand();
          cmd.setTarget(mo);
          cmd.setNode((MapNode) no);
          final FigureCanvas control = (FigureCanvas) EditMapEditPart.this.getViewer()
            .getControl();
          final Point loc = request.getLocation();
          if (control.getVerticalBar() != null)
            loc.y += control.getVerticalBar().getSelection();
          if (control.getHorizontalBar() != null)
            loc.x += control.getHorizontalBar().getSelection();
          cmd.setLocation(loc);
          cmd.setCoordSys(_coordinateSystem);
          return cmd;
        }
        return null;
View Full Code Here

  }
 
  protected void createTrayViewer(Composite parent) {
    trayViewer = new ScrollingGraphicalViewer();
    trayViewer.createControl(parent);
    final FigureCanvas canvas = (FigureCanvas) trayViewer.getControl();
    canvas.setScrollBarVisibility(FigureCanvas.NEVER);
   
    // We need to modify the viewport layout so that it adjusts the
    // size of the viewport contents according to the viewport size.
    // The contents cannot be bigger than the viewport otherwise it
    // will break the tray scrolling.
    canvas.getViewport().setLayoutManager(new ViewportLayout() {
     
      @Override
      public void layout(IFigure figure) {
        Viewport viewport = (Viewport)figure;
        IFigure contents = viewport.getContents();
View Full Code Here

 
  @Inject
  private Animator animator;
 
  public void createPartControl(final Composite parent) {
    FigureCanvas _figureCanvas = new FigureCanvas(parent, SWT.DOUBLE_BUFFERED);
    this.canvas = _figureCanvas;
    FreeformViewport _freeformViewport = new FreeformViewport();
    this.canvas.setViewport(_freeformViewport);
    this.canvas.setBackground(ColorConstants.white);
    final FreeformLayeredPane pane = new FreeformLayeredPane();
View Full Code Here

  public RailroadView() {
  }

  @Override
  public void createPartControl(final Composite parent) {
    canvas = new FigureCanvas(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    rootFigure = new Figure();
    rootFigure.addMouseListener(selectionProvider);
    rootFigure.setLayoutManager(new StackLayout());
    rootFigure.setVisible(true);
    canvas.setContents(rootFigure);
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.FigureCanvas

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.