You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/08/10 17:45:14 UTC
[royale-asjs] branch feature/MXRoyale updated (735d5ef -> d6b10e0)
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a change to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.
from 735d5ef Add RichTextEditor.as
new 495f465 fix open node
new f30fba3 add more APIs
new cbc910d use interface
new ff7c97d don't set dimensions if we don't need to
new 52b0b0c move initComplete to after layout is setup
new da6f719 refactor PanelView so we can override layout. The flexbox layout did not like children being absolute positioned which fools its size calculations so we will switch to using the Flex BoxLayout
new d364682 SWF code could presume that all collections supported Proxy and handle [] access, but JS code can't so we must use the collection APIs
new 3a28b0a get tree working
new d6b10e0 allow for TitleBar substitution
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/royale/html/beads/PanelView.as | 76 +++++-----
.../TreeSingleSelectionMouseController.as | 8 +-
.../html/supportClasses/AccordionItemRenderer.as | 2 +-
.../org/apache/royale/collections/ITreeData.as | 2 +
.../MXRoyale/src/main/resources/defaults.css | 16 ++-
.../src/main/resources/mx-royale-manifest.xml | 2 +
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 1 +
.../models/PanelModel.as => PanelTitleBar.as} | 30 ++--
.../main/royale/mx/containers/beads/BoxLayout.as | 6 +-
.../main/royale/mx/containers/beads/PanelView.as | 21 ++-
.../treeClasses/HierarchicalCollectionView.as | 159 +++++++++++++--------
.../controls/treeClasses/HierarchicalViewCursor.as | 54 +++++--
.../MXRoyale/src/main/royale/mx/core/Container.as | 2 +-
13 files changed, 236 insertions(+), 143 deletions(-)
copy frameworks/projects/MXRoyale/src/main/royale/mx/containers/{beads/models/PanelModel.as => PanelTitleBar.as} (73%)
[royale-asjs] 05/09: move initComplete to after layout is setup
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 52b0b0c9e5a94dd5cb93f432ce7f33c9db2065ae
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 00:07:23 2018 -0700
move initComplete to after layout is setup
---
frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index 3932df4..bef4300 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -615,6 +615,7 @@ public class Container extends UIComponent
// Load the layout bead if it hasn't already been loaded.
if (loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", this))
{
+ dispatchEvent(new Event("initComplete"));
if ((isHeightSizedToContent() || !isNaN(explicitHeight)) &&
(isWidthSizedToContent() || !isNaN(explicitWidth)))
dispatchEvent(new Event("layoutNeeded"));
@@ -629,7 +630,6 @@ public class Container extends UIComponent
addBead(new ContainerDataBinding());
dispatchEvent(new Event("initBindings"));
- dispatchEvent(new Event("initComplete"));
}
/**
[royale-asjs] 08/09: get tree working
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 3a28b0a54bb6469b0b1afdceaa0a2f60b61cf823
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 09:48:38 2018 -0700
get tree working
---
.../royale/mx/controls/treeClasses/HierarchicalCollectionView.as | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
index 66ffe55..77427fb 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
@@ -1070,7 +1070,7 @@ public class HierarchicalCollectionView extends EventDispatcher
var offset:int = getItemIndex(node);
//otherwise seek to offset and get the depth
var bookmark:CursorBookmark = iterator.bookmark;
- iterator.seek(bookmark, offset);
+ iterator.seek(CursorBookmark.FIRST, offset);
var depth:int = getCurrentCursorDepth();
//put the cursor back
iterator.seek(bookmark, 0);
@@ -1131,6 +1131,7 @@ public class HierarchicalCollectionView extends EventDispatcher
private function dispatchAddOrRemoveEvents(node:Object, index:int, type:String):int
{
+ var adding:Boolean = (type == org.apache.royale.events.CollectionEvent.ITEM_ADDED);
var children:ICollectionView = getChildren(node);
var cursor:IViewCursor = children.createCursor();
do
@@ -1140,6 +1141,10 @@ public class HierarchicalCollectionView extends EventDispatcher
collectionEvent.item = item;
collectionEvent.index = index++;
dispatchEvent(collectionEvent);
+ if (adding)
+ currentLength++;
+ else
+ currentLength--;
if (isOpen(item))
{
index = dispatchAddOrRemoveEvents(node, index, type);
[royale-asjs] 06/09: refactor PanelView so we can override layout.
The flexbox layout did not like children being absolute positioned which
fools its size calculations so we will switch to using the Flex BoxLayout
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit da6f7191b0cb3ad941cc531eb61ad1f48c45e9d1
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 00:08:39 2018 -0700
refactor PanelView so we can override layout. The flexbox layout did not like children being absolute positioned which fools its size calculations so we will switch to using the Flex BoxLayout
---
.../org/apache/royale/html/beads/PanelView.as | 68 ++++++++++++----------
.../MXRoyale/src/main/resources/defaults.css | 2 +-
.../main/royale/mx/containers/beads/PanelView.as | 18 +++++-
3 files changed, 54 insertions(+), 34 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
index e356e94..ed26d4d 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
@@ -160,21 +160,6 @@ package org.apache.royale.html.beads
_titleBar.id = "panelTitleBar";
- COMPILE::SWF {
- _titleBar.percentWidth = 100;
-
- if (_titleBar.style == null) {
- _titleBar.style = new SimpleCSSStylesWithFlex();
- }
- _titleBar.style.flexGrow = 0;
- _titleBar.style.order = 1;
- }
-
- COMPILE::JS {
- _titleBar.element.style["flex-grow"] = "0";
- _titleBar.element.style["order"] = "1";
- }
-
_titleBar.addEventListener("close", handleClose);
// replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
@@ -197,21 +182,6 @@ package org.apache.royale.html.beads
// add the viewport bead to the content area.
if (transferViewportBead) _contentArea.addBead(transferViewportBead);
- COMPILE::SWF {
- _contentArea.percentWidth = 100;
-
- if (_contentArea.style == null) {
- _contentArea.style = new SimpleCSSStylesWithFlex();
- }
- _contentArea.style.flexGrow = 1;
- _contentArea.style.order = 2;
- }
-
- COMPILE::JS {
- _contentArea.element.style["flex-grow"] = "1";
- _contentArea.element.style["order"] = "2";
- _contentArea.element.style["overflow"] = "auto"; // temporary
- }
}
COMPILE::SWF {
@@ -228,9 +198,45 @@ package org.apache.royale.html.beads
(_strand as IContainerBaseStrandChildrenHost).$addElement(contentArea as IChild);
}
+ setupLayout();
+ }
+
+ protected function setupLayout():void
+ {
+ COMPILE::JS {
+ _titleBar.element.style["flex-grow"] = "0";
+ _titleBar.element.style["order"] = "1";
+ }
+
+ COMPILE::SWF {
+ _contentArea.percentWidth = 100;
+
+ if (_contentArea.style == null) {
+ _contentArea.style = new SimpleCSSStylesWithFlex();
+ }
+ _contentArea.style.flexGrow = 1;
+ _contentArea.style.order = 2;
+ }
+
+ COMPILE::SWF {
+ _titleBar.percentWidth = 100;
+
+ if (_titleBar.style == null) {
+ _titleBar.style = new SimpleCSSStylesWithFlex();
+ }
+ _titleBar.style.flexGrow = 0;
+ _titleBar.style.order = 1;
+ }
+
+ COMPILE::JS {
+ _contentArea.element.style["flex-grow"] = "1";
+ _contentArea.element.style["order"] = "2";
+ _contentArea.element.style["overflow"] = "auto"; // temporary
+ }
+
// Now give the Panel its own layout
var layoutBead:IBeadLayout = new VerticalFlexLayout();
- value.addBead(layoutBead);
+ _strand.addBead(layoutBead);
}
private var _panelLayoutProxy:PanelLayoutProxy;
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 1767c94..bd55f7b 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -200,7 +200,7 @@ Panel
{
IBeadModel: ClassReference("mx.containers.beads.models.PanelModel");
IBeadView: ClassReference("mx.containers.beads.PanelView");
- IPanelLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalFlexLayout");
+ IPanelLayout: ClassReference("mx.containers.beads.BoxLayout");
IPanelContentArea: ClassReference("mx.core.Container");
background-color: #FFFFFF;
border: 1px solid #333333
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
index cf379ef..c86ff27 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
@@ -20,16 +20,17 @@
package mx.containers.beads
{
-import mx.core.ContainerLayout;
import mx.containers.BoxDirection;
import mx.containers.beads.BoxLayout;
import mx.containers.beads.CanvasLayout;
import mx.containers.beads.models.PanelModel;
+import mx.core.ContainerLayout;
-import org.apache.royale.html.beads.PanelView;
import org.apache.royale.core.IBead;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.UIBase;
+import org.apache.royale.html.beads.PanelView;
+import org.apache.royale.html.beads.layouts.VerticalFlexLayout;
/**
* @private
@@ -83,6 +84,19 @@ public class PanelView extends org.apache.royale.html.beads.PanelView
if (layoutObject)
contentArea.addBead(layoutObject);
}
+
+ override protected function setupLayout():void
+ {
+ titleBar.percentWidth = 100;
+
+ contentArea.percentWidth = 100;
+ contentArea.percentHeight = 100;
+
+ // Now give the Panel its own layout
+ var boxLayout:BoxLayout = new BoxLayout();
+ boxLayout.direction = "vertical";
+ _strand.addBead(boxLayout);
+ }
}
}
[royale-asjs] 01/09: fix open node
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 495f46593c87708aa7ea191d0b5cc6c8c8a41aa0
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Aug 9 17:06:00 2018 -0700
fix open node
---
.../treeClasses/HierarchicalCollectionView.as | 152 +++++++++++++--------
1 file changed, 94 insertions(+), 58 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
index 6d8fa1e..66ffe55 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
@@ -34,6 +34,7 @@ import mx.events.PropertyChangeEvent;
import mx.utils.IXMLNotifiable;
import mx.utils.XMLNotifier;
+import org.apache.royale.events.CollectionEvent;
import org.apache.royale.events.EventDispatcher;
import org.apache.royale.collections.ITreeData;
@@ -93,10 +94,10 @@ public class HierarchicalCollectionView extends EventDispatcher
0,
true);
*/
- treeData.addEventListener(CollectionEvent.COLLECTION_CHANGE,
+ treeData.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
collectionChangeHandler);
- addEventListener(CollectionEvent.COLLECTION_CHANGE,
+ addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
expandEventHandler);
dataDescriptor = treeDataDescriptor;
@@ -412,9 +413,9 @@ public class HierarchicalCollectionView extends EventDispatcher
oldValue:Object = null,
newValue:Object = null):void
{
- var event:CollectionEvent =
- new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
- event.kind = CollectionEventKind.UPDATE;
+ var event:mx.events.CollectionEvent =
+ new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
+ event.kind = mx.events.CollectionEventKind.UPDATE;
var objEvent:PropertyChangeEvent =
new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
@@ -431,9 +432,9 @@ public class HierarchicalCollectionView extends EventDispatcher
*/
public function refresh():Boolean
{
- var event:CollectionEvent =
- new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
- event.kind = CollectionEventKind.REFRESH;
+ var event:mx.events.CollectionEvent =
+ new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
+ event.kind = mx.events.CollectionEventKind.REFRESH;
dispatchEvent(event);
return true;
@@ -451,7 +452,7 @@ public class HierarchicalCollectionView extends EventDispatcher
{
if (oldChildren != null)
{
- oldChildren.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
+ oldChildren.removeEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
}
if (children)
@@ -459,7 +460,7 @@ public class HierarchicalCollectionView extends EventDispatcher
/*
children.addEventListener(CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler, false, 0, true);*/
- children.addEventListener(CollectionEvent.COLLECTION_CHANGE,
+ children.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
childrenMap.put(node, children);
}
@@ -573,7 +574,7 @@ public class HierarchicalCollectionView extends EventDispatcher
/**
* @private
*/
- public function collectionChangeHandler(event:CollectionEvent):void
+ public function collectionChangeHandler(event:mx.events.CollectionEvent):void
{
var i:int;
var n:int;
@@ -583,21 +584,21 @@ public class HierarchicalCollectionView extends EventDispatcher
var node:Object;
var items:Array;
- var convertedEvent:CollectionEvent;
+ var convertedEvent:mx.events.CollectionEvent;
- if (event is CollectionEvent)
+ if (event is mx.events.CollectionEvent)
{
- var ce:CollectionEvent = CollectionEvent(event);
+ var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
if (ce.kind == CollectionEventKind.RESET)
{
updateLength();
dispatchEvent(event);
}
- else if (ce.kind == CollectionEventKind.ADD)
+ else if (ce.kind == mx.events.CollectionEventKind.ADD)
{
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
@@ -612,11 +613,11 @@ public class HierarchicalCollectionView extends EventDispatcher
currentLength += convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
- else if (ce.kind == CollectionEventKind.REMOVE)
+ else if (ce.kind == mx.events.CollectionEventKind.REMOVE)
{
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
@@ -631,25 +632,25 @@ public class HierarchicalCollectionView extends EventDispatcher
currentLength -= convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
- else if (ce.kind == CollectionEventKind.UPDATE)
+ else if (ce.kind == mx.events.CollectionEventKind.UPDATE)
{
// so far, nobody cares about the details so just
// send it
//updateLength();
dispatchEvent(event);
}
- else if (ce.kind == CollectionEventKind.REPLACE)
+ else if (ce.kind == mx.events.CollectionEventKind.REPLACE)
{
// someday handle case where node is marked as open
// before it becomes the replacement.
// for now, just pass on the data and remove
// old visible rows
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
- CollectionEventKind.REMOVE);
+ mx.events.CollectionEventKind.REMOVE);
for (i = 0; i < n; i++)
{
@@ -682,7 +683,7 @@ public class HierarchicalCollectionView extends EventDispatcher
/**
* @private
*/
- public function nestedCollectionChangeHandler(event:CollectionEvent):void
+ public function nestedCollectionChangeHandler(event:mx.events.CollectionEvent):void
{
var i:int;
var n:int;
@@ -691,16 +692,16 @@ public class HierarchicalCollectionView extends EventDispatcher
var parent:Object;
var node:Object;
var items:Array;
- var convertedEvent:CollectionEvent;
+ var convertedEvent:mx.events.CollectionEvent;
- if (event is CollectionEvent)
+ if (event is mx.events.CollectionEvent)
{
- var ce:CollectionEvent = CollectionEvent(event);
- if (ce.kind == CollectionEventKind.EXPAND)
+ var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
+ if (ce.kind == mx.events.CollectionEventKind.EXPAND)
{
event.stopImmediatePropagation();
}
- else if (ce.kind == CollectionEventKind.ADD)
+ else if (ce.kind == mx.events.CollectionEventKind.ADD)
{
// optimize someday. We do a full tree walk so we can
// not only count how many but find the parents of the
@@ -709,8 +710,8 @@ public class HierarchicalCollectionView extends EventDispatcher
// don't have a good way to get the parents.
updateLength();
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
@@ -726,11 +727,11 @@ public class HierarchicalCollectionView extends EventDispatcher
convertedEvent.location = getVisibleLocationInSubCollection(parent, ce.location);
dispatchEvent(convertedEvent);
}
- else if (ce.kind == CollectionEventKind.REMOVE)
+ else if (ce.kind == mx.events.CollectionEventKind.REMOVE)
{
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
@@ -747,24 +748,24 @@ public class HierarchicalCollectionView extends EventDispatcher
currentLength -= convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
- else if (ce.kind == CollectionEventKind.UPDATE)
+ else if (ce.kind == mx.events.CollectionEventKind.UPDATE)
{
// so far, nobody cares about the details so just
// send it
dispatchEvent(event);
}
- else if (ce.kind == CollectionEventKind.REPLACE)
+ else if (ce.kind == mx.events.CollectionEventKind.REPLACE)
{
// someday handle case where node is marked as open
// before it becomes the replacement.
// for now, just pass on the data and remove
// old visible rows
n = ce.items.length;
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
- CollectionEventKind.REMOVE);
+ mx.events.CollectionEventKind.REMOVE);
for (i = 0; i < n; i++)
{
@@ -793,7 +794,7 @@ public class HierarchicalCollectionView extends EventDispatcher
}
dispatchEvent(event);
}
- else if (ce.kind == CollectionEventKind.RESET)
+ else if (ce.kind == mx.events.CollectionEventKind.RESET)
{
// removeAll() sends a RESET.
// when we get a reset we don't know what went away
@@ -801,11 +802,11 @@ public class HierarchicalCollectionView extends EventDispatcher
// we just fake a refresh as if there was a filter
// applied that filtered out whatever went away
updateLength();
- convertedEvent = new CollectionEvent(
- CollectionEvent.COLLECTION_CHANGE,
+ convertedEvent = new mx.events.CollectionEvent(
+ mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
- CollectionEventKind.REFRESH);
+ mx.events.CollectionEventKind.REFRESH);
dispatchEvent(convertedEvent);
}
}
@@ -833,7 +834,7 @@ public class HierarchicalCollectionView extends EventDispatcher
var newValue:Object;
var children:XMLListCollection;
var location:int;
- var event:CollectionEvent;
+ var event:mx.events.CollectionEvent;
var list:XMLListAdapter;
// trace("currentTarget", currentTarget.toXMLString());
@@ -896,8 +897,8 @@ public class HierarchicalCollectionView extends EventDispatcher
// now we fake an event on behalf of the
// child collection
location = value.childIndex();
- event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
- event.kind = CollectionEventKind.ADD;
+ event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
+ event.kind = mx.events.CollectionEventKind.ADD;
event.location = location;
event.items = [ value ];
children.dispatchEvent(event);
@@ -968,17 +969,17 @@ public class HierarchicalCollectionView extends EventDispatcher
if (!children)
{
// last item got removed so there's no child collection
- oldChildren.addEventListener(CollectionEvent.COLLECTION_CHANGE,
+ oldChildren.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
//oldChildren.addEventListener(CollectionEvent.COLLECTION_CHANGE,
// nestedCollectionChangeHandler, false, 0, true);
- event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
- event.kind = CollectionEventKind.REMOVE;
+ event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
+ event.kind = mx.events.CollectionEventKind.REMOVE;
event.location = 0;
event.items = [ value ];
oldChildren.dispatchEvent(event);
- oldChildren.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
+ oldChildren.removeEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
}
@@ -990,8 +991,8 @@ public class HierarchicalCollectionView extends EventDispatcher
{
if (xmllist[i] === value)
{
- event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
- event.kind = CollectionEventKind.REMOVE;
+ event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
+ event.kind = mx.events.CollectionEventKind.REMOVE;
event.location = location;
event.items = [ value ];
children.dispatchEvent(event);
@@ -1043,12 +1044,12 @@ public class HierarchicalCollectionView extends EventDispatcher
/**
* @private
*/
- public function expandEventHandler(event:CollectionEvent):void
+ public function expandEventHandler(event:mx.events.CollectionEvent):void
{
- if (event is CollectionEvent)
+ if (event is mx.events.CollectionEvent)
{
- var ce:CollectionEvent = CollectionEvent(event);
- if (ce.kind == CollectionEventKind.EXPAND)
+ var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
+ if (ce.kind == mx.events.CollectionEventKind.EXPAND)
{
event.stopImmediatePropagation();
updateLength();
@@ -1120,6 +1121,41 @@ public class HierarchicalCollectionView extends EventDispatcher
return dataDescriptor.hasChildren(node, treeData)
}
+ public function openNode(node:Object):void
+ {
+ var uid:String = itemToUID(node);
+ openNodes[uid] = 1;
+ var index:int = getItemIndex(node);
+ dispatchAddOrRemoveEvents(node, index + 1, org.apache.royale.events.CollectionEvent.ITEM_ADDED);
+ }
+
+ private function dispatchAddOrRemoveEvents(node:Object, index:int, type:String):int
+ {
+ var children:ICollectionView = getChildren(node);
+ var cursor:IViewCursor = children.createCursor();
+ do
+ {
+ var item:Object = cursor.current;
+ var collectionEvent:org.apache.royale.events.CollectionEvent = new org.apache.royale.events.CollectionEvent(type);
+ collectionEvent.item = item;
+ collectionEvent.index = index++;
+ dispatchEvent(collectionEvent);
+ if (isOpen(item))
+ {
+ index = dispatchAddOrRemoveEvents(node, index, type);
+ }
+
+ } while (cursor.moveNext());
+ return index;
+ }
+
+ public function closeNode(node:Object):void
+ {
+ var uid:String = itemToUID(node);
+ delete openNodes[uid];
+ var index:int = getItemIndex(node);
+ dispatchAddOrRemoveEvents(node, index + 1, org.apache.royale.events.CollectionEvent.ITEM_REMOVED);
+ }
}
}
[royale-asjs] 09/09: allow for TitleBar substitution
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit d6b10e0290b299cf7a73a5cbaf3f50073f73db92
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 10:44:57 2018 -0700
allow for TitleBar substitution
---
.../org/apache/royale/html/beads/PanelView.as | 8 ++--
.../html/supportClasses/AccordionItemRenderer.as | 2 +-
.../MXRoyale/src/main/resources/defaults.css | 14 +++++-
.../src/main/resources/mx-royale-manifest.xml | 2 +
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 1 +
.../src/main/royale/mx/containers/PanelTitleBar.as | 56 ++++++++++++++++++++++
.../main/royale/mx/containers/beads/PanelView.as | 3 ++
7 files changed, 79 insertions(+), 7 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
index ed26d4d..f419f5a 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
@@ -38,7 +38,7 @@ package org.apache.royale.html.beads
import org.apache.royale.geom.Size;
import org.apache.royale.html.Container;
import org.apache.royale.html.Group;
- import org.apache.royale.html.TitleBar;
+ import org.apache.royale.html.TitleBar;
import org.apache.royale.html.beads.layouts.VerticalFlexLayout;
import org.apache.royale.html.supportClasses.PanelLayoutProxy;
import org.apache.royale.utils.CSSUtils;
@@ -73,7 +73,7 @@ package org.apache.royale.html.beads
super();
}
- private var _titleBar:TitleBar;
+ private var _titleBar:UIBase;
/**
* The org.apache.royale.html.TitleBar component of the
@@ -84,7 +84,7 @@ package org.apache.royale.html.beads
* @playerversion AIR 2.6
* @productversion Royale 0.9
*/
- public function get titleBar():TitleBar
+ public function get titleBar():UIBase
{
return _titleBar;
}
@@ -92,7 +92,7 @@ package org.apache.royale.html.beads
/**
* @private
*/
- public function set titleBar(value:TitleBar):void
+ public function set titleBar(value:UIBase):void
{
_titleBar = value;
}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AccordionItemRenderer.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AccordionItemRenderer.as
index 7f3d25f..b731fa5 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AccordionItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AccordionItemRenderer.as
@@ -141,7 +141,7 @@ package org.apache.royale.html.supportClasses
public function get titleBar():TitleBar
{
- return (getBeadByType(PanelView) as PanelView).titleBar;
+ return (getBeadByType(PanelView) as PanelView).titleBar as TitleBar;
}
public function get collapsedHeight():Number
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index bd55f7b..cef992c 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -216,9 +216,19 @@ Panel .TitleBar
background-color: #FFFFFF;
}
-Basic|TitleBar
+PanelTitleBar
{
- font-weight: bold;
+ IBeadModel: ClassReference("org.apache.royale.html.beads.models.TitleBarModel");
+ IBeadView: ClassReference("org.apache.royale.html.beads.TitleBarView");
+ IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.FlexibleFirstChildHorizontalLayout");
+ iMeasurementBead: ClassReference("org.apache.royale.html.beads.TitleBarMeasurementBead");
+ background-color: #E2E2E2;
+ padding: 2px;
+ height: 30px;
+ flex-grow: 0;
+ min-height: 30px;
+ font-weight: bold;
+ border-bottom: 1px solid #333333;
}
Tree
diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index 05250f6..9ef43cc 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -147,5 +147,7 @@
<component id="AdvancedDataGrid" class="mx.controls.AdvancedDataGrid" />
<component id="MenuBarMouseController" class="mx.controls.beads.controllers.MenuBarMouseController" />
<component id="RichTextEditor" class="mx.controls.RichTextEditor" />
+ <component id="PanelTitleBar" class="mx.containers.PanelTitleBar" />
+
</componentPackage>
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 398034e..44f2ba3 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -157,6 +157,7 @@ internal class MXRoyaleClasses
import mx.controls.dateFieldClasses.DateFieldDateChooser; DateFieldDateChooser;
import mx.controls.beads.controllers.MenuBarMouseController;
+ import mx.containers.PanelTitleBar; PanelTitleBar;
import mx.containers.beads.PanelView; PanelView;
import mx.containers.beads.models.PanelModel; PanelModel;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/PanelTitleBar.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/PanelTitleBar.as
new file mode 100644
index 0000000..9440f39
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/PanelTitleBar.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.containers
+{
+COMPILE::JS
+{
+ import goog.DEBUG;
+}
+
+import mx.core.UIComponent;
+
+/**
+ * @private
+ * The PanelView for emulation.
+ */
+public class PanelTitleBar extends UIComponent
+{
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function PanelTitleBar()
+ {
+ super();
+ typeNames += " PanelTitleBar";
+ }
+}
+
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
index c86ff27..75393d8 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/PanelView.as
@@ -21,6 +21,8 @@ package mx.containers.beads
{
import mx.containers.BoxDirection;
+import mx.containers.Panel;
+import mx.containers.PanelTitleBar;
import mx.containers.beads.BoxLayout;
import mx.containers.beads.CanvasLayout;
import mx.containers.beads.models.PanelModel;
@@ -63,6 +65,7 @@ public class PanelView extends org.apache.royale.html.beads.PanelView
*/
override public function set strand(value:IStrand):void
{
+ titleBar = new PanelTitleBar();
super.strand = value;
var model:PanelModel = (value as UIBase).model as PanelModel;
var _layout:String = model.layout;
[royale-asjs] 07/09: SWF code could presume that all collections
supported Proxy and handle [] access,
but JS code can't so we must use the collection APIs
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit d364682c5ecf5b082de49ab3c65cc1a2c5066a70
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 09:48:15 2018 -0700
SWF code could presume that all collections supported Proxy and handle [] access, but JS code can't so we must use the collection APIs
---
.../controls/treeClasses/HierarchicalViewCursor.as | 54 ++++++++++++++++------
1 file changed, 39 insertions(+), 15 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalViewCursor.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalViewCursor.as
index fea9433..b89c206 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalViewCursor.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalViewCursor.as
@@ -20,13 +20,13 @@
package mx.controls.treeClasses
{
- import org.apache.royale.events.EventDispatcher;
-
import mx.collections.CursorBookmark;
import mx.collections.ICollectionView;
import mx.collections.IViewCursor;
import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
+
+ import org.apache.royale.events.EventDispatcher;
[ExcludeClass]
@@ -312,7 +312,8 @@ public class HierarchicalViewCursor extends EventDispatcher
var n:int;
var i:int;
var childNodes:ICollectionView;
- var sameParent:Object;
+ var cursor:IViewCursor;
+ var sameParent:Object;
var nodeParents:Array = getParentStack(node);
var curParents:Array = getParentStack(currentNode);
@@ -343,16 +344,17 @@ public class HierarchicalViewCursor extends EventDispatcher
childNodes = model;
}
// Walk it until you hit one or the other.
- n = childNodes.length;
+ cursor = childNodes.createCursor();
+ do
{
- var child:Object = childNodes[i];
+ var child:Object = cursor.current;
if (child == curParent)
return false;
if (child == nodeParent)
return true;
- }
+ } while (cursor.moveNext());
}
}
@@ -364,17 +366,18 @@ public class HierarchicalViewCursor extends EventDispatcher
// If we get here, they have the same parentage or one or both
// had a root parent. Who's first?
childNodes = model;
- n = childNodes.length;
- for (i = 0; i < n; i++)
+ cursor = childNodes.createCursor();
+ do
{
- child = childNodes[i];
+ child = cursor.current;
if (child == currentNode)
return false;
if (child == node)
return true;
- }
+ } while (cursor.moveNext());
+
return false;
}
@@ -471,7 +474,7 @@ public class HierarchicalViewCursor extends EventDispatcher
dataDescriptor.hasChildren(currentNode, model))
{
var previousChildNodes:Object = childNodes;
- childNodes = dataDescriptor.getChildren(currentNode, model);
+ childNodes = arrayLike(dataDescriptor.getChildren(currentNode, model));
if (childNodes.length > 0)
{
childIndexStack.push(currentChildIndex);
@@ -514,7 +517,7 @@ public class HierarchicalViewCursor extends EventDispatcher
dataDescriptor.isBranch(grandParent, model) &&
dataDescriptor.hasChildren(grandParent, model))
{
- childNodes = dataDescriptor.getChildren(grandParent, model);
+ childNodes = arrayLike(dataDescriptor.getChildren(grandParent, model));
}
else
{
@@ -595,7 +598,7 @@ public class HierarchicalViewCursor extends EventDispatcher
dataDescriptor.isBranch(grandParent, model) &&
dataDescriptor.hasChildren(grandParent, model))
{
- childNodes = dataDescriptor.getChildren(grandParent, model);
+ childNodes = arrayLike(dataDescriptor.getChildren(grandParent, model));
}
else
{
@@ -647,7 +650,7 @@ public class HierarchicalViewCursor extends EventDispatcher
dataDescriptor.hasChildren(currentNode, model))
{
var previousChildNodes:Object = childNodes;
- childNodes = dataDescriptor.getChildren(currentNode, model);
+ childNodes = arrayLike(dataDescriptor.getChildren(currentNode, model));
if (childNodes.length > 0)
{
childIndexStack.push(currentChildIndex);
@@ -810,7 +813,7 @@ public class HierarchicalViewCursor extends EventDispatcher
dataDescriptor.hasChildren(currentNode, model))
{
var previousChildNodes:Object = childNodes;
- childNodes = dataDescriptor.getChildren(currentNode, model);
+ childNodes = arrayLike(dataDescriptor.getChildren(currentNode, model));
if (childNodes != null && childNodes.length > 0)
{
parentNodes.push(currentNode);
@@ -977,6 +980,27 @@ public class HierarchicalViewCursor extends EventDispatcher
}
}
+
+ private function arrayLike(collection:ICollectionView):Object
+ {
+ // for SWF, we assume all collections implement Proxy and
+ // [] lookups will work.
+ COMPILE::SWF
+ {
+ return collection;
+ }
+ // for JS, the runtime can't know how to interpret [] lookups
+ // so we generate an array.
+ COMPILE::JS
+ {
+ var output:Array = [];
+ var cursor:IViewCursor = collection.createCursor();
+ do {
+ output.push(cursor.current);
+ } while (cursor.moveNext());
+ return output;
+ }
+ }
}
}
[royale-asjs] 02/09: add more APIs
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit f30fba39981fe0f9e3d6fca32ee7469df2156b96
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Aug 9 17:06:44 2018 -0700
add more APIs
---
.../src/main/royale/org/apache/royale/collections/ITreeData.as | 2 ++
1 file changed, 2 insertions(+)
diff --git a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ITreeData.as b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ITreeData.as
index bcb777f..444731e 100644
--- a/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ITreeData.as
+++ b/frameworks/projects/Collections/src/main/royale/org/apache/royale/collections/ITreeData.as
@@ -32,5 +32,7 @@ package org.apache.royale.collections
function getDepth(node:Object):int;
function isOpen(node:Object):Boolean;
function hasChildren(node:Object):Boolean;
+ function openNode(node:Object):void;
+ function closeNode(node:Object):void;
}
}
[royale-asjs] 03/09: use interface
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit cbc910d02d26a6207acfa11e80360ed3dad20421
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Aug 9 17:06:58 2018 -0700
use interface
---
.../html/beads/controllers/TreeSingleSelectionMouseController.as | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/TreeSingleSelectionMouseController.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/TreeSingleSelectionMouseController.as
index d5d03ce..8266166 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/TreeSingleSelectionMouseController.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/TreeSingleSelectionMouseController.as
@@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.html.beads.controllers
{
- import org.apache.royale.collections.TreeData;
+ import org.apache.royale.collections.ITreeData;
import org.apache.royale.core.IStrand;
import org.apache.royale.events.Event;
import org.apache.royale.events.IEventDispatcher;
@@ -66,15 +66,11 @@ package org.apache.royale.html.beads.controllers
*/
override protected function selectedHandler(event:ItemClickedEvent):void
{
- var treeData:TreeData = listModel.dataProvider as TreeData;
+ var treeData:ITreeData = listModel.dataProvider as ITreeData;
if (treeData == null) return;
var node:Object = event.data;
- // clear any previous selections
- listModel.selectedIndex = -1;
- IEventDispatcher(_strand).dispatchEvent(new Event("change"));
-
if (treeData.isOpen(node)) {
treeData.closeNode(node);
} else {
[royale-asjs] 04/09: don't set dimensions if we don't need to
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit ff7c97def5b2deeac53010c1bd2ad6b87d77ac73
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 00:05:18 2018 -0700
don't set dimensions if we don't need to
---
.../MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
index bce2787..0c2f6a9 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
@@ -198,10 +198,14 @@ package mx.containers.beads
updateDisplayList(target.width, target.height);
// update the target's actual size if needed.
- if (target.isWidthSizedToContent() || target.isHeightSizedToContent()) {
+ if (target.isWidthSizedToContent() && target.isHeightSizedToContent()) {
target.setActualSize(target.getExplicitOrMeasuredWidth(),
target.getExplicitOrMeasuredHeight());
}
+ else if (target.isWidthSizedToContent())
+ target.setWidth(target.getExplicitOrMeasuredWidth());
+ else if (target.isHeightSizedToContent())
+ target.setHeight(target.getExplicitOrMeasuredHeight());
return true;
}