コード例 #1
0
        protected override void SetEditorConfiguration(ExtendedMetadata metadata)
        {
            // Get the StringListAttribute with which you can specify the editor configuration,
            // and override the default settings in the StringList.js file.
            var stringListAttribute = metadata.Attributes.FirstOrDefault(a => typeof(StringListAttribute) == a.GetType()) as StringListAttribute;

            if (stringListAttribute != null)
            {
                if (!string.IsNullOrEmpty(stringListAttribute.ValueLabel))
                {
                    EditorConfiguration[VALUE_LABEL] = stringListAttribute.ValueLabel;
                }
                else
                {
                    EditorConfiguration.Remove(VALUE_LABEL);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.AddButtonLabel))
                {
                    EditorConfiguration[ADD_BUTTON_LABEL] = stringListAttribute.AddButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(ADD_BUTTON_LABEL);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.RemoveButtonLabel))
                {
                    EditorConfiguration[REMOVE_BUTTON_LABEL] = stringListAttribute.RemoveButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(REMOVE_BUTTON_LABEL);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.ValidationExpression))
                {
                    EditorConfiguration[VALIDATION_EXPRESSION] = stringListAttribute.ValidationExpression;
                }
                else
                {
                    EditorConfiguration.Remove(VALIDATION_EXPRESSION);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.ValidationMessage))
                {
                    EditorConfiguration[VALIDATION_MESSAGE] = stringListAttribute.ValidationMessage;
                }
                else
                {
                    EditorConfiguration.Remove(VALIDATION_MESSAGE);
                }
            }

            base.SetEditorConfiguration(metadata);
        }
コード例 #2
0
        protected override void SetEditorConfiguration(ExtendedMetadata metadata)
        {
            // Get the AutocompleteListAttribute with which you can specify the editor configuration,
            // and override the default settings in the AutocompleteList.js file.
            var stringListAttribute = metadata.Attributes.FirstOrDefault(a => typeof(AutocompleteListAttribute) == a.GetType()) as AutocompleteListAttribute;

            if (stringListAttribute != null)
            {
                if (!string.IsNullOrEmpty(stringListAttribute.ValueLabel))
                {
                    EditorConfiguration[VALUE_LABEL] = stringListAttribute.ValueLabel;
                }
                else
                {
                    EditorConfiguration.Remove(VALUE_LABEL);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.AddButtonLabel))
                {
                    EditorConfiguration[ADD_BUTTON_LABEL] = stringListAttribute.AddButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(ADD_BUTTON_LABEL);
                }

                if (!string.IsNullOrEmpty(stringListAttribute.RemoveButtonLabel))
                {
                    EditorConfiguration[REMOVE_BUTTON_LABEL] = stringListAttribute.RemoveButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(REMOVE_BUTTON_LABEL);
                }

                string format = ServiceLocator.Current.GetInstance <ModuleTable>().ResolvePath("Shell", "stores/selectionquery/{0}/");
                EditorConfiguration["storeurl"] = string.Format(CultureInfo.InvariantCulture, format, new object[]
                {
                    stringListAttribute.SelectionFactoryType.FullName
                });
            }

            base.SetEditorConfiguration(metadata);
        }
        protected override void SetEditorConfiguration(ExtendedMetadata metadata)
        {
            // Get the KeyValueItemsAttribute with which you can specify the editor configuration,
            // and override the default settings in the KeyValueItems.js file.
            var keyValueItemsAttribute = metadata.Attributes.FirstOrDefault(a => typeof(KeyValueItemsAttribute) == a.GetType()) as KeyValueItemsAttribute;

            if (keyValueItemsAttribute != null)
            {
                if (!string.IsNullOrEmpty(keyValueItemsAttribute.KeyLabel))
                {
                    EditorConfiguration[KEY_LABEL] = keyValueItemsAttribute.KeyLabel;
                }
                else
                {
                    EditorConfiguration.Remove(KEY_LABEL);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.ValueLabel))
                {
                    EditorConfiguration[VALUE_LABEL] = keyValueItemsAttribute.ValueLabel;
                }
                else
                {
                    EditorConfiguration.Remove(VALUE_LABEL);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.AddButtonLabel))
                {
                    EditorConfiguration[ADD_BUTTON_LABEL] = keyValueItemsAttribute.AddButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(ADD_BUTTON_LABEL);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.RemoveButtonLabel))
                {
                    EditorConfiguration[REMOVE_BUTTON_LABEL] = keyValueItemsAttribute.RemoveButtonLabel;
                }
                else
                {
                    EditorConfiguration.Remove(REMOVE_BUTTON_LABEL);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.KeyValidationExpression))
                {
                    EditorConfiguration[KEY_VALIDATION_EXPRESSION] = keyValueItemsAttribute.KeyValidationExpression;
                }
                else
                {
                    EditorConfiguration.Remove(KEY_VALIDATION_EXPRESSION);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.KeyValidationMessage))
                {
                    EditorConfiguration[KEY_VALIDATION_MESSAGE] = keyValueItemsAttribute.KeyValidationMessage;
                }
                else
                {
                    EditorConfiguration.Remove(KEY_VALIDATION_MESSAGE);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.ValueValidationExpression))
                {
                    EditorConfiguration[VALUE_VALIDATION_EXPRESSION] = keyValueItemsAttribute.ValueValidationExpression;
                }
                else
                {
                    EditorConfiguration.Remove(VALUE_VALIDATION_EXPRESSION);
                }

                if (!string.IsNullOrEmpty(keyValueItemsAttribute.ValueValidationMessage))
                {
                    EditorConfiguration[VALUE_VALIDATION_MESSAGE] = keyValueItemsAttribute.ValueValidationMessage;
                }
                else
                {
                    EditorConfiguration.Remove(VALUE_VALIDATION_MESSAGE);
                }

                EditorConfiguration[SHOW_SELECTED_BY_DEFAULT_CHECKBOX] = keyValueItemsAttribute.ShowSelectedByDefaultCheckbox;
            }

            base.SetEditorConfiguration(metadata);
        }