Poll Plugin Developer Guide - HST Components
Delegation
The Poll plugin includes the standard poll component class org.onehippo.forge.poll.component.PollComponent. This class manages the core logic for voting and displaying polls. If your implementation requires a custom poll component, you can use the org.onehippo.forge.poll.component.PollProvider class. The PollComponent delegates poll-related logic to PollProvider, allowing you to implement a custom component that also delegates to this provider.
To implement delegation in your custom poll component, refer to the default PollComponent for examples of delegating calls to the doAction, doBeforeRender, and getParameter methods.
Channel Editor Parameter Support
To enable the Channel Editor to display a configuration dialog for your custom poll component, annotate your component with the org.onehippo.forge.poll.component.PollDocumentComponentInfo interface. Since parameter definitions and handling are managed in PollProvider, you can reuse the PollDocumentComponentInfo interface in your custom component.
@ParametersInfo(type = PollDocumentComponentInfo.class)
public class [...]
You must also override the getParameter method in your custom component and delegate the call to PollProvider:
@Override public String getParameter(String name, HstRequest request) { return PollProvider.getParameter(name, (PollComponentInfo)getParametersInfo(request)); }
For more information, see Define a Component's Configuration Parameters and Annotate Channel or Component Configuration Parameters with UI Directives.