I think I fixed ImageViewBase (not tested), here’s what my grep shows after
pulling the changes.
PS C:\dev\flexjs\royale-asjs\frameworks\projects> git grep
"getBeadByType.*I*Model"
Basic/src/main/royale/org/apache/royale/html/beads/AlternatingBackgroundColorSelectableItemRendererBead.as:
owner = (ir.getBeadByType(ItemRendererOwnerViewBead) as
ItemRendererOwnerViewBead).ownerView.host as IStrandWithModel;
Basic/src/main/royale/org/apache/royale/html/beads/DataGridLinesBead.as:
var presentationModel:DataGridPresentationModel =
_strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
Basic/src/main/royale/org/apache/royale/html/beads/HideColorSpectrumThumbWhenEmpty.as:
(_strand.getBeadByType(ISliderView) as
ISliderView).thumb.visible = !isNaN(colorModel.baseColor);
Basic/src/main/royale/org/apache/royale/html/util/getModelByType.as:
return strand.getBeadByType(type) as IBeadModel;
Core/src/main/royale/org/apache/royale/core/TransformBeadBase.as:
return host.getBeadByType(ITransformModel) as ITransformModel;
Core/src/main/royale/org/apache/royale/core/UIButtonBase.as: if
(getBeadByType(IBeadModel) == null)
CreateJS/src/main/royale/org/apache/royale/createjs/core/UIBase.as:
if (getBeadByType(IBeadModel) == null)
GoogleMaps/src/main/royale/org/apache/royale/maps/google/GoogleMap.as:
// var model:IBeadModel = getBeadByType(IBeadModel) as IBeadModel;
GoogleMaps/src/main/royale/org/apache/royale/maps/google/beads/MapView_original.as:
var model:IBeadModel = _strand.getBeadByType(IBeadModel)
as IBeadModel;
GoogleMaps/src/main/royale/org/apache/royale/maps/google/beads/MapView_original.as:
var model:MapModel =
_strand.getBeadByType(IBeadModel) as MapModel;
GoogleMaps/src/main/royale/org/apache/royale/maps/google/beads/MapView_original.as:
var model:MapModel =
_strand.getBeadByType(IBeadModel) as MapModel;
GoogleMaps/src/main/royale/org/apache/royale/maps/google/beads/MapView_original.as:
var model:MapModel = _strand.getBeadByType(IBeadModel) as
MapModel;
GoogleMaps/src/main/royale/org/apache/royale/maps/google/beads/MapView_original.as:
var model:MapModel = _strand.getBeadByType(IBeadModel) as
MapModel;
Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DropDownListController.as:
// var selectionModel:ISelectionModel =
_strand.getBeadByType(ISelectionModel) as ISelectionModel;
Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DropDownListController.as:
// var selectionModel:ISelectionModel =
_strand.getBeadByType(ISelectionModel) as ISelectionModel;
Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as:
// dataProviderModel = host.getBeadByType(IDataProviderModel) as
IDataProviderModel;
Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as:
// listModel = value.getBeadByType(ISelectionModel) as
ISelectionModel;
Jewel/src/main/royale/org/apache/royale/jewel/beads/views/VirtualListView.as:
// var pm:IListPresentationModel =
_strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
MXRoyale/src/main/royale/mx/controls/beads/DataGridLinesBeadForICollectionView.as:
var presentationModel:DataGridPresentationModel =
_strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
MXRoyale/src/main/royale/mx/controls/beads/layouts/DataGridLayout.as: //
var bbmodel:ButtonBarModel = header.getBeadByType(ButtonBarModel) as
ButtonBarModel;
MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/TabsItemRendererFactoryForArrayData.as:
var presentationModel:IListPresentationModel =
_strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/TabsItemRendererInitializer.as:
var presentationModel:IListPresentationModel =
_strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
SparkRoyale/src/main/royale/spark/components/DataGroup.as: var
presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as
IListPresentationModel;
SparkRoyale/src/main/royale/spark/components/SkinnableDataContainer.as:
var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as
IListPresentationModel;
From: Yishay Weiss<mailto:[email protected]>
Sent: Monday, January 3, 2022 1:33 PM
To: [email protected]<mailto:[email protected]>
Subject: RE: Bead optimizations
This breaks some SDK code. Our client is complaining about ImageViewBase.strand
not letting the app run.
Did you scan for occurences of getBeadByType(IBeadModel) in the SDK?
From: Harbs<mailto:[email protected]>
Sent: Monday, January 3, 2022 1:15 PM
To: [email protected]<mailto:[email protected]>
Subject: Bead optimizations
I committed some changes to when/how bead lookups work to improve performance.
Here’s the details:
For the most part, not much has changed from a use-perspective. The only caveat
is when it comes to models. We had a type check **every** time a bead was added
to check if it was a model bead and we always tried to load a model bead
whether it’s needed or not. Needless to say this wasn’t very PAYG. I changed
models to only be loaded the first time it was actually requested. Since models
don’t actually dispatch events when loaded this is not a problem. The only
issue comes up if you use strand.getBeadByType(IBeadModel). This will fail
because the model was not added yet. strand.getBeadByType(IBeadModel) is
actually not a great way to get a model int he first place because you’re
looping through the beads to find the model every time you access it. Since we
have a model getter, that’s a much better way to get the model. And with the
new change, it’s kind of necessary to do it that way because the getter will
load the model if it wasn’t yet loaded.
Sometimes components have more than one model. In that case there’s “the” model
and other models which is not the main one. It might not be clear to the user
which is the main model. To solve that issue, there’s now
getModelByType(strand,type) which returns the model and makjes sure it’s
initialized if it’s the right type. Otherwise it will find the correct bead and
return that. When in doubt, always use this function instead of
strand.getBeadByType.
Views, Controllers and Layouts had a similar issue to models. Not all
components need a view or a controller or a layout. There’s now a function
needsView() and needsController() in UIBase. It defaults to true for now
because I didn’t want to break things, but subclasses can override and change
it to false. This will prevent the view and controller from being loaded. This
improves performance on those components. The HTML component set all has this
set to false.
Similarly, GroupBase now has needsLayout() which also defaults to true and can
likewise be overridden to return false. Likewise, the HTML component set sets
this to false.
HTH,
Harbs