public interface IChannelService
Implementation of this interface are the basis of a channel based communication implementation. You usually store one IChannelService implementation in your application instance, and then delegate all your channel related operations to this service, allowing very easy switching between channel communication implementations.
Here is how you usually use an IChannelService implementation:
IChannelService channelService = MyApplication.get().getChannelService();
// I want to send an event when i click a button
[...]
onClick(AjaxRequestTarget target){
channelService.publish(new ChannelEvent("channel"));
}
[...]
// All pages listening this event should add
[...]
channelService.addChannelListener(this, "channel", new IChannelListener() {
public void onEvent(String channel, Map datas, IChannelTarget target){
target.[...]
}
});
[...]
| Modifier and Type | Method and Description |
|---|---|
void |
addChannelListener(org.apache.wicket.Component component,
String channel,
IChannelListener listener)
Adds a behavior to the given component so that it will be notified of ChannelEvents.
|
void |
publish(ChannelEvent event)
Publishes a channel event which will be sent to the channel listeners.
|
void addChannelListener(org.apache.wicket.Component component,
String channel,
IChannelListener listener)
Usually the component if a Page, even if it's not mandatory. Indeed the components reacting
to the event are defined in the IChannelListener, by calling IChannelTarget
methods. Hence any component on the page can serve as the host of the behavior, as soon as it
is visible.
component - the component to which the behavior should be addedchannel - the channel for which the listener should be notifiedlistener - the IChannelListener which should be notified of ChannelEventsvoid publish(ChannelEvent event)
event - the event to publish to the listenersCopyright © 2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.