Package org.eclipse.wb.draw2d.geometry

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


            "    }",
            "  }",
            "}");
    // 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");
    assertEditor(
View Full Code Here


    if (isRoot()) {
      fetchImage(element);
    }
    // prepare parent-relative bounds
    {
      Rectangle parentBounds = new Rectangle(m_absoluteBounds);
      if (getParent() instanceof AbstractComponentInfo) {
        AbstractComponentInfo parent = (AbstractComponentInfo) getParent();
        Rectangle parentAbsoluteBounds = parent.getAbsoluteBounds();
        parentBounds.x -= parentAbsoluteBounds.x;
        parentBounds.y -= parentAbsoluteBounds.y;
      } else {
        parentBounds.x = parentBounds.y = 0;
      }
View Full Code Here

  }

  protected void fetchBounds(Object element) throws Exception {
    m_absoluteBounds = fetchAbsoluteBounds(element);
    {
      Rectangle bounds = m_absoluteBounds.getCopy();
      if (getParent() instanceof AbstractComponentInfo) {
        AbstractComponentInfo parent = (AbstractComponentInfo) getParent();
        Rectangle parentAbsoluteBounds = parent.getAbsoluteBounds();
        bounds.x -= parentAbsoluteBounds.x;
        bounds.y -= parentAbsoluteBounds.y;
        bounds.translate(parent.getClientAreaInsets().getNegated());
      }
      setModelBounds(bounds);
View Full Code Here

  protected Rectangle fetchModelBounds(Object element) {
    return getState().getModelBounds(element);
  }

  protected Rectangle fetchAbsoluteBounds(Object element) {
    Rectangle absoluteBounds = getState().getAbsoluteBounds(element);
    // Case 43858: https://fogbugz.instantiations.com/default.php?43858
    if (isRoot()) {
      if (absoluteBounds.x < 0) {
        absoluteBounds.x = 0;
      }
View Full Code Here

  protected void fetchImage(Object element) throws Exception {
    GwtState state = getState();
    Image browserScreenshot = state.createBrowserScreenshot();
    // prepare bounds of image
    Rectangle imageBounds = m_absoluteBounds;
    if (state.isStrictMode() && state.isBrowserExplorer()) {
      imageBounds = imageBounds.getTranslated(2, 2);
    }
    // set image
    Image objectImage = UiUtils.getCroppedImage(browserScreenshot, imageBounds.getSwtRectangle());
    setImage(objectImage);
  }
View Full Code Here

  /**
   * If widget has no size and no forced size (i.e. most probably custom component), then set some
   * reasonable default size.
   */
  private void setDefaultSizeIfEmpty(final WidgetInfo widget) {
    Rectangle bounds = widget.getBounds();
    if (bounds.width == 0 || bounds.height == 0) {
      m_shouldSetSize = true;
      ExecutionUtils.run(widget, new RunnableEx() {
        public void run() throws Exception {
          widget.getSizeSupport().setSize(100, 100);
View Full Code Here

  /**
   * @return the {@link Image} of {@link WidgetInfo} that is direct child of
   *         <code>AbsolutePanel</code>.
   */
  private Image getWidgetImage(WidgetInfo widget) {
    Rectangle bounds = widget.getAbsoluteBounds();
    if (bounds.width == 0 || bounds.height == 0) {
      Dimension forcedSize = getForcedSize();
      return new Image(null, forcedSize.width, forcedSize.height);
    } else {
      AbsolutePanelInfo absolutePanel = (AbsolutePanelInfo) widget.getRoot();
      return UiUtils.getCroppedImage(absolutePanel.getImage(), bounds.getSwtRectangle());
    }
  }
View Full Code Here

  private void command_SIZE_X(WidgetInfo widget, int width, ResizeDirection direction)
      throws Exception {
    Location location = getLocation(widget, true);
    DocumentElement layer = location.layer;
    Rectangle bounds = widget.getBounds();
    // LeftWidth
    if (location.leading != null && location.size != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldLeft = bounds.left();
        int deltaWidth = width - bounds.width;
        int left = oldLeft - deltaWidth;
        setPixels(location.leading, left);
      }
      setPixels(location.size, width);
      return;
    }
    // RightWidth
    if (location.trailing != null && location.size != null) {
      if (direction == ResizeDirection.TRAILING) {
        int oldRight = getBounds().width - bounds.right();
        int deltaWidth = width - bounds.width;
        int right = oldRight - deltaWidth;
        setPixels(location.trailing, right);
      }
      setPixels(location.size, width);
      return;
    }
    // LeftRight
    if (location.leading != null && location.trailing != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldLeft = bounds.left();
        int deltaWidth = width - bounds.width;
        int left = oldLeft - deltaWidth;
        setPixels(location.leading, left);
      }
      if (direction == ResizeDirection.TRAILING) {
        int oldRight = getBounds().width - bounds.right();
        int deltaWidth = width - bounds.width;
        int right = oldRight - deltaWidth;
        setPixels(location.trailing, right);
      }
      return;
View Full Code Here

  private void command_SIZE_Y(WidgetInfo widget, int height, ResizeDirection direction)
      throws Exception {
    Location location = getLocation(widget, false);
    DocumentElement layer = location.layer;
    Rectangle bounds = widget.getBounds();
    // TopHeight
    if (location.leading != null && location.size != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldTop = bounds.top();
        int deltaHeight = height - bounds.height;
        int top = oldTop - deltaHeight;
        setPixels(location.leading, top);
      }
      setPixels(location.size, height);
      return;
    }
    // BottomHeight
    if (location.trailing != null && location.size != null) {
      if (direction == ResizeDirection.TRAILING) {
        int oldBottom = getBounds().height - bounds.bottom();
        int deltaHeight = height - bounds.height;
        int bottom = oldBottom - deltaHeight;
        setPixels(location.trailing, bottom);
      }
      setPixels(location.size, height);
      return;
    }
    // TopBottom
    if (location.leading != null && location.trailing != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldTop = bounds.top();
        int deltaHeight = height - bounds.height;
        int top = oldTop - deltaHeight;
        setPixels(location.leading, top);
      }
      if (direction == ResizeDirection.TRAILING) {
        int oldBottom = getBounds().height - bounds.bottom();
        int deltaHeight = height - bounds.height;
        int bottom = oldBottom - deltaHeight;
        setPixels(location.trailing, bottom);
      }
      return;
View Full Code Here

  }

  private void command_ANCHOR_horizontal(WidgetInfo widget, Anchor anchor) throws Exception {
    Location location = getLocation(widget, true);
    DocumentElement layer = location.layer;
    Rectangle bounds = widget.getBounds();
    if (location.leading != null && location.size != null) {
      if (anchor == Anchor.NONE) {
        layer.setAttribute("left", null);
        layer.setAttribute("width", null);
      }
      if (anchor == Anchor.TRAILING) {
        int right = getBounds().width - bounds.right();
        layer.setAttribute("left", null);
        setPixels(location.leading, "right", right);
      }
      if (anchor == Anchor.BOTH) {
        int right = getBounds().width - bounds.right();
        layer.setAttribute("width", null);
        setPixels(location.leading, "right", right);
      }
      return;
    }
    if (location.trailing != null && location.size != null) {
      if (anchor == Anchor.NONE) {
        layer.setAttribute("right", null);
        layer.setAttribute("width", null);
      }
      if (anchor == Anchor.LEADING) {
        int left = bounds.left();
        layer.setAttribute("right", null);
        setPixels(location.trailing, "left", left);
      }
      if (anchor == Anchor.BOTH) {
        int left = bounds.left();
        layer.setAttribute("width", null);
        setPixels(location.trailing, "left", left);
      }
      return;
    }
    if (location.leading != null && location.trailing != null) {
      if (anchor == Anchor.NONE) {
        layer.setAttribute("left", null);
        layer.setAttribute("right", null);
      }
      if (anchor == Anchor.LEADING) {
        layer.setAttribute("right", null);
        setPixels(location.leading, "width", bounds.width);
      }
      if (anchor == Anchor.TRAILING) {
        layer.setAttribute("left", null);
        setPixels(location.trailing, "width", bounds.width);
      }
      return;
    }
    // no anchor yet
    if (anchor != Anchor.NONE) {
      if (anchor == Anchor.LEADING) {
        layer.setAttribute("left", bounds.left() + "px");
        layer.setAttribute("width", bounds.width + "px");
      }
      if (anchor == Anchor.TRAILING) {
        layer.setAttribute("right", getBounds().width - bounds.right() + "px");
        layer.setAttribute("width", bounds.width + "px");
      }
      if (anchor == Anchor.BOTH) {
        layer.setAttribute("left", bounds.left() + "px");
        layer.setAttribute("right", getBounds().width - bounds.right() + "px");
      }
    }
  }
View Full Code Here

TOP

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

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.