Package org.gwt.mosaic.core.client

Examples of org.gwt.mosaic.core.client.Dimension


    }

    final int left = paddingLeftMeasure.sizeOf(layoutPanel);
    final int top = paddingTopMeasure.sizeOf(layoutPanel);

    final Dimension box = DOM.getClientSize(layoutPanel.getElement());
    int width = box.width - (left + paddingRightMeasure.sizeOf(layoutPanel));
    int height = box.height - (top + paddingBottomMeasure.sizeOf(layoutPanel));

    final Widget parent = child.getParent();
    if (parent instanceof InternalDecoratorPanel) {
      final InternalDecoratorPanel decPanel = (InternalDecoratorPanel) parent;
      final int borderSizes[] = decPanel.getBorderSizes();
      width -= (borderSizes[1] + borderSizes[3]);
      height -= (borderSizes[0] + borderSizes[2]);
    }

    HorizontalAlignmentConstant hAlignment = layoutData.getHorizontalAlignment();
    if (hAlignment == null) {
      hAlignment = getHorizontalAlignment();
    }

    Dimension prefSize = null;

    if (hAlignment == null) {
      layoutData.targetLeft = left;
      layoutData.targetWidth = width;
    } else {
      // (ggeorg) this call to WidgetHelper.getPreferredSize() is
      // required even for ALIGN_LEFT
      prefSize = new Dimension(preferredWidthMeasure.sizeOf(child),
          preferredHeightMeasure.sizeOf(child));

      if (HasHorizontalAlignment.ALIGN_LEFT == hAlignment) {
        layoutData.targetLeft = left;
      } else if (HasHorizontalAlignment.ALIGN_CENTER == hAlignment) {
        layoutData.targetLeft = left + (width - prefSize.width) / 2;
      } else {
        layoutData.targetLeft = left + width - prefSize.width;
      }
      layoutData.targetWidth = prefSize.width;
    }

    VerticalAlignmentConstant vAlignment = layoutData.getVerticalAlignment();
    if (vAlignment == null) {
      vAlignment = getVerticalAlignment();
    }

    if (vAlignment == null) {
      layoutData.targetTop = top;
      layoutData.targetHeight = height;
    } else {
      if (prefSize == null) {
        // (ggeorg) this call to WidgetHelper.getPreferredSize() is
        // required even for ALIGN_TOP
        prefSize = new Dimension(preferredWidthMeasure.sizeOf(child),
            preferredHeightMeasure.sizeOf(child));
      }

      if (HasVerticalAlignment.ALIGN_TOP == vAlignment) {
        layoutData.targetTop = top;
View Full Code Here


   * @see org.gwt.mosaic.ui.client.layout.LayoutManager#getPreferredSize(org.gwt.mosaic.ui.client.layout.LayoutPanel)
   */
  public Dimension getPreferredSize(LayoutPanel layoutPanel) {
    try {
      if (!(layoutPanel == null || !init(layoutPanel))) {
        final Dimension d = computeLayoutSize(layoutPanel,
            preferredWidthMeasure, preferredHeightMeasure);
        return d;
      }
    } catch (Exception e) {
      GWT.log(e.getMessage(), e);
      Window.alert(getClass().getName() + ".getPreferredSize(): "
          + e.getLocalizedMessage());
    }
    return new Dimension();
  }
View Full Code Here

   *
   * @param target the container which needs to be laid out
   * @return the maximum dimensions for this layout
   */
  public Dimension maximumLayoutSize(Widget target) {
    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  }
View Full Code Here

    try {
      if (layoutPanel == null || !init(layoutPanel)) {
        return;
      }

      final Dimension box = DOM.getClientSize(layoutPanel.getElement());

      final int left = paddingLeftMeasure.sizeOf(layoutPanel);
      final int top = paddingTopMeasure.sizeOf(layoutPanel);
      int width = box.width - (left + paddingRightMeasure.sizeOf(layoutPanel));
      int height = box.height
View Full Code Here

        + borderTopMeasure.sizeOf(layoutPanel)
        + borderBottomMeasure.sizeOf(layoutPanel)
        + paddingTopMeasure.sizeOf(layoutPanel)
        + paddingBottomMeasure.sizeOf(layoutPanel);

    return new Dimension(maxWidth, maxHeight);
  }
View Full Code Here

  public int getContentHeight() {
    return contentHeight;
  }

  public Dimension getContentSize() {
    return new Dimension(contentWidth, contentHeight);
  }
View Full Code Here

   * @param parent the <code>Container</code> to inspect
   * @return an object that comprises the grid x and y origins
   */
  public LayoutInfo getLayoutInfo(LayoutPanel parent) {
    initializeColAndRowWidgetLists();
    final Dimension size = WidgetHelper.getOffsetSize(parent);

    // FIXME
    // Insets insets = parent.getInsets();
    int totalWidth = size.width;// - insets.left - insets.right;
    int totalHeight = size.height;// - insets.top - insets.bottom;
View Full Code Here

      return;
    }

    if (collapsed) {
      if (getWindowState() != WindowState.MAXIMIZED) {
        final Dimension box = DOM.getClientSize(getElement());
        final Dimension size2 = WidgetHelper.getOffsetSize(WindowPanel.this);
        final Dimension size3 = WidgetHelper.getOffsetSize(getLayoutPanel());
        normalBounds.width = box.width - (size2.width - size3.width);
        normalBounds.height = box.height - (size2.height - size3.height);
      }
      panel.setCollapsed(true);
View Full Code Here

  protected void adjustGlassPanelBounds() {
    if (glassPanelParent == null) {
      return;
    }
    final Dimension size = WidgetHelper.getOffsetSize(targetWidget);
    RootPanel.get().setWidgetPosition(glassPanelParent,
        targetWidget.getAbsoluteLeft(), targetWidget.getAbsoluteTop());
    glassPanelParent.setPixelSize(size.width, size.height);
    glassPanel.removeFromParent();
    glassPanelParent.add(glassPanel, 0, 0);
View Full Code Here

   * {@inheritDoc}
   *
   * @see org.gwt.mosaic.ui.client.layout.HasLayoutManager#getPreferredSize()
   */
  public Dimension getPreferredSize() {
    final Dimension result = getLayoutPanel().getPreferredSize();

    final int[] decoratorBorder = getDecoratorBorder();

    result.width += decoratorBorder[0];
    result.height += decoratorBorder[1];
View Full Code Here

TOP

Related Classes of org.gwt.mosaic.core.client.Dimension

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.