@Override
    public void setResource() {

        if (m_handler == null) {
            throw new UnsupportedOperationException("Preview handler not initialized");
        }
        final CmsCroppingParamBean croppingParam = m_handler.getCroppingParam();

        switch (getGalleryMode()) {
            case widget:
                if (getGalleryDialog().getWidgetHandler() != null) {
                    getGalleryDialog().getWidgetHandler().setWidgetValue(
                        m_infoBean.getResourcePath(),
                        m_infoBean.getStructureId(),
                        croppingParam);
                } else {
                    if (CmsPreviewUtil.isAdvancedWidget()) {
                        CmsPreviewUtil.setVfsImage(
                            m_infoBean.getResourcePath(),
                            croppingParam.getScaleParam(),
                            croppingParam.getFormatName(),
                            croppingParam.getRatio() + "");
                    } else {
                        CmsPreviewUtil.setResourcePath(
                            m_infoBean.getResourcePath()
                                + ((croppingParam.isCropped() || croppingParam.isScaled())
                                ? "?" + croppingParam.toString()
                                : ""));
                    }
                }
                break;
            case editor:
                m_handler.getImageAttributes(new I_CmsSimpleCallback<Map<String, String>>() {

                    public void execute(Map<String, String> attributes) {

                        CmsPreviewUtil.setImage(
                            CmsCoreProvider.get().link(
                                m_infoBean.getResourcePath()
                                    + ((croppingParam.isCropped() || croppingParam.isScaled())
                                    ? "?" + croppingParam.toString() + ",c:transparent"
                                    : "")),
                            attributes);
                    }
                });

                break;
            case ade:
            case view:
            case adeView:
            default:
                //nothing to do here, should not be called
                break;
        }
    }
@ Override public void setResource ( ) { if ( m_handler == null ) { throw new UnsupportedOperationException ( "Preview handler not initialized" ) ; } final CmsCroppingParamBean croppingParam = m_handler . getCroppingParam ( ) ; switch ( getGalleryMode ( ) ) { case widget : if ( getGalleryDialog ( ) . getWidgetHandler ( ) != null ) { getGalleryDialog ( ) . getWidgetHandler ( ) . setWidgetValue ( m_infoBean . getResourcePath ( ) , m_infoBean . getStructureId ( ) , croppingParam ) ; } else { if ( CmsPreviewUtil . isAdvancedWidget ( ) ) { CmsPreviewUtil . setVfsImage ( m_infoBean . getResourcePath ( ) , croppingParam . getScaleParam ( ) , croppingParam . getFormatName ( ) , croppingParam . getRatio ( ) + "" ) ; } else { CmsPreviewUtil . setResourcePath ( m_infoBean . getResourcePath ( ) + ( ( croppingParam . isCropped ( ) || croppingParam . isScaled ( ) ) ? "?" + croppingParam . toString ( ) : "" ) ) ; } } break ; case editor : m_handler . getImageAttributes ( new I_CmsSimpleCallback < Map < String , String > > ( ) { public void execute ( Map < String , String > attributes ) { CmsPreviewUtil . setImage ( CmsCoreProvider . get ( ) . link ( m_infoBean . getResourcePath ( ) + ( ( croppingParam . isCropped ( ) || croppingParam . isScaled ( ) ) ? "?" + croppingParam . toString ( ) + ",c:transparent" : "" ) ) , attributes ) ; } } ) ; break ; case ade : case view : case adeView : default : break ; } }
@see org.opencms.ade.galleries.client.preview.A_CmsResourcePreview#setResource()