Author: aharui
Date: Tue Jan 29 19:10:42 2013
New Revision: 1440065
URL: http://svn.apache.org/viewvc?rev=1440065&view=rev
Log:
Basic ScrollBar. Won't have JS equivalent (at least for now). It is just a
re-usable piece needed to create List and TextArea. JS already has scrollbars
built into those components.
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as
(with props)
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
(with props)
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 IRangeModel extends IBeadModel
+ {
+ function get maximum():Number;
+ function set maximum(value:Number):void;
+
+ function get minimum():Number;
+ function set minimum(value:Number):void;
+
+ function get snapInterval():Number;
+ function set snapInterval(value:Number):void;
+
+ function get stepSize():Number;
+ function set stepSize(value:Number):void;
+
+ function get value():Number;
+ function set value(value:Number):void;
+}
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IRangeModel.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as
Tue Jan 29 19:10:42 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 IScrollBarModel extends IRangeModel
+ {
+ function get pageSize():Number;
+ function set pageSize(value:Number):void;
+
+ function get pageStepSize():Number;
+ function set pageStepSize(value:Number):void;
+}
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/core/IScrollBarModel.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IStrand;
+
+ public class DownArrowButtonBead implements IButtonBead
+ {
+ public function DownArrowButtonBead()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, 16);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(4, 4);
+ g.lineTo(12, 4);
+ g.lineTo(8, 12);
+ g.lineTo(4, 4);
+ g.endFill();
+ }
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, 16);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/DownArrowButtonBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+
+ public interface IScrollBarBead
+ {
+ function get increment():DisplayObject;
+ function get decrement():DisplayObject;
+ function get track():DisplayObject;
+ function get thumb():DisplayObject;
+
+ function get scrollBarModel():IScrollBarModel;
+ function get strand():IStrand;
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/IScrollBarBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/ScrollBarBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,136 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 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.Button;
+
+ public class ScrollBarBead implements IBead, IInitSkin, IStrand,
IScrollBarBead
+ {
+ public function ScrollBarBead()
+ {
+ }
+
+ public function get scrollBarModel():IScrollBarModel
+ {
+ return sbModel;
+ }
+
+ private var sbModel:IScrollBarModel;
+
+ private var _strand:IStrand;
+
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ UIBase(value).addChild(_decrement);
+ UIBase(value).addChild(_increment);
+ UIBase(value).addChild(_track);
+ UIBase(value).addChild(_thumb);
+ sbModel = value.getBeadByType(IScrollBarModel) as
IScrollBarModel;
+ }
+
+ public function initSkin():void
+ {
+ // TODO: (aharui) put in values impl
+ _increment = new Button();
+ Button(_increment).addBead(new DownArrowButtonBead());
+ Button(_increment).initSkin();
+ _decrement = new Button();
+ Button(_decrement).addBead(new UpArrowButtonBead());
+ Button(_decrement).initSkin();
+ _track = new Button();
+ Button(_track).addBead(new VScrollBarTrackBead());
+ Button(_track).initSkin();
+ _thumb = new Button();
+ Button(_thumb).addBead(new VScrollBarThumbBead());
+ Button(_thumb).initSkin();
+ }
+
+ private var _decrement:DisplayObject;
+ private var _increment:DisplayObject;
+ private var _track:DisplayObject;
+ private var _thumb:DisplayObject;
+
+ public function get decrement():DisplayObject
+ {
+ return _decrement;
+ }
+ public function get increment():DisplayObject
+ {
+ return _increment;
+ }
+ public function get track():DisplayObject
+ {
+ return _track;
+ }
+ public function get thumb():DisplayObject
+ {
+ return _thumb;
+ }
+
+ // 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/ScrollBarBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IStrand;
+
+ public class UpArrowButtonBead implements IButtonBead
+ {
+ public function UpArrowButtonBead()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, 16);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(4, 12);
+ g.lineTo(12, 12);
+ g.lineTo(8, 4);
+ g.lineTo(4, 12);
+ g.endFill();
+ }
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, 16);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/UpArrowButtonBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IStrand;
+
+ public class VScrollBarThumbBead implements IButtonBead
+ {
+ public function VScrollBarThumbBead()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, 16);
+ g.endFill();
+ g.moveTo(4, 4);
+ g.lineTo(12, 4);
+ g.moveTo(4, 8);
+ g.lineTo(12, 8);
+ g.moveTo(4, 12);
+ g.lineTo(12, 12);
+ }
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, 16);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarThumbBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Graphics;
+ import flash.display.SimpleButton;
+ import flash.display.Shape;
+ import flash.events.Event;
+
+ import org.apache.flex.core.IStrand;
+
+ public class VScrollBarTrackBead implements IButtonBead
+ {
+ public function VScrollBarTrackBead()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ }
+
+ private function drawView(g:Graphics, bgColor:uint,
h:Number):void
+ {
+ g.clear();
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 16, h);
+ g.endFill();
+ g.lineStyle(0);
+ }
+
+ private function heightChangeHandler(event:Event):void
+ {
+ var h:Number = SimpleButton(_strand).height;
+
+ drawView(upView.graphics, 0xCCCCCC, h);
+ drawView(downView.graphics, 0x808080, h);
+ drawView(overView.graphics, 0xEEEEEE, h);
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 16, h);
+ shape.graphics.endFill();
+
+ }
+
+ private var _strand:IStrand;
+
+ private var shape:Shape;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ SimpleButton(value).addEventListener("heightChanged",
heightChangeHandler);
+ shape = new Shape();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/VScrollBarTrackBead.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.events.Event;
+ import flash.events.IEventDispatcher;
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.staticControls.beads.IScrollBarBead;
+
+ public class ScrollBarMouseControllerBase implements IBead
+ {
+ public function ScrollBarMouseControllerBase()
+ {
+ }
+
+ protected var sbModel:IScrollBarModel;
+ protected var sbView:IScrollBarBead;
+
+ private var _strand:IStrand;
+
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ sbModel = value.getBeadByType(IScrollBarModel) as
IScrollBarModel;
+ sbView = value.getBeadByType(IScrollBarBead) as
IScrollBarBead;
+ sbView.decrement.addEventListener(MouseEvent.CLICK,
decrementClickHandler);
+ sbView.increment.addEventListener(MouseEvent.CLICK,
incrementClickHandler);
+ sbView.track.addEventListener(MouseEvent.CLICK,
trackClickHandler);
+ sbView.thumb.addEventListener(MouseEvent.MOUSE_DOWN,
thumbMouseDownHandler);
+ }
+
+
+ protected function snap(value:Number):Number
+ {
+ var si:Number = sbModel.snapInterval;
+ var n:Number = Math.round((value - sbModel.minimum) /
si) * si + sbModel.minimum;
+ if (value > 0)
+ {
+ if (value - n < n + si - value)
+ return n;
+ return n + si;
+
+ }
+ if (value - n > n + si - value)
+ return n + si;
+ return n;
+ }
+
+ protected function decrementClickHandler(event:MouseEvent):void
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum,
sbModel.value - sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new
Event("scroll"));
+ }
+
+ protected function incrementClickHandler(event:MouseEvent):void
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum,
sbModel.value + sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new
Event("scroll"));
+ }
+
+ protected function trackClickHandler(event:MouseEvent):void
+ {
+ }
+
+ protected function thumbMouseDownHandler(event:MouseEvent):void
+ {
+ }
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/ScrollBarMouseControllerBase.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers
+{
+ import flash.display.DisplayObject;
+ import flash.events.Event;
+ import flash.events.IEventDispatcher;
+ import flash.events.MouseEvent;
+
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.staticControls.beads.IScrollBarBead;
+
+ public class VScrollBarMouseController extends
ScrollBarMouseControllerBase
+ {
+ public function VScrollBarMouseController()
+ {
+ }
+
+ override protected function
trackClickHandler(event:MouseEvent):void
+ {
+ if (sbView.thumb.visible)
+ {
+ if (event.localY < sbView.thumb.y)
+ {
+ sbModel.value =
snap(Math.max(sbModel.minimum, sbModel.value - sbModel.pageStepSize));
+
IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ else
+ {
+ sbModel.value =
snap(Math.min(sbModel.maximum, sbModel.value + sbModel.pageStepSize));
+
IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ }
+ }
+
+ private var thumbDownY:Number;
+ private var lastThumbY:Number;
+
+ override protected function
thumbMouseDownHandler(event:MouseEvent):void
+ {
+
sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_MOVE,
thumbMouseMoveHandler);
+
sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ thumbDownY = event.stageY;
+ lastThumbY = sbView.thumb.y;
+ }
+
+ private function thumbMouseMoveHandler(event:MouseEvent):void
+ {
+ var thumb:DisplayObject = sbView.thumb;
+ var track:DisplayObject = sbView.track;
+ thumb.y = Math.max(track.y, Math.min(lastThumbY +
(event.stageY - thumbDownY), track.y + track.height - thumb.height));
+ var newValue:Number = snap((thumb.y - track.y) /
(track.height - thumb.height) * (sbModel.maximum - sbModel.minimum -
sbModel.pageSize));
+ sbModel.value = newValue;
+ IEventDispatcher(strand).dispatchEvent(new
Event("scroll"));
+ }
+
+ private function thumbMouseUpHandler(event:MouseEvent):void
+ {
+
sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_MOVE,
thumbMouseMoveHandler);
+
sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_UP,
thumbMouseUpHandler);
+ }
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/controllers/VScrollBarMouseController.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.layouts
+{
+ import flash.display.DisplayObject;
+ import flash.events.Event;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.staticControls.beads.IScrollBarBead;
+
+ public class VScrollBarLayout implements IBead
+ {
+ public function VScrollBarLayout()
+ {
+ }
+
+ private var sbModel:IScrollBarModel;
+ private var sbView:IScrollBarBead;
+
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ sbView = value as IScrollBarBead;
+ sbModel = sbView.scrollBarModel;
+ sbModel.addEventListener("maximumChange",
changeHandler);
+ sbModel.addEventListener("minimumChange",
changeHandler);
+ sbModel.addEventListener("snapIntervalChange",
changeHandler);
+ sbModel.addEventListener("stepSizeChange",
changeHandler);
+ sbModel.addEventListener("valueChange", changeHandler);
+ sbModel.addEventListener("heightChanged",
changeHandler);
+ changeHandler(null);
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var h:Number = DisplayObject(sbView.strand).height;
+ var increment:DisplayObject = sbView.increment;
+ var decrement:DisplayObject = sbView.decrement;
+ var track:DisplayObject = sbView.track;
+ var thumb:DisplayObject = sbView.thumb;
+
+ decrement.x = 0;
+ decrement.y = 0;
+ increment.x = 0;
+ increment.y = h - increment.height;
+ track.x = 0;
+ track.y = decrement.height;
+ track.height = increment.y - decrement.height;
+ if (track.height > thumb.height)
+ {
+ thumb.visible = true;
+ thumb.height = sbModel.pageSize /
(sbModel.maximum - sbModel.minimum) * track.height;
+ thumb.y = (sbModel.value / (sbModel.maximum -
sbModel.minimum - sbModel.pageSize) * (track.height - thumb.height)) + track.y;
+ }
+ else
+ {
+ thumb.visible = false;
+ }
+ }
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/layouts/VScrollBarLayout.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,117 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.models
+{
+ import flash.events.Event;
+ import flash.events.EventDispatcher;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IRangeModel;
+
+ public class RangeModel extends EventDispatcher implements IBead,
IRangeModel
+ {
+ public function RangeModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _maximum:Number;
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+
+ public function set maximum(value:Number):void
+ {
+ if (value != _maximum)
+ {
+ _maximum = value;
+ dispatchEvent(new Event("maximumChange"));
+ }
+ }
+
+ private var _minimum:Number;
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+
+ public function set minimum(value:Number):void
+ {
+ if (value != _minimum)
+ {
+ _minimum = value;
+ dispatchEvent(new Event("minimumChange"));
+ }
+ }
+
+ private var _snapInterval:Number;
+ public function get snapInterval():Number
+ {
+ return _snapInterval;
+ }
+
+ public function set snapInterval(value:Number):void
+ {
+ if (value != _snapInterval)
+ {
+ _snapInterval = value;
+ dispatchEvent(new Event("snapIntervalChange"));
+ }
+ }
+
+ private var _stepSize:Number;
+ public function get stepSize():Number
+ {
+ return _stepSize;
+ }
+
+ public function set stepSize(value:Number):void
+ {
+ if (value != _stepSize)
+ {
+ _stepSize = value;
+ dispatchEvent(new Event("stepSizeChange"));
+ }
+ }
+
+ private var _value:Number;
+ public function get value():Number
+ {
+ return _value;
+ }
+
+ public function set value(newValue:Number):void
+ {
+ if (newValue != _value)
+ {
+ _value = newValue;
+ dispatchEvent(new Event("valueChange"));
+ }
+ }
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/RangeModel.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.models
+{
+ import flash.events.Event;
+
+ import org.apache.flex.core.IScrollBarModel;
+
+ public class ScrollBarModel extends RangeModel implements
IScrollBarModel
+ {
+ public function ScrollBarModel()
+ {
+ }
+
+ private var _pageSize:Number;
+ public function get pageSize():Number
+ {
+ return _pageSize;
+ }
+
+ public function set pageSize(value:Number):void
+ {
+ if (value != _pageSize)
+ {
+ _pageSize = value;
+ dispatchEvent(new Event("pageSizeChange"));
+ }
+ }
+
+ private var _pageStepSize:Number;
+ public function get pageStepSize():Number
+ {
+ return _pageStepSize;
+ }
+
+ public function set pageStepSize(value:Number):void
+ {
+ if (value != _pageStepSize)
+ {
+ _pageStepSize = value;
+ dispatchEvent(new Event("pageStepSizeChange"));
+ }
+ }
+
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/ScrollBarModel.as
------------------------------------------------------------------------------
svn:eol-style = native
Added:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
URL:
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as?rev=1440065&view=auto
==============================================================================
---
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
(added)
+++
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
Tue Jan 29 19:10:42 2013
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.supportClasses
+{
+ import org.apache.flex.core.UIBase;
+
+ public class ScrollBar extends UIBase
+ {
+ public function ScrollBar()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
Propchange:
flex/asjs/branches/develop/frameworks/as/src/org/apache/flex/html/staticControls/supportClasses/ScrollBar.as
------------------------------------------------------------------------------
svn:eol-style = native