Example #1
0
 protected override void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration property");
     Properties.EnumerationPropertyTemplate.Call(Host, ctx,
                                                 this.MembersToSerialize,
                                                 prop, true);
 }
Example #2
0
        public static void GetPropertyType(EnumerationProperty obj, MethodReturnEventArgs <Type> e)
        {
            var cls = obj.Enumeration;

            e.Result = Type.GetType(cls.Module.Namespace + "." + cls.Name + ", " + Zetbox.API.Helper.InterfaceAssembly, true);
            PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder);
        }
Example #3
0
 public EnumerationPropertyTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, EnumerationProperty prop, bool callGetterSetterEvents)
     : base(_host)
 {
     this.ctx = ctx;
     this.serializationList = serializationList;
     this.prop = prop;
     this.callGetterSetterEvents = callGetterSetterEvents;
 }
Example #4
0
 protected virtual void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration property");
     this.ApplyNotifyingValueProperty(prop, null);
     var backingStoreName = String.Format("(({0})this).{1}",
         prop.ObjectClass.Module.Namespace + "." + prop.ObjectClass.Name,
         prop.Name);
     Serialization.EnumBinarySerialization.AddToSerializers(MembersToSerialize, prop, backingStoreName);
 }
        public EnumerationPropertyTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, EnumerationProperty prop, bool callGetterSetterEvents)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.prop = prop;
			this.callGetterSetterEvents = callGetterSetterEvents;

        }
Example #6
0
        protected virtual void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
        {
            this.WriteLine("        // enumeration property");
            this.ApplyNotifyingValueProperty(prop, null);
            var backingStoreName = String.Format("(({0})this).{1}",
                                                 prop.ObjectClass.Module.Namespace + "." + prop.ObjectClass.Name,
                                                 prop.Name);

            Serialization.EnumBinarySerialization.AddToSerializers(MembersToSerialize, prop, backingStoreName);
        }
Example #7
0
 protected override void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     ApplyNotifyingValueProperty(prop, null);
     Templates.Serialization.EnumBinarySerialization.AddToSerializers(MembersToSerialize,
                                                                      prop.DisableExport == true ? Templates.Serialization.SerializerType.Binary : Templates.Serialization.SerializerType.All,
                                                                      prop.Module.Namespace,
                                                                      prop.Name,
                                                                      "Proxy." + prop.Name,
                                                                      prop.GetElementTypeString());
 }
        public void SetUp()
        {
            Initialize();

            _enumValue = MockRepository.GenerateStub <IBocEnumValue>();
            var businessObjectProvider = BindableObjectProvider.GetProvider(typeof(BindableObjectProviderAttribute));
            var propertyInfo           = PropertyInfoAdapter.Create(typeof(TypeWithEnum).GetProperty("EnumValue"));
            IBusinessObjectEnumerationProperty property =
                new EnumerationProperty(
                    new PropertyBase.Parameters(
                        (BindableObjectProvider)businessObjectProvider,
                        propertyInfo,
                        typeof(TestEnum),
                        new Lazy <Type> (() => typeof(TestEnum)),
                        null,
                        true,
                        false,
                        new BindableObjectDefaultValueStrategy(),
                        MockRepository.GenerateStub <IBindablePropertyReadAccessStrategy>(),
                        MockRepository.GenerateStub <IBindablePropertyWriteAccessStrategy>(),
                        SafeServiceLocator.Current.GetInstance <BindableObjectGlobalizationService>()));

            _enumValue.Property = property;
            _enumValue.Stub(stub => stub.ClientID).Return(c_clientID);
            _enumValue.Stub(mock => mock.IsDesignMode).Return(false);

            var pageStub = MockRepository.GenerateStub <IPage>();

            pageStub.Stub(stub => stub.WrappedInstance).Return(new PageMock());
            _enumValue.Stub(stub => stub.Page).Return(pageStub);

            var values = new List <EnumerationValueInfo> (3);

            foreach (TestEnum value in Enum.GetValues(typeof(TestEnum)))
            {
                values.Add(new EnumerationValueInfo(value, value.ToString(), value.ToString(), true));
            }
            _enumerationInfos = values.ToArray();
            _enumValue.Stub(mock => mock.GetEnabledValues()).Return(_enumerationInfos);

            _enumValue.Stub(mock => mock.GetNullItemText()).Return("null");
            _enumValue.Stub(mock => mock.GetValueName()).Return(c_valueName);

            StateBag stateBag = new StateBag();

            _enumValue.Stub(mock => mock.Attributes).Return(new AttributeCollection(stateBag));
            _enumValue.Stub(mock => mock.Style).Return(_enumValue.Attributes.CssStyle);
            _enumValue.Stub(mock => mock.LabelStyle).Return(new Style(stateBag));
            _enumValue.Stub(mock => mock.ListControlStyle).Return(new ListControlStyle());
            _enumValue.Stub(mock => mock.ControlStyle).Return(new Style(stateBag));

            _resourceUrlFactory = new FakeResourceUrlFactory();
        }
Example #9
0
        public static void AddToSerializers(SerializationMembersList list,
            EnumerationProperty prop,
            string backingStoreName)
        {
            string xmlnamespace = prop.Module.Namespace;
            string xmlname = prop.Name;
            string enumerationType = prop.GetElementTypeString();

            AddToSerializers(list,
                prop.DisableExport == true ? Templates.Serialization.SerializerType.Binary : SerializerType.All,
                xmlnamespace,
                xmlname,
                backingStoreName,
                enumerationType);
        }
Example #10
0
        public static void AddToSerializers(SerializationMembersList list,
                                            EnumerationProperty prop,
                                            string backingStoreName)
        {
            string xmlnamespace    = prop.Module.Namespace;
            string xmlname         = prop.Name;
            string enumerationType = prop.GetElementTypeString();

            AddToSerializers(list,
                             prop.DisableExport == true ? Templates.Serialization.SerializerType.Binary : SerializerType.All,
                             xmlnamespace,
                             xmlname,
                             backingStoreName,
                             enumerationType);
        }
Example #11
0
 protected virtual void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration property");
     this.ApplyNotifyingValueProperty(prop, null);
     var backingStoreName = String.Format("this._{0}", prop.Name);
     if (prop.DefaultValue != null)
     {
         var isSetFlagName = String.Format("_is{0}Set", prop.Name);
         Serialization.EnumWithDefaultBinarySerialization.AddToSerializers(MembersToSerialize, prop, backingStoreName, isSetFlagName);
     }
     else
     {
         Serialization.EnumBinarySerialization.AddToSerializers(MembersToSerialize, prop, backingStoreName);
     }
 }
 public static void GetElementTypeString(EnumerationProperty obj, MethodReturnEventArgs<string> e)
 {
     var cls = obj.Enumeration;
     if (cls == null)
     {
         e.Result = "<no enum>";
     }
     else if (cls.Module == null)
     {
         e.Result = "<no namespace>." + cls.Name;
     }
     else
     {
         e.Result = cls.Module.Namespace + "." + cls.Name;
     }
     PropertyActions.DecorateElementType(obj, e, true);
 }
Example #13
0
        public static void GetElementTypeString(EnumerationProperty obj, MethodReturnEventArgs <string> e)
        {
            var cls = obj.Enumeration;

            if (cls == null)
            {
                e.Result = "<no enum>";
            }
            else if (cls.Module == null)
            {
                e.Result = "<no namespace>." + cls.Name;
            }
            else
            {
                e.Result = cls.Module.Namespace + "." + cls.Name;
            }
            PropertyActions.DecorateElementType(obj, e, true);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Type                itemType     = GetType();
            PropertyInfo        propertyInfo = itemType.GetProperty("ConformanceLevel");
            EnumerationProperty property     = new EnumerationProperty(
                new PropertyBase.Parameters(
                    (BindableObjectProvider)BusinessObjectProvider.GetProvider <BindableObjectProviderAttribute>(),
                    PropertyInfoAdapter.Create(propertyInfo),
                    propertyInfo.PropertyType,
                    new Lazy <Type> (() => propertyInfo.PropertyType),
                    null,
                    false,
                    false,
                    new BindableObjectDefaultValueStrategy(),
                    SafeServiceLocator.Current.GetInstance <IBindablePropertyReadAccessStrategy>(),
                    SafeServiceLocator.Current.GetInstance <IBindablePropertyWriteAccessStrategy>(),
                    SafeServiceLocator.Current.GetInstance <BindableObjectGlobalizationService>()));

            WaiConformanceLevelField.Property = property;
            WaiConformanceLevelField.LoadUnboundValue(ConformanceLevel, IsPostBack);
        }
Example #15
0
 public static void GetPropertyTypeString(EnumerationProperty obj, MethodReturnEventArgs <string> e)
 {
     GetElementTypeString(obj, e);
     PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder);
 }
Example #16
0
 public EnumerationPropertyValueModel(INotifyingObject obj, EnumerationProperty prop)
     : base(obj, prop)
 {
     enumProp = prop;
 }
Example #17
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, EnumerationProperty prop, bool callGetterSetterEvents)
        {
            if (_host == null)
            {
                throw new global::System.ArgumentNullException("_host");
            }

            _host.CallTemplate("Properties.EnumerationPropertyTemplate", ctx, serializationList, prop, callGetterSetterEvents);
        }
Example #18
0
 protected virtual void ApplyEnumerationListTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration list property");
     ApplyListProperty(prop, this.MembersToSerialize);
 }
Example #19
0
 protected override void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     ApplyNotifyingValueProperty(prop, null);
     Templates.Serialization.EnumBinarySerialization.AddToSerializers(MembersToSerialize,
         prop.DisableExport == true ? Templates.Serialization.SerializerType.Binary : Templates.Serialization.SerializerType.All,
         prop.Module.Namespace,
         prop.Name,
         "Proxy." + prop.Name,
         prop.GetElementTypeString());
 }
Example #20
0
 protected override void ApplyEnumerationListTemplate(EnumerationProperty prop)
 {
     base.ApplyEnumerationListTemplate(prop);
 }
Example #21
0
 get => (Enum)GetValue(EnumerationProperty); set => SetValue(EnumerationProperty, value);
 public static void GetPropertyType(EnumerationProperty obj, MethodReturnEventArgs<Type> e)
 {
     var cls = obj.Enumeration;
     e.Result = Type.GetType(cls.Module.Namespace + "." + cls.Name + ", " + Zetbox.API.Helper.InterfaceAssembly, true);
     PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder);
 }
        public static void Call(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, EnumerationProperty prop, bool callGetterSetterEvents)
        {
            if (_host == null) { throw new global::System.ArgumentNullException("_host"); }

            _host.CallTemplate("Properties.EnumerationPropertyTemplate", ctx, serializationList, prop, callGetterSetterEvents);
        }
 public static void GetPropertyTypeString(EnumerationProperty obj, MethodReturnEventArgs<string> e)
 {
     GetElementTypeString(obj, e);
     PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder);
 }
Example #25
0
 protected virtual void ApplyEnumerationListTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration list property");
     ApplyListProperty(prop, this.MembersToSerialize);
 }
Example #26
0
 protected override void ApplyEnumerationPropertyTemplate(EnumerationProperty prop)
 {
     this.WriteLine("        // enumeration property");
     Properties.EnumerationPropertyTemplate.Call(Host, ctx,
         this.MembersToSerialize,
         prop, true);
 }
Example #27
0
 protected override void ApplyEnumerationListTemplate(EnumerationProperty prop)
 {
     base.ApplyEnumerationListTemplate(prop);
 }