UNPKG

@qooxdoo/framework

Version:

The JS Framework for Coders

93 lines (75 loc) 2.15 kB
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2008 1&1 Internet AG, Germany, http://www.1und1.de License: MIT: https://opensource.org/licenses/MIT See the LICENSE file in the project's top-level directory for details. Authors: * Fabian Jakobs (fjakobs) ************************************************************************ */ /** * The small folder open/close button */ qx.Class.define("qx.ui.tree.core.FolderOpenButton", { extend: qx.ui.basic.Image, include: qx.ui.core.MExecutable, /* ***************************************************************************** CONSTRUCTOR ***************************************************************************** */ construct() { super(); this.initOpen(); this.addListener("tap", this._onTap); this.addListener("pointerdown", this._stopPropagation, this); this.addListener("pointerup", this._stopPropagation, this); }, /* ***************************************************************************** PROPERTIES ***************************************************************************** */ properties: { /** * Whether the button state is "open" */ open: { check: "Boolean", init: false, event: "changeOpen", apply: "_applyOpen" } }, /* ***************************************************************************** MEMBERS ***************************************************************************** */ members: { // property apply _applyOpen(value, old) { value ? this.addState("opened") : this.removeState("opened"); this.execute(); }, /** * Stop tap event propagation * * @param e {qx.event.type.Event} The event object */ _stopPropagation(e) { e.stopPropagation(); }, /** * Pointer tap event listener * * @param e {qx.event.type.Pointer} Pointer event */ _onTap(e) { this.toggleOpen(); e.stopPropagation(); } } });