Package org.eclipse.wb.draw2d.geometry

Examples of org.eclipse.wb.draw2d.geometry.Point


  // ExpressionAccessor
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public Expression getExpression(JavaInfo javaInfo) throws Exception {
    Point location = getLocation(javaInfo);
    JavaInfo formatter = getFormatter(javaInfo);
    for (MethodInvocation invocation : formatter.getMethodInvocations(m_methodSignature)) {
      List<Expression> arguments = DomGenerics.arguments(invocation);
      int row = (Integer) JavaInfoEvaluationHelper.getValue(arguments.get(0));
      int cell = (Integer) JavaInfoEvaluationHelper.getValue(arguments.get(1));
View Full Code Here


    // add new invocation
    if (source != null) {
      ExecutionUtils.run(javaInfo, new RunnableEx() {
        public void run() throws Exception {
          StatementTarget target = getTarget();
          Point location = getLocation(javaInfo);
          String argumentsSource =
              TemplateUtils.format("{0}, {1}, {2}", location.y, location.x, source);
          // add invocation
          JavaInfo formatter = getFormatter(javaInfo);
          MethodInvocation invocation =
View Full Code Here

  private Point getLocation(JavaInfo widget) {
    CellConstraintsSupport constraints = HTMLTableInfo.getConstraints((WidgetInfo) widget);
    int row = constraints.getY();
    int column = constraints.getX();
    int cell = getPanel(widget).getStatus().getCellOfColumn(row, column);
    return new Point(cell, row);
  }
View Full Code Here

  /**
   * @return the offset of {@link Figure} with headers relative to the absolute layer.
   */
  public final Point getOffset() {
    Point offset = new Point(0, 0);
    FigureUtils.translateFigureToAbsolute2(m_containerFigure, offset);
    return offset;
  }
View Full Code Here

    }
    // check creation flow
    if (location != null && useCreationFlow()) {
      // force set new translated bounds
      Insets insets = container.getClientAreaInsets();
      Point location_ = location.getCopy();
      location_.translate(insets);
      AbsoluteLayoutCreationFlowSupport.checkBounds(widget, location_, size);
      // apply creation flow
      AbsoluteLayoutCreationFlowSupport.apply(
          container,
          container.getChildrenWidgets(),
View Full Code Here

  @Override
  protected void updateGridTarget(Point mouseLocation) throws Exception {
    m_target = new GridTarget();
    // prepare location in model
    Point location = mouseLocation.getCopy();
    PolicyUtils.translateAbsoluteToModel(this, location);
    // prepare grid information
    IGridInfo gridInfo = m_layout.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
View Full Code Here

    {
      ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
      headerEditPart = (DimensionHeaderEditPart) changeBoundsRequest.getEditParts().get(0);
    }
    // prepare location
    Point location;
    {
      IDropRequest dropRequest = (IDropRequest) request;
      location = dropRequest.getLocation().getCopy();
    }
    // prepare target header
    DimensionHeaderEditPart target = null;
    {
      List<EditPart> children = getHost().getChildren();
      for (EditPart child : children) {
        DimensionHeaderEditPart columnEditPart = (DimensionHeaderEditPart) child;
        Rectangle bounds = columnEditPart.getFigure().getBounds();
        if (location.x < bounds.getCenter().x) {
          target = columnEditPart;
          break;
        }
      }
    }
    // prepare grid information
    IGridInfo gridInfo = m_layout.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
    int y1 = rowIntervals[0].begin - 5;
    int y2 = rowIntervals[rowIntervals.length - 1].end() + 5;
    // prepare index of target column and position for insert feedbacks
    final int index;
    int x;
    int size;
    if (target != null) {
      index = target.getDimension().getIndex();
      // prepare previous interval
      Interval prevInterval;
      if (index == 0) {
        prevInterval = new Interval(0, 0);
      } else {
        prevInterval = columnIntervals[index - 1];
      }
      // prepare parameters
      int[] parameters =
          TableLayoutEditPolicy.getInsertFeedbackParameters(
              prevInterval,
              columnIntervals[index],
              AbstractGridLayoutEditPolicy.INSERT_COLUMN_SIZE);
      x = parameters[1];
      size = parameters[2] - parameters[1];
    } else {
      index = m_layout.getColumns().size();
      m_mainPolicy.showInsertFeedbacks(null, null);
      // prepare parameters
      x = columnIntervals[columnIntervals.length - 1].end() + 1;
      size = AbstractGridLayoutEditPolicy.INSERT_COLUMN_SIZE;
    }
    // show insert feedbacks
    {
      // ...on main viewer
      m_mainPolicy.showInsertFeedbacks(new Rectangle(x, y1, size, y2 - y1), null);
      // ...on header viewer
      {
        if (m_insertFeedback.getParent() == null) {
          addFeedback(m_insertFeedback);
        }
        //
        Point offset = headerEditPart.getOffset();
        Rectangle bounds = new Rectangle(x + offset.x, 0, size, getHostFigure().getSize().height);
        m_insertFeedback.setBounds(bounds);
      }
    }
    // show text feedback
    {
      Layer feedbackLayer = getMainLayer(IEditPartViewer.FEEDBACK_LAYER);
      // add feedback
      if (m_feedback == null) {
        m_feedback = new TextFeedback(feedbackLayer);
        m_feedback.add();
      }
      // set feedback bounds
      {
        Point feedbackLocation = new Point(location.x + 30, 10);
        FigureUtils.translateAbsoluteToFigure(feedbackLayer, feedbackLocation);
        m_feedback.setLocation(feedbackLocation);
      }
      // set text
      m_feedback.setText("column: " + index);
View Full Code Here

      @Override
      protected void executeEdit() throws Exception {
        placementsSupport.commitAdd();
        Rectangle widgetModelBounds = component.getModelBounds();
        m_canvas.command_absolute_CREATE(component, null);
        Point location = widgetModelBounds.getLocation();
        Dimension size = getSize(widgetModelBounds);
        CanvasInfo boundsCanvas = getBoundsCanvas(component);
        if (boundsCanvas != null) {
          m_canvas.command_BOUNDS(boundsCanvas, location, size);
        }
View Full Code Here

    {
      ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
      headerEditPart = (DimensionHeaderEditPart) changeBoundsRequest.getEditParts().get(0);
    }
    // prepare location
    Point location;
    {
      IDropRequest dropRequest = (IDropRequest) request;
      location = dropRequest.getLocation().getCopy();
    }
    // prepare target header
    DimensionHeaderEditPart target = null;
    {
      List<EditPart> children = getHost().getChildren();
      for (EditPart child : children) {
        DimensionHeaderEditPart rowEditPart = (DimensionHeaderEditPart) child;
        Rectangle bounds = rowEditPart.getFigure().getBounds();
        if (location.y < bounds.getCenter().y) {
          target = rowEditPart;
          break;
        }
      }
    }
    // prepare grid information
    IGridInfo gridInfo = m_layout.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
    int x1 = columnIntervals[0].begin - 5;
    int x2 = columnIntervals[columnIntervals.length - 1].end() + 5;
    // prepare index of target row and position for insert feedbacks
    final int index;
    int y;
    int size;
    if (target != null) {
      index = target.getDimension().getIndex();
      // prepare previous interval
      Interval prevInterval;
      if (index == 0) {
        prevInterval = new Interval(0, 0);
      } else {
        prevInterval = rowIntervals[index - 1];
      }
      // prepare parameters
      int[] parameters =
          TableLayoutEditPolicy.getInsertFeedbackParameters(
              prevInterval,
              rowIntervals[index],
              AbstractGridLayoutEditPolicy.INSERT_ROW_SIZE);
      y = parameters[1];
      size = parameters[2] - parameters[1];
    } else {
      index = m_layout.getRows().size();
      m_mainPolicy.showInsertFeedbacks(null, null);
      // prepare parameters
      y = rowIntervals[rowIntervals.length - 1].end() + 1;
      size = AbstractGridLayoutEditPolicy.INSERT_ROW_SIZE;
    }
    // show insert feedbacks
    {
      // ...on main viewer
      m_mainPolicy.showInsertFeedbacks(null, new Rectangle(x1, y, x2 - x1, size));
      // ...on header viewer
      {
        if (m_insertFeedback.getParent() == null) {
          addFeedback(m_insertFeedback);
        }
        //
        Point offset = headerEditPart.getOffset();
        Rectangle bounds = new Rectangle(0, y + offset.y, getHostFigure().getSize().width, size);
        m_insertFeedback.setBounds(bounds);
      }
    }
    // show text feedback
    {
      Layer feedbackLayer = getMainLayer(IEditPartViewer.FEEDBACK_LAYER);
      // add feedback
      if (m_feedback == null) {
        m_feedback = new TextFeedback(feedbackLayer);
        m_feedback.add();
      }
      // set feedback bounds
      {
        Point feedbackLocation = new Point(30, location.y + 10);
        FigureUtils.translateAbsoluteToFigure(feedbackLayer, feedbackLocation);
        m_feedback.setLocation(feedbackLocation);
      }
      // set text
      m_feedback.setText("row: " + index);
View Full Code Here

    //
    Insets insets = contentPanel.getClientAreaInsets();
    Rectangle buttonParentBounds = button.getBounds();
    Rectangle buttonModelBounds = button.getModelBounds();
    assertEquals(new Insets(36, 11, 11, 11), insets);
    assertEquals(new Point(20, 30), buttonModelBounds.getLocation());
    assertEquals(buttonParentBounds.x, buttonModelBounds.x + insets.left);
    assertEquals(buttonParentBounds.y, buttonModelBounds.y + insets.top);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.draw2d.geometry.Point

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.