Package org.eclipse.wb.draw2d

Examples of org.eclipse.wb.draw2d.Figure


      }
    }
    // prepare bounds
    Rectangle bounds;
    {
      Figure hostFigure = getHostFigure();
      bounds = request.getTransformedRectangle(hostFigure.getBounds());
      FigureUtils.translateFigureToAbsolute(hostFigure, bounds.shrink(-1, -1));
    }
    // update selection feedback
    m_resizeFeedback.setBounds(bounds);
    // update text feedback
View Full Code Here


  // Figure
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Figure createFigure() {
    return new Figure();
  }
View Full Code Here

  /**
   * @return {@link ILocator} that positions handles on component side.
   */
  private final ILocator createComponentLocator(int direction, double percent) {
    Figure reference = getHostFigure();
    if (direction == IPositionConstants.WEST) {
      return new RelativeLocator(reference, 0, percent);
    } else if (direction == IPositionConstants.EAST) {
      return new RelativeLocator(reference, 1, percent);
    } else if (direction == IPositionConstants.NORTH) {
View Full Code Here

    m_newSize = getHostFigure().getSize();
    m_newSize.expand(m_sizeDelta);
  }

  private void prepareFeedbackBounds(ChangeBoundsRequest request) {
    Figure hostFigure = getHostFigure();
    m_newBounds = hostFigure.getBounds().getCopy();
    // update bounds
    if (m_resizeDirection == IPositionConstants.WEST) {
      m_newBounds.moveX(-m_sizeDelta.width);
    } else if (m_resizeDirection == IPositionConstants.NORTH) {
      m_newBounds.moveY(-m_sizeDelta.height);
View Full Code Here

    FigureUtils.translateAbsoluteToFigure2(getFeedbackLayer(), m_newBounds);
  }

  private void showRectangleFeedback() {
    if (m_resizeFeedback == null) {
      m_resizeFeedback = new Figure();
      m_resizeFeedback.setBorder(new LineBorder(IColorConstants.orange));
      addFeedback(m_resizeFeedback);
    }
    // update
    m_resizeFeedback.setBounds(m_newBounds);
View Full Code Here

      }
    }
    // prepare bounds
    Rectangle bounds;
    {
      Figure hostFigure = getHostFigure();
      bounds = request.getTransformedRectangle(hostFigure.getBounds());
      FigureUtils.translateFigureToAbsolute(hostFigure, bounds.expand(1, 1));
    }
    // update selection feedback
    m_resizeFeedback.setBounds(bounds);
    // update text feedback
View Full Code Here

  @SuppressWarnings("unchecked")
  private void showAlignmentsFigures(EditPart editPart) {
    C component = (C) editPart.getModel();
    int offset = INITIAL_RIGHT_SPACE;
    {
      Figure horizontalFigure = createAlignmentFigure(component, true);
      if (horizontalFigure != null) {
        offset += horizontalFigure.getSize().width;
        addAlignmentFigure(component, horizontalFigure, offset);
        offset += FIGURES_SPACE;
      }
    }
    {
      Figure verticalFigure = createAlignmentFigure(component, false);
      if (verticalFigure != null) {
        offset += verticalFigure.getSize().width;
        addAlignmentFigure(component, verticalFigure, offset);
        offset += FIGURES_SPACE;
      }
    }
  }
View Full Code Here

  /**
   * Adds alignment figure at given offset from right side of component's cells.
   */
  private void addAlignmentFigure(IAbstractComponentInfo component, Figure figure, int offset) {
    Figure layer = m_viewer.getLayer(IEditPartViewer.CLICKABLE_LAYER);
    // prepare rectangle for cells used by component (in layer coordinates)
    Rectangle cellRect;
    {
      cellRect = component.getModelBounds().getCopy();
      PolicyUtils.translateModelToFeedback(m_policy, cellRect);
    }
    // prepare location and size
    Point figureLocation;
    {
      Dimension figureSize = figure.getSize();
      figureLocation = new Point(cellRect.right() - offset, cellRect.y - figureSize.height / 2);
      if (figureLocation.x < cellRect.x + MIN_LEFT_SPACE) {
        return;
      }
    }
    // add alignment figure
    layer.add(figure);
    figure.setLocation(figureLocation);
    m_alignmentFigures.add(figure);
  }
View Full Code Here

    }
  }

  private AbstractPopupFigure getAlignFigure(final int width, final int height) {
    final AbstractPopupFigure[] popupFigure = {null};
    Figure layer = m_viewerCanvas.getLayer(IEditPartViewer.CLICKABLE_LAYER);
    layer.accept(new FigureVisitor() {
      private final int MARGIN = 6;

      @Override
      public void endVisit(Figure figure) {
        if (figure instanceof AbstractPopupFigure) {
View Full Code Here

  // Figure
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Figure createFigure() {
    Figure newFigure = new Figure() {
      @Override
      protected void paintClientArea(Graphics graphics) {
        Rectangle r = getClientArea();
        // draw rectangle
        graphics.setForegroundColor(IColorConstants.buttonDarker);
        graphics.drawLine(r.x, r.y, r.x, r.bottom());
        graphics.drawLine(r.right() - 1, r.y, r.right() - 1, r.bottom());
        // draw column index
        int titleLeft;
        {
          String title = "" + getIndex();
          Dimension textExtents = graphics.getTextExtent(title);
          if (r.width < 3 + textExtents.width + 3) {
            return;
          }
          // draw title
          titleLeft = r.x + (r.width - textExtents.width) / 2;
          int y = r.y + (r.height - textExtents.height) / 2;
          graphics.setForegroundColor(IColorConstants.black);
          graphics.drawText(title, titleLeft, y);
        }
        // draw alignment indicator
        if (titleLeft - r.x > 3 + 7 + 3) {
          Image image = m_column.getAlignment().getSmallImage();
          if (image != null) {
            int x = r.x + 2;
            drawCentered(graphics, image, x);
          }
        }
      }

      private void drawCentered(Graphics graphics, Image image, int x) {
        int y = (getBounds().height - image.getBounds().height) / 2;
        graphics.drawImage(image, x, y);
      }
    };
    //
    newFigure.setFont(DEFAULT_FONT);
    newFigure.setOpaque(true);
    return newFigure;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.draw2d.Figure

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.