/// <summary>
        /// Constructor for a ParameterEditor
        /// </summary>
        protected AbstractParameterEditor(IPropertyEditorFactory propertyEditorFactory)
        {
            //Locate the metadata attribute
            var paramEditorAttributes = GetType()
                .GetCustomAttributes(typeof(ParameterEditorAttribute), true)
                .OfType<ParameterEditorAttribute>();

            if (!paramEditorAttributes.Any())
                throw new InvalidOperationException(
                    string.Format("The ParameterEditor of type {0} is missing the {1} attribute", GetType().FullName,
                                  typeof(ParameterEditorAttribute).FullName));

            //assign the properties of this object to those of the metadata attribute
            var attr = paramEditorAttributes.First();
            Id = attr.Id;
            Name = attr.Name;
            Alias = attr.Alias;
            PropertyEditorId = attr.PropertyEditorId;

            _propertyEditorFactory = propertyEditorFactory;

            var propEditor = _propertyEditorFactory.GetPropertyEditor(PropertyEditorId);
            if(propEditor == null)
                throw new InvalidOperationException("Unable to find a Property Editor with the id '"+ PropertyEditorId +"'");
            if (!propEditor.Metadata.IsParameterEditor)
                throw new InvalidOperationException("Property Editor '"+ propEditor.Metadata.Name +"' is not a valid Parameter Editor type");
            _propertyEditor = propertyEditorFactory.GetPropertyEditor(PropertyEditorId).Value;
        }
 public DevDatasetInstallTask(
     IFrameworkContext frameworkContext,
     IPropertyEditorFactory propertyEditorFactory,
     IHiveManager hiveManager,
     IAttributeTypeRegistry attributeTypeRegistry)
     : base(frameworkContext, hiveManager)
 {
     _devDataSet = new DevDataset(propertyEditorFactory, frameworkContext, attributeTypeRegistry);
 }
 public DevDatasetInstallTask(
     IFrameworkContext frameworkContext,
     IPropertyEditorFactory propertyEditorFactory,
     IHiveManager hiveManager,
     IAttributeTypeRegistry attributeTypeRegistry)
     : base(frameworkContext, hiveManager)
 {
     _devDataSet = new DevDataset(propertyEditorFactory, frameworkContext, attributeTypeRegistry);
 }
Ejemplo n.º 4
0
 public DevDataset(IPropertyEditorFactory propertyEditorFactory, IFrameworkContext frameworkContext, IAttributeTypeRegistry attributeTypeRegistry)
 {
     _frameworkContext      = frameworkContext;
     _attributeTypeRegistry = attributeTypeRegistry;
     PropertyEditorFactory  = propertyEditorFactory;
     InitCreators();
     InitDataTypes();
     InitTemplates();
     InitDocTypes();
     _nodeData = XDocument.Parse(Files.rebel);
 }
Ejemplo n.º 5
0
        public DevDataset(IPropertyEditorFactory propertyEditorFactory, IFrameworkContext frameworkContext, IAttributeTypeRegistry attributeTypeRegistry)
        {
            _frameworkContext = frameworkContext;
            _attributeTypeRegistry = attributeTypeRegistry;
            PropertyEditorFactory = propertyEditorFactory;
            InitCreators();
            InitDataTypes();
            InitTemplates();
            InitDocTypes();
            _nodeData = XDocument.Parse(Files.umbraco);

        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public MapResolverContext(
            IFrameworkContext frameworkContext,
            IHiveManager hive,
            IPropertyEditorFactory propertyEditorFactory,
            IParameterEditorFactory parameterEditorFactory)
        {
            ApplicationId    = Guid.NewGuid();
            FrameworkContext = frameworkContext;
            Hive             = hive;

            PropertyEditorFactory  = propertyEditorFactory;
            ParameterEditorFactory = parameterEditorFactory;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public MapResolverContext(
            IFrameworkContext frameworkContext,
            IHiveManager hive, 
            IPropertyEditorFactory propertyEditorFactory,
            IParameterEditorFactory parameterEditorFactory)
        {
            ApplicationId = Guid.NewGuid();
            FrameworkContext = frameworkContext;
            Hive = hive;

            PropertyEditorFactory = propertyEditorFactory;
            ParameterEditorFactory = parameterEditorFactory;
        }
        public PugpigDataset(IPropertyEditorFactory propertyEditorFactory, IFrameworkContext frameworkContext, IAttributeTypeRegistry attributeTypeRegistry)
        {
            _frameworkContext = frameworkContext;
            PropertyEditorFactory = propertyEditorFactory;
            //InitCreators();

            // Anthony's code
            var helper = new UmbracoXmlImportHelper(attributeTypeRegistry, propertyEditorFactory);
            _templates = helper.InitTemplates();
            _dataTypes = helper.InitDataTypes(_frameworkContext);
            _docTypes = helper.InitDocTypes();

            // get content node xml
            _nodeData = XDocument.Parse(Files.umbraco);
        }
Ejemplo n.º 9
0
        public Property(object owner, PropertyInfo info, IPropertyEditorFactory editorFactory)
        {
            DisplayName = info.GetCustomAttribute <DisplayNameAttribute>(true)?.DisplayName ?? info.Name;
            Description = info.GetCustomAttribute <DescriptionAttribute>(true)?.Description;
            Category    = info.GetCustomAttribute <CategoryAttribute>(true)?.Category ?? GENERIC_CATEGORY;

            var editable   = info.GetCustomAttribute <EditableAttribute>(true)?.AllowEdit ?? false;
            var editorType = editable ? editorFactory.GetEditorType(info.PropertyType) : null;

            Value.Owner  = owner;
            Value.Type   = info.PropertyType;
            Value.Editor = editorType != null?Activator.CreateInstance(editorType, true) as IPropertyEditor : null;

            Value.Getter = () => info.GetValue(owner);
            Value.Setter = (v) => info.SetValue(owner, v);

            if (owner is INotifyPropertyChanged)
            {
                notificationSource                  = owner as INotifyPropertyChanged;
                propertyChangedHandler              = new PropertyChangedEventHandler(Property_PropertyChanged);
                notificationSource.PropertyChanged += propertyChangedHandler;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Constructor for a ParameterEditor
        /// </summary>
        protected AbstractParameterEditor(IPropertyEditorFactory propertyEditorFactory)
        {
            //Locate the metadata attribute
            var paramEditorAttributes = GetType()
                                        .GetCustomAttributes(typeof(ParameterEditorAttribute), true)
                                        .OfType <ParameterEditorAttribute>();

            if (!paramEditorAttributes.Any())
            {
                throw new InvalidOperationException(
                          string.Format("The ParameterEditor of type {0} is missing the {1} attribute", GetType().FullName,
                                        typeof(ParameterEditorAttribute).FullName));
            }

            //assign the properties of this object to those of the metadata attribute
            var attr = paramEditorAttributes.First();

            Id               = attr.Id;
            Name             = attr.Name;
            Alias            = attr.Alias;
            PropertyEditorId = attr.PropertyEditorId;

            _propertyEditorFactory = propertyEditorFactory;

            var propEditor = _propertyEditorFactory.GetPropertyEditor(PropertyEditorId);

            if (propEditor == null)
            {
                throw new InvalidOperationException("Unable to find a Property Editor with the id '" + PropertyEditorId + "'");
            }
            if (!propEditor.Metadata.IsParameterEditor)
            {
                throw new InvalidOperationException("Property Editor '" + propEditor.Metadata.Name + "' is not a valid Parameter Editor type");
            }
            _propertyEditor = propertyEditorFactory.GetPropertyEditor(PropertyEditorId).Value;
        }
Ejemplo n.º 11
0
 public IntegerEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public MockedMapResolverContext(IFrameworkContext frameworkContext, IHiveManager hive, IPropertyEditorFactory propertyEditorFactory, IParameterEditorFactory parameterEditorFactory)
     : base(frameworkContext, hive, propertyEditorFactory, parameterEditorFactory)
 {
 }
Ejemplo n.º 13
0
 public DocumentTypePicker(IPropertyEditorFactory propertyEditorFactory) 
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 14
0
 public TextareaEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 15
0
 public TextstringEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 16
0
 public DocumentTypePicker(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 17
0
 public TextstringEditor(IPropertyEditorFactory propertyEditorFactory) 
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 18
0
 protected ParameterEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 19
0
 public MemberTypePicker(IPropertyEditorFactory propertyEditorFactory) 
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 20
0
 public TrueFalseEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 21
0
 public UserGroupPicker(IPropertyEditorFactory propertyEditorFactory) 
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 22
0
 public UmbracoXmlImportHelper(IAttributeTypeRegistry attributeTypeRegistry, IPropertyEditorFactory propertyEditorFactory)
 {
     _attributeTypeRegistry = attributeTypeRegistry;
     _propertyEditorFactory = propertyEditorFactory;
     _Schema = XDocument.Parse(Files.Schema);
 }
Ejemplo n.º 23
0
 public ContentPickerEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 24
0
 public TextareaEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 25
0
 public ContentPickerEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 26
0
 public MemberGroupPicker(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 27
0
 public IntegerEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 28
0
 public TrueFalseEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 29
0
 public MediaTypePicker(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 {
 }
Ejemplo n.º 30
0
 public MediaPickerEditor(IPropertyEditorFactory propertyEditorFactory)
     : base(propertyEditorFactory)
 { }
Ejemplo n.º 31
0
        /// <summary>
        /// Returns a property editor from the property editor factory using a string id which must parse to a Guid
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Lazy <PropertyEditor, PropertyEditorMetadata> GetPropertyEditor(this IPropertyEditorFactory factory, string id)
        {
            Guid propEditorId;

            if (!Guid.TryParse(id, out propEditorId))
            {
                throw new InvalidCastException("The id specified is not a valid GUID");
            }
            return(factory.GetPropertyEditor(propEditorId));
        }