[opencms-dev] Creating a CustomeCategoryWidget

Le Nouveau opencms at lenouveau.fr
Tue Jul 23 11:21:23 CEST 2013


Hi all,

My aim is to manage (adding, deleting, ...) categories through the
CategoryWidget.
It seems there is not option to allow this (at least, I did not find it).
So, I decided to create my own widget : CategoryCustomWidget.

CmsCategoryCustomWidget extends from CmsCategoryWidget, but my
method getDialogWidget() is never called, instead of newInstance() is
called, returning a CmsCategoryCustomWidget.

Here is my class code :

public class CmsCategoryCustomWidget extends CmsCategoryWidget {

    public CmsCategoryCustomWidget() {
        super();
    }

    public CmsCategoryCustomWidget(String configuration)  {
        super(configuration);
    }

    @Override
    public I_CmsWidget newInstance() {
        return new CmsCategoryCustomWidget(getConfiguration());
    }

    @Override
    public String getDialogWidget(CmsObject cms, I_CmsWidgetDialog
widgetDialog, I_CmsWidgetParameter param) {
        StringBuffer result = new StringBuffer();

        result.append("<table>");
        result.append("<tr><td>Coucou</td></tr>");
        result.append("</table>");

        return result.toString();
    }
}

What am I doing wrong ?
Did mechanics changed since tuto were written ?

Thanks for your help.
LeNouveau

PS : If you who a such widget already exists, don't hesitate to tell me !
^^
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130723/436212af/attachment.htm>


More information about the opencms-dev mailing list