Package org.eclipse.wb.draw2d.geometry

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


            "  </g:TabPanel>",
            "</ui:UiBinder>");
    // drag header of "button_2"
    {
      Rectangle bounds = panel.getWidgetHandles().get(1).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y);
      canvas.beginDrag().dragTo(panel, 0, 5).endDrag();
    }
    assertXML(
        "// filler filler filler filler filler",
View Full Code Here


            "  </g:TabPanel>",
            "</ui:UiBinder>");
    // drag header of "button_1"
    {
      Rectangle bounds = panel.getWidgetHandles().get(0).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y);
      canvas.beginDrag().dragTo(panel, -1, 0).endDrag();
    }
    assertXML(
        "// filler filler filler filler filler",
View Full Code Here

    assertTrue(isVisible(button_1));
    assertFalse(isVisible(button_2));
    // double click handle of "button_1"
    {
      Rectangle bounds = panel.getWidgetHandles().get(1).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y).doubleClick();
    }
    // now "button_2" is visible
    assertFalse(isVisible(button_1));
    assertTrue(isVisible(button_2));
View Full Code Here

            "  </g:TabPanel>",
            "</ui:UiBinder>");
    // select header
    {
      Rectangle bounds = panel.getWidgetHandles().get(0).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y).click();
    }
    // do direct edit
    canvas.performDirectEdit("123");
    assertXML(
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

      canvas.putArbitraryValue(this, boundsProperty);
      // x
      BoundsProperty<?> xProperty = new BoundsProperty<CanvasInfo>(canvas, "x") {
        @Override
        public void setValue2(int value, Rectangle modelBounds) throws Exception {
          command_BOUNDS(m_component, new Point(value, modelBounds.y), null);
        }
      };
      // y
      BoundsProperty<?> yProperty = new BoundsProperty<CanvasInfo>(canvas, "y") {
        @Override
        public void setValue2(int value, Rectangle modelBounds) throws Exception {
          command_BOUNDS(m_component, new Point(modelBounds.x, value), null);
        }
      };
      // width
      BoundsProperty<?> widthProperty = new BoundsProperty<CanvasInfo>(canvas, "width") {
        @Override
View Full Code Here

    }
    // prepare component
    CanvasInfo canvas = createClone();
    // add component on Canvas
    parentCanvas.command_absolute_CREATE(canvas, null);
    parentCanvas.command_BOUNDS(canvas, new Point(10, 10), null);
    // check for forced size
    {
      String width = canvas.getDescription().getParameter("liveComponent.forcedSize.width");
      String height = canvas.getDescription().getParameter("liveComponent.forcedSize.height");
      if (!StringUtils.isEmpty(width) && !StringUtils.isEmpty(height)) {
View Full Code Here

            "  </g:StackLayoutPanel>",
            "</ui:UiBinder>");
    // drag header of "button_2"
    {
      Rectangle bounds = panel.getWidgetHandles().get(1).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y);
      canvas.beginDrag().dragTo(panel, 0.5, 0).endDrag();
    }
    assertXML(
        "// filler filler filler filler filler",
View Full Code Here

            "  </g:StackLayoutPanel>",
            "</ui:UiBinder>");
    // drag header of "button_1"
    {
      Rectangle bounds = panel.getWidgetHandles().get(0).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y);
      canvas.beginDrag().dragTo(panel, 0.5, -1).endDrag();
    }
    assertXML(
        "<ui:UiBinder>",
View Full Code Here

    assertTrue(isVisible(button_1));
    assertFalse(isVisible(button_2));
    // double click handle of "button_1"
    {
      Rectangle bounds = panel.getWidgetHandles().get(1).getBounds();
      Point handleCenter = bounds.getCenter();
      canvas.moveTo(panel, handleCenter.x, handleCenter.y).doubleClick();
    }
    // now "button_2" is visible
    assertFalse(isVisible(button_1));
    assertTrue(isVisible(button_2));
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.