Hi,

For some macros, the parameter situation can become very complex. The chart macro is the obvious example, where several different aspects can be independently configured.

I will therefore propose adding support for namespaces in macro parameters.

This example illustrates the idea:

public class ChartMacroParameters
{

    private String title;

    private DatasetType datasetType;

    private DatasourceType datasourceType;

    private LocaleConfiguration locale;

    private AxisConfiguration domainAxis;

    private AxisConfiguration rangeAxis;

    private DatasetConfiguration dataset;

    private DataSourceConfiguration datasource;
}

{{chart datasourceType="xdom_table"
        datasetType="timetable_xy"
        domainAxis:type="date"
        locale:timeformat="yyyy"
        datasource:range="A1-B."}}

I have already implemented a bean manager for this and can commit it if this proposal is accepted. But maybe we want the name space support already in the default bean manager?

I'm also thinking that the bean manager should set the values in the base bean before proceeding with the sub-beans. This would make it possible to instantiate the sub beans differently depending on some configured value, for instance:

    public DataSourceConfiguration getDatasource()
    {
        if (datasource == null) {
            switch (datasourceType) {
                case XDOM_TABLE:
                    datasource = new XDOMTableDatasourceConfiguration();
                    break;
                case INLINE_TABLE:
                    datasource = new InlineTableDatasourceConfiguration();
                    break;
                // etc.
            }
            return datasource;
        }
    }


Best Regards,

/Andreas

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to