Package rocket.style.client

Examples of rocket.style.client.ComputedStyle


    // Must set absolute coordinates in order to read the coordinates of
    // element accurately IE6 bug
    final Element menuListElement = menuList.getElement();
    final InlineStyle menuListInlineStyle = InlineStyle.getInlineStyle(menuListElement );
    final ComputedStyle menuListComputedStyle = ComputedStyle.getComputedStyle(menuListElement );
   
    menuListInlineStyle.setString(Css.POSITION, "absolute");
    menuListInlineStyle.setInteger(Css.LEFT, 0, CssUnit.PX);
    menuListInlineStyle.setInteger(Css.TOP, 0, CssUnit.PX);

    int x = Dom.getContainerLeftOffset(menuListElement);
    int y = Dom.getContainerTopOffset(menuListElement);

    while (true) {
      final MenuListOpenDirection openDirection = menuList.getOpenDirection();

      if (MenuListOpenDirection.LEFT == openDirection) {
        x = x - menuListComputedStyle.getInteger(Css.WIDTH, CssUnit.PX, 0);
        x = x + menuListComputedStyle.getInteger(Css.BORDER_RIGHT_WIDTH, CssUnit.PX, 0);
        x++;

        y = y - menuListComputedStyle.getInteger(Css.BORDER_TOP_WIDTH, CssUnit.PX, 0);
        break;
      }
      if (MenuListOpenDirection.UP == openDirection) {
        x = x - menuListComputedStyle.getInteger(Css.BORDER_LEFT_WIDTH, CssUnit.PX, 0);

        y = y - menuListComputedStyle.getInteger(Css.HEIGHT, CssUnit.PX, 0);
        y = y + menuListComputedStyle.getInteger(Css.BORDER_BOTTOM_WIDTH, CssUnit.PX, 0);
        y--;
        break;
      }
      if (MenuListOpenDirection.RIGHT == openDirection) {
        x = x + menuListComputedStyle.getInteger(Css.WIDTH, CssUnit.PX, 0);
        x = x - menuListComputedStyle.getInteger(Css.BORDER_LEFT_WIDTH, CssUnit.PX, 0);
        x--;

        y = y - menuListComputedStyle.getInteger(Css.BORDER_TOP_WIDTH, CssUnit.PX, 0);
        break;
      }
      Checker.same("openDirection", MenuListOpenDirection.DOWN, openDirection);

      x = x - menuListComputedStyle.getInteger(Css.BORDER_LEFT_WIDTH, CssUnit.PX, 0);

      y = y + menuListComputedStyle.getInteger(Css.HEIGHT, CssUnit.PX, 0); // parentMenuList
      y = y - menuListComputedStyle.getInteger(Css.BORDER_TOP_WIDTH, CssUnit.PX, 0);
      y--;
      break;
    }
    menuListInlineStyle.setString(Css.POSITION, "absolute");
    menuListInlineStyle.setInteger(Css.LEFT, x, CssUnit.PX);
View Full Code Here


    final String originalHeight = backgroundInlineStyle.getString(Css.HEIGHT);

    JavaScript.setString(element, "_" + Css.WIDTH, originalWidth);
    JavaScript.setString(element, "_" + Css.HEIGHT, originalHeight);

    final ComputedStyle elementComputedStyle = ComputedStyle.getComputedStyle( this.getElement() );
    final int widthInPixels = elementComputedStyle.getInteger(Css.WIDTH, CssUnit.PX, 0);
    backgroundInlineStyle.setInteger(Css.WIDTH, widthInPixels, CssUnit.PX);

    final int heightInPixels = elementComputedStyle.getInteger(Css.HEIGHT, CssUnit.PX, 0);
    backgroundInlineStyle.setInteger(Css.HEIGHT, heightInPixels, CssUnit.PX);
  }
View Full Code Here

      // attempting to maintain the aspect ratio.
      final Widget widget = ResizablePanel.this.getWidget();
      widget.addStyleName(ResizablePanel.this.getDraggedWidgetStyle());

      final Element element = widget.getElement();
      final ComputedStyle elementComputedStyle = ComputedStyle.getComputedStyle(element);
     
      final int width = elementComputedStyle.getInteger( Css.WIDTH, CssUnit.PX, 0);
      this.setInitialWidgetWidth(width);

      final int height = elementComputedStyle.getInteger(Css.HEIGHT, CssUnit.PX, 0);
      this.setInitialWidgetHeight(height);

      // record the initial mouse position
      this.setInitialMouseX(event.getPageX());
      this.setInitialMouseY(event.getPageY());
View Full Code Here

  }

  protected void onBackgroundMouseDown(final int mouseX, final int mouseY) {
    final Element handle = this.getHandle().getElement();
    final InlineStyle inlineStyle = InlineStyle.getInlineStyle(handle);
    final ComputedStyle computedStyle = ComputedStyle.getComputedStyle(handle);
   
    boolean killTimer = false;

    final int x = this.getXValue();
    final int handleX = computedStyle.getInteger(Css.LEFT, CssUnit.PX, 0);
    int deltaX = mouseX - handleX;
    if (0 != deltaX) {
      if (deltaX < 0) {
        this.onBeforeHandleXMouseDown();
      } else {
        this.onAfterHandleXMouseDown();
      }
      final int handleXAfter = computedStyle.getInteger(Css.LEFT, CssUnit.PX, 0);
      final int deltaXAfter = mouseX - handleXAfter;

      if (deltaX < 0 ^ deltaXAfter < 0) {
        this.setXValue(x);
        inlineStyle.setInteger(Css.LEFT, mouseX, CssUnit.PX);
        deltaX = 0;
      }
    }

    final int y = this.getYValue();
    final int handleY = computedStyle.getInteger( Css.TOP, CssUnit.PX, 0);
    int deltaY = mouseY - handleY;
    if (0 != deltaY) {
      if (deltaY < 0) {
        this.onBeforeHandleYMouseDown();
      } else {
        this.onAfterHandleYMouseDown();
      }
      final int handleYAfter = computedStyle.getInteger(Css.TOP, CssUnit.PX, 0);
      final int deltaYAfter = mouseY - handleYAfter;

      if (deltaY < 0 ^ deltaYAfter < 0) {
        this.setYValue(y);
        inlineStyle.setInteger(Css.TOP, mouseY, CssUnit.PX);
View Full Code Here

TOP

Related Classes of rocket.style.client.ComputedStyle

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.