Documentation
¶
Index ¶
- func GetInstance(key string, factory func() interfaces.IView) interfaces.IView
- func RemoveView(key string)
- type View
- func (self *View) HasMediator(mediatorName string) bool
- func (self *View) InitializeView()
- func (self *View) NotifyObservers(notification interfaces.INotification)
- func (self *View) RegisterMediator(mediator interfaces.IMediator)
- func (self *View) RegisterObserver(notificationName string, observer interfaces.IObserver)
- func (self *View) RemoveMediator(mediatorName string) interfaces.IMediator
- func (self *View) RemoveObserver(notificationName string, notifyContext interface{})
- func (self *View) RetrieveMediator(mediatorName string) interfaces.IMediator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInstance ¶
func GetInstance(key string, factory func() interfaces.IView) interfaces.IView
GetInstance View Multiton Factory method.
- parameter key: multitonKey
- parameter factory: reference that returns IView
- returns: the Multiton instance returned by executing the passed factory
func RemoveView ¶
func RemoveView(key string)
RemoveView Remove an IView instance
- parameter multitonKey: of IView instance to remove
Types ¶
type View ¶
type View struct {
Key string
// contains filtered or unexported fields
}
View A Multiton IView implementation. In PureMVC, the View class assumes these responsibilities:
* Maintain a cache of IMediator instances.
* Provide methods for registering, retrieving, and removing IMediators.
* Notifying IMediators when they are registered or removed.
* Managing the observer lists for each INotification in the application.
* Providing a method for attaching IObservers to an INotification's observer list.
* Providing a method for broadcasting an INotification.
* Notifying the IObservers of a given INotification when it broadcast.
func (*View) HasMediator ¶
HasMediator Check if a Mediator is registered or not
- parameter mediatorName:
- returns: whether a Mediator is registered with the given mediatorName.
func (*View) InitializeView ¶
func (self *View) InitializeView()
InitializeView Initialize the Multiton View instance.
Called automatically by the GetInstance, this is your opportunity to initialize the Multiton instance in your subclass without overriding the constructor.
func (*View) NotifyObservers ¶
func (self *View) NotifyObservers(notification interfaces.INotification)
NotifyObservers Notify the IObservers for a particular INotification.
All previously attached IObservers for this INotification's list are notified and are passed a reference to the INotification in the order in which they were registered.
- parameter notification: the INotification to notify IObservers of.
func (*View) RegisterMediator ¶
func (self *View) RegisterMediator(mediator interfaces.IMediator)
RegisterMediator Register an IMediator instance with the View.
Registers the IMediator so that it can be retrieved by name, and further interrogates the IMediator for its INotification interests.
If the IMediator returns any INotification names to be notified about, an Observer is created encapsulating the IMediator instance's handleNotification method and registering it as an Observer for all INotifications the IMediator is interested in.
- parameter mediator: a reference to the IMediator instance
func (*View) RegisterObserver ¶
func (self *View) RegisterObserver(notificationName string, observer interfaces.IObserver)
RegisterObserver Register an IObserver to be notified of INotifications with a given name.
- parameter notificationName: the name of the INotifications to notify this IObserver of
- parameter observer: the IObserver to register
func (*View) RemoveMediator ¶
func (self *View) RemoveMediator(mediatorName string) interfaces.IMediator
RemoveMediator Remove an IMediator from the View.
- parameter mediatorName: name of the IMediator instance to be removed.
- returns: the IMediator that was removed from the View
func (*View) RemoveObserver ¶
RemoveObserver Remove the observer for a given notifyContext from an observer list for a given Notification name.
- parameter notificationName: which observer list to remove from
- parameter notifyContext: remove the observer with this object as its notifyContext
func (*View) RetrieveMediator ¶
func (self *View) RetrieveMediator(mediatorName string) interfaces.IMediator
RetrieveMediator Retrieve an IMediator from the View.
- parameter mediatorName: the name of the IMediator instance to retrieve.
- returns: the IMediator instance previously registered with the given mediatorName.