public Format getFormatForContainer(CmsObject cms, String type, int width) {

        IdentityHashMap<CmsFormatterBean, Format> formatsByFormatter = new IdentityHashMap<CmsFormatterBean, Format>();
        // relate formatters to formats so we can pick the corresponding format after a formatter has been selected
        CmsFormatterBean mainFormatter = createFormatterBean(m_mainFormat, true);
        formatsByFormatter.put(mainFormatter, m_mainFormat);
        List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>();
        for (Format format : m_otherFormats) {
            CmsFormatterBean formatter = createFormatterBean(format, false);
            formatsByFormatter.put(formatter, format);
            formatters.add(formatter);
        }
        formatters.add(0, mainFormatter);
        CmsFormatterConfiguration formatterConfiguration = CmsFormatterConfiguration.create(cms, formatters);
        I_CmsFormatterBean matchingFormatter = formatterConfiguration.getDefaultFormatter(type, width);
        if (matchingFormatter == null) {
            return null;
        }
        return formatsByFormatter.get(matchingFormatter);
    }
public Format getFormatForContainer ( CmsObject cms , String type , int width ) { IdentityHashMap < CmsFormatterBean , Format > formatsByFormatter = new IdentityHashMap < CmsFormatterBean , Format > ( ) ; CmsFormatterBean mainFormatter = createFormatterBean ( m_mainFormat , true ) ; formatsByFormatter . put ( mainFormatter , m_mainFormat ) ; List < I_CmsFormatterBean > formatters = new ArrayList < I_CmsFormatterBean > ( ) ; for ( Format format : m_otherFormats ) { CmsFormatterBean formatter = createFormatterBean ( format , false ) ; formatsByFormatter . put ( formatter , format ) ; formatters . add ( formatter ) ; } formatters . add ( 0 , mainFormatter ) ; CmsFormatterConfiguration formatterConfiguration = CmsFormatterConfiguration . create ( cms , formatters ) ; I_CmsFormatterBean matchingFormatter = formatterConfiguration . getDefaultFormatter ( type , width ) ; if ( matchingFormatter == null ) { return null ; } return formatsByFormatter . get ( matchingFormatter ) ; }
Finds the correct format for a given container type and width.<p>

@param cms the current CMS context
@param type the container type
@param width the container width

@return the format for the given container type and width