On Fri, Nov 9, 2018 at 12:29 PM Vincent Massol <[email protected]> wrote:
> Hi, > > > On 9 Nov 2018, at 11:20, Marius Dumitru Florea < > [email protected]> wrote: > > > > On Wed, Nov 7, 2018 at 5:34 PM Adel Atallah <[email protected]> > wrote: > > > >> Hello everyone, > >> > >> So what we thought about with Vincent for implementing the "concept of > >> aliases or groups" would be to actually have two new annotations that > >> we would use on macro properties. > >> The first one is a "Group" annotation which is meant to indicate that > >> some properties are part of the same group, obviously. > >> The second is an "Alternative" annotation which is meant to indicate > >> that only one property / group of properties can be used (among the > >> ones that are part of the alternative). > >> Here is an example: > >> We want for the Include macro to be able to specify either: > >> the "reference" and "type" parameters > >> or > >> the "page" parameter > >> For that, we will change the IncludeMacroParameters java class like > this: > >> > >> @Alternative("reference") > >> @Group("entityReference") > >> public void setReference(String reference) > >> > >> @Alternative("reference") > >> @Group("entityReference") > >> public void setType(EntityType type) > >> > >> @Alternative("reference") > >> public void setPage(String page) > >> > >> In the WYSIWYG side, we will only be able to specify either the > >> "reference" and the "type" or the "page" parameter. > >> > > > > I think it would make more sense, at least in this case, to have the > > alternative as an attribute of the group, because semantically the > > "entityReference" group is an alternative to the page parameter. You > can't > > say that the type parameter alone is an alternative to the page > parameter. > > > > The @Group annotation is clear. No doubt about it. I'm not sure about > > the @Alternative annotation. I'm thinking that the "alternative" is also > a > > group, where only one item from the group can be used, which could be > > expressed with an attribute of the @Group annotation. > > For me the concepts of Groups and Alternatives are separate. For example > you could imagine defining a group of properties so that the WYSIWYG would > display them together, one under another or with some box border around > them. > > > Alternatives don’t need to be on groups. I did not say the alternatives must be **on** groups. I said the alternatives **are** groups. When you have two alternative parameters then those 2 parameters are in an alternative **group**. That's what I said. Whether the groups is used just for display or for enforcing exclusive usage is something that could be expressed using annotation attributes. > You can have alternatives on individual properties or alternatives between > 1 property and a group or alternatives between one group and another. > > Thanks > -Vincent > > [snip] > > >

