Package org.eclipse.wb.draw2d.geometry

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


  @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


   */
  protected Point fetchObjectLocation() throws Exception {
    Object object = getObject();
    int left = (Integer) ReflectionUtils.invokeMethodEx(object, "getLeft()");
    int top = (Integer) ReflectionUtils.invokeMethodEx(object, "getTop()");
    return new Point(left, top);
  }
View Full Code Here

      @Override
      protected void executeEdit() throws Exception {
        placementsSupport.commitAdd();
        Rectangle widgetModelBounds = component.getModelBounds();
        m_layout.command_CREATE(component, null);
        Point location = widgetModelBounds.getLocation();
        Dimension size = getSize(widgetModelBounds);
        m_layout.command_BOUNDS(component, location, size);
      }

      private Dimension getSize(Rectangle widgetModelBounds) {
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected void refresh_fetch() throws Exception {
    super.refresh_fetch();
    // correct corrupted bounds
    Point shiftPoint = getBounds().getLocation().getNegated();
    for (StatefulCanvasInfo button : getButtons()) {
      Rectangle buttonBounds = new Rectangle(button.getModelBounds());
      buttonBounds.translate(shiftPoint);
      button.setBounds(buttonBounds);
    }
View Full Code Here

            "}");
    container.refresh();
    AbsoluteLayoutInfo layout = (AbsoluteLayoutInfo) container.getLayout();
    WidgetInfo button = container.getWidgets().get(0);
    // set location
    layout.command_BOUNDS(button, new Point(1, 2), null);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new AbsoluteLayout());",
        "    {",
View Full Code Here

            "}");
    container.refresh();
    AbsoluteLayoutInfo layout = (AbsoluteLayoutInfo) container.getLayout();
    WidgetInfo button = container.getWidgets().get(0);
    // set location
    layout.command_BOUNDS(button, new Point(1, 2), null);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new AbsoluteLayout());",
        "    {",
View Full Code Here

            "}");
    container.refresh();
    AbsoluteLayoutInfo layout = (AbsoluteLayoutInfo) container.getLayout();
    WidgetInfo button = container.getWidgets().get(0);
    // set location
    layout.command_BOUNDS(button, new Point(-1, -1), null);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new AbsoluteLayout());",
        "    {",
View Full Code Here

        "      add(button);",
        "    }",
        "  }",
        "}");
    // set bounds
    layout.command_BOUNDS(newButton, new Point(10, 20), new Dimension(100, 50));
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new AbsoluteLayout());",
        "    {",
View Full Code Here

            "}");
    container.refresh();
    AbsoluteLayoutInfo layout = (AbsoluteLayoutInfo) container.getLayout();
    ComponentInfo text = container.getChildren(ComponentInfo.class).get(1);
    // Bounds
    layout.command_BOUNDS(text, new Point(5, 5), null);
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new AbsoluteLayout());",
        "    {",
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

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.