public static new PaletteRenderer getInstance() { if (instance_ == null) { instance_ = new PaletteRenderer(); } return(instance_); }
/// <summary> /// A palette is a grid of DOM nodes that the user can highlight or select via /// the keyboard or the mouse. The selection state of the palette is controlled /// an ACTION event. Event listeners may retrieve the selected item using the /// {@link #getSelectedItem} or {@link #getSelectedIndex} method. /// /// Use this class as the base for components like color palettes or emoticon /// pickers. Use {@link #setContent} to set/change the items in the palette /// after construction. See palette.html demo for example usage. /// </summary> /// <param name="items">Array of DOM nodes to be displayed as items /// in the palette grid (limited to one per cell).</param> /// <param name="opt_renderer">Renderer used to render or /// decorate the palette; defaults to {@link goog.ui.PaletteRenderer}.</param> /// <param name="opt_domHelper">Optional DOM helper, used for /// document interaction.</param> public Palette(JsArray <Node> items, PaletteRenderer opt_renderer = null, dom.DomHelper opt_domHelper = null) : base(new ControlContent(items), opt_renderer ?? goog.ui.PaletteRenderer.getInstance(), opt_domHelper) { this.setAutoStates( goog.ui.Component.State.CHECKED | goog.ui.Component.State.SELECTED | goog.ui.Component.State.OPENED, false); this.currentCellControl_ = new goog.ui.Palette.CurrentCell_(); this.currentCellControl_.setParentEventTarget(this); this.lastHighlightedIndex_ = -1; }