ItsNat core is enough to build event based web applications, but if we talk
about events we are nearer to the desktop paradigm, then
a component system fits perfectly well in this scenario, furthermore
a component system without events is interesting though is a strange
artifact (consequence of the old and poor web paradigm).
ItsNat component system:
- Is fully based on events (AJAX or SCRIPT)
- Many components are namespace and tag agnostic,
every DOM element group can be a component including
events (for instance a list of SVG circles).
- Reuses Swing as far as possible including data models, selection models and related listeners,
in fact the architecture is similar to Swing MVC,
but is not forced, ItsNat components are not a web clone of Swing
and are not "pixel based".
- Pattern based: the markup is not imposed by the component,
ItsNat components leverages the pattern based DOM utilities (ElementList etc)
as components (with events, data models and selection models).
- Extensible: components offer many extension points as model listeners, selection
listeners, renderers and structures.
- Building user defined components amazingly easy, for instance custom components
build as compound components.
All ItsNat components implement the ItsNatComponent
and implementations provided by ItsNat are obtained with specific
ItsNatComponentManager.createX and
ItsNatHTMLComponentManager.createX methods.
Components uses internal DOM event/listeners to do the
expected task, the user can add listeners to be notified when a DOM
event is received by the component registering them with the method
ItsNatComponent.addEventListener. This notification is complementary
to the usual Swing based listener system of models.
When a component is no longer be used is recommended to call the
method ItsNatComponent.dispose() to remove listener disconnect
listeners of data and selection models etc. A disposed component can not
be reused.
There are several ways to create components such as:
ItsNatComponentManager.createItsNatComponent or
ItsNatComponentManager.createItsNatComponentById
methods: the concrete component is obtained as the most appropriated
component to specified node specified or using the optional compType
component type (free components). The artifacts may be used
to specify initial objects like custom structures.
- Concrete factory methods as
ItsNatHTMLComponentManager.createItsNatHTMLCompName
methods.
- Using the automatic build from the markup calling
ItsNatComponentManager.buildItsNatComponents(Node),
the necessary data must be in the markup.