/** * Returns a list for the indexed select box.<p> * * @return a list for the indexed select box */ private List<CmsSelectWidgetOption> getTokenizedWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); result.add(new CmsSelectWidgetOption("true", true)); result.add(new CmsSelectWidgetOption("false", false)); result.add(new CmsSelectWidgetOption("untokenized", false)); return result; } }
/** * Returns the list of default destinations for export points.<p> * * The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p> * * @return the list of default destinations for export points */ private List getDestinations() { List result = new ArrayList(); result.add(new CmsSelectWidgetOption("WEB-INF/classes/")); result.add(new CmsSelectWidgetOption("WEB-INF/lib/")); return result; }
/** * Returns the indexer class widget configuration.<p> * * @return the indexer class widget configuration */ private List<CmsSelectWidgetOption> getIndexerClassWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); result.add(new CmsSelectWidgetOption(CmsVfsIndexer.class.getName(), true)); return result; } }
/** * Returns the rebuild mode widget configuration.<p> * * @return the rebuild mode widget configuration */ private List<CmsSelectWidgetOption> getRebuildModeWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); String rebuildMode = getSearchIndexIndex().getRebuildMode(); result.add(new CmsSelectWidgetOption("auto", "auto".equals(rebuildMode))); result.add(new CmsSelectWidgetOption("manual", "manual".equals(rebuildMode))); result.add(new CmsSelectWidgetOption("offline", "offline".equals(rebuildMode))); return result; }
/** * @see org.opencms.widgets.A_CmsSelectWidget#parseSelectOptions(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override protected List<CmsSelectWidgetOption> parseSelectOptions( CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { List<CmsSelectWidgetOption> options = Lists.newArrayList(); options.add(new CmsSelectWidgetOption("", true, getMessage(cms, Messages.GUI_FORMATTER_EMPTY_SELECTION_0))); return options; }
/** * Returns a list of CmsSearchFieldMappingTypes for the type select box.<p> * * @return a list of CmsSearchFieldMappingTypes */ private List<CmsSelectWidgetOption> getTypeWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); result.add(new CmsSelectWidgetOption(CmsSearchFieldMappingType.CONTENT.toString(), true)); result.add(new CmsSelectWidgetOption(CmsSearchFieldMappingType.PROPERTY.toString(), false)); result.add(new CmsSelectWidgetOption(CmsSearchFieldMappingType.PROPERTY_SEARCH.toString(), false)); result.add(new CmsSelectWidgetOption(CmsSearchFieldMappingType.ITEM.toString(), false)); return result; } }
/** * Returns the list of all uploadable zip files and uploadable folders available on the server.<p> * * The list is returned as a String separated by "|" to use as configuration parameter for selectbox widgets.<p> * * @return pipe separated list of file names */ protected List getFilesFromServer() { List retVal = new ArrayList(); Iterator i = getFileListFromServer(true).iterator(); while (i.hasNext()) { String fileName = (String)i.next(); retVal.add(new CmsSelectWidgetOption(fileName)); } return retVal; }
/** * Creates the select widget configuration for the sort names.<p> * * @return the select widget configuration for the sort names */ private List getSortNamesConf() { List retVal = new ArrayList(); try { String[] names = CmsSearchParameters.SORT_NAMES; for (int i = 0; i < names.length; i++) { retVal.add(new CmsSelectWidgetOption(names[i], (i == 0), key(A_CmsWidget.LABEL_PREFIX + names[i].toLowerCase()))); } } catch (Exception e) { // noop } return retVal; }
/** * Returns the present export files on the server to show in the combo box.<p> * * The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p> * * @return the present export files on the server to show in the combo box */ protected List getComboExportFiles() { List result = new ArrayList(8); Iterator i = CmsDatabaseImportFromServer.getFileListFromServer(true).iterator(); while (i.hasNext()) { String fileName = (String)i.next(); String helpText = key(Messages.GUI_EDITOR_HELP_EXPORTFILE_1, new String[] {fileName}); result.add(new CmsSelectWidgetOption(fileName, false, null, helpText)); } return result; }
/** * Returns the locale widget configuration.<p> * * @return the locale widget configuration */ private List<CmsSelectWidgetOption> getLocaleWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); for (Locale locale : m_searchManager.getAnalyzers().keySet()) { CmsSelectWidgetOption option = new CmsSelectWidgetOption( locale.toString(), locale.equals(getSearchIndexIndex().getLocale())); result.add(option); } return result; }
/** * Returns the selector widget options to build a Locale selector widget.<p> * * @return the selector widget options to build a Locale selector widget */ 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; }
/** * Returns a list with the possible modes for the clean action.<p> * * @return a list with the possible modes for the clean action */ private List getModes() { ArrayList ret = new ArrayList(); ret.add( new CmsSelectWidgetOption( MODE_VARIATIONS, getMode().equals(MODE_VARIATIONS), key(Messages.GUI_FLEXCACHE_CLEAN_MODE_VARIATIONS_0))); ret.add(new CmsSelectWidgetOption( MODE_ALL, getMode().equals(MODE_ALL), key(Messages.GUI_FLEXCACHE_CLEAN_MODE_ALL_0))); return ret; } }
/** * Returns a list with the possible <code>{@link Locale}</code> selections based on the OpenCms configuration. * <p> * * @return a list with the possible <code>{@link Locale}</code> selections based on the OpenCms configuration. */ private List<CmsSelectWidgetOption> getLanguageSelections() { List<CmsSelectWidgetOption> result = new LinkedList<CmsSelectWidgetOption>(); List<Locale> sysLocales = OpenCms.getLocaleManager().getAvailableLocales(); CmsSelectWidgetOption option; boolean first = true; for (Locale locale : sysLocales) { option = new CmsSelectWidgetOption(locale.toString(), first, locale.getDisplayName(getLocale())); first = false; result.add(option); } return result; }
/** * Creates the select widget configuration for the index names.<p> * * @return the select widget configuration for the index names */ 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; }
/** * Returns a list of <code>{@link CmsSelectWidgetOption}</code> objects for field list selection.<p> * * @return a list of <code>{@link CmsSelectWidgetOption}</code> objects */ private List getFieldList() { List retVal = new ArrayList(); try { Iterator i = getFields().iterator(); while (i.hasNext()) { CmsSearchField field = (CmsSearchField)i.next(); retVal.add(new CmsSelectWidgetOption(field.getName(), true, getMacroResolver().resolveMacros( field.getDisplayName()))); } } catch (Exception e) { // noop } return retVal; }
/** *@see org.opencms.widgets.A_CmsSelectWidget#parseSelectOptions(CmsObject, I_CmsWidgetDialog, I_CmsWidgetParameter) */ protected List parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { List result = new ArrayList(); try { List resources = cms.readResources("/", CmsResourceFilter.DEFAULT.addRequireType(PRESET_TYPE_ID), true); Iterator iter = resources.iterator(); while (iter.hasNext()) { CmsResource res = (CmsResource)iter.next(); String title = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); result.add(new CmsSelectWidgetOption(cms.getSitePath(res), false, title, "")); } } catch (CmsException e) { // noop } return result; } }
/** * Returns select options for all configures Solr Offline indexes.<p> * * @return select options for all configures Solr Offline indexes */ private List<CmsSelectWidgetOption> getSolrIndexOptions() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); result.add( new CmsSelectWidgetOption(CmsSearchReplaceSettings.VFS, true, CmsSearchReplaceSettings.VFS.toUpperCase())); if (OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled()) { for (CmsSearchIndex index : OpenCms.getSearchManager().getAllSolrIndexes()) { if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) { result.add(new CmsSelectWidgetOption(index.getName(), false, index.getName())); } } } return result; }
/** * Returns the project widget configuration.<p> * * @return the project widget configuration */ private List<CmsSelectWidgetOption> getProjectWidgetConfiguration() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); try { List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllManageableProjects(getCms(), "", true); projects.add(getCms().readProject(CmsProject.ONLINE_PROJECT_ID)); for (CmsProject project : projects) { CmsSelectWidgetOption option = new CmsSelectWidgetOption(project.getName(), project.equals(project)); result.add(option); } } catch (CmsException e) { // should never happen } return result; }
/** * Creates a widget option corresponding to a formatter bean for an external formatter.<p> * * @param cms the current CMS context * @param formatter the formatter bean * * @return the select option which was created */ public static CmsSelectWidgetOption getWidgetOptionForFormatter(CmsObject cms, I_CmsFormatterBean formatter) { String name = formatter.getNiceName(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)) + " " + formatter.getResourceTypeNames().toString() + " " + " (" + formatter.getJspRootPath() + ")"; CmsSelectWidgetOption option = new CmsSelectWidgetOption(formatter.getId(), false, name); return option; }
/** * Creates a widget option for a resource type.<p> * * @param cms the current CMS context * @param typeName the type for which we want a widget option * * @return the created widget option */ public static CmsSelectWidgetOption getWidgetOptionForType(CmsObject cms, String typeName) { String niceTypeName = typeName; try { Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); niceTypeName = CmsWorkplaceMessages.getResourceTypeName(locale, typeName); } catch (@SuppressWarnings("unused") Exception e) { // resource type name will be used as a fallback } CmsSelectWidgetOption option = new CmsSelectWidgetOption( CmsFormatterChangeSet.keyForType(typeName), false, getMessage(cms, Messages.GUI_SCHEMA_FORMATTER_OPTION_1, niceTypeName)); return option; }