Home

# Class goog.ui.PaletteRenderer

Default renderer for {@link goog.ui.Palette}s. Renders the palette as an HTML table wrapped in a DIV, with one palette item per cell:

...
...Item 0... | ...Item 1...
...

extends goog.ui.ControlRenderer

Instance Method Summary
| `canDecorate(?Element element) ⇒ boolean` Overrides {@link goog.ui.ControlRenderer#canDecorate} to always return false.
| `createCell((Node|null|string) node, ?goog.dom.DomHelper dom) ⇒ ?Element` Returns a table cell element (or equivalent) that wraps the given palette item (which must be a DOM node).
| `createDom(?goog.ui.Palette palette) ⇒ ?Element` Returns the palette items arranged in a table wrapped in a DIV, with the renderer's own CSS class and additional state-specific classes applied to it.
| `createGrid(?Array items, ?goog.math.Size size, ?goog.dom.DomHelper dom) ⇒ ?Element` Returns the given items in a table with {@code size.width} columns and {@code size.height} rows. If the table is too big, empty cells will be created as needed. If the table is too small, the items that don't fit will not be rendered.
| `createRow(?Array cells, ?goog.dom.DomHelper dom) ⇒ ?Element` Returns a table row element (or equivalent) that wraps the given cells.
| `createTable(?Array rows, ?goog.dom.DomHelper dom) ⇒ ?Element` Returns a table element (or equivalent) that wraps the given rows.
| `decorate(?goog.ui.Palette palette, ?Element element) ⇒ null` Overrides {@link goog.ui.ControlRenderer#decorate} to be a no-op, since palettes don't support the decorate flow (for now).
| `getContainingItem(?goog.ui.Palette palette, ?Node node) ⇒ ?Node` Returns the item corresponding to the given node, or null if the node is neither a palette cell nor part of a palette item.
| `getCssClass() ⇒ string` Returns the CSS class to be applied to the root element of components rendered using this renderer.
| `highlightCell(?goog.ui.Palette palette, ?Node node, boolean highlight)` Updates the highlight styling of the palette cell containing the given node based on the value of the Boolean argument.
| `selectCell(?goog.ui.Palette palette, ?Node node, boolean select)` Updates the selection styling of the palette cell containing the given node based on the value of the Boolean argument.

`setContent(?Element element, ?Array items)`

Overrides {@link goog.ui.ControlRenderer#setContent} for palettes. Locates the HTML table representing the palette grid, and replaces the contents of each cell with a new element from the array of nodes passed as the second argument. If the new content has too many items the table will have more rows added to fit, if there are less items than the table has cells, then the left over cells will be empty.