Package com.google.gwt.layout.client.Layout

Examples of com.google.gwt.layout.client.Layout.Layer


    if (direction == Direction.CENTER) {
      center = widget;
    }

    // Physical attach.
    Layer layer = layout.attachChild(widget.getElement(),
        (before != null) ? before.getElement() : null, widget);
    LayoutData data = new LayoutData(direction, size, layer);
    widget.setLayoutData(data);

    // Adopt.
View Full Code Here


  private void doLayout() {
    double left = 0, top = 0, right = 0, bottom = 0;

    for (Widget child : getChildren()) {
      LayoutData data = (LayoutData) child.getLayoutData();
      Layer layer = data.layer;

      switch (data.direction) {
        case NORTH:
          layer.setLeftRight(left, unit, right, unit);
          layer.setTopHeight(top, unit, data.size, unit);
          top += data.size;
          break;

        case SOUTH:
          layer.setLeftRight(left, unit, right, unit);
          layer.setBottomHeight(bottom, unit, data.size, unit);
          bottom += data.size;
          break;

        case WEST:
          layer.setTopBottom(top, unit, bottom, unit);
          layer.setLeftWidth(left, unit, data.size, unit);
          left += data.size;
          break;

        case EAST:
          layer.setTopBottom(top, unit, bottom, unit);
          layer.setRightWidth(right, unit, data.size, unit);
          right += data.size;
          break;

        case CENTER:
          layer.setLeftRight(left, unit, right, unit);
          layer.setTopBottom(top, unit, bottom, unit);
          break;
      }
    }
  }
View Full Code Here

    // Remove old child.
    if (toReplace != null) {
      remove(toReplace);
    }

    Layer toRet = null;
    if (w != null) {
      // Physical attach.
      toRet = layout.attachChild(w.asWidget().getElement());

      adopt(w.asWidget());
View Full Code Here

      int index = children.indexOf(before);
      children.insert(widget, index);
    }

    // Physical attach.
    Layer layer = layout.attachChild(widget.getElement(), (before != null)
        ? before.getElement() : null, widget);
    setWidgetVisible(widget, layer, false);
    widget.setLayoutData(layer);

    // Adopt.
View Full Code Here

  @Override
  public boolean remove(Widget w) {
    boolean removed = super.remove(w);
    if (removed) {
      Layer layer = (Layer) w.getLayoutData();
      layout.removeChild(layer);
      w.setLayoutData(null);

      if (visibleWidget == w) {
        visibleWidget = null;
View Full Code Here

  /**
   * Hide the widget that just slid out of view.
   */
  private void doAfterLayout() {
    if (hidingWidget != null) {
      Layer layer = (Layer) hidingWidget.getLayoutData();
      setWidgetVisible(hidingWidget, layer, false);
      layout.layout();
      hidingWidget = null;
    }
  }
View Full Code Here

  /**
   * Initialize the location of the widget that will slide into view.
   */
  private void doBeforeLayout() {
    Layer oldLayer = (lastVisibleWidget == null) ? null
        : (Layer) lastVisibleWidget.getLayoutData();
    Layer newLayer = (visibleWidget == null) ? null
        : (Layer) visibleWidget.getLayoutData();

    // Calculate the direction that the new widget will enter.
    int oldIndex = getWidgetIndex(lastVisibleWidget);
    int newIndex = getWidgetIndex(visibleWidget);
    double direction = (oldIndex < newIndex) ? 100.0 : -100.0;
    double vDirection = isAnimationVertical ? direction : 0.0;
    double hDirection = isAnimationVertical ? 0.0
        : LocaleInfo.getCurrentLocale().isRTL() ? -direction : direction;

    /*
     * Position the old widget in the center of the panel, and the new widget
     * off to one side. If the old widget is the same as the new widget, then
     * skip this step.
     */
    hidingWidget = null;
    if (visibleWidget != lastVisibleWidget) {
      // Position the layers in their start positions.
      if (oldLayer != null) {
        // The old layer starts centered in the panel.
        oldLayer.setTopHeight(0.0, Unit.PCT, 100.0, Unit.PCT);
        oldLayer.setLeftWidth(0.0, Unit.PCT, 100.0, Unit.PCT);
        setWidgetVisible(lastVisibleWidget, oldLayer, true);
      }
      if (newLayer != null) {
        // The new layer starts off to one side.
        newLayer.setTopHeight(vDirection, Unit.PCT, 100.0, Unit.PCT);
        newLayer.setLeftWidth(hDirection, Unit.PCT, 100.0, Unit.PCT);
        setWidgetVisible(visibleWidget, newLayer, true);
      }
      layout.layout();
      hidingWidget = lastVisibleWidget;
    }

    // Set the end positions of the layers.
    if (oldLayer != null) {
      // The old layer ends off to one side.
      oldLayer.setTopHeight(-vDirection, Unit.PCT, 100.0, Unit.PCT);
      oldLayer.setLeftWidth(-hDirection, Unit.PCT, 100.0, Unit.PCT);
      setWidgetVisible(lastVisibleWidget, oldLayer, true);
    }
    if (newLayer != null) {
      // The new layer ends centered in the panel.
      newLayer.setTopHeight(0.0, Unit.PCT, 100.0, Unit.PCT);
      newLayer.setLeftWidth(0.0, Unit.PCT, 100.0, Unit.PCT);
      /*
       * The call to layout() above could have canceled an existing layout
       * animation, which could cause this widget to be hidden if the user
       * toggles between two visible widgets. We set it visible again to ensure
       * that it ends up visible.
View Full Code Here

    if (direction == Direction.CENTER) {
      center = widget;
    }

    // Physical attach.
    Layer layer = layout.attachChild(widget.getElement(),
        (before != null) ? before.getElement() : null, widget);
    LayoutData data = new LayoutData(direction, size, layer);
    widget.setLayoutData(data);

    // Adopt.
View Full Code Here

    double right = 0;
    double bottom = 0;

    for (Widget child : getChildren()) {
      LayoutData data = (LayoutData) child.getLayoutData();
      Layer layer = data.layer;

      switch (getResolvedDirection(data.direction)) {
        case NORTH:
          layer.setLeftRight(left, unit, right, unit);
          layer.setTopHeight(top, unit, data.size, unit);
          top += data.size;
          break;

        case SOUTH:
          layer.setLeftRight(left, unit, right, unit);
          layer.setBottomHeight(bottom, unit, data.size, unit);
          bottom += data.size;
          break;

        case WEST:
          layer.setTopBottom(top, unit, bottom, unit);
          layer.setLeftWidth(left, unit, data.size, unit);
          left += data.size;
          break;

        case EAST:
          layer.setTopBottom(top, unit, bottom, unit);
          layer.setRightWidth(right, unit, data.size, unit);
          right += data.size;
          break;

        case CENTER:
          layer.setLeftRight(left, unit, right, unit);
          layer.setTopBottom(top, unit, bottom, unit);
          break;
      }
    }

    filledWidth = left + right;
View Full Code Here

    // Logical attach.
    getChildren().insert(widget, beforeIndex);

    // Physical attach.
    Layer layer = layout.attachChild(widget.getElement(), widget);
    widget.setLayoutData(layer);

    // Adopt.
    adopt(widget);
View Full Code Here

TOP

Related Classes of com.google.gwt.layout.client.Layout.Layer

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.