[opencms-dev] CmsResultItemWidget customisation question

Sandrine Prousteau s.prousteau at eurelis.com
Thu Apr 11 13:29:09 CEST 2013


Hi all

I'd like to create a custom type based on xmlcontent, with a "gallery preview" as in "Image gallery", with a custom TileView. I already created a custom gallery type for my xmlcontent type, and the items appears in lines as usual, the preview is enabled with a default formatter.

I'd like to know how I can customize this function with a custom module :

In org.opencms.ade.galleries.client.ui. CmsResultItemWidget

public CmsResultItemWidget(CmsResultItemBean infoBean) {

        super(infoBean);
        setIcon(CmsIconUtil.getResourceIconClasses(infoBean.getType(), infoBean.getPath(), false));

        // if resourceType=="image" prepare for tile view
        if (IMAGE_TYPE.equals(infoBean.getType())) {
            m_hasTileView = true;
            // add tile view marker css classes
            String src = infoBean.getViewLink();
            if (src == null) {
                src = CmsCoreProvider.get().link(infoBean.getPath());
            }
            // insert tile view image div
            HTML imageTile = new HTML("<img src=\"" + src + IMAGE_SCALE_PARAM
            // add time stamp to override image caching
                + "&time="
                + System.currentTimeMillis()
                + "\" />");
            imageTile.setStyleName(I_CmsLayoutBundle.INSTANCE.galleryResultItemCss().imageTile());
            m_tooltipHandler = new CmsToolTipHandler(imageTile, generateTooltipHtml(infoBean));
            m_contentPanel.insert(imageTile, 0);
        }

    }


Thanks for your help!
Sandrine


More information about the opencms-dev mailing list