Hi, let's see if someone can help me or give me some clue to follow.
In the application in which I am working there are many maintenance, mvc, whose
management is identical. We have created a component SectionContent,
ModuleSectionContent.as, with the idea of encapsulating in it all the
processes and / or common components (navigation between the records, detail
view-list view, toolbars according to the edition status, ...). In this
template, for example, we add a header (mxml component) as a "Toolbar" that, as
you can imagine, will need a bindable reference to the "model" that is assigned
to the component and, at this point, is WHERE I NEED HELP: I can't make the
automatic binding of the model work, from the main view to the header.
(Everything works perfectly if I create a set in the template and hence a call
to the bindable set of the header subcomponent)
We use crux and all the models implement the same interface, IModelArqManager;
currently this is the implementation:
Component “ModuleSectionContent.as” (Template)
[Bindable]
public class ModuleSectionContent extends SectionContent
{
…
public var header:HeaderModule = new HeaderModule();
…
public function set isOnAddingMode(value:Boolean):void { header.isOnAddingMode
= value; }
…
Componente “HeaderModule.mxml” (var header)
<?xml version="1.0" encoding="utf-8"?>
<j:Grid
xmlns:fx=http://ns.adobe.com/mxml/2009
…
private var _isOnAddingMode:Boolean;
[Bindable]
public function get isOnAddingMode():Boolean{ return _isOnAddingMode;}
public function set isOnAddingMode(value:Boolean):void{ _isOnAddingMode =
value;}
…
<j:IconButton localId="tbProc" unboxed="true" emphasis="emphasized">
<j:icon>
<js:FontAwesomeIcon text="{(isOnAddingMode) ?
FontAwesome5IconType.PLUS_CIRCLE : 'edit'}"
relativeSize="{FontAwesomeIcon.SIZE_LG}"
faStyle="{FontAwesomeIcon.DUOTONE}" />
</j:icon>
</j:IconButton >
…
Implementation, example, CustomerView.mxml:
<?xml version="1.0" encoding="utf-8"?>
<views:ModuleSectionContent
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
…
isOnAddingMode="{customerModel.currentState == UtilConstants.STATE_ADDING}"
>
<fx:Script>
<![CDATA[
…
[Bindable]
[Inject(source="customerModel", required="true")]
public var customerModel:CustomerModel; //Implement IModelArqManager
…
What I am trying to do is remove the "set isOnAddingMode" function from the
ModuleSectionContent.as template, and the setters mapped in the
CustomerView.mxml tag (we have about 20-25 binda variables similar to
isOnAddingMode)
Can be done?
I have had relative success injecting the customerModel as an interface but
binding is not working for me.
Any suggestion?
Thx.
Hiedra.