/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org License: LGPL 2.1: http://www.gnu.org/licenses/lgpl.html Authors: * Sebastian Werner (wpbasti) * Andreas Ecker (ecker) ************************************************************************ */ /* ************************************************************************ ************************************************************************ */ /*! A color popup */ qx.OO.defineClass("qx.ui.component.ColorPopup", qx.ui.popup.Popup, function(tables) { qx.ui.popup.Popup.call(this); this.setPadding(4); this.auto(); this.setBorder(qx.renderer.border.BorderPresets.getInstance().outset); this.setBackgroundColor("threedface"); this._tables = tables; this._createLayout(); this._createAutoBtn(); this._createBoxes(); this._createPreview(); this._createSelectorBtn(); this.addEventListener("beforeAppear", this._onBeforeAppear); }); qx.OO.addProperty({ name : "value", type : "object", instance : "qx.renderer.color.Color" }); qx.OO.addProperty({ name : "red", type : "number", defaultValue : 0 }); qx.OO.addProperty({ name : "green", type : "number", defaultValue : 0 }); qx.OO.addProperty({ name : "blue", type : "number", defaultValue : 0 }); qx.Proto._minZIndex = 1e5; /* --------------------------------------------------------------------------- CREATOR SUBS --------------------------------------------------------------------------- */ qx.Proto._createLayout = function() { this._layout = new qx.ui.layout.VerticalBoxLayout; this._layout.setLocation(0, 0); this._layout.auto(); this._layout.setSpacing(2); this.add(this._layout); } qx.Proto._createAutoBtn = function() { this._automaticBtn = new qx.ui.form.Button("Automatic"); this._automaticBtn.setWidth(null); this._automaticBtn.setAllowStretchX(true); this._automaticBtn.addEventListener("execute", this._onAutomaticBtnExecute, this); this._layout.add(this._automaticBtn); } qx.Proto._recentTableId = "recent"; qx.Proto._fieldWidth = 14; qx.Proto._fieldHeight = 14; qx.Proto._fieldNumber = 12; qx.Proto._createBoxes = function() { this._boxes = {}; var tables = this._tables; var table, box, boxLayout, field; for (var tableId in tables) { table = tables[tableId]; box = new qx.ui.groupbox.GroupBox(table.label); box.setHeight("auto"); this._boxes[tableId] = box; this._layout.add(box); boxLayout = new qx.ui.layout.HorizontalBoxLayout; boxLayout.setLocation(0, 0); boxLayout.setSpacing(1); boxLayout.auto(); box.add(boxLayout); for (var i=0; i