public class AddPortletRequest extends RenderPortletRequestBase<String>
Sent to the portal (server) if a new portlet instance of a given
type should be added to the portal page. The portal server usually
responds with a RenderPortlet
event that has as payload the
HTML that displays the portlet on the portal page.
Properties may be passed with the event. The interpretation
of the properties is completely dependent on the handling portlet.
It is recommended to use String
s as keys and JDK types
as values. This avoids classpath dependencies on the portlet
that is to be added.
The event’s result is the portlet id of the new portlet instance.
Constructor and Description |
---|
AddPortletRequest(RenderSupport renderSupport,
String portletType,
List<Portlet.RenderMode> renderModes)
Creates a new event.
|
AddPortletRequest(RenderSupport renderSupport,
String portletType,
List<Portlet.RenderMode> renderModes,
Map<?,?> properties)
Creates a new event.
|
Modifier and Type | Method and Description |
---|---|
AddPortletRequest |
addProperty(Object key,
Object value)
Convenience method for adding properties one-by-one.
|
AddPortletRequest |
ifPresent(Object key,
BiConsumer<Object,Object> action)
Convenience method that performs the given action if a property
with the given key exists.
|
boolean |
isForeground()
Indicates if portlet is to be put in foreground.
|
String |
portletType()
Returns the portlet type
|
Map<Object,Object> |
properties()
Returns the properties.
|
AddPortletRequest |
setForeground(boolean foreground)
Determines if the portlet will be put in the foreground.
|
preferredRenderMode, renderModes, renderSupport
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, defaultCriterion, forChannels, get, get, handled, handlingError, isCancelled, isDone, isEligibleFor, isStopped, processedBy, results, results, setAssociated, setChannels, setRequiresResult, setResult, stop, tieTo, toString
disableTracking, enqueued, firstResultAssigned, isTracked
public AddPortletRequest(RenderSupport renderSupport, String portletType, List<Portlet.RenderMode> renderModes)
Creates a new event.
renderSupport
- the render supportportletType
- the type of the portletrenderModes
- the render modespublic AddPortletRequest(RenderSupport renderSupport, String portletType, List<Portlet.RenderMode> renderModes, Map<?,?> properties)
Creates a new event.
renderSupport
- the render supportportletType
- the type of the portletrenderModes
- the render modesproperties
- optional values for properties of the portlet instancepublic AddPortletRequest setForeground(boolean foreground)
Determines if the portlet will be put in the foreground.
Defaults to true
for added portlets as they are most likely
supposed to be seen.
foreground
- the foregroundpublic String portletType()
Returns the portlet type
public Map<Object,Object> properties()
Returns the properties. Every event returns a mutable map, thus allowing event handlers to modify the map even if none was passed to the constructor.
public AddPortletRequest addProperty(Object key, Object value)
Convenience method for adding properties one-by-one.
key
- the property keyvalue
- the property valuepublic AddPortletRequest ifPresent(Object key, BiConsumer<Object,Object> action)
Convenience method that performs the given action if a property with the given key exists.
key
- the property keyaction
- the action to performpublic boolean isForeground()
RenderPortletRequestBase
Indicates if portlet is to be put in foreground.
isForeground
in class RenderPortletRequestBase<String>