| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:controls="com.flexcapacitor.controls.*" |
| |
| width="200" height="100" |
| creationComplete="group1_creationCompleteHandler(event)" |
| > |
| |
| |
| <!-- to use |
| |
| |
| Radiate.log.info("Document SHOW event"); |
| Radiate.log.error(event.text); |
| |
| --> |
| <fx:Script> |
| <![CDATA[ |
| import com.flexcapacitor.controller.Radiate; |
| |
| import mx.events.FlexEvent; |
| import mx.logging.AbstractTarget; |
| |
| import spark.components.VScrollBar; |
| import spark.events.TextOperationEvent; |
| |
| private var radiate:Radiate; |
| |
| [Bindable] |
| public var logTarget:AbstractTarget; |
| |
| /** |
| * The more text in the text area the slower everything runs. |
| * |
| * In one test during debug in Properties view, the time to call describe type |
| * on a target increased by 1 or 3 ms for each line of text. |
| * |
| * If the font size is 10 px and max position is 200 lines |
| * since 2000/10. |
| * */ |
| public var maxScrollPosition:int = 3000; |
| |
| protected function group1_creationCompleteHandler(event:FlexEvent):void {
|
| |
| /* |
| logTarget = new RadiateLogTarget(); |
| Radiate.setLoggingTarget(logTarget, null, consoleTextArea); |
| */ |
| |
| logTarget = Radiate.logTarget; |
| Radiate.setLoggingTarget(logTarget, null, consoleTextArea); |
|
|
| } |
| |
| protected function clearTextAreaHandler(event:MouseEvent):void {
|
| consoleTextArea.text = "";
|
| } |
| |
| protected function consoleTextArea_valueCommitHandler(event:FlexEvent):void { |
| scrollToTheBottom();
|
| }
|
| |
| protected function consoleTextArea_changeHandler(event:TextOperationEvent):void { |
| scrollToTheBottom() |
| } |
| |
| public function scrollToTheBottom():void { |
| var scrollBar:VScrollBar = consoleTextArea.scroller.verticalScrollBar; |
| scrollBar.value = scrollBar.maximum; |
| consoleTextArea.validateNow(); |
| |
| if (scrollBar.value != scrollBar.maximum) { |
| scrollBar.value = scrollBar.maximum; |
| consoleTextArea.validateNow(); |
| } |
| |
| if (scrollBar.maximum>maxScrollPosition) { |
| consoleTextArea.text = ""; |
| } |
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <s:Label text="" |
| height="14" |
| right="4" |
| fontSize="10" |
| typographicCase="uppercase" |
| textAlign="center" |
| verticalAlign="middle" |
| fontWeight="bold" |
| backgroundAlpha=".15" |
| backgroundColor="#000000" |
| useHandCursor="true" |
| buttonMode="true" |
| click="clearTextAreaHandler(event)" |
| /> |
| <s:TextArea id="consoleTextArea" |
| top="12" |
| width="100%" height="100%" |
| tabFocusEnabled="false" |
| fontWeight="normal" |
| fontSize="13" |
| focusAlpha="0" |
| fontFamily="Courier New" |
| borderVisible="false" |
| change="consoleTextArea_changeHandler(event)" |
| valueCommit="consoleTextArea_valueCommitHandler(event)" |
| /> |
| <controls:ImageButton source="{Radii8LibraryAssets.clear}" |
| right="8" |
| click="clearTextAreaHandler(event)" |
| width="18" |
| height="18" |
| horizontalAlign="center" |
| verticalAlign="middle" |
| /> |
| </s:Group> |