Try to view the macro parameters listed as a boolean expression. For the include macro we would have:
(page XOR (reference AND type) XOR document) OR section OR context * the parentheses define the parameter groups * the boolean operators specify the relation between the members of a group We then need to express this using Java annotations. In any case, this is a **tree** structure (not a flat structure). On Fri, Nov 9, 2018 at 12:30 PM Adel Atallah <adel.atal...@xwiki.com> wrote: > On Fri, Nov 9, 2018 at 11:20 AM Marius Dumitru Florea > <mariusdumitru.flo...@xwiki.com> wrote: > > > > On Wed, Nov 7, 2018 at 5:34 PM Adel Atallah <adel.atal...@xwiki.com> > 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. > > Thanks for the suggestion, but how can it be used? If I retake my previous > example, will it be: > > @Group(name = "entityReference", alternative = "reference") > public void setReference(String reference) > > @Group(name = "entityReference", alternative = "reference") > public void setType(EntityType type) > > @Group(name = "page", alternative = "reference") > public void setPage(String page) > > ? > > > > > > > > > > WDYT? > > > > > > Thanks, > > > Adel > > > > > > On Tue, Sep 25, 2018 at 11:51 AM Marius Dumitru Florea > > > <mariusdumitru.flo...@xwiki.com> wrote: > > > > > > > > On Wed, Sep 19, 2018 at 4:31 PM Vincent Massol <vinc...@massol.net> > > > wrote: > > > > > > > > > > > > > > > > > > > > On 19 Sep 2018, at 14:47, Adel Atallah <adel.atal...@xwiki.com> > > > wrote: > > > > > > > > > > > > On Wed, Jul 18, 2018 at 5:00 PM Vincent Massol < > vinc...@massol.net> > > > > > wrote: > > > > > >> > > > > > >> > > > > > >> > > > > > >>> On 5 Jul 2018, at 12:06, Vincent Massol <vinc...@massol.net> > > > wrote: > > > > > >>> > > > > > >>> > > > > > >>> > > > > > >>>> On 4 Jul 2018, at 12:07, Thomas Mortagne < > > > thomas.morta...@xwiki.com> > > > > > wrote: > > > > > >>>> > > > > > >>>> Here are more details on the actual use case we need to > support: > > > > > >>>> > > > > > >>>> In include/Display macro either you set: > > > > > >>>> > > > > > >>>> * "reference" and "type" (which default to DOCUMENT) > > > > > >>>> * or you set “page" > > > > > >>> > > > > > >>> Globally I think we need to add 3 concepts to macro parameter > > > > > descriptor: > > > > > >>> > > > > > >>> 1) The concept of “deprecated” parameter. For example for > > > “document” > > > > > in the include macro. > > > > > >>> 2) The concept of aliases or groups, i.e the ability to list > > > > > parameters that are mutually exclusive. Example: reference + type > vs > > > page > > > > > for display/include macros. This would mean that in the Macro > Dialog > > > UI if > > > > > you select one of those the other gets unselected/cleared out (you > > > cannot > > > > > have mutually exclusive params have values). > > > > > >>> 3) The concept of Advanced parameters. For example, we should > put > > > > > reference + type as advanced parameters so that they are not shown > to > > > the > > > > > user by default (and so that the page parameter is more > highlighted). > > > Users > > > > > would need to click on Advanced to see advanced parameters. I think > > > we’re > > > > > doing something automatic today (I don’t remember the details) to > try > > > to > > > > > hide some parameters but we should probably review this. > > > > > >>> > > > > > >>> WDYT? > > > > > >> > > > > > >> Ping! > > > > > >> > > > > > >> Do we agree about this? If we do we can then create jira issue > > > about it > > > > > and take it for implementation. > > > > > > > > > > > > +1, I can create the jira issue if it's ok. > > > > > > > > > > Please do :) > > > > > > > > > > > > > > > > > > > @Marius: Ok for you? > > > > > > > > > > > > > Yes. > > > > > > > > > > > > > > > > > > thanks > > > > > -Vincent > > > > > > > > > > [snip] > > > > > > > > > > > > > > > > > > >