Returns the selector widget options to build a Locale selector widget.<p>

@return the selector widget options to build a Locale selector widget
973850
public List getLocaleConfigOptions() {

        List result = new ArrayList();

        List locales = OpenCms.getLocaleManager().getAvailableLocales();
        Iterator i = locales.iterator();
        while (i.hasNext()) {
            Locale locale = (Locale)i.next();
            String localeStr = locale.toString();
            String localeDisplayStr = locale.getDisplayName(getLocale());

            result.add(new CmsSelectWidgetOption(localeStr, false, localeDisplayStr));
        }

        return result;
    }
312263
public static SelectOptions getSiteSelectOptionsStatic(CmsObject cms, String wpSite, Locale locale) {

        List<String> options = new ArrayList<String>();
        List<String> values = new ArrayList<String>();
        int selectedIndex = 0;

        List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(
            cms,
            true,
            false,
            cms.getRequestContext().getOuFqn());
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(wpSite) && !wpSite.endsWith("/")) {
            wpSite += "/";
        }

        Iterator<CmsSite> i = sites.iterator();
        int pos = 0;
        while (i.hasNext()) {
            CmsSite site = i.next();
            String siteRoot = site.getSiteRoot();
            if (!siteRoot.endsWith("/")) {
                siteRoot += "/";
            }
            values.add(siteRoot);
            options.add(CmsWorkplace.substituteSiteTitleStatic(site.getTitle(), locale));
            if (siteRoot.equals(wpSite)) {
                // this is the user's currently chosen site
                selectedIndex = pos;
            }
            pos++;
        }

        if (sites.size() < 1) {
            // no site found, assure that at least the current site is shown in the selector
            String siteRoot = cms.getRequestContext().getSiteRoot();
            CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
            if (!siteRoot.endsWith("/")) {
                siteRoot += "/";
            }
            String title = "";
            if (site != null) {
                title = site.getTitle();
            }
            values.add(siteRoot);
            options.add(title);
        }
        SelectOptions selectOptions = new SelectOptions(options, values, selectedIndex);
        return selectOptions;
    }
211872
protected List<CmsDialogElement> getElementList() {

        if (m_elementList == null) {
            m_elementList = CmsDialogElements.computeElements(getCms(), m_page, getParamTempfile(), getElementLocale());
        }
        return m_elementList;
    }
526001
public static SelectOptions getViewSelectOptions(CmsObject cms, String value) {

        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);

        List<String> options = new ArrayList<String>();
        List<String> values = new ArrayList<String>();
        int selectedIndex = 0;

        List<I_CmsWorkplaceAppConfiguration> apps = OpenCms.getWorkplaceAppManager().getDefaultQuickLaunchConfigurations();

        for (I_CmsWorkplaceAppConfiguration app : apps) {
            if (OpenCms.getRoleManager().hasRole(
                cms,
                cms.getRequestContext().getCurrentUser().getName(),
                app.getRequiredRole())) {
                values.add(app.getId());
                options.add(app.getName(locale));
            }
        }

        SelectOptions optionBean = new SelectOptions(options, values, selectedIndex);
        return optionBean;
    }
399996
@Override
    public String getSelectedOption() throws WidgetException {
        try {
            Select select = new Select(getByLocator());
            List<String> selectedOptions = select.getSelectedOptions();
            if (selectedOptions != null && selectedOptions.size() > 0) {
                return selectedOptions.get(0);
            } else {
                return "";
            }
        } catch (Exception e) {
            throw new WidgetException("Error while fetching selected options", getByLocator(), e);
        }
    }
147074
private void initLocaleSelect() {

        if (m_availableLocales.size() < 2) {
            return;
        }
        Map<String, String> selectOptions = new HashMap<String, String>();
        for (Entry<String, String> localeEntry : m_availableLocales.entrySet()) {
            if (m_contentLocales.contains(localeEntry.getKey())) {
                selectOptions.put(localeEntry.getKey(), localeEntry.getValue());
            } else {
                selectOptions.put(localeEntry.getKey(), localeEntry.getValue() + " [-]");
            }
        }
        if (m_localeSelect == null) {
            m_localeSelect = new CmsSelectBox(selectOptions);
            m_toolbar.insertRight(m_localeSelect, 1);
            m_localeSelect.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().inlineBlock());
            m_localeSelect.getElement().getStyle().setWidth(100, Unit.PX);
            m_localeSelect.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
            m_localeSelect.addValueChangeHandler(new ValueChangeHandler<String>() {

                public void onValueChange(ValueChangeEvent<String> event) {

                    switchLocale(event.getValue());
                }
            });
        } else {
            m_localeSelect.setItems(selectOptions);
        }
        m_localeSelect.setFormValueAsString(m_locale);
        if (m_deleteLocaleButton == null) {
            m_deleteLocaleButton = createButton(
                Messages.get().key(Messages.GUI_TOOLBAR_DELETE_LOCALE_0),
                "opencms-icon-remove-locale");
            m_deleteLocaleButton.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    confirmDeleteLocale();
                }
            });
            m_toolbar.insertRight(m_deleteLocaleButton, 2);
        }
        if (m_contentLocales.size() > 1) {
            m_deleteLocaleButton.enable();
        } else {
            m_deleteLocaleButton.disable(Messages.get().key(Messages.GUI_TOOLBAR_CANT_DELETE_LAST_LOCALE_0));
        }
        if (m_copyLocaleButton == null) {
            m_copyLocaleButton = createButton(
                I_CmsButton.ButtonData.COPY_LOCALE_BUTTON.getTitle(),
                I_CmsButton.ButtonData.COPY_LOCALE_BUTTON.getIconClass());
            m_copyLocaleButton.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {

                    openCopyLocaleDialog();
                }
            });
            m_toolbar.insertRight(m_copyLocaleButton, 3);
        }
    }
600566
public function choices()
    {
        if (empty($this->choices)) {
            $locales = $this->translator()->locales();
            if ($locales) {
                $selected = (array)$this->val();
                $choices  = [];

                foreach ($locales as $langCode => $localeStruct) {
                    /**
                     * @see \Charcoal\Admin\Widget\FormSidebarWidget::languages()
                     * @see \Charcoal\Admin\Widget\FormGroupWidget::languages()
                     */
                    if (isset($localeStruct['name'])) {
                        $label = $this->translator()->translation($localeStruct['name']);
                    } else {
                        $trans = 'locale.'.$langCode;
                        if ($trans === $this->translator()->translate($trans)) {
                            $label = strtoupper($langCode);
                        } else {
                            $label = $this->translator()->translation($trans);
                        }
                    }

                    $choices[$langCode] = [
                        'label'    => $label,
                        'selected' => in_array($langCode, $selected),
                        'value'    => $langCode
                    ];
                }

                $this->choices = $choices;
            }
        }

        return $this->choices;
    }
91838
public static List<I_CmsResourceType> getResourceTypes() {

        List<I_CmsResourceType> res = new ArrayList<I_CmsResourceType>();
        for (I_CmsResourceType type : OpenCms.getResourceManager().getResourceTypes()) {
            CmsExplorerTypeSettings typeSetting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
                type.getTypeName());
            if (typeSetting != null) {
                res.add(type);
            }
        }
        return res;
    }
1117104
private List<CmsSelectWidgetOption> getSortNamesIndex() {

        List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>();
        try {
            List<String> names = OpenCms.getSearchManager().getIndexNames();
            for (int i = 0; i < names.size(); i++) {
                String indexName = names.get(i);
                String wpIndexName = getSettings().getUserSettings().getWorkplaceSearchIndexName();
                boolean isDefault = indexName.toLowerCase().equals(wpIndexName.toLowerCase());
                retVal.add(new CmsSelectWidgetOption(names.get(i), isDefault, names.get(i)));
            }
        } catch (Exception e) {
            // noop
        }
        return retVal;
    }
1333180
public SelectOptions getSiteSelectOptions() {

        return getSiteSelectOptionsStatic(
            getCms(),
            CmsWorkplace.getStartSiteRoot(getCms(), m_userSettings),
            getSettings().getUserSettings().getLocale());
    }
840507
public static List<ViewLocale> getAvailableViewLocales() {
		List<String> locales = readAvailableLocales();

		List<ViewLocale> localesUI = new ArrayList<>();
		if (!locales.isEmpty()) {
			for (String locale : locales) {
				localesUI.add(new ViewLocale(locale, getLocalDisplayName(locale)));
			}

			Collections.sort(localesUI, new Comparator<ViewLocale>() {

				@Override
				public int compare(ViewLocale o1, ViewLocale o2) {
					return o1.toString().compareTo(o2.toString());
				}
			});
		}

		// Always put English at the top
		localesUI.add(0, new ViewLocale(DEFAULT_LOCALE, getLocalDisplayName(DEFAULT_LOCALE)));

		return localesUI;
	}
482695
public List<String> getButtonBarOption() {

        if (m_buttonBarOption == null) {
            // use lazy initializing for performance reasons
            if (CmsStringUtil.isEmpty(getButtonBarOptionString())) {
                // no individual configuration defined, create empty list
                m_buttonBarOption = Collections.emptyList();
            } else {
                // create list of button bar options from configuration string
                m_buttonBarOption = CmsStringUtil.splitAsList(getButtonBarOptionString(), DELIMITER_VALUE, true);
            }
        }
        return m_buttonBarOption;
    }
91576
public String buildSelectLocales(String attributes) {

        List options = new ArrayList();
        List values = new ArrayList();
        List locales = OpenCms.getLocaleManager().getAvailableLocales();
        int selectedIndex = -1;
        if (locales == null) {
            // no locales found, return empty String
            return "";
        } else {
            // locales found, create option and value lists
            CmsMessages messages = Messages.get().getBundle(getLocale());
            options.add(messages.key(Messages.GUI_PLEASE_SELECT_0));
            values.add("");
            options.add(messages.key(Messages.GUI_BUTTON_ALL_0));
            values.add(ALL);
            if (ALL.equals(getParamLocale())) {
                selectedIndex = 1;
            }
            Iterator i = locales.iterator();
            int counter = 2;
            while (i.hasNext()) {
                Locale locale = (Locale)i.next();
                String language = locale.getLanguage();
                String displayLanguage = locale.getDisplayLanguage();
                if (language.equals(getParamLocale())) {
                    selectedIndex = counter;
                }
                options.add(displayLanguage);
                values.add(language);
                counter++;
            }
        }

        return CmsWorkplace.buildSelect(attributes, options, values, selectedIndex, false);
    }
577752
protected List<CmsSelectWidgetOption> getSelectRoles() {

        List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>();

        try {
            boolean inRootOu = CmsStringUtil.isEmptyOrWhitespaceOnly(getParamOufqn())
                || CmsOrganizationalUnit.SEPARATOR.equals(getParamOufqn());
            List<CmsRole> roles = OpenCms.getRoleManager().getRolesOfUser(
                getCms(),
                getCms().getRequestContext().getCurrentUser().getName(),
                getParamOufqn(),
                false,
                false,
                false);
            Iterator<CmsRole> itRoles = roles.iterator();
            while (itRoles.hasNext()) {
                CmsRole role = itRoles.next();
                if (role.isOrganizationalUnitIndependent() && !inRootOu) {
                    continue;
                }
                retVal.add(new CmsSelectWidgetOption(role.getGroupName(), false, role.getName(getLocale())));
            }
        } catch (CmsException e) {
            // noop
        }
        Collections.sort(retVal, new Comparator<CmsSelectWidgetOption>() {

            public int compare(CmsSelectWidgetOption arg0, CmsSelectWidgetOption arg1) {

                return arg0.getOption().compareTo(arg1.getOption());
            }

        });
        return retVal;
    }
849587
private List<CmsSelectWidgetOption> getLanguages() {

        List<CmsSelectWidgetOption> locales = new ArrayList<CmsSelectWidgetOption>();

        Locale defLocale = null;
        if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
            defLocale = new CmsUserSettings(m_user).getLocale();
        }
        if (defLocale == null) {
            defLocale = getCms().getRequestContext().getLocale();
        }

        Iterator<Locale> itLocales = OpenCms.getLocaleManager().getAvailableLocales().iterator();
        while (itLocales.hasNext()) {
            Locale locale = itLocales.next();
            boolean selected = locale.equals(defLocale);
            locales.add(
                new CmsSelectWidgetOption(locale.toString(), selected, locale.getDisplayName(getLocale()), null));
        }
        return locales;
    }
137812
private Map<String, String> getLocaleProperties() {

        if (m_localeProperties == null) {
            m_localeProperties = CmsCollectionsGenericWrapper.createLazyMap(
                new CmsProperty.CmsPropertyLocaleTransformer(m_properties, m_locale));
        }
        return m_localeProperties;
    }
133977
protected List<I_CmsSearchConfigurationSortOption> getSortOptions() {

        List<I_CmsSearchConfigurationSortOption> options = new LinkedList<I_CmsSearchConfigurationSortOption>();
        try {
            JSONArray sortOptions = m_configObject.getJSONArray(JSON_KEY_SORTOPTIONS);
            for (int i = 0; i < sortOptions.length(); i++) {
                I_CmsSearchConfigurationSortOption option = parseSortOption(sortOptions.getJSONObject(i));
                if (option != null) {
                    options.add(option);
                }
            }
        } catch (JSONException e) {
            if (null == m_baseConfig) {
                if (LOG.isInfoEnabled()) {
                    LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_SORT_CONFIG_0), e);
                }
            } else {
                options = m_baseConfig.getSortConfig().getSortOptions();
            }
        }
        return options;
    }