C# Класс Habanero.Faces.Base.ControlMapper

A superclass to model a mapper that wraps a control in order to display and capture information for an individual property of a Business Object. Think of the Control Mappers as Binding on Steriods.
Наследование: IControlMapper
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_attributes System.Collections.Hashtable
_businessObject IBusinessObject
_logger IHabaneroLogger

Private Properties

Свойство Тип Описание
AddCurrentBOPropHandlers void
AddKeyPressHandlers void
CheckReadWriteRules bool
DoesVirtualPropertyHaveSetter bool
IsPropertyReflective bool
IsPropertyViaRelationship bool
IsTypeOfIControlMapper bool
RemoveCurrentBOPropHandlers void

Открытые методы

Метод Описание
ApplyChangesToBusinessObject ( ) : void

Updates the properties on the represented business object

BOPropValueUpdatedHandler ( object sender, EventArgs e ) : void

Handler to carry out changes where the value of a business object property has changed

Create ( IControlHabanero ctl, string propertyName ) : IControlMapper

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.

Create ( Type mapperType, IControlHabanero ctl, string propertyName, bool isReadOnly, IControlFactory controlFactory ) : IControlMapper

Create a Control Mapper based on the mapperType

Create ( string mapperTypeName, IControlHabanero ctl, string propertyName ) : IControlMapper

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.

Create ( string mapperTypeName, string mapperAssembly, IControlHabanero ctl, string propertyName, bool isReadOnly, IControlFactory controlFactory ) : IControlMapper

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.

CurrentBOProp ( ) : IBOProp

Returns the IBOProp object being mapped to this control

GetErrorMessage ( ) : string

Returns the Error Provider's Error message.

SetPropertyAttributes ( Hashtable attributes ) : void

A form field can have attributes defined in the class definition. These attributes are passed to the control mapper via a hashtable so that the control mapper can adjust its behaviour accordingly.

UpdateControlValueFromBusinessObject ( ) : void

Updates the value on the control from the corresponding property on the represented IControlMapper.BusinessObject. This also updates the Error Provider with any Error Messages.

UpdateErrorProviderErrorMessage ( ) : void

Sets the Error Provider Error with the appropriate value for the property e.g. if it is invalid then sets the error provider with the invalid reason else sets the error provider with a zero length string.

Защищенные методы

Метод Описание
ControlMapper ( IControlHabanero ctl, string propName, bool isReadOnly, IControlFactory factory ) : System

Constructor to instantiate a new instance of the class

GetPropertyValue ( ) : object

Returns the property value of the business object being mapped

InitialiseWithAttributes ( ) : void

Initialises the control using the attributes already provided, using SetPropertyAttributes.

InternalUpdateControlValueFromBo ( ) : void

Updates the value on the control from the corresponding property on the represented IControlMapper.BusinessObject.

IsPropertyVirtual ( ) : bool

is the property a virtual property i.e. is it loaded via reflection or via a relationship.

OnBusinessObjectChanged ( ) : void

An overridable method to provide custom logic to carry out when the business object is changed

SetError ( string errorMessage ) : void
SetPropertyValue ( object value ) : void

Sets the property value to that provided. If the property value is invalid, the error provider will be given the reason why the value is invalid.

UpdateControlVisualState ( bool editable ) : void

Update the Visual state of the control so as to differentiate between Editable and none editable controls.

UpdateIsEditable ( ) : void

Updates the isEditable flag and updates the control according to the current state

Приватные методы

Метод Описание
AddCurrentBOPropHandlers ( ) : void
AddKeyPressHandlers ( ) : void
CheckReadWriteRules ( ) : bool
DoesVirtualPropertyHaveSetter ( ) : bool
IsPropertyReflective ( ) : bool
IsPropertyViaRelationship ( ) : bool
IsTypeOfIControlMapper ( Type mapperType ) : bool
RemoveCurrentBOPropHandlers ( ) : void

Описание методов

ApplyChangesToBusinessObject() публичный абстрактный Метод

Updates the properties on the represented business object
public abstract ApplyChangesToBusinessObject ( ) : void
Результат void

BOPropValueUpdatedHandler() публичный Метод

Handler to carry out changes where the value of a business object property has changed
public BOPropValueUpdatedHandler ( object sender, EventArgs e ) : void
sender object The object that notified of the event
e System.EventArgs Attached arguments regarding the event
Результат void

ControlMapper() защищенный Метод

Constructor to instantiate a new instance of the class
protected ControlMapper ( IControlHabanero ctl, string propName, bool isReadOnly, IControlFactory factory ) : System
ctl IControlHabanero The control object to map
propName string The property name
isReadOnly bool Whether the control is read only. /// If so, it then becomes disabled. If not, /// handlers are assigned to manage key presses.
factory IControlFactory
Результат System

Create() публичный статический Метод

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.
An exception is /// thrown if the mapperTypeName does not provide a type that is /// a subclass of the ControlMapper class.
public static Create ( IControlHabanero ctl, string propertyName ) : IControlMapper
ctl IControlHabanero The control to be mapped
propertyName string The property name
Результат IControlMapper

Create() публичный статический Метод

Create a Control Mapper based on the mapperType
public static Create ( Type mapperType, IControlHabanero ctl, string propertyName, bool isReadOnly, IControlFactory controlFactory ) : IControlMapper
mapperType System.Type
ctl IControlHabanero The control to be mapped
propertyName string The property name
isReadOnly bool Whether the control is read-only
controlFactory IControlFactory The control factory that is being set on the Mapper
Результат IControlMapper

Create() публичный статический Метод

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.
An exception is /// thrown if the mapperTypeName does not provide a type that is /// a subclass of the ControlMapper class.
public static Create ( string mapperTypeName, IControlHabanero ctl, string propertyName ) : IControlMapper
mapperTypeName string The class name of the mapper type /// (e.g. ComboBoxMapper). The current namespace of this /// ControlMapper class will then be prefixed to the name.
ctl IControlHabanero The control to be mapped
propertyName string The property name
Результат IControlMapper

Create() публичный статический Метод

Creates a new control mapper of a specified type. If no 'mapperTypeName' has been specified, an appropriate mapper for standard controls will be assigned, depending on the type of control.
An exception is /// thrown if the mapperTypeName does not provide a type that is /// a subclass of the ControlMapper class.
public static Create ( string mapperTypeName, string mapperAssembly, IControlHabanero ctl, string propertyName, bool isReadOnly, IControlFactory controlFactory ) : IControlMapper
mapperTypeName string The class name of the mapper type /// (e.g. ComboBoxMapper). The current namespace of this /// ControlMapper class will then be prefixed to the name.
mapperAssembly string The assembly where the mapper is /// located
ctl IControlHabanero The control to be mapped
propertyName string The property name
isReadOnly bool Whether the control is read-only
controlFactory IControlFactory The control factory
Результат IControlMapper

CurrentBOProp() публичный Метод

Returns the IBOProp object being mapped to this control
public CurrentBOProp ( ) : IBOProp
Результат IBOProp

GetErrorMessage() публичный Метод

Returns the Error Provider's Error message.
public GetErrorMessage ( ) : string
Результат string

GetPropertyValue() защищенный Метод

Returns the property value of the business object being mapped
protected GetPropertyValue ( ) : object
Результат object

InitialiseWithAttributes() защищенный Метод

Initialises the control using the attributes already provided, using SetPropertyAttributes.
protected InitialiseWithAttributes ( ) : void
Результат void

InternalUpdateControlValueFromBo() защищенный абстрактный Метод

Updates the value on the control from the corresponding property on the represented IControlMapper.BusinessObject.
protected abstract InternalUpdateControlValueFromBo ( ) : void
Результат void

IsPropertyVirtual() защищенный Метод

is the property a virtual property i.e. is it loaded via reflection or via a relationship.
protected IsPropertyVirtual ( ) : bool
Результат bool

OnBusinessObjectChanged() защищенный Метод

An overridable method to provide custom logic to carry out when the business object is changed
protected OnBusinessObjectChanged ( ) : void
Результат void

SetError() защищенный Метод

protected SetError ( string errorMessage ) : void
errorMessage string
Результат void

SetPropertyAttributes() публичный Метод

A form field can have attributes defined in the class definition. These attributes are passed to the control mapper via a hashtable so that the control mapper can adjust its behaviour accordingly.
public SetPropertyAttributes ( Hashtable attributes ) : void
attributes System.Collections.Hashtable A hashtable of attributes, which consists /// of name-value pairs, where name is the attribute name. This is usually /// set in the XML definitions for the class's user interface.
Результат void

SetPropertyValue() защищенный Метод

Sets the property value to that provided. If the property value is invalid, the error provider will be given the reason why the value is invalid.
protected SetPropertyValue ( object value ) : void
value object
Результат void

UpdateControlValueFromBusinessObject() публичный Метод

Updates the value on the control from the corresponding property on the represented IControlMapper.BusinessObject. This also updates the Error Provider with any Error Messages.
public UpdateControlValueFromBusinessObject ( ) : void
Результат void

UpdateControlVisualState() защищенный Метод

Update the Visual state of the control so as to differentiate between Editable and none editable controls.
protected UpdateControlVisualState ( bool editable ) : void
editable bool
Результат void

UpdateErrorProviderErrorMessage() публичный Метод

Sets the Error Provider Error with the appropriate value for the property e.g. if it is invalid then sets the error provider with the invalid reason else sets the error provider with a zero length string.
public UpdateErrorProviderErrorMessage ( ) : void
Результат void

UpdateIsEditable() защищенный Метод

Updates the isEditable flag and updates the control according to the current state
protected UpdateIsEditable ( ) : void
Результат void

Описание свойств

_attributes защищенное свойство

A Hash table of additional Attributes available for this Control Mapper e.g. for DateTimePickerMapper may have date format
protected Hashtable,System.Collections _attributes
Результат System.Collections.Hashtable

_businessObject защищенное свойство

The Business Object being mapped
protected IBusinessObject _businessObject
Результат IBusinessObject

_logger защищенное статическое свойство

the ILog used to log any messages for this class or its children
protected static IHabaneroLogger _logger
Результат IHabaneroLogger