A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/597.html

Document ID: 597
Branch: main
Language: default
Name: Portal: Event Handling (unchanged)
Document Type: Document (unchanged)
Updated on: 8/15/05 1:03:11 PM
Updated by: Helma

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 13332 bytes (previous version: 13341 bytes)
Content diff:
(52 equal lines skipped)
    
    <p>Let's have a look how such an event is created:</p>
    
--- <pre>
--- Event event;
+++ <pre>Event event;
    event = new ChangeCopletInstanceAspectDataEvent(
                copletInstanceData,
                "size", 
(14 equal lines skipped)
    the event and release the manager again. If you fire the event, the event is
    directly published to all subscribed components.</p>
    
--- <pre>
--- EventManager manager = null;
+++ <pre>EventManager manager = null;
    try {
        manager = serviceManager.lookup(EventManager.ROLE);
        manager.getPublisher().publish(event);
(23 equal lines skipped)
    you need to have access to the portal service component. (Renderers e.g. 
don't
    have to lookup the service by itself, they get it as a method 
parameter).</p>
    
--- <pre>
--- PortalService service = null;
+++ <pre>PortalService service = null;
    try {
        service = serviceManager.lookup(PortalService.ROLE);
        LinkService ls = service.getComponentManager().getLinkService();
(30 equal lines skipped)
    the coplet instance data to change, the JXPath expression that defines the 
data
    to change and the value:</p>
    
--- <pre>
--- Event event = new CopletJXPathEvent(copletInstanceData, 
+++ <pre>Event event = new CopletJXPathEvent(copletInstanceData, 
                                        "attributes/username", 
                                        username); 
        </pre>
(13 equal lines skipped)
    or class (and all of the subclasses). Subscribing is done using the event
    manager:</p>
    
--- <pre>
--- EventManager manager = null;
+++ <pre>EventManager manager = null;
    try {
        manager = serviceManager.lookup(EventManager.ROLE);
        manager.getRegister().subscribe( myComponent );
(4 equal lines skipped)
    
    <p>The component you subscribe must implement the Subscriber interface:</p>
    
--- <pre>
--- Subscriber interface:
+++ <pre>Subscriber interface:
    
    public Class getEventType();
    
(41 equal lines skipped)
    <p>The coplet element has nothing to do with events :) It can be used to 
include
    information about the current coplet in the SAX stream:</p>
    
--- <pre>
--- ...
+++ <pre>...
      &lt;coplet:coplet select="attributes/name"/&gt;
    ...
          </pre>
(7 equal lines skipped)
    <p>The link element creates a link that will trigger an event if the user 
clicks
    this link:</p>
    
--- <pre>
--- ...
+++ <pre>...
      &lt;coplet:link coplet="COPLET_ID" path="JXPATH" value="TO_SET"/&gt;
      &lt;coplet:link layout="LAYOUT_ID" path="JXPATH" value="TO_SET"/&gt;
    ...
(29 equal lines skipped)
    <p>The configuration takes place in the cocoon.xconf as a configuration for 
the
    event manager:</p>
    
--- <pre>
--- ...
+++ <pre>...
     &lt;component 
class="org.apache.cocoon.portal.event.impl.DefaultEventManager" 
                logger="portal" 
                role="org.apache.cocoon.portal.event.EventManager"&gt;
(36 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
Removed from collection: legacydocs
Added to collection: documentation