/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ import mx.utils.Delegate; import nl.idgis.giclient.gui.ContainerContent; import nl.idgis.giclient.util.Strings; class nl.idgis.giclient.framework.ValuePicker extends ContainerContent { private var values:Array; private var returnObject:Object; function onLoad():Void { values = frame.contentProperties.values; returnObject = frame.contentProperties.returnObject; drawValues(); } private function drawValues():Void{ var textFormat:TextFormat = new TextFormat(); textFormat.font = "_sans"; this.moveTo(0,0); for (var i:Number = 0; i < values.length; i++) { this.lineTo(10,i*20); createObject("CheckBox", "check"+ i, getNextHighestDepth(),{_x:0, _y:i*20}); this["check"+ i].addEventListener("click", onClickCheckBox); this["check"+ i].selected = values[i][1]; createTextField("value" + i, getNextHighestDepth(), 20, i*20, 170, 20); this["value" + i].setNewTextFormat(textFormat); if(values[i][0].label==null){ this["value" + i].text = values[i][0].data; } else { this["value" + i].text = values[i][0].label; } this["value" + i].enabled = false; } attachMovie("Button", "selectButton", getNextHighestDepth(), {_width:80,_x:0, _y:(values.length * 20) + 20 , label: Strings.getFile("Geoide").getString("Select")}); this["selectButton"].addEventListener("click", Delegate.create(this, onClickSelectButton)); attachMovie("Button", "cancelButton", getNextHighestDepth(), {_width:80,_x:90, _y:(values.length * 20) + 20 , label: Strings.getFile("Geoide").getString("Cancel")}); this["cancelButton"].addEventListener("click", Delegate.create(this, onClickCancelButton)); _parent.refreshPane(); } private function onClickCheckBox():Void{ var checkBoxNr:Number; checkBoxNr = Number(this._name.slice(5)); _parent.values[checkBoxNr][1] = _parent["check"+ checkBoxNr].selected; } private function onClickSelectButton():Void{ returnObject.setValues(values); } private function onClickCancelButton():Void{ returnObject.closeValuePicker(); } }