What I've come up with as a solution is that I decided to use the
IStyleManager2 of the Main RSLs loader SWF which has all the class selectors
for the skins.
I've changed the code for the [ExtensionPoint] class as follow:
public function instanciateExtensionUnits():void{
if (container){
for each(var extensionUnit:ExtensionUnit in
extensionUnits){
if (!extensionUnit.instance){
var uiElement:UIComponent =
extensionUnit.newInstance();
var className:String =
getQualifiedClassName(extensionUnit.infos.type.clazz).replace("::", ".");
var
skinStyle:CSSStyleDeclaration =
styleManager.getMergedStyleDeclaration(className);
if (!skinStyle){
className =
getQualifiedSuperclassName(extensionUnit.infos.type.clazz).replace("::", ".");
skinStyle =
styleManager.getMergedStyleDeclaration(className);
}
if (skinStyle){
if
(uiElement.getStyle("skinClass") == null){
var
inheritedStyleClass:Class = skinStyle.getStyle("skinClass") as Class;
uiElement.setStyle("skinClass", inheritedStyleClass);
}
if (container is
IVisualElementContainer)
IVisualElementContainer(container).addElement(uiElement);
else
container.addChild(uiElement);
}
}
}
}
}
So I'm handling manually the skin of the first object and it is shown as it is
supposed to but the second problem that I have is the Popup that is created by
that button is missing it own skinClass and the background of the
[TitleWindows] is black. How can I make it that everything is handled
automatically?
Screenshot link : https://pasteboard.co/ICLWnzG.png
19.10.2019, 20:42, "Ramazan Ergüder Bekrek" <[email protected]>:
> Greetings to all again!
>
> I'm developing something similar to Eclipse Extension Points with Annotations
> [ExtensionPoint] and [Extension] for dynamic
> sparks and mx control injection at runtime. The whole thing is running inside
> of an OSGi framework built with AS3 and the problem that I'm having is
> concerning
> the keep-all-type-selectors=true which is not working. Let me explain the
> structure.
>
> The UI is loading different Modules as the container for "Toolbar",
> "Timeline", "PropertiesWindow", which are all independant <s:Module> handled
> by the OSGi runtime.
> The runtime creates for each bundle their own ApplicationDomain.
>
> I created another bundle which is an Actionscript project which check at
> runtime in each bundles in the OSGi framework if there is any class
> containing the
> [ExtensionPoint] and [Extension] metadata. If it finds something then they
> are gathered and built in Parent/Children relationship.
>
> This [ExtensionPointsManager] (in its own ApplicationDomain) is also scouting
> the Stage.ADDED event to check when ever a UIComponent which has
> [ExtensionPoint] is added.
>
> [ExtensionPointManager class]
>
> private function scoutAllExtensionUnitsByBundle(bundle:IBundle):void{
>
> var applicationDomain:ApplicationDomain =
> ApplicationDomain(Object(bundle).applicationDomain);
> var domainClasses:Vector.<String> =
> applicationDomain.getQualifiedDefinitionNames();
> for each(var className:String in domainClasses){
> try{
> var infosExtensionUnit:ExtensionInfos
> = infosExtensionUnitFromClassName(className);
> var extensionPoint:ExtensionPoint =
> getExtensionPointByName(infosExtensionUnit.name);
> if (extensionPoint &&
> infosExtensionUnit)
> var parented:Boolean =
> addExtensionUnitFromClass(infosExtensionUnit.type.clazz);
> if (!parented)
>
> unparentedExtensionUnits.push(new ExtensionUnit(null, infosExtensionUnit));
> }catch(e:Error){
> trace(e.message);
> }
> }
> try{
> extensionPoint.instanciateExtensionUnits();
> }catch(e:Error){
> }
> }
>
> [ExtensionPoint class]
>
> public function instanciateExtensionUnits():void{
> if (container){
> for each(var extensionUnit:ExtensionUnit in
> extensionUnits){
> if (!extensionUnit.instance){
> var uiElement:UIComponent =
> extensionUnit.newInstance();
> if (container is
> IVisualElementContainer)
>
> IVisualElementContainer(container).addElement(uiElement);
> else
>
> container.addChild(uiElement);
> }
> }
> }
> }
>
> My problem is that I have a bundle which contains an <s:Button> (contains
> [Extension(target="toolbar")] metadata)with an icons that I would like to be
> automatically inserted in the "Toolbar" <s:Module> which has the
> [ExtensionPoint(name="toolbar")] metadata. That button in its own code would
> create a PopupManager.createPopup when it is clicked. Right now when that
> button doesn't have the (skinClass="spark.skins.spark.ButtonSkin") property
> it throws an error as follow:
>
> Error: Skin for
> instance1.instance2.instance18.instance19.instance20.rsls_loader0.ApplicationSkin2.containerGrp.contentGroup.SharedUIService6.instance167.UIServiceProxy8.MultiversesMainUI7.SkinnableContainerSkin9.contentGroup.toolbar.instance234.UIServiceProxy59.MultiversesMenuRoot58.SkinnableContainerSkin60.contentGroup.PluginsSettingsButton74
> cannot be found.
>
> So the "Toolbar" <s:Module> I've compiled with keep-all-type-selectors=true
> seems to not recognize the (SkinClasses).
>
> Right now I don't understand why
> IVisualElementContainer(container).addElement(uiElement) always throws this
> big line of exception...
>
> When I add the (skinClass="spark.skins.spark.ButtonSkin") to that button and
> recompile then its get added in the "toolbar" but another problem happens
> when I click the button:
>
> Error: Skin for
> instance1.instance2.instance18.instance19.instance20.PluginsSettingsView92.ResizableTitleWindowSkin93._ResizableTitleWindowSkin_Group1.contents.contentGroup.parentDivider.pluginsCategories
> cannot be found.
>
> How do I fix this problem?
>
> Best regards
>
> Ergü