Esempio n. 1
0
  /**
   * Inserts a widget before the specified index.
   *
   * <p>By default, each child will fill the panel. To build more interesting layouts, set child
   * widgets' layout constraints using {@link #setWidgetLeftRight(Widget, double, Style.Unit,
   * double, Style.Unit)} and related methods.
   *
   * <p>Inserting a widget in this way has no effect on the DOM structure, but can be useful for
   * other panels that wrap LayoutPanel to maintain insertion order.
   *
   * @param widget the widget to be inserted
   * @param beforeIndex the index before which it will be inserted
   * @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out of range
   */
  public void insert(Widget widget, int beforeIndex) {
    // Detach new child.
    widget.removeFromParent();

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

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

    // Adopt.
    adopt(widget);

    animate(0);
  }
Esempio n. 2
0
 /**
  * Shows or hides the given widget and its layer. This method explicitly calls {@link
  * UIObject#setVisible(boolean)} on the child widget and ensures that its associated layer is
  * shown/hidden.
  *
  * @param child
  * @param visible
  */
 public void setWidgetVisible(Widget child, boolean visible) {
   assertIsChild(child);
   getLayer(child).setVisible(visible);
   child.setVisible(visible);
   animate(0);
 }
Esempio n. 3
0
 /**
  * Sets the child widget's vertical position within its layer.
  *
  * @param child
  * @param position
  */
 public void setWidgetVerticalPosition(Widget child, Alignment position) {
   assertIsChild(child);
   getLayer(child).setChildVerticalPosition(position);
   animate(0);
 }
Esempio n. 4
0
 /**
  * Sets the child widget's top and height values.
  *
  * @param child
  * @param top
  * @param topUnit
  * @param height
  * @param heightUnit
  */
 public void setWidgetTopHeight(
     Widget child, double top, Unit topUnit, double height, Unit heightUnit) {
   assertIsChild(child);
   getLayer(child).setTopHeight(top, topUnit, height, heightUnit);
   animate(0);
 }
Esempio n. 5
0
 /**
  * Sets the child widget's top and bottom values.
  *
  * @param child
  * @param top
  * @param topUnit
  * @param bottom
  * @param bottomUnit
  */
 public void setWidgetTopBottom(
     Widget child, double top, Unit topUnit, double bottom, Unit bottomUnit) {
   assertIsChild(child);
   getLayer(child).setTopBottom(top, topUnit, bottom, bottomUnit);
   animate(0);
 }
Esempio n. 6
0
 /**
  * Sets the child widget's right and width values.
  *
  * @param child
  * @param right
  * @param rightUnit
  * @param width
  * @param widthUnit
  */
 public void setWidgetRightWidth(
     Widget child, double right, Unit rightUnit, double width, Unit widthUnit) {
   assertIsChild(child);
   getLayer(child).setRightWidth(right, rightUnit, width, widthUnit);
   animate(0);
 }
Esempio n. 7
0
 /**
  * Sets the child widget's left and width values.
  *
  * @param child
  * @param left
  * @param leftUnit
  * @param width
  * @param widthUnit
  */
 public void setWidgetLeftWidth(
     Widget child, double left, Unit leftUnit, double width, Unit widthUnit) {
   assertIsChild(child);
   getLayer(child).setLeftWidth(left, leftUnit, width, widthUnit);
   animate(0);
 }
Esempio n. 8
0
 /**
  * Sets the child widget's left and right values.
  *
  * @param child
  * @param left
  * @param leftUnit
  * @param right
  * @param rightUnit
  */
 public void setWidgetLeftRight(
     Widget child, double left, Unit leftUnit, double right, Unit rightUnit) {
   assertIsChild(child);
   getLayer(child).setLeftRight(left, leftUnit, right, rightUnit);
   animate(0);
 }
Esempio n. 9
0
 /**
  * Sets the child widget's bottom and height values.
  *
  * @param child
  * @param bottom
  * @param bottomUnit
  * @param height
  * @param heightUnit
  */
 public void setWidgetBottomHeight(
     Widget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) {
   assertIsChild(child);
   getLayer(child).setBottomHeight(bottom, bottomUnit, height, heightUnit);
   animate(0);
 }
Esempio n. 10
0
 public void animate(int duration) {
   animate(duration, null);
 }