Author: pent
Date: Wed Feb 13 16:49:57 2013
New Revision: 1445733
URL: http://svn.apache.org/r1445733
Log:
Fixed issue in button repeater where the repeat interval was not being stopped
if the mouse-up happened quickly. Adding first draft of TextArea
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as
(with props)
Modified:
flex/asjs/branches/develop/frameworks/as/manifest.xml
flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
Modified: flex/asjs/branches/develop/frameworks/as/manifest.xml
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/manifest.xml?rev=1445733&r1=1445732&r2=1445733&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/manifest.xml (original)
+++ flex/asjs/branches/develop/frameworks/as/manifest.xml Wed Feb 13 16:49:57
2013
@@ -30,6 +30,7 @@
<component id="Label" class="org.apache.flex.html.staticControls.Label"/>
<component id="TextButton"
class="org.apache.flex.html.staticControls.TextButton"/>
<component id="TextInput"
class="org.apache.flex.html.staticControls.TextInput"/>
+ <component id="TextArea"
class="org.apache.flex.html.staticControls.TextArea"/>
<component id="List" class="org.apache.flex.html.staticControls.List"/>
<component id="HTTPService" class="org.apache.flex.net.HTTPService"/>
<component id="LazyCollection"
class="org.apache.flex.net.dataConverters.LazyCollection"/>
Modified: flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as?rev=1445733&r1=1445732&r2=1445733&view=diff
==============================================================================
--- flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as (original)
+++ flex/asjs/branches/develop/frameworks/as/src/FlexJSUIClasses.as Wed Feb 13
16:49:57 2013
@@ -32,6 +32,7 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.TextFieldBead;
TextFieldBead;
import org.apache.flex.html.staticControls.beads.TextInputBead;
TextInputBead;
import
org.apache.flex.html.staticControls.beads.TextInputWithBorderBead;
TextInputWithBorderBead;
+ import org.apache.flex.html.staticControls.beads.TextAreaBead;
TextAreaBead;
import org.apache.flex.html.staticControls.beads.models.TextModel;
TextModel;
import
org.apache.flex.html.staticControls.beads.models.ArraySelectionModel;
ArraySelectionModel;
}
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as?rev=1445733&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as
Wed Feb 13 16:49:57 2013
@@ -0,0 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ public interface ITextAreaBead extends IBead
+ {
+ function get text():String;
+ function set text(value:String):void;
+
+ function get html():String;
+ function set html(value:String):void;
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/ITextAreaBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as?rev=1445733&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as
Wed Feb 13 16:49:57 2013
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.staticControls
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IInitSkin;
+ import org.apache.flex.core.ITextAreaBead;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.staticControls.beads.TextAreaBead;
+
+ public class TextArea extends UIBase implements IInitSkin
+ {
+ public function TextArea()
+ {
+ super();
+ }
+
+ public function get text():String
+ {
+ return ITextModel(model).text;
+ }
+ public function set text(value:String):void
+ {
+ ITextModel(model).text = value;
+ }
+
+ public function get html():String
+ {
+ return ITextModel(model).html;
+ }
+ public function set html(value:String):void
+ {
+ ITextModel(model).html = value;
+ }
+
+ override public function initModel():void
+ {
+ if (getBeadByType(ITextModel) == null)
+ addBead(new
(ValuesManager.valuesImpl.getValue("ITextModel")) as IBead);
+ }
+
+ public function initSkin():void
+ {
+ if (getBeadByType(ITextAreaBead) == null) {
+ var tab:TextAreaBead = new TextAreaBead();
+ addBead(tab);
+ }
+ }
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/TextArea.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as?rev=1445733&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as
Wed Feb 13 16:49:57 2013
@@ -0,0 +1,204 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.staticControls.beads
+{
+ import flash.display.DisplayObject;
+ import flash.events.Event;
+ import flash.events.IEventDispatcher;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IInitSkin;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import
org.apache.flex.html.staticControls.beads.controllers.VScrollBarMouseController;
+ import
org.apache.flex.html.staticControls.beads.layouts.VScrollBarLayout;
+ import org.apache.flex.html.staticControls.beads.models.ScrollBarModel;
+ import
org.apache.flex.html.staticControls.beads.models.SingleLineBorderModel;
+ import org.apache.flex.html.staticControls.supportClasses.Border;
+ import org.apache.flex.html.staticControls.supportClasses.ScrollBar;
+
+ public class TextAreaBead extends TextFieldBeadBase implements
IInitSkin, IStrand
+ {
+ public function TextAreaBead()
+ {
+ super();
+
+ textField.selectable = true;
+ textField.type = TextFieldType.INPUT;
+ textField.mouseEnabled = true;
+ textField.multiline = true;
+ textField.wordWrap = true;
+ }
+
+ private var _border:Border;
+
+ public function get border():Border
+ {
+ return _border;
+ }
+
+ private var _vScrollBar:ScrollBar;
+
+ public function get vScrollBar():ScrollBar
+ {
+ if (!_vScrollBar)
+ _vScrollBar = createScrollBar();
+ return _vScrollBar;
+ }
+
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ // add a border to this
+ _border = new Border();
+ border.addToParent(UIBase(strand));
+ _border.model = new SingleLineBorderModel();
+ _border.addBead(new SingleLineBorderBead());
+
+ var vb:ScrollBar = vScrollBar;
+
+ // Default size
+ var ww:Number = DisplayObject(strand).width;
+ if( isNaN(ww) || ww == 0 ) DisplayObject(strand).width
= 100;
+ var hh:Number = DisplayObject(strand).height;
+ if( isNaN(hh) || hh == 0 ) DisplayObject(strand).height
= 42;
+
+ // for input, listen for changes to the _textField and
update
+ // the model
+ textField.addEventListener(Event.CHANGE,
inputChangeHandler);
+ textField.addEventListener(Event.SCROLL,
textScrollHandler);
+
+
IEventDispatcher(strand).addEventListener("widthChanged", sizeChangedHandler);
+
IEventDispatcher(strand).addEventListener("heightChanged", sizeChangedHandler);
+ sizeChangedHandler(null);
+ }
+
+ public function initSkin():void
+ {
+ }
+
+ private function createScrollBar():ScrollBar
+ {
+ var vsb:ScrollBar;
+ vsb = new ScrollBar();
+ vsb.addToParent(UIBase(strand));
+ var vsbm:ScrollBarModel = new ScrollBarModel();
+ vsbm.maximum = 100;
+ vsbm.minimum = 0;
+ vsbm.pageSize = 10;
+ vsbm.pageStepSize = 10;
+ vsbm.snapInterval = 1;
+ vsbm.stepSize = 1;
+ vsbm.value = 0;
+ vsb.model = vsbm;
+ vsb.initModel();
+ vsb.width = 16;
+ var vsbb:ScrollBarBead = new ScrollBarBead();
+ vsbb.initSkin();
+ vsb.addBead(vsbb);
+ var vsbl:VScrollBarLayout = new VScrollBarLayout();
+ vsbb.addBead(vsbl);
+ var vsbc:VScrollBarMouseController = new
VScrollBarMouseController();
+ vsb.addBead(vsbc);
+
+ vsb.addEventListener("scroll", scrollHandler);
+
+ return vsb;
+ }
+
+ private function inputChangeHandler(event:Event):void
+ {
+ textModel.text = textField.text;
+ }
+
+ private function textScrollHandler(event:Event):void
+ {
+ var vsbm:ScrollBarModel =
ScrollBarModel(vScrollBar.model);
+ vsbm.maximum = textField.numLines;
+ vsbm.value = textField.scrollV;
+ }
+
+ private function sizeChangedHandler(event:Event):void
+ {
+ var ww:Number = DisplayObject(strand).width -
DisplayObject(vScrollBar).width;
+ if( !isNaN(ww) && ww > 0 ) {
+ textField.width = ww;
+ _border.width = ww;
+ }
+
+ var hh:Number = DisplayObject(strand).height;
+ if( !isNaN(hh) && hh > 0 ) {
+ textField.height = hh;
+ _border.height = hh;
+ }
+
+ var sb:DisplayObject = DisplayObject(vScrollBar);
+ sb.y = 0;
+ sb.x = textField.width - 1;
+ sb.height = textField.height;
+ }
+
+ private function scrollHandler(event:Event):void
+ {
+ var vpos:Number =
IScrollBarModel(vScrollBar.model).value;
+ textField.scrollV = vpos;
+ }
+
+ // beads declared in MXML are added to the strand.
+ // from AS, just call addBead()
+ public var beads:Array;
+
+ private var _beads:Vector.<IBead>;
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = new Vector.<IBead>;
+ _beads.push(bead);
+ bead.strand = this;
+ }
+
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/TextAreaBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as?rev=1445733&r1=1445732&r2=1445733&view=diff
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
(original)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ButtonAutoRepeatController.as
Wed Feb 13 16:49:57 2013
@@ -18,13 +18,13 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.staticControls.beads.controllers
{
+ import flash.events.Event;
import flash.events.IEventDispatcher;
- import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.clearInterval;
import flash.utils.clearTimeout;
- import flash.utils.setInterval;
- import flash.utils.setTimeout;
+ import flash.utils.setInterval;
+ import flash.utils.setTimeout;
import org.apache.flex.core.IBead;
import org.apache.flex.core.IStrand;
@@ -53,11 +53,13 @@ package org.apache.flex.html.staticContr
private var timeout:uint;
private var repeater:uint;
+ private var stop:Boolean = false;
private function mouseDownHandler(event:MouseEvent):void
{
event.target.addEventListener(MouseEvent.MOUSE_OUT,
mouseOutHandler);
event.target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ stop = false;
setTimeout(sendFirstRepeat, delay);
}
@@ -65,6 +67,7 @@ package org.apache.flex.html.staticContr
{
event.target.removeEventListener(MouseEvent.MOUSE_OUT,
mouseOutHandler);
event.target.removeEventListener(MouseEvent.MOUSE_UP,
mouseUpHandler);
+ stop = true;
if (repeater > 0)
clearInterval(repeater);
repeater = 0;
@@ -76,7 +79,8 @@ package org.apache.flex.html.staticContr
private function mouseUpHandler(event:MouseEvent):void
{
event.target.removeEventListener(MouseEvent.MOUSE_OUT,
mouseOutHandler);
- event.target.removeEventListener(MouseEvent.MOUSE_UP,
mouseUpHandler);
+ event.target.removeEventListener(MouseEvent.MOUSE_UP,
mouseUpHandler);
+ stop = true;
if (repeater > 0)
clearInterval(repeater);
repeater = 0;
@@ -89,13 +93,22 @@ package org.apache.flex.html.staticContr
{
clearTimeout(timeout);
timeout = 0;
- repeater = setInterval(sendRepeats, interval);
- IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ if (!stop) {
+ repeater = setInterval(sendRepeats, interval);
+ IEventDispatcher(_strand).dispatchEvent(new
Event("buttonRepeat"));
+ }
}
private function sendRepeats():void
{
- IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ if( stop ) {
+ if (repeater > 0 )
+ clearInterval(repeater);
+ repeater = 0;
+ }
+ else {
+ IEventDispatcher(_strand).dispatchEvent(new
Event("buttonRepeat"));
+ }
}
}
}
\ No newline at end of file