Home

# Class goog.demos.SampleComponent

A simple box that changes colour when clicked. This class demonstrates the goog.ui.Component API, and is keyboard accessible, as per http://wiki/Main/ClosureKeyboardAccessible

extends goog.ui.Component

Instance Method Summary
| `changeColor_()` Changes the color of the element.
| `createDom()` Creates an initial DOM representation for the component.
| `decorateInternal(?Element element)` Decorates an existing HTML DIV element as a SampleComponent.
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `enterDocument()` Called when component's element is known to be in the document.
| `exitDocument()` Called when component's element is known to have been removed from the document.
| `getLabelText() ⇒ string` Gets the current label text.
| `onDivClicked_(?goog.events.Event event)` Handles DIV element clicks, causing the DIV's colour to change.
| `onKey_(?goog.events.Event event)` Fired when user presses a key while the DIV has focus. If the user presses space or enter, the color will be changed.
| `setLabelText(string text)` Sets the current label text. Has no effect if component is not rendered.