public List <EmployeeDTO> getEmployees() { var employees = new List <EmployeeDTO>(); var data = new DataAccessFacade().executeRequest(1, ConfigurationManager.AppSettings["Method"], new List <Parameter>(), ConfigurationManager.AppSettings["ApiUrl"]); var roleAdapter = AdapterCreator.getInstance().getFactory("Role"); Adapter employeeAdapter; for (var i = 0; i < data.Count(); i++) { var role = (RoleDTO)roleAdapter.create(data, i); if (data.getDato(i).getStringField("contractTypeName") == "HourlySalaryEmployee") { employeeAdapter = AdapterCreator.getInstance().getFactory("HourlyEmployee"); } else { employeeAdapter = AdapterCreator.getInstance().getFactory("MonthlyEmployee"); } var employee = (EmployeeDTO)employeeAdapter.create(data, i); employee.role = role; employees.Add(employee); } return(employees); }
public void TestCanAdapt() { AdapterCreator <SimpleAdapter> creator = new AdapterCreator <SimpleAdapter>(); // test CanAdapt Assert.True(creator.CanAdapt(this, typeof(ISimpleInterface))); Assert.False(creator.CanAdapt(this, typeof(string))); }
public void TestCanAdapt() { AdapterCreator<SimpleAdapter> creator = new AdapterCreator<SimpleAdapter>(); // test CanAdapt Assert.True(creator.CanAdapt(this, typeof(ISimpleInterface))); Assert.False(creator.CanAdapt(this, typeof(string))); }
protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // register extensions Schema.storyType.Type.Define(new ExtensionInfo<Story>()); Schema.storyType.Type.Define(new ExtensionInfo<StoryDocument>()); Schema.storyType.Type.Define(new ExtensionInfo<StoryContext>()); Schema.storyType.Type.Define(new ExtensionInfo<ReferenceValidator>()); Schema.storyType.Type.Define(new ExtensionInfo<UniqueIdValidator>()); Schema.storyType.Type.Define(new ExtensionInfo<DomNodeQueryable>()); Schema.settingsType.Type.Define(new ExtensionInfo<Settings>()); Schema.settingsType.Type.Define(new ExtensionInfo<CharacterSettingsContext>()); Schema.characterType.Type.Define(new ExtensionInfo<Character>()); // Enable metadata driven property editing for events and resources var creator = new AdapterCreator<CustomTypeDescriptorNodeAdapter>(); Schema.characterType.Type.AddAdapterCreator(creator); Schema.characterType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.characterType.nameAttribute, null, "Name".Localize(), false), new AttributePropertyDescriptor( "Alternative Names".Localize(), Schema.characterType.altNamesAttribute, null, "List of Alternative Names".Localize(), false, new StringArrayEditor()), new AttributePropertyDescriptor( "Age".Localize(), Schema.characterType.ageAttribute, null, "Age".Localize(), false), })); } }
protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // register extensions Schema.storyType.Type.Define(new ExtensionInfo <Story>()); Schema.storyType.Type.Define(new ExtensionInfo <StoryDocument>()); Schema.storyType.Type.Define(new ExtensionInfo <StoryContext>()); Schema.storyType.Type.Define(new ExtensionInfo <ReferenceValidator>()); Schema.storyType.Type.Define(new ExtensionInfo <UniqueIdValidator>()); Schema.storyType.Type.Define(new ExtensionInfo <DomNodeQueryable>()); Schema.settingsType.Type.Define(new ExtensionInfo <Settings>()); Schema.settingsType.Type.Define(new ExtensionInfo <CharacterSettingsContext>()); Schema.characterType.Type.Define(new ExtensionInfo <Character>()); // Enable metadata driven property editing for events and resources var creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); Schema.characterType.Type.AddAdapterCreator(creator); Schema.characterType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.characterType.nameAttribute, null, "Name".Localize(), false), new AttributePropertyDescriptor( "Alternative Names".Localize(), Schema.characterType.altNamesAttribute, null, "List of Alternative Names".Localize(), false, new StringArrayEditor()), new AttributePropertyDescriptor( "Age".Localize(), Schema.characterType.ageAttribute, null, "Age".Localize(), false), })); } }
public void TestGetAdapter() { AdapterCreator<SimpleAdapter> creator = new AdapterCreator<SimpleAdapter>(); object obj; // test successful request (SimpleAdapter implements ISimpleInterface) obj = creator.GetAdapter(this, typeof(ISimpleInterface)); SimpleAdapter simpleAdapter = obj as SimpleAdapter; Assert.NotNull(simpleAdapter); Assert.AreSame(simpleAdapter.Adaptee, this); // test failed request (SimpleAdapter is not a string) obj = creator.GetAdapter(this, typeof(string)); Assert.Null(obj); }
public void TestGetAdapter() { AdapterCreator <SimpleAdapter> creator = new AdapterCreator <SimpleAdapter>(); object obj; // test successful request (SimpleAdapter implements ISimpleInterface) obj = creator.GetAdapter(this, typeof(ISimpleInterface)); SimpleAdapter simpleAdapter = obj as SimpleAdapter; Assert.NotNull(simpleAdapter); Assert.AreSame(simpleAdapter.Adaptee, this); // test failed request (SimpleAdapter is not a string) obj = creator.GetAdapter(this, typeof(string)); Assert.Null(obj); }
/// <summary> /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen. /// Defines DOM adapters on the DOM types.</summary> /// <param name="schemaSet">XML schema sets being loaded</param> protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_namespace = typeCollection.TargetNamespace; m_typeCollection = typeCollection; bitBoxSchema.Initialize(typeCollection); bitBoxSchema.graphType.Type.Define(new ExtensionInfo <SceneEditingContext>()); bitBoxSchema.graphType.Type.Define(new ExtensionInfo <NodeEditingContext>()); bitBoxSchema.graphType.Type.Define(new ExtensionInfo <SceneDocument>()); //bitBoxSchema.graphType.Type.Define(new ExtensionInfo<UniqueIdValidator>()); // register extensions //bitBoxSchema.graphType.Type.Define(new ExtensionInfo<Game>()); //bitBoxSchema.graphType.Type.Define(new ExtensionInfo<ReferenceValidator>()); //bitBoxSchema.graphType.Type.Define(new ExtensionInfo<UniqueIdValidator>()); // //bitBoxSchema.nodeType.Type.Define(new ExtensionInfo<GameObject>()); //bitBoxSchema.MeshNode.Type.Define(new ExtensionInfo<Dwarf>()); //bitBoxSchema.MeshNode.Type.Define(new ExtensionInfo<MeshNode>()); var creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); foreach (DomNodeType type in GetNodeTypes(bitBoxSchema.nodeType.Type)) { type.AddAdapterCreator(creator); string defaultNodeName = type.Name.Split(':').Last().Replace("Node", ""); type.SetTag(new NodeTypePaletteItem(type, defaultNodeName, defaultNodeName.Localize(), null)); PropertyDescriptorCollection propDescs = new PropertyDescriptorCollection(null); foreach (AttributeInfo attr in type.Attributes) { IPropertyEditor editor = PropertyEditorFactory.createEditorForAttribute(attr); AttributePropertyDescriptor attributePropDesc = new AttributePropertyDescriptor(attr.Name.Localize(), attr, "Attributes".Localize(), null, false, editor); propDescs.Add(attributePropDesc); } type.SetTag(propDescs); } break; } }
/// <summary> /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen. /// Defines DOM adapters on the DOM types. /// Sets up information for types in palette. Constructs PropertyDescriptors for types.</summary> /// <param name="schemaSet">XML schema sets being loaded</param> protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_namespace = typeCollection.TargetNamespace; m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // Enable metadata driven property editing for events and resources var creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); Schema.eventType.Type.AddAdapterCreator(creator); Schema.resourceType.Type.AddAdapterCreator(creator); break; // schema only defines one type collection } }
static DomTypes() { // register extensions eventType.Type.Define(new ExtensionInfo <Event>()); // Enable metadata driven property editing for events and resources AdapterCreator <CustomTypeDescriptorNodeAdapter> creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); eventType.Type.AddAdapterCreator(creator); // annotate types with display information for palette eventType.Type.SetTag( new NodeTypePaletteItem( eventType.Type, Localizer.Localize("Event"), Localizer.Localize("Event in a sequence"), Resources.FactoryImage)); // register property descriptors on state, transition, folder types eventType.Type.SetTag( new System.ComponentModel.PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), eventType.nameAttribute, null, Localizer.Localize("Event name"), false), new AttributePropertyDescriptor( Localizer.Localize("Time"), eventType.timeAttribute, null, Localizer.Localize("Event starting time"), false), new AttributePropertyDescriptor( Localizer.Localize("Duration"), eventType.durationAttribute, null, Localizer.Localize("Event duration"), false), })); }
static DomTypes() { // register extensions eventType.Type.Define(new ExtensionInfo<Event>()); // Enable metadata driven property editing for events and resources AdapterCreator<CustomTypeDescriptorNodeAdapter> creator = new AdapterCreator<CustomTypeDescriptorNodeAdapter>(); eventType.Type.AddAdapterCreator(creator); // annotate types with display information for palette eventType.Type.SetTag( new NodeTypePaletteItem( eventType.Type, Localizer.Localize("Event"), Localizer.Localize("Event in a sequence"), Resources.FactoryImage)); // register property descriptors on state, transition, folder types eventType.Type.SetTag( new System.ComponentModel.PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), eventType.nameAttribute, null, Localizer.Localize("Event name"), false), new AttributePropertyDescriptor( Localizer.Localize("Time"), eventType.timeAttribute, null, Localizer.Localize("Event starting time"), false), new AttributePropertyDescriptor( Localizer.Localize("Duration"), eventType.durationAttribute, null, Localizer.Localize("Event duration"), false), })); }
/// <summary> /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen. /// Defines DOM adapters on the DOM types. /// Sets up information for types in palette. Constructs PropertyDescriptors for types.</summary> /// <param name="schemaSet">XML schema sets being loaded</param> protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_namespace = typeCollection.TargetNamespace; m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // register extensions Schema.eventSequenceType.Type.Define(new ExtensionInfo <EventSequenceDocument>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <EventSequenceContext>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <MultipleHistoryContext>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <EventSequence>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <ReferenceValidator>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <UniqueIdValidator>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo <DomNodeQueryable>()); Schema.eventType.Type.Define(new ExtensionInfo <Event>()); Schema.eventType.Type.Define(new ExtensionInfo <ResourceListContext>()); Schema.resourceType.Type.Define(new ExtensionInfo <Resource>()); // Enable metadata driven property editing for events and resources var creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); Schema.eventType.Type.AddAdapterCreator(creator); Schema.resourceType.Type.AddAdapterCreator(creator); // annotate types with display information for palette Schema.eventType.Type.SetTag( new NodeTypePaletteItem( Schema.eventType.Type, "Event".Localize(), "Event in a sequence".Localize(), "Events".Localize(), Resources.EventImage)); string resourcesCategory = "Resources".Localize(); Schema.animationResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.animationResourceType.Type, "Animation".Localize(), "Animation resource".Localize(), resourcesCategory, Resources.AnimationImage)); Schema.geometryResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.geometryResourceType.Type, "Geometry".Localize(), "Geometry resource".Localize(), resourcesCategory, Resources.GeometryImage)); // register property descriptors on state, transition, folder types Schema.eventType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.eventType.nameAttribute, null, "Event name".Localize(), false), new AttributePropertyDescriptor( "Time".Localize(), Schema.eventType.timeAttribute, null, "Event starting time".Localize(), false), new AttributePropertyDescriptor( "Duration".Localize(), Schema.eventType.durationAttribute, null, "Event duration".Localize(), false), })); Schema.animationResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.animationResourceType.nameAttribute, null, "Animation name".Localize(), false), new AttributePropertyDescriptor( "Size".Localize(), Schema.animationResourceType.sizeAttribute, null, "Size of animation, in bytes".Localize(), true), new AttributePropertyDescriptor( "# Tracks".Localize(), Schema.animationResourceType.tracksAttribute, null, "Number of tracks in animation".Localize(), true), new AttributePropertyDescriptor( "Duration".Localize(), Schema.animationResourceType.durationAttribute, null, "Duration of animation, in milliseconds".Localize(), true), new AttributePropertyDescriptor( "Compressed".Localize(), Schema.animationResourceType.compressedAttribute, null, "Whether or not animation is compressed".Localize(), false, null), })); var primitiveKinds = new string[] { "Lines", "Line_Strips", "Polygons", "Polylist", "Triangles", "Triangle_Strips", "Bezier_Curves", "Bezier_Surfaces", "Subdivision_Surfaces" }; // TODO: Seems like default values for enums should be set automatically by XmlSchemaTypeLoader. Schema.geometryResourceType.primitiveTypeAttribute.DefaultValue = primitiveKinds[0]; Schema.geometryResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.geometryResourceType.nameAttribute, null, "Geometry name".Localize(), false), new AttributePropertyDescriptor( "Size".Localize(), Schema.geometryResourceType.sizeAttribute, null, "Size of geometry, in bytes".Localize(), true), new AttributePropertyDescriptor( "# Bones".Localize(), Schema.geometryResourceType.bonesAttribute, null, "Number of bones in geometry".Localize(), true), new AttributePropertyDescriptor( "# Vertices".Localize(), Schema.geometryResourceType.verticesAttribute, null, "Number of vertices in geometry".Localize(), true), new AttributePropertyDescriptor( "Primitive Kind".Localize(), Schema.geometryResourceType.primitiveTypeAttribute, null, "Kind of primitives in geometry".Localize(), false, StandardValuesEditor.Instance, null, new Attribute[] { new StandardValuesAttribute(primitiveKinds) }) })); break; // schema only defines one type collection } }
/// <summary> /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen. /// Defines DOM adapters on the DOM types. /// Sets up information for types in palette. Constructs PropertyDescriptors for types.</summary> /// <param name="schemaSet">XML schema sets being loaded</param> protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_namespace = typeCollection.TargetNamespace; m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // register extensions Schema.eventSequenceType.Type.Define(new ExtensionInfo<EventSequenceDocument>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<EventSequenceContext>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<MultipleHistoryContext>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<EventSequence>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<ReferenceValidator>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<UniqueIdValidator>()); Schema.eventSequenceType.Type.Define(new ExtensionInfo<DomNodeQueryable>()); Schema.eventType.Type.Define(new ExtensionInfo<Event>()); Schema.eventType.Type.Define(new ExtensionInfo<EventContext>()); Schema.resourceType.Type.Define(new ExtensionInfo<Resource>()); // Enable metadata driven property editing for events and resources var creator = new AdapterCreator<CustomTypeDescriptorNodeAdapter>(); Schema.eventType.Type.AddAdapterCreator(creator); Schema.resourceType.Type.AddAdapterCreator(creator); // annotate types with display information for palette Schema.eventType.Type.SetTag( new NodeTypePaletteItem( Schema.eventType.Type, "Event".Localize(), "Event in a sequence".Localize(), Resources.EventImage)); Schema.animationResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.animationResourceType.Type, "Animation".Localize(), "Animation resource".Localize(), Resources.AnimationImage)); Schema.geometryResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.geometryResourceType.Type, "Geometry".Localize(), "Geometry resource".Localize(), Resources.GeometryImage)); // register property descriptors on state, transition, folder types Schema.eventType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.eventType.nameAttribute, null, "Event name".Localize(), false), new AttributePropertyDescriptor( "Time".Localize(), Schema.eventType.timeAttribute, null, "Event starting time".Localize(), false), new AttributePropertyDescriptor( "Duration".Localize(), Schema.eventType.durationAttribute, null, "Event duration".Localize(), false), })); Schema.animationResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.animationResourceType.nameAttribute, null, "Animation name".Localize(), false), new AttributePropertyDescriptor( "Size".Localize(), Schema.animationResourceType.sizeAttribute, null, "Size of animation, in bytes".Localize(), true), new AttributePropertyDescriptor( "# Tracks".Localize(), Schema.animationResourceType.tracksAttribute, null, "Number of tracks in animation".Localize(), true), new AttributePropertyDescriptor( "Duration".Localize(), Schema.animationResourceType.durationAttribute, null, "Duration of animation, in milliseconds".Localize(), true), new AttributePropertyDescriptor( "Compressed".Localize(), Schema.animationResourceType.compressedAttribute, null, "Whether or not animation is compressed".Localize(), false, new BoolEditor()), })); var primitiveKinds = new string[] { "Lines", "Line_Strips", "Polygons", "Polylist", "Triangles", "Triangle_Strips", "Bezier_Curves", "Bezier_Surfaces", "Subdivision_Surfaces" }; // TODO: Seems like default values for enums should be set automatically by XmlSchemaTypeLoader. Schema.geometryResourceType.primitiveTypeAttribute.DefaultValue = primitiveKinds[0]; Schema.geometryResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( "Name".Localize(), Schema.geometryResourceType.nameAttribute, null, "Geometry name".Localize(), false), new AttributePropertyDescriptor( "Size".Localize(), Schema.geometryResourceType.sizeAttribute, null, "Size of geometry, in bytes".Localize(), true), new AttributePropertyDescriptor( "# Bones".Localize(), Schema.geometryResourceType.bonesAttribute, null, "Number of bones in geometry".Localize(), true), new AttributePropertyDescriptor( "# Vertices".Localize(), Schema.geometryResourceType.verticesAttribute, null, "Number of vertices in geometry".Localize(), true), new AttributePropertyDescriptor( "Primitive Kind".Localize(), Schema.geometryResourceType.primitiveTypeAttribute, null, "Kind of primitives in geometry".Localize(), false, new EnumUITypeEditor(primitiveKinds), new EnumTypeConverter(primitiveKinds)), })); break; // schema only defines one type collection } }
/// <summary> /// Static constructor, add type information for palette and setting up property descriptors</summary> static DomTypes() { // register extensions eventSequenceType.Type.Define(new ExtensionInfo <EventSequenceDocument>()); eventSequenceType.Type.Define(new ExtensionInfo <EventSequenceContext>()); eventSequenceType.Type.Define(new ExtensionInfo <MultipleHistoryContext>()); eventSequenceType.Type.Define(new ExtensionInfo <EventSequence>()); eventSequenceType.Type.Define(new ExtensionInfo <ReferenceValidator>()); eventSequenceType.Type.Define(new ExtensionInfo <UniqueIdValidator>()); eventSequenceType.Type.Define(new ExtensionInfo <DomNodeQueryable>()); eventType.Type.Define(new ExtensionInfo <Event>()); eventType.Type.Define(new ExtensionInfo <EventContext>()); resourceType.Type.Define(new ExtensionInfo <Resource>()); // Enable metadata driven property editing for events and resources AdapterCreator <CustomTypeDescriptorNodeAdapter> creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); eventType.Type.AddAdapterCreator(creator); resourceType.Type.AddAdapterCreator(creator); // annotate types with display information for palette eventType.Type.SetTag( new NodeTypePaletteItem( eventType.Type, Localizer.Localize("Event"), Localizer.Localize("Event in a sequence"), Resources.EventImage)); animationResourceType.Type.SetTag( new NodeTypePaletteItem( animationResourceType.Type, Localizer.Localize("Animation"), Localizer.Localize("Animation resource"), Resources.AnimationImage)); geometryResourceType.Type.SetTag( new NodeTypePaletteItem( geometryResourceType.Type, Localizer.Localize("Geometry"), Localizer.Localize("Geometry resource"), Resources.GeometryImage)); // register property descriptors on state, transition, folder types eventType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), eventType.nameAttribute, null, Localizer.Localize("Event name"), false), new AttributePropertyDescriptor( Localizer.Localize("Time"), eventType.timeAttribute, null, Localizer.Localize("Event starting time"), false), new AttributePropertyDescriptor( Localizer.Localize("Duration"), eventType.durationAttribute, null, Localizer.Localize("Event duration"), false), })); animationResourceType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), animationResourceType.nameAttribute, null, Localizer.Localize("Animation name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), animationResourceType.sizeAttribute, null, Localizer.Localize("Size of animation, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Tracks"), animationResourceType.tracksAttribute, null, Localizer.Localize("Number of tracks in animation"), true), new AttributePropertyDescriptor( Localizer.Localize("Duration"), animationResourceType.durationAttribute, null, Localizer.Localize("Duration of animation, in milliseconds"), true), new AttributePropertyDescriptor( Localizer.Localize("Compressed"), animationResourceType.compressedAttribute, null, Localizer.Localize("Whether or not animation is compressed"), false, new BoolEditor()), })); geometryResourceType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), geometryResourceType.nameAttribute, null, Localizer.Localize("Geometry name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), geometryResourceType.sizeAttribute, null, Localizer.Localize("Size of geometry, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Bones"), geometryResourceType.bonesAttribute, null, Localizer.Localize("Number of bones in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("# Vertices"), geometryResourceType.verticesAttribute, null, Localizer.Localize("Number of vertices in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("Primitive Kind"), geometryResourceType.primitiveTypeAttribute, null, Localizer.Localize("Kind of primitives in geometry"), false, new EnumUITypeEditor(primitiveKinds), new EnumTypeConverter(primitiveKinds)), })); }
/// <summary> /// Static constructor</summary> static DomTypes() { // register extensions eventSequenceType.Type.Define(new ExtensionInfo<EventSequenceDocument>()); eventSequenceType.Type.Define(new ExtensionInfo<EventSequenceContext>()); eventSequenceType.Type.Define(new ExtensionInfo<MultipleHistoryContext>()); eventSequenceType.Type.Define(new ExtensionInfo<EventSequence>()); eventSequenceType.Type.Define(new ExtensionInfo<ReferenceValidator>()); eventSequenceType.Type.Define(new ExtensionInfo<UniqueIdValidator>()); eventSequenceType.Type.Define(new ExtensionInfo<DomNodeQueryable>()); eventType.Type.Define(new ExtensionInfo<Event>()); eventType.Type.Define(new ExtensionInfo<EventContext>()); resourceType.Type.Define(new ExtensionInfo<Resource>()); // Enable metadata driven property editing for events and resources AdapterCreator<CustomTypeDescriptorNodeAdapter> creator = new AdapterCreator<CustomTypeDescriptorNodeAdapter>(); eventType.Type.AddAdapterCreator(creator); resourceType.Type.AddAdapterCreator(creator); // annotate types with display information for palette eventType.Type.SetTag( new NodeTypePaletteItem( eventType.Type, Localizer.Localize("Event"), Localizer.Localize("Event in a sequence"), Resources.EventImage)); animationResourceType.Type.SetTag( new NodeTypePaletteItem( animationResourceType.Type, Localizer.Localize("Animation"), Localizer.Localize("Animation resource"), Resources.AnimationImage)); geometryResourceType.Type.SetTag( new NodeTypePaletteItem( geometryResourceType.Type, Localizer.Localize("Geometry"), Localizer.Localize("Geometry resource"), Resources.GeometryImage)); // register property descriptors on state, transition, folder types eventType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), eventType.nameAttribute, null, Localizer.Localize("Event name"), false), new AttributePropertyDescriptor( Localizer.Localize("Time"), eventType.timeAttribute, null, Localizer.Localize("Event starting time"), false), new AttributePropertyDescriptor( Localizer.Localize("Duration"), eventType.durationAttribute, null, Localizer.Localize("Event duration"), false), })); animationResourceType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), animationResourceType.nameAttribute, null, Localizer.Localize("Animation name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), animationResourceType.sizeAttribute, null, Localizer.Localize("Size of animation, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Tracks"), animationResourceType.tracksAttribute, null, Localizer.Localize("Number of tracks in animation"), true), new AttributePropertyDescriptor( Localizer.Localize("Duration"), animationResourceType.durationAttribute, null, Localizer.Localize("Duration of animation, in milliseconds"), true), new AttributePropertyDescriptor( Localizer.Localize("Compressed"), animationResourceType.compressedAttribute, null, Localizer.Localize("Whether or not animation is compressed"), false, new BoolEditor()), })); geometryResourceType.Type.SetTag( new PropertyDescriptorCollection( new Sce.Atf.Dom.PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), geometryResourceType.nameAttribute, null, Localizer.Localize("Geometry name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), geometryResourceType.sizeAttribute, null, Localizer.Localize("Size of geometry, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Bones"), geometryResourceType.bonesAttribute, null, Localizer.Localize("Number of bones in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("# Vertices"), geometryResourceType.verticesAttribute, null, Localizer.Localize("Number of vertices in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("Primitive Kind"), geometryResourceType.primitiveTypeAttribute, null, Localizer.Localize("Kind of primitives in geometry"), false, new EnumUITypeEditor(primitiveKinds), new EnumTypeConverter(primitiveKinds)), })); }
/// <summary> /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen. /// Defines DOM adapters for types. Adds information for palette to types. /// Adds PropertyDescriptors to types for property editors.</summary> /// <param name="schemaSet">XML schema sets being loaded</param> protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet) { foreach (XmlSchemaTypeCollection typeCollection in GetTypeCollections()) { m_namespace = typeCollection.TargetNamespace; m_typeCollection = typeCollection; Schema.Initialize(typeCollection); // register extensions Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <WinGuiCommonDataDocument>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <WinGuiCommonDataContext>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <WinGuiWpfDataDocument>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <WinGuiWpfDataContext>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <MultipleHistoryContext>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <WinGuiCommonData>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <ReferenceValidator>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <UniqueIdValidator>()); Schema.winGuiCommonDataType.Type.Define(new ExtensionInfo <DomNodeQueryable>()); Schema.eventType.Type.Define(new ExtensionInfo <WinGuiCommon.Event>()); Schema.eventType.Type.Define(new ExtensionInfo <EventContext>()); Schema.resourceType.Type.Define(new ExtensionInfo <WinGuiCommon.Resource>()); // Enable metadata driven property editing for events and resources AdapterCreator <CustomTypeDescriptorNodeAdapter> creator = new AdapterCreator <CustomTypeDescriptorNodeAdapter>(); Schema.eventType.Type.AddAdapterCreator(creator); Schema.resourceType.Type.AddAdapterCreator(creator); // annotate types with display information for palette Schema.eventType.Type.SetTag( new NodeTypePaletteItem( Schema.eventType.Type, Localizer.Localize("Event"), Localizer.Localize("Event in a sequence"), WinGuiCommon.Resources.EventImage)); Schema.animationResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.animationResourceType.Type, Localizer.Localize("Animation"), Localizer.Localize("Animation resource"), WinGuiCommon.Resources.AnimationImage)); Schema.geometryResourceType.Type.SetTag( new NodeTypePaletteItem( Schema.geometryResourceType.Type, Localizer.Localize("Geometry"), Localizer.Localize("Geometry resource"), WinGuiCommon.Resources.GeometryImage)); // register property descriptors on state, transition, folder types Schema.eventType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), Schema.eventType.nameAttribute, null, Localizer.Localize("Event name"), false), new AttributePropertyDescriptor( Localizer.Localize("Time"), Schema.eventType.timeAttribute, null, Localizer.Localize("Event starting time"), false), new AttributePropertyDescriptor( Localizer.Localize("Duration"), Schema.eventType.durationAttribute, null, Localizer.Localize("Event duration"), false), })); Schema.animationResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), Schema.animationResourceType.nameAttribute, null, Localizer.Localize("Animation name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), Schema.animationResourceType.sizeAttribute, null, Localizer.Localize("Size of animation, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Tracks"), Schema.animationResourceType.tracksAttribute, null, Localizer.Localize("Number of tracks in animation"), true), new AttributePropertyDescriptor( Localizer.Localize("Duration"), Schema.animationResourceType.durationAttribute, null, Localizer.Localize("Duration of animation, in milliseconds"), true), new AttributePropertyDescriptor( Localizer.Localize("Compressed"), Schema.animationResourceType.compressedAttribute, null, Localizer.Localize("Whether or not animation is compressed"), false, new BoolEditor()), })); string[] primitiveKinds = new string[] { "Lines", "Line_Strips", "Polygons", "Polylist", "Triangles", "Triangle_Strips", "Bezier_Curves", "Bezier_Surfaces", "Subdivision_Surfaces" }; Schema.geometryResourceType.Type.SetTag( new PropertyDescriptorCollection( new PropertyDescriptor[] { new AttributePropertyDescriptor( Localizer.Localize("Name"), Schema.geometryResourceType.nameAttribute, null, Localizer.Localize("Geometry name"), false), new AttributePropertyDescriptor( Localizer.Localize("Size"), Schema.geometryResourceType.sizeAttribute, null, Localizer.Localize("Size of geometry, in bytes"), true), new AttributePropertyDescriptor( Localizer.Localize("# Bones"), Schema.geometryResourceType.bonesAttribute, null, Localizer.Localize("Number of bones in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("# Vertices"), Schema.geometryResourceType.verticesAttribute, null, Localizer.Localize("Number of vertices in geometry"), true), new AttributePropertyDescriptor( Localizer.Localize("Primitive Kind"), Schema.geometryResourceType.verticesAttribute, null, Localizer.Localize("Kind of primitives in geometry"), true, new EnumUITypeEditor(primitiveKinds), new EnumTypeConverter(primitiveKinds)), })); break; // schema only defines one type collection } }