I have updated the org.jboss.portal.api package with a new kind of event and an interface
which expose a part of the navigational state managed by the portal.
The event is RenderPageEvent and it allows listeners to be aware of when a page is
rendered by the portal.
The interface for navigational state is NavigationalStateContext and is available from the
PortalNodeEventContext provided in the listener callback
| public interface PortalNodeEventListener
| {
| PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event);
| }
|
| public interface PortalNodeEventContext
| {
| ...
| NavigationalStateContext getNavigationalStateContext();
| ...
| }
|
| public interface NavigationalStateContext
| {
| WindowState getWindowState(PortalNode window) throws IllegalArgumentException;
| void setWindowState(PortalNode window, WindowState windowState) throws
IllegalArgumentException;
| Mode getMode(PortalNode window) throws IllegalArgumentException;
| void setMode(PortalNode window, Mode mode) throws IllegalArgumentException;
| }
|
This allows for example to read or update the different window state when rendering a page
:
| if (event instanceof RenderPageEvent)
| {
| NavigationalStateContext nsctx = context.get NavigationalStateContext();
| PortalNode pageNode = event.getNode();
| for (Iterator i = pageNode.getChildren().iterator();i.hasNext();)
| {
| PortalNode child = (PortalNode)i.next();
| if (child.getType() == PortalNode.TYPE_WINDOW)
| {
| nsctx.setWindowState(child, WindowState.NORMAL);
| }
| }
| }
|
There is a more complete example in the core-samples module which implement a complex set
of constraint on the page.
Please look at the API and look if nothing look fundamentally wrong because this is going
to become part of the supported API.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005010#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...