/** * @see org.opencms.widgets.I_CmsADEWidget#getConfiguration(org.opencms.file.CmsObject, org.opencms.xml.types.A_CmsXmlContentValue, org.opencms.i18n.CmsMessages, org.opencms.file.CmsResource, java.util.Locale) */ public String getConfiguration( CmsObject cms, A_CmsXmlContentValue schemaType, CmsMessages messages, CmsResource resource, Locale contentLocale) { CmsDummyWidgetDialog widgetDialog = new CmsDummyWidgetDialog(messages.getLocale(), messages); widgetDialog.setResource(resource); List<CmsSelectWidgetOption> options = parseSelectOptions(cms, widgetDialog, schemaType); String result = optionsToConfigurationString(options); return result; }
super.setConfiguration(configuration);
/** * @see org.opencms.widgets.A_CmsWidget#getWidgetStringValue(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override public String getWidgetStringValue(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { String result = super.getWidgetStringValue(cms, widgetDialog, param); String configuration = CmsMacroResolver.resolveMacros(getConfiguration(), cms, widgetDialog.getMessages()); if (configuration == null) { configuration = param.getDefault(cms); } List<CmsSelectWidgetOption> options = CmsSelectWidgetOption.parseOptions(configuration); for (int m = 0; m < options.size(); m++) { CmsSelectWidgetOption option = options.get(m); if (result.equals(option.getValue())) { result = option.getOption(); break; } } return result; }
/** * Returns the list of configured select options, parsing the configuration String if required.<p> * * The list elements are of type <code>{@link CmsSelectWidgetOption}</code>. * The configuration String is parsed only once and then stored internally.<p> * * @param cms the current users OpenCms context * @param widgetDialog the dialog of this widget * @param param the widget parameter of this dialog * * @return the list of select options * * @see CmsSelectWidgetOption */ protected List parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { if (m_selectOptions == null) { String configuration = getConfiguration(); if (configuration == null) { // workaround: use the default value to parse the options configuration = param.getDefault(cms); } configuration = CmsMacroResolver.resolveMacros(configuration, cms, widgetDialog.getMessages()); m_selectOptions = CmsSelectWidgetOption.parseOptions(configuration); if (m_selectOptions == Collections.EMPTY_LIST) { m_selectOptions = new ArrayList(); } } return m_selectOptions; }
result.append(super.getDialogHtmlEnd(cms, widgetDialog, param)); return result.toString();
/** * @see org.opencms.widgets.A_CmsWidget#getWidgetStringValue(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override public String getWidgetStringValue(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { String result = super.getWidgetStringValue(cms, widgetDialog, param); String configuration = CmsMacroResolver.resolveMacros(getConfiguration(), cms, widgetDialog.getMessages()); if (configuration == null) { configuration = param.getDefault(cms); } List options = CmsSelectWidgetOption.parseOptions(configuration); for (int m = 0; m < options.size(); m++) { CmsSelectWidgetOption option = (CmsSelectWidgetOption)options.get(m); if (result.equals(option.getValue())) { result = option.getOption(); break; } } return result; }
String configuration = getConfiguration(); if (configuration == null) {
result.append(super.getDialogHtmlEnd(cms, widgetDialog, param)); return result.toString();