/*---------------- 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 nl.idgis.giclient.framework.bars.Bar; import nl.idgis.giclient.GIClientConfig; import nl.idgis.giclient.gui.mapviewer.MapViewer; import nl.idgis.giclient.gui.mapviewer.MapViewerLoadListener; import nl.idgis.giclient.framework.buttons.PaneButton; import nl.idgis.giclient.framework.buttons.PaneButtonConfig; import nl.idgis.giclient.Ruler; class nl.idgis.giclient.framework.bars.ProgressBar extends Bar implements MapViewerLoadListener { private var ruler:Ruler = null; private var percentage:Number = 0; function onMapViewerBusy(mapViewer:MapViewer):Void { this["frame"]._visible = true; } function onMapViewerLoad(mapViewer:MapViewer, numBytesLoaded:Number, numBytesTotal:Number):Void { var percentage:Number = Math.round(100 * numBytesLoaded / numBytesTotal); this["frameContent"].lineStyle(4, 0x000000, 100); this["frameContent"].moveTo(10, 5); this["frameContent"].lineTo(10 + percentage, 5); if (this.percentage > percentage) { this["frameContent"].lineStyle(4, 0xBBBBBB, 100); this["frameContent"].lineTo(10 + this.percentage, 5); } this.percentage = percentage; } function onMapViewerReady(mapViewer:MapViewer):Void { this["frame"]._visible = false; this["frameContent"].clear(); percentage = 0; } // To be called when giButtonConfig array HAS been loaded, but the single pane components HAVE NOT YET. function setGIClientConfig(giClientConfig:GIClientConfig):Void { var paneButtonConfig:PaneButtonConfig = giClientConfig.getPaneButtonConfig("AboutViewerButton"); paneButtonConfig.setButton(addPaneButton(paneButtonConfig)); this.createEmptyMovieClip("frame", 2); // Background has depth 0; pane button has depth 1. this["frame"]._visible = false; this["frame"]._x = 75; this["frame"]._y = 15; this["frame"].beginFill(0xFFFFFF, 30); this["frame"].lineStyle(1, 0x000000, 100); this["frame"].moveTo(0, 0); this["frame"].lineTo(120, 0); this["frame"].lineTo(120, 10); this["frame"].lineTo(0, 10); this["frame"].endFill(); this.createEmptyMovieClip("frameContent", 3); this["frameContent"]._x = 75; this["frameContent"]._y = 15; this.attachMovie("GeoideLogoTekst", "logoText", 4, {_x: 15, _y: 15, _width: 55, _height: 10}); setWidth(200); } function setRuler(ruler:Ruler):Void { ruler.rulerEventDispatcher.addMapViewerLoadListener(this); } private function addPaneButton(paneButtonConfig:PaneButtonConfig):PaneButton { var initObject:Object = {_x: 25, _y: 20, name: paneButtonConfig.getName(), size: 35, toolTipText: paneButtonConfig.getToolTipText(), baseURL: paneButtonConfig.getBaseURL(), iconURL: paneButtonConfig.getIconURL(), _giButtonLoadListener: this}; var movieClip:MovieClip = attachMovie("PaneButton", paneButtonConfig.getName(), 1, initObject); var paneButton:PaneButton = PaneButton(movieClip); return paneButton; } }