royale-compiler icon indicating copy to clipboard operation
royale-compiler copied to clipboard

itemRenderer can't be specified mxml class definition

Open yishayw opened this issue 5 years ago • 12 comments

This works:

<local:RequestList id="requestList" itemRenderer="dashboard.view.royale.UserItemRenderer" height="100%"/>

But this doen't (in RequestList.mxml)

<j:List xmlns:fx="http://ns.adobe.com/mxml/2009"
        itemRenderer="dashboard.view.royale.UserItemRenderer"
        implements="dashboard.core.as3.interfaces.IRequestList"
        xmlns:j="library://ns.apache.org/royale/jewel"
        xmlns:form="forms.view.royale.*"
        xmlns:local="dashboard.view.royale.*"
>

I get a run-time error:

RequestList.js:38 Uncaught TypeError: this.generateMXMLAttributes is not a function at new dashboard.view.royale.RequestList (RequestList.js:38) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLArray (MXMLDataInterpreter.js:124) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLInstances (MXMLDataInterpreter.js:266) at org.apache.royale.jewel.supportClasses.drawer.DrawerContent.org.apache.royale.html.Group.addedToParent (Group.js:76) at org.apache.royale.jewel.Drawer.org.apache.royale.jewel.supportClasses.drawer.DrawerBase.addElement (DrawerBase.js:78) at Function.org.apache.royale.utils.MXMLDataInterpreter.initializeStrandBasedObject (MXMLDataInterpreter.js:236) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLArray (MXMLDataInterpreter.js:125) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLInstances (MXMLDataInterpreter.js:266) at org.apache.royale.jewel.Drawer.org.apache.royale.html.Group.addedToParent (Group.js:76) at dashboard.view.royale.Dashboard.org.apache.royale.core.UIBase.addElement (UIBase.js:414)

yishayw avatar Feb 07 '19 13:02 yishayw

Wow! How are you recognize that is compiler issue?

piotrzarzycki21 avatar Feb 07 '19 13:02 piotrzarzycki21

I don't think List can be used as a base class for an MXML file. (Whether it should or not is another question...)

Harbs avatar Feb 07 '19 13:02 Harbs

Is it working in Flex?

piotrzarzycki21 avatar Feb 07 '19 13:02 piotrzarzycki21

Yes, but in Flex pretty much anything could be used as a base for an MXML file. In Royale, it's only classes which implement IMXMLDocument.

Harbs avatar Feb 07 '19 13:02 Harbs

Probably the compiler should give an error when a class which is not an IMXMLDocument is used as a base for an MXML file.

Harbs avatar Feb 07 '19 13:02 Harbs

As Harbs says in Flex you can use almost any class as root of an MXML doc. Seems, this is a limitation in Royale over what we had in Flex.

carlosrovira avatar Feb 07 '19 15:02 carlosrovira

It’s working as long as you don’t specify the item renderer there, so I’m not sure using List as a base class is the issue. But I may be wrong about it being a compiler issue. The comments here have prompted me to debug

org.apache.royale.utils. MXMLDataInterpreter.generateMXMLProperties()

I’ll look into it and report…


From: Harbs [email protected] Sent: Thursday, February 7, 2019 3:45:33 PM To: apache/royale-compiler Cc: yishayw; Author Subject: Re: [apache/royale-compiler] itemRenderer can't be specified mxml class definition (#79)

I don't think List can be used as a base class for an MXML file. (Whether it should or not is another question...)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/apache/royale-compiler/issues/79#issuecomment-461424402, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACASfR_W4lGOxu-LOLiHDdGHLdaX1ZH_ks5vLC39gaJpZM4anTD_.

yishayw avatar Feb 11 '19 14:02 yishayw

As Harbs says the problem is that List does not implement IMXMLDocument. I agree the compiler should throw and error when a non-implementer is used as a base class in an mxml document.

yishayw avatar Feb 11 '19 18:02 yishayw

So Royale always need to use something like Group, VGroup and so on as base tag. This means an extra nesting level in both SWF and JS right? We all agree that is right scenario?

carlosrovira avatar Feb 12 '19 11:02 carlosrovira

@carlosrovira not necessary we are using List as root tag and everything is working fine - yeah that's issue, but apart of that we are good.

piotrzarzycki21 avatar Feb 12 '19 12:02 piotrzarzycki21

You can subclass any component and make it implement IMXMLDocument.

I think it's reasonable to do that in the Express and Jewel List components.

Harbs avatar Feb 12 '19 12:02 Harbs

ok, we could consider that in Jewel... thanks

carlosrovira avatar Feb 12 '19 15:02 carlosrovira