API Reference 0.3.24dart_web_toolkit_uiLayoutPanel

LayoutPanel class

A panel that lays its children out in arbitrary {@link com.google.gwt.layout.client.Layout.Layer layers} using the {@link Layout} class.

This widget will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.

Example

{@example com.google.gwt.examples.LayoutPanelExample}

Use in UiBinder Templates

LayoutPanel elements in {@link com.google.gwt.uibinder.client.UiBinder UiBinder} templates lay out their children with arbitrary constraints, using <g:layer> elements. Each layer may have any of the following constraint attributes specified as CSS length attributes: left, top, right, bottom, width , and height.

Precisely zero or two constraints are required for each axis (horizontal and vertical). Specifying no constraints implies that the child should fill that axis completely.

The valid sets of horizontal constraints are:

(none)
Fill the parent's horizontal axis
left, width
Fixed width, positioned from parent's left edge
right, width
Fixed width, positioned from parent's right edge
left, right
Width implied by fixed distance from parent's left and right edges

The valid sets of vertical constraints are:

(none)
Fill the parent's vertical axis
top, height
Fixed height, positioned from parent's top edge
bottom, height
Fixed height, positioned from parent's bottom edge
top, bottom
Height implied by fixed distance from parent's top and bottom edges

The values of constraint attributes can be any valid CSS length, such as 1px, 3em, or 0 (zero lengths require no units).

For example:

<g:LayoutPanel>
  <!-- No constraints causes the layer to fill the parent -->
  <g:layer>
    <g:Label>Lorem ipsum...</g:Label>
  </g:layer>
  <!-- Position horizontally 25% from each edge;
       Vertically 4px from the top and 10em tall. -->
  <g:layer left='25%' right='25%' top='4px' height='10em'>
    <g:Label>Header</g:Label>
  </g:layer>
</g:LayoutPanel>
class LayoutPanel extends ComplexPanel implements AnimatedLayout, RequiresResize, ProvidesResize {

 Layout _layout;
 LayoutCommand _layoutCmd;

 /**
  * Creates an empty layout panel.
  */
 LayoutPanel() {
   setElement(new dart_html.DivElement());
   _layout = new Layout(getElement());
   _layoutCmd = new LayoutCommand(_layout);
 }

 /**
  * Adds a widget to this panel.
  *
  * <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>
  *
  * @param widget the widget to be added
  */
 void add(Widget widget) {
   insertAt(widget, getWidgetCount());
 }

 void animate(int duration, [LayoutAnimationCallback callback = null]) {
   _layoutCmd.schedule(duration, callback);
 }

 void forceLayout() {
   _layoutCmd.cancel();
   _layout.layout();
   onResize();
 }

 /**
  * Gets the container element wrapping the given child widget.
  *
  * @param child
  * @return the widget's container element
  */
 dart_html.Element getWidgetContainerElement(Widget child) {
   _assertIsChild(child);
   return _getLayer(child).getContainerElement();
 }

 /**
  * 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>
  *
  * <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.
  * </p>
  *
  * @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
  */
 void insertAt(Widget widget, int beforeIndex) {
   // Detach new child.
   widget.removeFromParent();

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

   // Physical attach.
   Layer layer = _layout.attachChild(widget.getElement(), userObject:widget);
   widget.setLayoutData(layer);

   // Adopt.
   adopt(widget);

   animate(0);
 }

 //*********************************
 // Implementation of RequiresResize
 //*********************************

 void onResize() {
   for (Widget child in getChildren()) {
     if (child is RequiresResize) {
       (child as RequiresResize).onResize();
     }
   }
 }

 bool remove(Widget w) {
   bool removed = super.remove(w);
   if (removed) {
     _layout.removeChild(w.getLayoutData() as Layer);
   }
   return removed;
 }

 /**
  * Sets the child widget's bottom and height values.
  *
  * @param child
  * @param bottom
  * @param bottomUnit
  * @param height
  * @param heightUnit
  */
 void setWidgetBottomHeight(Widget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) {
   _assertIsChild(child);
   _getLayer(child).setBottomHeight(bottom, bottomUnit, height, heightUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetBottomHeight(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetBottomHeight(IsWidget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) {
   this.setWidgetBottomHeight(child.asWidget(), bottom, bottomUnit, height, heightUnit);
 }

 /**
  * Sets the child widget's horizontal position within its layer.
  *
  * @param child
  * @param position
  */
 void setWidgetHorizontalPosition(Widget child, Alignment position) {
   _assertIsChild(child);
   _getLayer(child).setChildHorizontalPosition(position);
   animate(0);
 }

 /**
  * Sets the child widget's left and right values.
  *
  * @param child
  * @param left
  * @param leftUnit
  * @param right
  * @param rightUnit
  */
 void setWidgetLeftRight(Widget child, double left, Unit leftUnit, double right, Unit rightUnit) {
   _assertIsChild(child);
   _getLayer(child).setLeftRight(left, leftUnit, right, rightUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetLeftRight(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetLeftRight(IsWidget child, double left, Unit leftUnit, double right, Unit rightUnit) {
   this.setWidgetLeftRight(child.asWidget(), left, leftUnit, right, rightUnit);
 }

 /**
  * Sets the child widget's left and width values.
  *
  * @param child
  * @param left
  * @param leftUnit
  * @param width
  * @param widthUnit
  */
 void setWidgetLeftWidth(Widget child, double left, Unit leftUnit, double width, Unit widthUnit) {
   _assertIsChild(child);
   _getLayer(child).setLeftWidth(left, leftUnit, width, widthUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetLeftWidth(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetLeftWidth(IsWidget child, double left, Unit leftUnit, double width, Unit widthUnit) {
   this.setWidgetLeftWidth(child.asWidget(), left, leftUnit, width, widthUnit);
 }

 /**
  * Sets the child widget's right and width values.
  *
  * @param child
  * @param right
  * @param rightUnit
  * @param width
  * @param widthUnit
  */
 void setWidgetRightWidth(Widget child, double right, Unit rightUnit, double width, Unit widthUnit) {
   _assertIsChild(child);
   _getLayer(child).setRightWidth(right, rightUnit, width, widthUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetRightWidth(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetRightWidth(IsWidget child, double right, Unit rightUnit, double width, Unit widthUnit) {
   this.setWidgetRightWidth(child.asWidget(), right, rightUnit, width, widthUnit);
 }

 /**
  * Sets the child widget's top and bottom values.
  *
  * @param child
  * @param top
  * @param topUnit
  * @param bottom
  * @param bottomUnit
  */
 void setWidgetTopBottom(Widget child, double top, Unit topUnit, double bottom, Unit bottomUnit) {
   _assertIsChild(child);
   _getLayer(child).setTopBottom(top, topUnit, bottom, bottomUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetTopBottom(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetTopBottom(IsWidget child, double top, Unit topUnit, double bottom, Unit bottomUnit) {
   this.setWidgetTopBottom(child.asWidget(), top, topUnit, bottom, bottomUnit);
 }

 /**
  * Sets the child widget's top and height values.
  *
  * @param child
  * @param top
  * @param topUnit
  * @param height
  * @param heightUnit
  */
 void setWidgetTopHeight(Widget child, double top, Unit topUnit, double height, Unit heightUnit) {
   _assertIsChild(child);
   _getLayer(child).setTopHeight(top, topUnit, height, heightUnit);
   animate(0);
 }

 /**
  * Overloaded version for IsWidget.
  *
  * @see #setWidgetTopHeight(Widget,double, Style.Unit, double, Style.Unit)
  */
 void setIsWidgetTopHeight(IsWidget child, double top, Unit topUnit, double height, Unit heightUnit) {
   this.setWidgetTopHeight(child.asWidget(), top, topUnit, height, heightUnit);
 }

 /**
  * Sets the child widget's vertical position within its layer.
  *
  * @param child
  * @param position
  */
 void setWidgetVerticalPosition(Widget child, Alignment position) {
   _assertIsChild(child);
   _getLayer(child).setChildVerticalPosition(position);
   animate(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
  */
 void setWidgetVisible(Widget child, bool visible) {
   _assertIsChild(child);
   _getLayer(child).setVisible(visible);
   child.visible = visible;
   animate(0);
 }

 void onAttach() {
   super.onAttach();
   _layout.onAttach();
 }

 void onDetach() {
   super.onDetach();
   _layout.onDetach();
 }

 /**
  * Gets the {@link Layout} instance associated with this widget. This is made
  * package-protected for use by {@link RootLayoutPanel}.
  *
  * @return this widget's layout instance
  */
 Layout getLayout() {
   return _layout;
 }

 void _assertIsChild(Widget widget) {
   assert ((widget == null) || (widget.getParent() == this)); // : "The specified widget is not a child of this panel";
 }

 Layer _getLayer(Widget child) {
   assert (child.getParent() == this); // : "The requested widget is not a child of this panel";
   return child.getLayoutData() as Layer;
 }
}

Extends

UiObject > Widget > Panel > ComplexPanel > LayoutPanel

Subclasses

RootLayoutPanel

Implements

ProvidesResize, RequiresResize, AnimatedLayout

Constructors

new LayoutPanel() #

Creates an empty layout panel.

LayoutPanel() {
 setElement(new dart_html.DivElement());
 _layout = new Layout(getElement());
 _layoutCmd = new LayoutCommand(_layout);
}

Properties

int eventsToSink #

inherited from Widget

A set og events that should be sunk when the widget is attached to the DOM. (We delay the sinking of events to improve startup performance.) When the widget is attached, this is set is empty

Package protected to allow Composite to see it.

int eventsToSink = 0

String get title #

inherited from UiObject

Gets the title associated with this object. The title is the 'tool-tip' displayed to users when they hover over the object.

@return the object's title

String get title => getElement().title;

void set title(String value) #

inherited from UiObject

Sets the element's title.

void set title(String value) {
 getElement().title = value;
}

bool get visible #

inherited from UiObject

Determines whether or not this object is visible. Note that this does not necessarily take into account whether or not the receiver's parent is visible, or even if it is attached to the Document. The default implementation of this trait in UIObject is based on the value of a dom element's style object's display attribute.

@return <code>true</code> if the object is visible

bool get visible => isVisible(getElement());

void set visible(bool visible) #

inherited from UiObject

Sets whether this object is visible.

@param visible <code>true</code> to show the object, <code>false</code> to

     hide it
void set visible(bool visible) {
 setVisible(getElement(), visible);
}

Methods

void add(Widget widget) #

Adds a widget to this panel.

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.

@param widget the widget to be added

void add(Widget widget) {
 insertAt(widget, getWidgetCount());
}

HandlerRegistration addAttachHandler(AttachEventHandler handler) #

inherited from Widget

Adds an AttachEvent handler.

@param handler the handler @return the handler registration

HandlerRegistration addAttachHandler(AttachEventHandler handler) {
 return addHandler(handler, AttachEvent.TYPE);
}

HandlerRegistration addBitlessDomHandler(EventHandler handler, DomEventType type) #

inherited from Widget

For <a href= "http://code.google.com/p/google-web-toolkit/wiki/UnderstandingMemoryLeaks"

browsers which do not leak</a>, adds a native event handler to the widget.

Note that, unlike the {@link #addDomHandler(EventHandler, com.google.gwt.event.dom.client.DomEvent.Type)} implementation, there is no need to attach the widget to the DOM in order to cause the event handlers to be attached.

@param <H> the type of handler to add @param type the event key @param handler the handler @return {@link HandlerRegistration} used to remove the handler

HandlerRegistration addBitlessDomHandler(EventHandler handler, DomEventType type) {
 assert (handler != null);; // : "handler must not be null";
 assert (type != null); // : "type must not be null";
 sinkBitlessEvent(type.eventName);
 return ensureHandlers().addHandler(type, handler);
}

HandlerRegistration addDomHandler(EventHandler handler, DomEventType type) #

inherited from Widget

Adds a native event handler to the widget and sinks the corresponding native event. If you do not want to sink the native event, use the generic addHandler method instead.

@param <H> the type of handler to add @param type the event key @param handler the handler @return {@link HandlerRegistration} used to remove the handler

HandlerRegistration addDomHandler(EventHandler handler, DomEventType type) {
 assert (handler != null); // : "handler must not be null";
 assert (type != null); // : "type must not be null";
 int typeInt = IEvent.getTypeInt(type.eventName);
 if (typeInt == -1) {
   sinkBitlessEvent(type.eventName);
 } else {
   sinkEvents(typeInt);
 }
 return ensureHandlers().addHandler(type, handler);
}

HandlerRegistration addHandler(EventHandler handler, EventType<EventHandler> type) #

inherited from Widget

Adds this handler to the widget.

@param <H> the type of handler to add @param type the event type @param handler the handler @return {@link HandlerRegistration} used to remove the handler

HandlerRegistration addHandler(EventHandler handler, EventType<EventHandler> type) {
 return ensureHandlers().addHandler(type, handler);
}

void addIsWidget(IsWidget child) #

inherited from Panel
void addIsWidget(IsWidget child) {
 this.add(Widget.asWidgetOrNull(child));
}

void addStyleDependentName(String styleSuffix) #

inherited from UiObject

Adds a dependent style name by specifying the style name's suffix. The actual form of the style name that is added is:

getStylePrimaryName() + '-' + styleSuffix

@param styleSuffix the suffix of the dependent style to be added. @see #setStylePrimaryName(String) @see #removeStyleDependentName(String) @see #setStyleDependentName(String, boolean) @see #addStyleName(String)

void addStyleDependentName(String styleSuffix) {
 setStyleDependentName(styleSuffix, true);
}

void addStyleName(String style) #

inherited from UiObject

Adds a secondary or dependent style name to this object. A secondary style name is an additional style name that is, in HTML/CSS terms, included as a space-separated token in the value of the CSS <code>class</code> attribute for this object's root element.

The most important use for this method is to add a special kind of secondary style name called a dependent style name. To add a dependent style name, use {@link #addStyleDependentName(String)}, which will prefix the 'style' argument with the result of {@link #k()} (followed by a '-'). For example, suppose the primary style name is gwt-TextBox. If the following method is called as obj.setReadOnly(true):

public void setReadOnly(boolean readOnly) {
  isReadOnlyMode = readOnly;

// Create a dependent style name. String readOnlyStyle = "readonly";

if (readOnly) {

addStyleDependentName(readOnlyStyle);

} else {

removeStyleDependentName(readOnlyStyle);

} }</pre>

then both of the CSS style rules below will be applied:

// This rule is based on the primary style name and is always active. .gwt-TextBox { font-size: 12pt; }

// This rule is based on a dependent style name that is only active // when the widget has called addStyleName(getStylePrimaryName() + // "-readonly"). .gwt-TextBox-readonly { background-color: lightgrey; border: none; }</pre>

The code can also be simplified with {@link #setStyleDependentName(String, boolean)}:

public void setReadOnly(boolean readOnly) {
  isReadOnlyMode = readOnly;
  setStyleDependentName("readonly", readOnly);
}

Dependent style names are powerful because they are automatically updated whenever the primary style name changes. Continuing with the example above, if the primary style name changed due to the following call:

setStylePrimaryName("my-TextThingy");

then the object would be re-associated with following style rules, removing those that were shown above.

.my-TextThingy {
  font-size: 20pt;
}

.my-TextThingy-readonly { background-color: red; border: 2px solid yellow; }</pre>

Secondary style names that are not dependent style names are not automatically updated when the primary style name changes.

@param style the secondary style name to be added @see UIObject @see #removeStyleName(String)

void addStyleName(String style) {
 setStyleName(style, true);
}

void addWidget(Widget child, Element container) #

inherited from ComplexPanel

Adds a new child widget to the panel, attaching its Element to the specified container Element.

@param child the child widget to be added @param container the element within which the child will be contained

void addWidget(Widget child, dart_html.Element container) {
 // Detach new child.
 child.removeFromParent();

 // Logical attach.
 getChildren().add(child);

 // Physical attach.
 //Dom.appendChild(container, child.getElement());
 container.append(child.getElement());

 // Adopt.
 adopt(child);
}

int adjustIndex(Widget child, int beforeIndex) #

inherited from ComplexPanel

Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel.

@param child the widget that might be an existing child @param beforeIndex the index at which it will be added to this panel @return the modified index

int adjustIndex(Widget child, int beforeIndex) {
 checkIndexBoundsForInsertion(beforeIndex);

 // Check to see if this widget is already a direct child.
 if (child.getParent() == this) {
   // If the Widget's previous position was left of the desired new position
   // shift the desired position left to reflect the removal
   int idx = getWidgetIndex(child);
   if (idx < beforeIndex) {
     beforeIndex--;
   }
 }

 return beforeIndex;
}

void adopt(Widget child) #

inherited from Panel

Finalize the attachment of a Widget to this Panel. This method is the <b>last</b> step in adding or inserting a Widget into a Panel, and should be called after physical attachment in the DOM is complete. This Panel becomes the parent of the child Widget, and the child will now fire its {@link Widget#onAttach()} event if this Panel is currently attached.

@param child the widget to be adopted @see #add(Widget)

void adopt(Widget child) {
 assert (child.getParent() == null);
 child.setParent(this);
}

void animate(int duration, [LayoutAnimationCallback callback = null]) #

Layout children, animating over the specified period of time.

This method provides a callback that will be informed of animation updates. This can be used to create more complex animation effects.

@param duration the animation duration, in milliseconds @param callback the animation callback

docs inherited from AnimatedLayout
void animate(int duration, [LayoutAnimationCallback callback = null]) {
 _layoutCmd.schedule(duration, callback);
}

Widget asWidget() #

inherited from Widget

Returns the Widget aspect of the receiver.

Widget asWidget() {
 return this;
}

void checkIndexBoundsForAccess(int index) #

inherited from ComplexPanel

Checks that <code>index</code> is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.

@param index the index being accessed

void checkIndexBoundsForAccess(int index) {
 if (index < 0 || index >= getWidgetCount()) {
   throw new Exception("Index Out Of Bounds Exception");
 }
}

void checkIndexBoundsForInsertion(int index) #

inherited from ComplexPanel

Checks that <code>index</code> is in the range 0, getWidgetCount(), which is the valid range for indexes on an insertion.

@param index the index where insertion will occur

void checkIndexBoundsForInsertion(int index) {
 if (index < 0 || index > getWidgetCount()) {
   throw new Exception("Index Out Of Bounds Exception");
 }
}

void clear() #

inherited from Panel

Removes all child widgets.

void clear() {
 Iterator<Widget> it = iterator();
 while (it.moveNext()) {
   it.current.removeFromParent();
 }
}

void clearAndSetStyleName(String style) #

inherited from UiObject

Clears all of the object's style names and sets it to the given style. You should normally use {@link #setStylePrimaryName(String)} unless you wish to explicitly remove all existing styles.

@param style the new style name @see #setStylePrimaryName(String)

void clearAndSetStyleName(String style) {
 setElementStyleName(getStyleElement(), style);
}

EventBus createEventBus() #

inherited from Widget

Creates the SimpleEventBus used by this Widget. You can override this method to create a custom EventBus.

@return the EventBus you want to use.

EventBus createEventBus() {
 return new SimpleEventBus();
}

void delegateEvent(Widget target, DwtEvent event) #

inherited from Widget

Fires an event on a child widget. Used to delegate the handling of an event from one widget to another.

@param event the event @param target fire the event on the given target

void delegateEvent(Widget target, DwtEvent event) {
 target.fireEvent(event);
}

void doAttachChildren() #

inherited from Panel

If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call {@link #onAttach()} for each of its child widgets.

@see #onAttach()

docs inherited from Widget
void doAttachChildren() {
 AttachDetachException.tryCommand(this.iterator(), AttachDetachException.attachCommand);
}

void doDetachChildren() #

inherited from Panel

If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call {@link #onDetach()} for each of its child widgets.

@see #onDetach()

docs inherited from Widget
void doDetachChildren() {
 AttachDetachException.tryCommand(this.iterator(), AttachDetachException.detachCommand);
}

void doLogicalClear() #

inherited from ComplexPanel
void doLogicalClear() {
 // TODO(jgw): When Layout work has landed, deprecate FlowPanel (the only
 // caller of this method in our code), and deprecate this method with an eye
 // to making it private down the road.

 // Only use one orphan command per panel to avoid object creation.
 if (_orphanCommand == null) {
   _orphanCommand = new OrpahExceptionCommand(this);
 }
 try {
   AttachDetachException.tryCommand(this.iterator(), _orphanCommand);
 } finally {
   _children = new WidgetCollection(this);
 }
}

EventBus ensureHandlers() #

inherited from Widget

Ensures the existence of the event bus.

@return the EventBus.

EventBus ensureHandlers() {
 return _eventBus == null ? _eventBus = createEventBus() : _eventBus;
}

double extractLengthValue(String s) #

inherited from UiObject

Intended to be used to pull the value out of a CSS length. If the value is "auto" or "inherit", 0 will be returned.

@param s The CSS length string to extract @return The leading numeric portion of <code>s</code>, or 0 if "auto" or

    "inherit" are passed in.
double extractLengthValue(String s) {
 if (s == "auto" || s == "inherit" || s == "") {
   return 0.0;
 } else {
   // numberRegex divides the string into a leading numeric portion
   // followed by an arbitrary portion.
   if(numberRegex.hasMatch(s)) {
     // Extract the leading numeric portion of string
     s = numberRegex.firstMatch(s)[0];
   }
   return double.parse(s);
 }
}

void fireEvent(DwtEvent event) #

inherited from Widget

Fires the given event to the handlers listening to the event's type.

Any exceptions thrown by handlers will be bundled into a UmbrellaException and then re-thrown after all handlers have completed. An exception thrown by a handler will not prevent other handlers from executing.

@param event the event

void fireEvent(DwtEvent event) {
//    if (_eventBus != null) {
//      _eventBus.fireEvent(event);
//    }
 if (_eventBus != null) {
   // If it not live we should revive it.
   if (!event.isLive()) {
     event.revive();
   }
   Object oldSource = event.getSource();
   event.overrideSource(getElement());
   try {

     // May throw an UmbrellaException.
     _eventBus.fireEventFromSource(event, getElement());
   } on UmbrellaException catch (e) {
     throw new UmbrellaException(e.causes);
   } finally {
     if (oldSource == null) {
       // This was my event, so I should kill it now that I'm done.
       event.kill();
     } else {
       // Restoring the source for the next handler to use.
       event.overrideSource(oldSource);
     }
   }
 }
}

void forceLayout() #

Layout children immediately.

This is not normally necessary, unless you want to update child widgets' positions explicitly to create a starting point for a subsequent call to {@link #animate(int)}.

@see #animate(int) @see #animate(int, Layout.AnimationCallback)

docs inherited from AnimatedLayout
void forceLayout() {
 _layoutCmd.cancel();
 _layout.layout();
 onResize();
}

int getAbsoluteLeft() #

inherited from UiObject

Gets the object's absolute left position in pixels, as measured from the browser window's client area.

@return the object's absolute left position

int getAbsoluteLeft() {
 return Dom.getAbsoluteLeft(getElement());
}

int getAbsoluteTop() #

inherited from UiObject

Gets the object's absolute top position in pixels, as measured from the browser window's client area.

@return the object's absolute top position

int getAbsoluteTop() {
 return Dom.getAbsoluteTop(getElement());
}

WidgetCollection getChildren() #

inherited from ComplexPanel

Gets the list of children contained in this panel.

@return a collection of child widgets

WidgetCollection getChildren() {
 return _children;
}

Element getElement() #

inherited from UiObject

Gets this object's browser element.

dart_html.Element getElement() {
 assert (_element != null); // : MISSING_ELEMENT_ERROR;
 return _element;
}

EventBus getEventBus() #

inherited from Widget

Return EventBus.

EventBus getEventBus() {
 return _eventBus;
}

Layout getLayout() #

Gets the {@link Layout} instance associated with this widget. This is made package-protected for use by {@link RootLayoutPanel}.

@return this widget's layout instance

Layout getLayout() {
 return _layout;
}

Object getLayoutData() #

inherited from Widget

Gets the panel-defined layout data associated with this widget.

@return the widget's layout data @see #setLayoutData

Object getLayoutData() {
 return _layoutData;
}

int getOffsetHeight() #

inherited from UiObject

Gets the object's offset height in pixels. This is the total height of the object, including decorations such as border and padding, but not margin.

@return the object's offset height

int getOffsetHeight() {
 return getElement().offset.height; // Dom.getElementPropertyInt(getElement(), "offsetHeight");
}

int getOffsetWidth() #

inherited from UiObject

Gets the object's offset width in pixels. This is the total width of the object, including decorations such as border and padding, but not margin.

@return the object's offset width

int getOffsetWidth() {
 return getElement().offset.width; // Dom.getElementPropertyInt(getElement(), "offsetWidth");
}

Widget getParent() #

inherited from Widget

Gets this widget's parent panel.

@return the widget's parent panel

Widget getParent() {
 return _parent;
}

Element getStyleElement() #

inherited from UiObject

Template method that returns the element to which style names will be applied. By default it returns the root element, but this method may be overridden to apply styles to a child element.

@return the element to which style names will be applied

dart_html.Element getStyleElement() {
 return getElement();
}

String getStyleName() #

inherited from UiObject

Gets all of the object's style names, as a space-separated list. If you wish to retrieve only the primary style name, call {@link #getStylePrimaryName()}.

@return the objects's space-separated style names @see #getStylePrimaryName()

String getStyleName() {
 return getElementStyleName(getStyleElement());
}

String getStylePrimaryName() #

inherited from UiObject

Gets the primary style name associated with the object.

@return the object's primary style name @see #setStyleName(String) @see #addStyleName(String) @see #removeStyleName(String)

String getStylePrimaryName() {
 return getElementStylePrimaryName(getStyleElement());
}

Widget getWidgetAt(int index) #

inherited from ComplexPanel

Gets the child widget at the specified index.

@param index the child widget's index @return the child widget

Widget getWidgetAt(int index) {
 return getChildren().get(index);
}

Element getWidgetContainerElement(Widget child) #

Gets the container element wrapping the given child widget.

@param child @return the widget's container element

dart_html.Element getWidgetContainerElement(Widget child) {
 _assertIsChild(child);
 return _getLayer(child).getContainerElement();
}

int getWidgetCount() #

inherited from ComplexPanel

Gets the number of child widgets in this panel.

@return the number of children

int getWidgetCount() {
 return getChildren().size();
}

int getWidgetIndex(Widget child) #

inherited from ComplexPanel

Gets the index of the specified child widget.

@param child the widget to be found @return the widget's index, or <code>-1</code> if it is not a child of this

    panel
int getWidgetIndex(Widget child) {
 return getChildren().indexOf(child);
}

int getWidgetIndexIsWidget(IsWidget child) #

inherited from ComplexPanel
int getWidgetIndexIsWidget(IsWidget child) {
 return getWidgetIndex(Widget.asWidgetOrNull(child));
}

void insert(Widget child, Element container, int beforeIndex, bool domInsert) #

inherited from ComplexPanel

Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element. The child Element will either be attached to the container at the same index, or simply appended to the container, depending on the value of <code>domInsert</code>.

@param child the child Widget to be added @param container the Element within which <code>child</code> will be

     contained

@param beforeIndex the index before which <code>child</code> will be

     inserted

@param domInsert if <code>true</code>, insert <code>child</code> into

     <code>container</code> at <code>beforeIndex</code>; otherwise
     append <code>child</code> to the end of <code>container</code>.
void insert(Widget child, dart_html.Element container, int beforeIndex,
   bool domInsert) {

 if (container == null) {
   throw new Exception("container may not be null");
 }

 // Validate index; adjust if the widget is already a child of this panel.
 beforeIndex = adjustIndex(child, beforeIndex);

 // Detach new child.
 child.removeFromParent();

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

 // Physical attach.
 if (domInsert) {
   //DOM.insertChild(container, child.getElement(), beforeIndex);
   Dom.insertChild(container, child.getElement(), beforeIndex);
//      dart_html.Element refChild = container.nodes[beforeIndex];
//      if (refChild != null) {
//        container.insertBefore(child.getElement(), refChild);
//      } else {
//        container.append(child.getElement());
//      }
 } else {
   //DOM.appendChild(container, child.getElement());
   container.append(child.getElement());
 }

 // Adopt.
 adopt(child);
}

void insertAt(Widget widget, int beforeIndex) #

Inserts a widget before the specified index.

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.

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
void insertAt(Widget widget, int beforeIndex) {
 // Detach new child.
 widget.removeFromParent();

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

 // Physical attach.
 Layer layer = _layout.attachChild(widget.getElement(), userObject:widget);
 widget.setLayoutData(layer);

 // Adopt.
 adopt(widget);

 animate(0);
}

bool isAttached() #

inherited from Widget

Returns whether or not the receiver is attached to the {@link com.google.gwt.dom.client.Document Document}'s {@link com.google.gwt.dom.client.BodyElement BodyElement}.

@return true if attached, false otherwise

bool isAttached() {
 return _attached;
}

bool isOrWasAttached() #

inherited from Widget

Has this widget ever been attached?

@return true if this widget ever been attached to the DOM, false otherwise

bool isOrWasAttached() {
 return eventsToSink == -1;
}

Iterator<Widget> iterator() #

inherited from ComplexPanel

Returns an Iterator that iterates over this Iterable object.

docs inherited from HasWidgets
Iterator<Widget> iterator() {
 return getChildren().iterator;
}

void onAttach() #

This method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added to the document, override the {@link #onLoad} method or use {@link #addAttachHandler}.

It is strongly recommended that you override {@link #onLoad()} or {@link #doAttachChildren()} instead of this method to avoid inconsistencies between logical and physical attachment states.

Subclasses that override this method must call super.onAttach() to ensure that the Widget has been attached to its underlying Element.

@throws IllegalStateException if this widget is already attached @see #onLoad() @see #doAttachChildren()

docs inherited from Widget
void onAttach() {
 super.onAttach();
 _layout.onAttach();
}

void onBrowserEvent(Event event) #

inherited from Widget

Fired whenever a browser event is received.

@param event the event received

TODO

void onBrowserEvent(dart_html.Event event) {
 switch (Dom.eventGetType(event)) {
   case IEvent.ONMOUSEOVER:
     // Only fire the mouse over event if it's coming from outside this
     // widget.
   case IEvent.ONMOUSEOUT:
     // Only fire the mouse over event if it's coming from outside this widget.
     // Only fire the mouse out event if it's leaving this widget.
     dart_html.Element related = (event as dart_html.MouseEvent).relatedTarget as dart_html.Element;
     if (related != null && Dom.isOrHasChild(getElement(), related)) {
       return;
     }
     break;
 }

 DomEvent.fireNativeEvent(event, this, this.getElement());
}

void onDetach() #

This method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the {@link #onUnload} method or use {@link #addAttachHandler}.

It is strongly recommended that you override {@link #onUnload()} or {@link #doDetachChildren()} instead of this method to avoid inconsistencies between logical and physical attachment states.

Subclasses that override this method must call super.onDetach() to ensure that the Widget has been detached from the underlying Element. Failure to do so will result in application memory leaks due to circular references between DOM Elements and JavaScript objects.

@throws IllegalStateException if this widget is already detached @see #onUnload() @see #doDetachChildren()

docs inherited from Widget
void onDetach() {
 super.onDetach();
 _layout.onDetach();
}

void onLoad() #

inherited from Widget

This method is called immediately after a widget becomes attached to the browser's document.

void onLoad() {
}

void onResize() #

This method must be called whenever the implementor's size has been modified.

docs inherited from RequiresResize
void onResize() {
 for (Widget child in getChildren()) {
   if (child is RequiresResize) {
     (child as RequiresResize).onResize();
   }
 }
}

void onUnload() #

inherited from Widget

This method is called immediately before a widget will be detached from the browser's document.

void onUnload() {
}

void orphan(Widget child) #

inherited from Panel

This method must be called as part of the remove method of any Panel. It ensures that the Widget's parent is cleared. This method should be called after verifying that the child Widget is an existing child of the Panel, but before physically removing the child Widget from the DOM. The child will now fire its {@link Widget#onDetach()} event if this Panel is currently attached.

Calls to {@link #orphan(Widget)} should be wrapped in a try/finally block to ensure that the widget is physically detached even if orphan throws an exception.

@param child the widget to be disowned @see #add(Widget)

void orphan(Widget child) {
 assert (child.getParent() == this);
 child.setParent(null);
}

bool remove(Widget w) #

Removes a child widget.

How to Override this Method

There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

  1. Validate: Make sure this Panel is actually the parent of the child Widget; return false if it is not.
  2. Orphan: Call {@link #orphan(Widget)} first while the child Widget is still attached.
  3. Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
  4. Logical Detach: Update the Panel's state variables to reflect the removal of the child Widget. Example: the Widget is removed from the Panel's {@link WidgetCollection}.

@param child the widget to be removed @return <code>true</code> if the child was present

docs inherited from ComplexPanel
bool remove(Widget w) {
 bool removed = super.remove(w);
 if (removed) {
   _layout.removeChild(w.getLayoutData() as Layer);
 }
 return removed;
}

bool removeAt(int index) #

inherited from ComplexPanel

Removes the widget at the specified index.

@param index the index of the widget to be removed @return <code>false</code> if the widget is not present

bool removeAt(int index) {
 return remove(getWidgetAt(index));
}

void removeFromParent() #

inherited from Widget

Removes this widget from its parent widget, if one exists.

If it has no parent, this method does nothing. If it is a "root" widget (meaning it's been added to the detach list via {@link RootPanel#detachOnWindowClose(Widget)}), it will be removed from the detached immediately. This makes it possible for Composites and Panels to adopt root widgets.

@throws IllegalStateException if this widget's parent does not support

      removal (e.g. {@link Composite})
void removeFromParent() {
 if (_parent == null) {
   // If the widget had no parent, check to see if it was in the detach list
   // and remove it if necessary.
   if (RootPanel.isInDetachList(this)) {
     RootPanel.detachNow(this);
   }
 } else if (_parent is HasWidgets) {
   (_parent as HasWidgets).remove(this);
 } else if (_parent != null) {
   throw new Exception("This widget's parent does not implement HasWidgets");
 }
}

bool removeIsWidget(IsWidget child) #

inherited from Panel
bool removeIsWidget(IsWidget child) {
 return remove(Widget.asWidgetOrNull(child));
}

void removeStyleDependentName(String styleSuffix) #

inherited from UiObject

Removes a dependent style name by specifying the style name's suffix.

@param styleSuffix the suffix of the dependent style to be removed @see #setStylePrimaryName(Element, String) @see #addStyleDependentName(String) @see #setStyleDependentName(String, boolean)

void removeStyleDependentName(String styleSuffix) {
 setStyleDependentName(styleSuffix, false);
}

void removeStyleName(String style) #

inherited from UiObject

Removes a style name. This method is typically used to remove secondary style names, but it can be used to remove primary stylenames as well. That use is not recommended.

@param style the secondary style name to be removed @see #addStyleName(String) @see #setStyleName(String, boolean)

void removeStyleName(String style) {
 setStyleName(style, false);
}

void replaceElement(Element elem) #

inherited from Widget

Replaces this object's browser element.

This method exists only to support a specific use-case in Image, and should not be used by other classes.

@param elem the object's new element

void replaceElement(dart_html.Element elem) {
 if (isAttached()) {
   // Remove old event listener to avoid leaking. onDetach will not do this
   // for us, because it is only called when the widget itself is detached
   // from the document.
   Dom.setEventListener(getElement(), null);
 }

 super.replaceElement(elem);

 if (isAttached()) {
   // Hook the event listener back up on the new element. onAttach will not
   // do this for us, because it is only called when the widget itself is
   // attached to the document.
   Dom.setEventListener(getElement(), this);
 }
}

void setElement(Element elem) #

inherited from UiObject

Sets this object's browser element. UIObject subclasses must call this method before attempting to call any other methods, and it may only be called once.

@param elem the object's element

void setElement(dart_html.Element elem) {
 assert (_element == null);
 this._element = elem;
}

void setHeight(String height) #

inherited from UiObject

Sets the object's height. This height does not include decorations such as border, margin, and padding.

@param height the object's new height, in CSS units (e.g. "10px", "1em")

void setHeight(String height) {
 // This exists to deal with an inconsistency in IE's implementation where
 // it won't accept negative numbers in length measurements
 assert (extractLengthValue(height.trim().toLowerCase()) >= 0); // : "CSS heights should not be negative";
 Dom.setStyleAttribute(getElement(), "height", height);
}

void setIsWidgetBottomHeight(IsWidget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) #

Overloaded version for IsWidget.

@see #setWidgetBottomHeight(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetBottomHeight(IsWidget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) {
 this.setWidgetBottomHeight(child.asWidget(), bottom, bottomUnit, height, heightUnit);
}

void setIsWidgetLeftRight(IsWidget child, double left, Unit leftUnit, double right, Unit rightUnit) #

Overloaded version for IsWidget.

@see #setWidgetLeftRight(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetLeftRight(IsWidget child, double left, Unit leftUnit, double right, Unit rightUnit) {
 this.setWidgetLeftRight(child.asWidget(), left, leftUnit, right, rightUnit);
}

void setIsWidgetLeftWidth(IsWidget child, double left, Unit leftUnit, double width, Unit widthUnit) #

Overloaded version for IsWidget.

@see #setWidgetLeftWidth(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetLeftWidth(IsWidget child, double left, Unit leftUnit, double width, Unit widthUnit) {
 this.setWidgetLeftWidth(child.asWidget(), left, leftUnit, width, widthUnit);
}

void setIsWidgetRightWidth(IsWidget child, double right, Unit rightUnit, double width, Unit widthUnit) #

Overloaded version for IsWidget.

@see #setWidgetRightWidth(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetRightWidth(IsWidget child, double right, Unit rightUnit, double width, Unit widthUnit) {
 this.setWidgetRightWidth(child.asWidget(), right, rightUnit, width, widthUnit);
}

void setIsWidgetTopBottom(IsWidget child, double top, Unit topUnit, double bottom, Unit bottomUnit) #

Overloaded version for IsWidget.

@see #setWidgetTopBottom(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetTopBottom(IsWidget child, double top, Unit topUnit, double bottom, Unit bottomUnit) {
 this.setWidgetTopBottom(child.asWidget(), top, topUnit, bottom, bottomUnit);
}

void setIsWidgetTopHeight(IsWidget child, double top, Unit topUnit, double height, Unit heightUnit) #

Overloaded version for IsWidget.

@see #setWidgetTopHeight(Widget,double, Style.Unit, double, Style.Unit)

void setIsWidgetTopHeight(IsWidget child, double top, Unit topUnit, double height, Unit heightUnit) {
 this.setWidgetTopHeight(child.asWidget(), top, topUnit, height, heightUnit);
}

void setLayoutData(Object value) #

inherited from Widget

Sets the panel-defined layout data associated with this widget. Only the panel that currently contains a widget should ever set this value. It serves as a place to store layout bookkeeping data associated with a widget.

@param layoutData the widget's layout data

void setLayoutData(Object value) {
 this._layoutData = value;
}

void setParent(Widget parent) #

inherited from Widget

Sets this widget's parent. This method should only be called by {@link Panel} and {@link Composite}.

@param parent the widget's new parent @throws IllegalStateException if <code>parent</code> is non-null and the

      widget already has a parent
void setParent(Widget parent) {
 Widget oldParent = this._parent;
 if (parent == null) {
   try {
     if (oldParent != null && oldParent.isAttached()) {
       onDetach();
       assert (!isAttached()); // : "Failure of " + this.getClass().getName() + " to call super.onDetach()";
     }
   } finally {
     // Put this in a finally in case onDetach throws an exception.
     this._parent = null;
   }
 } else {
   if (oldParent != null) {
     throw new Exception("Cannot set a new parent without first clearing the old parent");
   }
   this._parent = parent;
   if (parent.isAttached()) {
     onAttach();
     assert (isAttached()); // : "Failure of " + this.getClass().getName() + " to call super.onAttach()";
   }
 }
}

void setPixelSize(int width, int height) #

inherited from UiObject

Sets the object's size, in pixels, not including decorations such as border, margin, and padding.

@param width the object's new width, in pixels @param height the object's new height, in pixels

void setPixelSize(int width, int height) {
 if (width >= 0) {
   setWidth(width.toString() + "px");
 }
 if (height >= 0) {
   setHeight(height.toString() + "px");
 }
}

void setSize(String width, String height) #

inherited from UiObject

Sets the object's size. This size does not include decorations such as border, margin, and padding.

@param width the object's new width, in CSS units (e.g. "10px", "1em") @param height the object's new height, in CSS units (e.g. "10px", "1em")

void setSize(String width, String height) {
 setWidth(width);
 setHeight(height);
}

void setStyleDependentName(String styleSuffix, bool add) #

inherited from UiObject

Adds or removes a dependent style name by specifying the style name's suffix. The actual form of the style name that is added is:

getStylePrimaryName() + '-' + styleSuffix

@param styleSuffix the suffix of the dependent style to be added or removed @param add <code>true</code> to add the given style, <code>false</code> to

     remove it

@see #setStylePrimaryName(Element, String) @see #addStyleDependentName(String) @see #setStyleName(String, boolean) @see #removeStyleDependentName(String)

void setStyleDependentName(String styleSuffix, bool add) {
 setStyleName(getStylePrimaryName() + '-' + styleSuffix, add);
}

void setStyleName(String style, bool add) #

inherited from UiObject

Adds or removes a style name. This method is typically used to remove secondary style names, but it can be used to remove primary stylenames as well. That use is not recommended.

@param style the style name to be added or removed @param add <code>true</code> to add the given style, <code>false</code> to

     remove it

@see #addStyleName(String) @see #removeStyleName(String)

void setStyleName(String style, bool add) {
 manageElementStyleName(getStyleElement(), style, add);
}

void setStylePrimaryName(String style) #

inherited from UiObject

Sets the object's primary style name and updates all dependent style names.

@param style the new primary style name @see #addStyleName(String) @see #removeStyleName(String)

void setStylePrimaryName(String style) {
 setElementStylePrimaryName(getStyleElement(), style);
}

void setWidgetBottomHeight(Widget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) #

Sets the child widget's bottom and height values.

@param child @param bottom @param bottomUnit @param height @param heightUnit

void setWidgetBottomHeight(Widget child, double bottom, Unit bottomUnit, double height, Unit heightUnit) {
 _assertIsChild(child);
 _getLayer(child).setBottomHeight(bottom, bottomUnit, height, heightUnit);
 animate(0);
}

void setWidgetHorizontalPosition(Widget child, Alignment position) #

Sets the child widget's horizontal position within its layer.

@param child @param position

void setWidgetHorizontalPosition(Widget child, Alignment position) {
 _assertIsChild(child);
 _getLayer(child).setChildHorizontalPosition(position);
 animate(0);
}

void setWidgetLeftRight(Widget child, double left, Unit leftUnit, double right, Unit rightUnit) #

Sets the child widget's left and right values.

@param child @param left @param leftUnit @param right @param rightUnit

void setWidgetLeftRight(Widget child, double left, Unit leftUnit, double right, Unit rightUnit) {
 _assertIsChild(child);
 _getLayer(child).setLeftRight(left, leftUnit, right, rightUnit);
 animate(0);
}

void setWidgetLeftWidth(Widget child, double left, Unit leftUnit, double width, Unit widthUnit) #

Sets the child widget's left and width values.

@param child @param left @param leftUnit @param width @param widthUnit

void setWidgetLeftWidth(Widget child, double left, Unit leftUnit, double width, Unit widthUnit) {
 _assertIsChild(child);
 _getLayer(child).setLeftWidth(left, leftUnit, width, widthUnit);
 animate(0);
}

void setWidgetRightWidth(Widget child, double right, Unit rightUnit, double width, Unit widthUnit) #

Sets the child widget's right and width values.

@param child @param right @param rightUnit @param width @param widthUnit

void setWidgetRightWidth(Widget child, double right, Unit rightUnit, double width, Unit widthUnit) {
 _assertIsChild(child);
 _getLayer(child).setRightWidth(right, rightUnit, width, widthUnit);
 animate(0);
}

void setWidgetTopBottom(Widget child, double top, Unit topUnit, double bottom, Unit bottomUnit) #

Sets the child widget's top and bottom values.

@param child @param top @param topUnit @param bottom @param bottomUnit

void setWidgetTopBottom(Widget child, double top, Unit topUnit, double bottom, Unit bottomUnit) {
 _assertIsChild(child);
 _getLayer(child).setTopBottom(top, topUnit, bottom, bottomUnit);
 animate(0);
}

void setWidgetTopHeight(Widget child, double top, Unit topUnit, double height, Unit heightUnit) #

Sets the child widget's top and height values.

@param child @param top @param topUnit @param height @param heightUnit

void setWidgetTopHeight(Widget child, double top, Unit topUnit, double height, Unit heightUnit) {
 _assertIsChild(child);
 _getLayer(child).setTopHeight(top, topUnit, height, heightUnit);
 animate(0);
}

void setWidgetVerticalPosition(Widget child, Alignment position) #

Sets the child widget's vertical position within its layer.

@param child @param position

void setWidgetVerticalPosition(Widget child, Alignment position) {
 _assertIsChild(child);
 _getLayer(child).setChildVerticalPosition(position);
 animate(0);
}

void setWidgetVisible(Widget child, bool visible) #

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

void setWidgetVisible(Widget child, bool visible) {
 _assertIsChild(child);
 _getLayer(child).setVisible(visible);
 child.visible = visible;
 animate(0);
}

void setWidth(String width) #

inherited from UiObject

Sets the object's width. This width does not include decorations such as border, margin, and padding.

@param width the object's new width, in CSS units (e.g. "10px", "1em")

void setWidth(String width) {
 // This exists to deal with an inconsistency in IE's implementation where
 // it won't accept negative numbers in length measurements
 assert (extractLengthValue(width.trim().toLowerCase()) >= 0); // : "CSS widths should not be negative";
 Dom.setStyleAttribute(getElement(), "width", width);
}

void sinkBitlessEvent(String eventTypeName) #

inherited from UiObject

Sinks a named event. Note that only {@link Widget widgets} may actually receive events, but can receive events from all objects contained within them.

@param eventTypeName name of the event to sink on this element @see com.google.gwt.user.client.Event

void sinkBitlessEvent(String eventTypeName) {
 Dom.sinkBitlessEvent(getElement(), eventTypeName);
}

void sinkEvents(int eventBitsToAdd) #

inherited from Widget

Overridden to defer the call to super.sinkEvents until the first time this widget is attached to the dom, as a performance enhancement. Subclasses wishing to customize sinkEvents can preserve this deferred sink behavior by putting their implementation behind a check of <code>isOrWasAttached()</code>:

{@literal @}Override
public void sinkEvents(int eventBitsToAdd) {
  if (isOrWasAttached()) {
    /{@literal *} customized sink code goes here {@literal *}/
  } else {
    super.sinkEvents(eventBitsToAdd);
 }
} 
void sinkEvents(int eventBitsToAdd) {
 if (isOrWasAttached()) {
   super.sinkEvents(eventsToSink);
 } else {
   eventsToSink |= eventBitsToAdd;
 }
}

String toString() #

inherited from UiObject

This method is overridden so that any object can be viewed in the debugger as an HTML snippet.

@return a string representation of the object

String toString() {
 if (_element == null) {
   return "(null handle)";
 }
 return getElement().toString();
}

void unsinkEvents(int eventBitsToRemove) #

inherited from UiObject

Removes a set of events from this object's event list.

@param eventBitsToRemove a bitfield representing the set of events to be

     removed from this element's event set

@see #sinkEvents @see com.google.gwt.user.client.Event

void unsinkEvents(int eventBitsToRemove) {
 Dom.sinkEvents(getElement(), Dom.getEventsSunk(getElement()) & (~eventBitsToRemove));
}