public static IndexedContainer getModuleSiteContainer(CmsObject cms, String captionPropertyName, String prevValue) {

        CmsSiteSelectorOptionBuilder optBuilder = new CmsSiteSelectorOptionBuilder(cms);
        optBuilder.addNormalSites(true, (new CmsUserSettings(cms)).getStartFolder());
        IndexedContainer availableSites = new IndexedContainer();
        availableSites.addContainerProperty(captionPropertyName, String.class, null);
        for (CmsSiteSelectorOption option : optBuilder.getOptions()) {
            String siteRoot = option.getSiteRoot();
            if (siteRoot.equals("")) {
                siteRoot = "/";
            }
            Item siteItem = availableSites.addItem(siteRoot);
            siteItem.getItemProperty(captionPropertyName).setValue(option.getMessage());
        }
        if (!availableSites.containsId(prevValue)) {
            String caption = prevValue;
            String siteId = prevValue;

            if (CmsStringUtil.isEmptyOrWhitespaceOnly(prevValue)) {
                caption = CmsVaadinUtils.getMessageText(Messages.GUI_MODULES_MODULE_SITE_NONE_0);
                siteId = ID_EMPTY_SITE;
            }
            availableSites.addItem(siteId).getItemProperty(captionPropertyName).setValue(caption);
        }
        return availableSites;
    }
public static IndexedContainer getModuleSiteContainer ( CmsObject cms , String captionPropertyName , String prevValue ) { CmsSiteSelectorOptionBuilder optBuilder = new CmsSiteSelectorOptionBuilder ( cms ) ; optBuilder . addNormalSites ( true , ( new CmsUserSettings ( cms ) ) . getStartFolder ( ) ) ; IndexedContainer availableSites = new IndexedContainer ( ) ; availableSites . addContainerProperty ( captionPropertyName , String . class , null ) ; for ( CmsSiteSelectorOption option : optBuilder . getOptions ( ) ) { String siteRoot = option . getSiteRoot ( ) ; if ( siteRoot . equals ( "" ) ) { siteRoot = "/" ; } Item siteItem = availableSites . addItem ( siteRoot ) ; siteItem . getItemProperty ( captionPropertyName ) . setValue ( option . getMessage ( ) ) ; } if ( ! availableSites . containsId ( prevValue ) ) { String caption = prevValue ; String siteId = prevValue ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( prevValue ) ) { caption = CmsVaadinUtils . getMessageText ( Messages . GUI_MODULES_MODULE_SITE_NONE_0 ) ; siteId = ID_EMPTY_SITE ; } availableSites . addItem ( siteId ) . getItemProperty ( captionPropertyName ) . setValue ( caption ) ; } return availableSites ; }
Builds the container used for the module site selector.<p>

@param cms the CMS context
@param captionPropertyName the name of the property used to store captions
@param prevValue the value previously set in the module

@return the container with the available sites