[Design of JBoss Portal] - Portal public API updates
by julien@jboss.com
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#4005010
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005010
19 years, 2 months
[Design of JBoss Portal] - Re: LayouStrategy and StrategyResponse API
by julien@jboss.com
So actually I transformed that into portal eventing object. Now there are :
base page event :
| public abstract class PageEvent extends PortalNodeEvent
| {
| ...
| }
|
page render event
| public class PageRenderEvent extends PageEvent
| {
| ...
| }
|
provide access to a portion of the navigational state managed by the portal :
| 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;
| }
|
I have recoded the previous interceptor I did (and removed it) using the public API (so it can be considered as a supported feature and will not break in the future with the 2.x versions).
The example has been commited as org.jboss.portal.core.portlet.test.event.WindowConstraintEventListener and is a little bit complex (because your use case is very special) so I will not list it here.
You can find it in the core-samples module in trunk.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004991#4004991
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004991
19 years, 2 months
[Design the new POJO MicroContainer] - Re: Case sensitivity in injecting a bean's property
by scott.stark@jboss.org
Then we need to look at how the kernel behaves with beans like:
| public class BeanWithStates
| {
| public String getstate()
| {
| return "state";
| }
| public void setstate(String s)
| {
| }
|
| public int getState()
| {
| return 0;
| }
| public void setState(int s)
| {
| }
| }
|
The java.beans.Introspector does not pickup different properties state and State for this:
| package javabean;
|
| import java.beans.BeanInfo;
| import java.beans.Introspector;
| import java.beans.PropertyDescriptor;
|
| import org.junit.Test;
|
| public class TestIntrospector
| {
| @Test
| public void testBeanPropertyCase()
| throws Exception
| {
| BeanInfo beanWithStatesInfo = Introspector.getBeanInfo(BeanWithStates.class);
| PropertyDescriptor[] props = beanWithStatesInfo.getPropertyDescriptors();
| System.out.println("BeanWithStates properties:");
| for(PropertyDescriptor p : props)
| {
| System.out.println(p.getName()+", read: "+p.getReadMethod()+", write: "+p.getWriteMethod());
| }
| }
| }
|
| BeanWithStates properties:
| class, read: public final native java.lang.Class java.lang.Object.getClass(), write: null
| state, read: public java.lang.String javabean.BeanWithStates.getstate(), write: public void javabean.BeanWithStates.setstate(java.lang.String)
|
Instead, it only finds state, but does use the setter/getter that is consistent with the mbean naming conventions. I guess one would have to supply a class level java.beans.BeanInfo to have access to both state and State as properties.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004985#4004985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004985
19 years, 2 months