/*---------------- 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.filterencoding.OperationDefines; import nl.idgis.giclient.filterencoding.PropertyIsBetweenOperation; import nl.idgis.giclient.filterencoding.PropertyIsCompOperation; import nl.idgis.giclient.filterencoding.PropertyIsInOperation; import nl.idgis.giclient.framework.IDComboBox; import nl.idgis.giclient.query.OperationViewer; import nl.idgis.giclient.query.QueryColumn; class nl.idgis.giclient.query.AdvancedOperationViewer extends OperationViewer{ private var operatorPicker:IDComboBox = null; function AdvancedOperationViewer(){ paint(); } private function paint(){ propertyField = IDComboBox(attachMovie("IDComboBox", "propertyField" , 1, {_x: 0, _y:0,maxWidth:100 })); propertyField.textField.setNewTextFormat(textFormat); propertyField.setMinimumWidth(propColumnWidth-10); propertyField.setMaximumWidth(propColumnWidth + 20); propertyField.addEventListener("select", Delegate.create(this, onSelectPropertyField)); paintOperator(); } private function paintOperator(){ var operatorNames:Array = queryColumn.getOperatorNames(); if(operatorNames.length > 1){ var operatorPickerName:String = queryAspectViewer.queryAspect.getName() + queryColumn.getName() + "Operator"; operatorPicker = IDComboBox(attachMovie("IDComboBox", operatorPickerName, 2, {_x: propColumnWidth + 25, _y: 0, _width:60, _visible:false})); operatorPicker.textField.setNewTextFormat(textFormat); operatorPicker._visible = propertyField._visible; operatorPicker.addEventListener("select", Delegate.create(this, onSelectOperator)); } else { createTextField("operatorLabel", 2, propColumnWidth + 25, 0, 20, 20, {enabled:false}); resetOperator(); queryAspectViewer.onChangeOperator(this); } } function resetOperator(){ var operatorNames:Array = queryColumn.getOperatorNames(); if(operatorNames.length > 1){ var provider:Array = new Array(); for (var i:Number = 0; i < operatorNames.length; i++) { provider.push({label:OperationDefines.getAliasById(OperationDefines.getIdByName(operatorNames[i])),data:OperationDefines.getIdByName(operatorNames[i])}); } operatorPicker.dataProvider=provider; //zet de default selectie operatorPicker.selectedIndex = 0; operator = operatorPicker.selectedItem.data; operatorWidth = operatorPicker.getWidth(); } else { operator = OperationDefines.getIdByName(operatorNames[0]); this["operatorLabel"].text = OperationDefines.getAliasById(OperationDefines.getIdByName(operatorNames[0]));// ":" operatorWidth = 10; } resetOperation(); } private function resetOperation():Void{ var classType:String = OperationDefines.getClassTypeById(operator); switch (classType) { case "PropertyIsComp" : operation = new PropertyIsCompOperation(operator,queryColumn.getFTQueryField(), queryColumn.getOperandValueField(), null); break; case "PropertyIsIn" : operation = new PropertyIsInOperation(null); break; case "PropertyIsBetween" : operation = new PropertyIsBetweenOperation(queryColumn.getFTQueryField(), queryColumn.getOperandValueField(), null, null); break; } resetOperand(); } private function onSelectPropertyField(eventObject:Object):Void{ queryColumn = QueryColumn(propertyField.selectedItem.data); resetOperator(); queryAspectViewer.onChangePropertyField(this); } private function onSelectOperator(eventObject:Object):Void{ operator = operatorPicker.selectedItem.data; resetOperation(); queryAspectViewer.onChangeOperator(this); } function setPropertyFieldValues(propFieldDataProvider:Array):Void{ propertyField.dataProvider = propFieldDataProvider; propertyField.resize(); propertyField.selectedIndex = 0; queryColumn = propertyField.selectedItem.data; resetOperator(); } }