Events..
tony.herstell1 Feb 1, 2008 8:24 PMI have an Entity and am trying to get it to throw an event when the number of riders changes (this is mapped to the View naturally)...
I have tried with just two annotation (thrower and catcher) to no avail... now I have added EVERYTHING in and it still does not work; what am I missing?
Entity...
@SuppressWarnings("serial") @Entity // Defines this as an Entity that is a class mapped to the Datastore. @Name("bookingResourceArena") // Name used within SEAM for an instance of this class. @DiscriminatorValue("WithArena") public class BookingResourceWithRiders extends BookingResourceWithHoursRange implements Serializable { ... @RaiseEvent("RiderNumbersChanged") public void setRiders(int number) { this.riders = number; Events.instance().raiseEvent("RiderNumbersChanged"); }
Controller...
@SuppressWarnings("serial") @Stateful // A new component is created or re-initialised and re-used each time it is // called. @Name("bookingController") // Name used within SEAM for an instance of this class. @Conversational // Scope that this class exists in. public class BookingControllerImpl implements BookingController, Serializable { ... @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @Observer("RiderNumbersChanged") public void changeRiderNumbers() { log.info(">changeRiderNumbers"); log.info("<changeRiderNumbers"); }
components.xml
<event type="RiderNumbersChanged"> <action expression="#{bookingController.changeRiderNumbers}" /> </event>
Chunk off screen
<!-- Number of Riders (Arenas) --> <rich:column colspan="3" breakBefore="true" rendered="#{(bookingController.reason == 'ONE_HOUR_PRIVATE' || bookingController.reason == 'ONE_HOUR_OPEN') and (eachResource.resource.kind == 'INDOOR_ARENA' || eachResource.resource.kind == 'DRESSAGE_ARENA' || eachResource.resource.kind == 'SJ_ARENA')}"> <h:outputText value="#{messages.booking_number_of_riders}" /> <rich:inputNumberSpinner id="riderNumbers" immediate="true" enableManualInput="false" minValue="1" maxValue="6" step="1" value="#{eachResource.riders}"> <a4j:support event="onchange" eventsQueue="eventsQueue" requestDelay="2000" /> </rich:inputNumberSpinner> </rich:column>