public interface IComponentSubject
extends java.io.Serializable
This is the subject element of the observer design pattern.
It will register the enumeration element with a list of components. Each registered component has all methods needed to set all relevant information.
Each observer element has two elements it stores in a private
class. The first element is the component itself and the second is a boolean
value, which provides the caller if this component should react on the
notify(IEData, EViewElement, Object)
method or not. By
registering an element with the methods register(IEData)
or register(IEData, IViewComponent)
the corresponding component is
enabled by the notify method (i.e. set to true). So each stored
component reacts on the notify(IEData, EViewElement, Object)
method.
notify(IEData, EViewElement, Object)
,
register(IEData)
,
register(IEData, IViewComponent)
Modifier and Type | Method and Description |
---|---|
boolean |
contains(IEData data_)
Returns if this data component is stored in the internal data value.
|
java.util.Collection<IViewComponent> |
fetchComponents(IEData data_)
Fetches all components of the specified enumeration.
|
java.util.Collection<IEData> |
fetchObservers()
Returns all observer enumeration objects as a collection.
|
boolean |
isIgnored(IEData data_)
Fetches the ignore flag of the specified data enumeration element.
|
boolean |
isRegisterEnabled(IEData data_,
IViewComponent component_)
Provides the caller if the current data enumeration and the component
itself is enabled or not.
|
void |
notify(IEData data_,
EViewElement view_)
Notifies all instance of the corresponding data element and executes
the view element.
|
void |
notify(IEData data_,
EViewElement view_,
java.lang.Object object_)
Will notify all component instances that the current object has changed.
|
void |
register(IEData data_)
Registers the data element to the component subject instance.
|
void |
register(IEData data_,
IViewComponent component_)
This will register to an enumeration type a component.
|
void |
remove(IEData data_)
Removes the enumeration object and destroys all object which are stored
under the enumeration.
|
void |
setRegisterEnabled(IEData data_,
IViewComponent component_,
boolean enabled_)
Sets the data enumeration and the component itself to be enabled or
not depending on the boolean value.
|
boolean isRegisterEnabled(IEData data_, IViewComponent component_)
data_
- Enumeration interface element.component_
- Is the viewable component.boolean isIgnored(IEData data_)
false
is returned.data_
- Data enumeration element.void setRegisterEnabled(IEData data_, IViewComponent component_, boolean enabled_)
notify(IEData, EViewElement, Object)
method if the
component should act on the method notify or not.data_
- Is the enumeration interface of the data component.component_
- Is the component to which to set the boolean value.enabled_
- Is a boolean value, which tells the
notify(IEData, EViewElement, Object)
method
to get notice of the notification or not.void notify(IEData data_, EViewElement view_)
notify(IEData, EViewElement, Object)
.data_
- Is the enumeration object.view_
- This is the view element on the screen.notify(IEData, EViewElement, Object)
void notify(IEData data_, EViewElement view_, java.lang.Object object_)
Will notify all component instances that the current object has changed.
This method will look for a current enumeration element of
EViewElement
which represents the
corresponding method name. If the enumeration has no such object an
IllegalArgumentException
will be thrown at runtime. You are also
allowed to set primitive types, which are autoboxed to their wrapper
classes.
The following example gives you a first impression on using this
method. For example, you wanted to set the visibility of the enumeration
of ERF104.NEAR
to false. Here you can call this method
with a boolean value which will be wrapped to an instance of Boolean:
IDeviceSubject subject = new ... ... RFLabel label = new ... subject.register(ERF104.NEAR, label); ... subject.notify(ERF104.NEAR, EViewElement.VISIBEL, false);
data_
- Is the enumeration object.view_
- This is the view element on the screen.object_
- Is the object you wanted to set.java.util.Collection<IViewComponent> fetchComponents(IEData data_)
Collections.synchronizedCollection(Collection)
or by
the unmodifiable collection of
Collections.unmodifiableCollection(Collection)
.data_
- Is the enumeration from which all components are returned.java.util.Collection<IEData> fetchObservers()
Collections.synchronizedCollection(Collection)
or by
the unmodifiable collection of
Collections.unmodifiableCollection(Collection)
.boolean contains(IEData data_)
data_
- The data component you are asking for.void register(IEData data_)
data_
- Data element.void register(IEData data_, IViewComponent component_)
data_
- Data element.component_
- Is the component element. This should never be null
otherwise an IllegalArgumentException is thrown.void remove(IEData data_)
data_
- The destroyed data element.14-September-2016 18:23 Deutsches Elektronen-Synchrotron DESY in der Helmholtz-Gemeinschaft