|
Home > Archive > WebSphere Portal Server > June 2006 > Portlet Window State
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Portlet Window State
|
|
| Carsten Blieske 2005-02-09, 5:58 pm |
| Hi,
we've recently changed to Portal 5.1 and I've got the problem to push a
portlet into a certain state (e.g. Maximized).
In the older version I did a Tracker.pushPortletState(), but that does not
exist anymore.
Thanks for your solutions
Carsten
| |
| Maik Weber 2005-02-09, 5:58 pm |
| Hello Carsten,
can you describe the overall scenario? Ususally, a portlet can define
its state in a portlet uri. When you click on the link, the portlet will
change its state.
The Tracker was internal API, so it's gone ... The same old story :-)
Maik
Carsten Blieske wrote:
> Hi,
>
> we've recently changed to Portal 5.1 and I've got the problem to push a
> portlet into a certain state (e.g. Maximized).
> In the older version I did a Tracker.pushPortletState(), but that does not
> exist anymore.
>
> Thanks for your solutions
> Carsten
>
>
| |
| Carsten Blieske 2005-02-10, 2:48 am |
| The scenario is that I' would like to change the Portlet State, from within
the code.
It is like the PortletSelector from one of the first Portal versions. So if
you click on a link,
one portlet has to maximize and all others have to minimize.
Thank you for the reply
Carsten
"Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
news:cudrq1$309q$1@news.boulder.ibm.com...[vbcol=seagreen]
> Hello Carsten,
>
> can you describe the overall scenario? Ususally, a portlet can define
> its state in a portlet uri. When you click on the link, the portlet will
> change its state.
>
> The Tracker was internal API, so it's gone ... The same old story :-)
>
> Maik
>
>
> Carsten Blieske wrote:
| |
| Maik Weber 2005-02-10, 7:51 am |
| I don't know which APIs you are using. However, in the legacy IBM
Portlet API, you would do something like this:
PortletURI uri = portletResponse.createURI(PortletWindow.State.MAXIMIZED);
uri.toString(); // -> gives the link inside markup
In the new JSR168 API you would do:
PortletURL url = renderResponse.createRenderURL();
url.setWindowState(WindowState.MAXIMIZED);
url.toString(); // -> give the link inside markup
Maik
Carsten Blieske wrote:
> The scenario is that I' would like to change the Portlet State, from within
> the code.
> It is like the PortletSelector from one of the first Portal versions. So if
> you click on a link,
> one portlet has to maximize and all others have to minimize.
>
> Thank you for the reply
> Carsten
>
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cudrq1$309q$1@news.boulder.ibm.com...
>
>
>
>
| |
| Carsten Blieske 2005-02-10, 7:51 am |
| Hi Maik,
thanks for your help, but I considered a different Problem and maybe you can
help me with it.
In the earlier version (eg 5.0) we did the following to add an action, but
that doesn't work anymore with P5.1
PortletURI uri = response.createReturnURI();
uri.addAction();
Greetings Carsten
"Maik Weber" <> schrieb im Newsbeitrag
news:cuf9e9$ev8$1@news.boulder.ibm.com...[vbcol=seagreen]
>I don't know which APIs you are using. However, in the legacy IBM Portlet
>API, you would do something like this:
>
> PortletURI uri = portletResponse.createURI(PortletWindow.State.MAXIMIZED);
>
> uri.toString(); // -> gives the link inside markup
>
> In the new JSR168 API you would do:
>
> PortletURL url = renderResponse.createRenderURL();
> url.setWindowState(WindowState.MAXIMIZED);
> url.toString(); // -> give the link inside markup
>
> Maik
>
>
>
> Carsten Blieske wrote:
| |
| Maik Weber 2005-02-10, 5:59 pm |
| Hi Carsten,
this should work:
PortletURI uri = response.createReturnURI();
uri.addAction("myAction");
In actionPerformed you just can check for the action-String:
if (actionEvent.getActionString().equals("myAction") {
... do something ...
}
In JSR168 you would use
PortletURL url = renderResponse.createActionURL();
url.setParameter("action", "myAction");
In the processAction method you would check for the parameter:
if ( actionResponse.getParameter("action").equals("myAction") ) {
... do something ...
}
Maik
Carsten Blieske wrote:
> Hi Maik,
>
> thanks for your help, but I considered a different Problem and maybe you can
> help me with it.
> In the earlier version (eg 5.0) we did the following to add an action, but
> that doesn't work anymore with P5.1
>
> PortletURI uri = response.createReturnURI();
> uri.addAction();
>
> Greetings Carsten
>
>
> "Maik Weber" <> schrieb im Newsbeitrag
> news:cuf9e9$ev8$1@news.boulder.ibm.com...
>
>
| |
| Carsten Blieske 2005-02-10, 5:59 pm |
| Thanks,
(again it's me :-))
but this time it worked, I made some fault, because I first did
org.apache.jetspeed.portlet.PortletAction myAction = new
DefaultPortletAction("myAction");
what did not work in my case.
Hope that it may help other people as well :-) sometimes it is to close to
see the solution.
Carsten
"Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
news:cufqtm$3a7c$1@news.boulder.ibm.com...[vbcol=seagreen]
> Hi Carsten,
>
> this should work:
>
> PortletURI uri = response.createReturnURI();
> uri.addAction("myAction");
>
> In actionPerformed you just can check for the action-String:
>
> if (actionEvent.getActionString().equals("myAction") {
> ... do something ...
> }
>
>
> In JSR168 you would use
>
> PortletURL url = renderResponse.createActionURL();
> url.setParameter("action", "myAction");
>
> In the processAction method you would check for the parameter:
> if ( actionResponse.getParameter("action").equals("myAction") ) {
> ... do something ...
> }
>
>
> Maik
>
> Carsten Blieske wrote:
| |
| Carsten Blieske 2005-02-10, 5:59 pm |
| Hi,
I've got a different Question to the Portlet Window State, because I guess
there is a missunderstanding, because I didn't describe the entire scenario.
I've more than one portlet on a side and I already know ObjectIDs, nodes,
controlcomps and so on, and I want to change the window state of a different
portlet on the side and not the state of the portlet I'm currently using.
Greetings Carsten
"Carsten Blieske" <cb@ewetel.de> schrieb im Newsbeitrag
news:cufur3$2kt4$1@news.boulder.ibm.com...
> Thanks,
> (again it's me :-))
> but this time it worked, I made some fault, because I first did
>
> org.apache.jetspeed.portlet.PortletAction myAction = new
> DefaultPortletAction("myAction");
>
> what did not work in my case.
> Hope that it may help other people as well :-) sometimes it is to close to
> see the solution.
>
> Carsten
>
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cufqtm$3a7c$1@news.boulder.ibm.com...
>
>
| |
| Maik Weber 2005-02-10, 5:59 pm |
| DefaultPortletAction was deprecated and is not supported in WPv5.1
anymore. You have to use ActionStrings or Parameters now. Usage of
the back-button is one reason for this design-change ...
Maik
Carsten Blieske wrote:
> Thanks,
> (again it's me :-))
> but this time it worked, I made some fault, because I first did
>
> org.apache.jetspeed.portlet.PortletAction myAction = new
> DefaultPortletAction("myAction");
>
> what did not work in my case.
> Hope that it may help other people as well :-) sometimes it is to close to
> see the solution.
>
> Carsten
>
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cufqtm$3a7c$1@news.boulder.ibm.com...
>
>
>
| |
| Maik Weber 2005-02-11, 8:00 am |
| Okay, I see. You are right, describing the overall scenario helps a lot :-)
You have to use the urlGeneration Tag for this. Here an example taken
from the Infocenter:
<wps:urlGeneration contentNode="wps.My Portal.Welcome"
layoutNode="welcome.bookmarks"
portletWindowState="Maximized">
<wps:urlParam name="<%= month %>" value="August" type="render" />
<wps:urlParam name="<%= day %>" value="Monday" type="render" />
<wps:urlParam name="<%= amount %>" value="<%= ACCOUNT_BALANCE %>"
type="render" />
<a href="<% wpsURL.write(out); %>" class="wpsLinkBarLink">
<wps:text key="link.bookmarkstitle" bundle="nls.myproperties"/>
</a>
</wps:urlGeneration>
For a detail description of all attributes, have a look in the Infocenter:
http://publib.boulder.ibm.com/pvc/w...s/dgn_link.html
Maik
Carsten Blieske wrote:
> Hi,
> I've got a different Question to the Portlet Window State, because I guess
> there is a missunderstanding, because I didn't describe the entire scenario.
> I've more than one portlet on a side and I already know ObjectIDs, nodes,
> controlcomps and so on, and I want to change the window state of a different
> portlet on the side and not the state of the portlet I'm currently using.
>
> Greetings Carsten
>
> "Carsten Blieske" <cb@ewetel.de> schrieb im Newsbeitrag
> news:cufur3$2kt4$1@news.boulder.ibm.com...
>
>
>
| |
| Carsten Blieske 2005-02-11, 8:00 am |
| Hi Maik,
that's a quite nice possibilty, but doesn't fit to good in our scenario.
So I'll give you some more information, maybe you have another different
idea - I know I'm quite difficult with this problem :-)
We have more than one portlet on a page and I'd like to change the window
state of a different portlet in the moment an action appears, so my problem
is, that I don't have necessarily an url. Maybe the user clicks somewhere
(eg in an "Mailclientportlet") and in that Moment I want to maximize an
("Adressbookportlet"). Or the even worse case I want to minimize more than
one portlet and normalize (maximize) another one.
So it would be esaier for me to do it with internal API like before with the
Tracker.
Greetings and a nice weekend
Carsten
"Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
news:cui8qk$3erc$2@news.boulder.ibm.com...[vbcol=seagreen]
> Okay, I see. You are right, describing the overall scenario helps a lot
> :-)
>
> You have to use the urlGeneration Tag for this. Here an example taken from
> the Infocenter:
>
> <wps:urlGeneration contentNode="wps.My Portal.Welcome"
> layoutNode="welcome.bookmarks" portletWindowState="Maximized">
>
> <wps:urlParam name="<%= month %>" value="August" type="render" />
> <wps:urlParam name="<%= day %>" value="Monday" type="render" />
> <wps:urlParam name="<%= amount %>" value="<%= ACCOUNT_BALANCE %>"
> type="render" />
>
> <a href="<% wpsURL.write(out); %>" class="wpsLinkBarLink">
> <wps:text key="link.bookmarkstitle" bundle="nls.myproperties"/>
> </a>
> </wps:urlGeneration>
>
> For a detail description of all attributes, have a look in the Infocenter:
>
> http://publib.boulder.ibm.com/pvc/w...s/dgn_link.html
>
> Maik
>
>
> Carsten Blieske wrote:
| |
| Maik Weber 2005-02-12, 7:54 am |
| The state-handling model has changed a lot since v5.1. Since I
understand your scenario right, you want to change the state of a number
of portlets on the same page regarding to one link in one portlet. An
action in this portlet should set the window state of other portlets on
the same page. You have to use the Navigational-State-API, which you
will find here:
http://www-106.ibm.com/developerwor.../spi/index.html
The interesting packages for you are in com.ibm.portal.state.*
However, I am not sure if it is possible with this API to change the
state of several portlets in one time.
Maik
Carsten Blieske wrote:
> Hi Maik,
>
> that's a quite nice possibilty, but doesn't fit to good in our scenario.
> So I'll give you some more information, maybe you have another different
> idea - I know I'm quite difficult with this problem :-)
> We have more than one portlet on a page and I'd like to change the window
> state of a different portlet in the moment an action appears, so my problem
> is, that I don't have necessarily an url. Maybe the user clicks somewhere
> (eg in an "Mailclientportlet") and in that Moment I want to maximize an
> ("Adressbookportlet"). Or the even worse case I want to minimize more than
> one portlet and normalize (maximize) another one.
> So it would be esaier for me to do it with internal API like before with the
> Tracker.
>
> Greetings and a nice weekend
> Carsten
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cui8qk$3erc$2@news.boulder.ibm.com...
>
>
| |
| Carsten Blieske 2005-02-16, 7:56 am |
| I already supposed that it would be this part of the API, but I cannot
figure out how to use it (yes I know, that's what the API should help with
:-) ).
I already got StateAccesor and -factory but I thought I need the
PortletState -whatever, and I don't know how to implement it. And maybe I'm
the first person who likes to know how this works, because it's quite
difficult to get information on this topic.
Maybe I could get another hint.
Thanks & Greetings Carsten
"Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
news:cuktpj$2m6m$1@news.boulder.ibm.com...[vbcol=seagreen]
> The state-handling model has changed a lot since v5.1. Since I understand
> your scenario right, you want to change the state of a number of portlets
> on the same page regarding to one link in one portlet. An action in this
> portlet should set the window state of other portlets on the same page.
> You have to use the Navigational-State-API, which you will find here:
> http://www-106.ibm.com/developerwor.../spi/index.html
>
> The interesting packages for you are in com.ibm.portal.state.*
> However, I am not sure if it is possible with this API to change the state
> of several portlets in one time.
>
> Maik
>
>
>
> Carsten Blieske wrote:
| |
| Carsten Blieske 2005-02-16, 7:56 am |
| OK, let's go on, I have now the following code, found in the last corner of
the API :-), edited by myself and no I get the following error:
[16.02.05 14:29:42:172 CET] 3b2a40c8 SystemErr R
com.ibm.portal.state.accessors.exceptions.StateNotWriteableException:EJPEI0055E:
Der Status-Holder <?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wps.state.StateHolderControllerImpl
class="com.ibm.wps.state.StateHolderControllerImpl">
<model class="com.ibm.wps.state.dom.DocumentModelImpl">
<hash>1326874960</hash>
<nodes>10</nodes>
</model>
</com.ibm.wps.state.StateHolderControllerImpl>
, auf den im Geltungsbereich der Anforderung
com.ibm.wps.pe.pc.legacy.impl.PortletRequestImpl@61c74150 zugegriffen wird,
ist nicht beschreibbar.
The Code is the following:
// get an instance of the state manager service
StateManagerService service = (StateManagerService)
ServiceManager.getService(StateManagerService.class, true);
// get the state manager from service for this thread
StateManager manager = service.getStateManager();
// fetch the StateAccessorFactory
StateAccessorFactory stateFactory = (StateAccessorFactory)
manager.getAccessorFactory(StateAccessorFactory.class);
PortletAccessorFactory paf = (PortletAccessorFactory)
manager. getAccessorFactory(PortletAccessorFactor
y.class);
// ------------------------------------------------------
StateAccessor stateAcc = stateFactory.getState();
StateHolder state = stateAcc.getStateHolder(request);
System.out.println(paf.getPortlet(coid,state ).getWindowState());
StateAccessorController stateAccController =
stateFactory.getStateController();
StateHolderController stateController =
stateAccController.getStateHolderController(request);
The first part is out of the API and the last part comes from me, the error
happens in the last row.
I also understand the Exception in sense of I know what it tells me, but I
don't know why I have no permission (wpsadmin), and how to deal whit it,
because I'm able to change the permission of nearly all the things in the
portal, but never heard of a StateNotWriteableException. So I guess that I
have a little bit wrong access to the StateHolderController. Maybe you can
help me with it.
Greetings Carsten
>I already supposed that it would be this part of the API, but I cannot
>figure out how to use it (yes I know, that's what the API should help with
>:-) ).
> I already got StateAccesor and -factory but I thought I need the
> PortletState -whatever, and I don't know how to implement it. And maybe
> I'm the first person who likes to know how this works, because it's quite
> difficult to get information on this topic.
>
> Maybe I could get another hint.
> Thanks & Greetings Carsten
>
>
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cuktpj$2m6m$1@news.boulder.ibm.com...
>
>
| |
| Maik Weber 2005-02-21, 7:55 am |
| Hello Carsten,
sorry for the delay in answering you. I had to check for myself how to
use the State-Handling-API because I never used it before :-) And, you
are right, it is not very easy to dive into this API using the provided
Javadocs. However, try this this code-snippet:
import com.ibm.portal.state.service.StateManagerHome;
import com.ibm.portal.state.StateManager;
....
// in init method
// you can cache the home interface for later use
Context ctx = new InitialContext();
StateManagerHome home = (StateManagerHome)
ctx.lookup("portalservice/com.ibm.portal.state.StateManager");
....
// in processAction
// you need to request the state manager on a per-thread basis
StateManager state = home.getStateManager();
StateHolderController shc = state.getStateHolderController();
PortletAccessorFactory paf = (PortletAccessorFactory)
state.getAccessorFactory(com.ibm.portal.state.accessors.portlet.PortletAccessFactory);
PortletAccessorController pac = paf.getPortletController(id, shc);
pac.setWindowState(WindowState.MAXIMIZED);
You have used an read-only accessor for changing the state (see
Javadoc). The com.ibm.portal.state.service.StateManagerHome is currently
not visible in the Javadoc but that will be changed soon. Usually it
should be part of the SPI.
Maik
Carsten Blieske wrote:
> OK, let's go on, I have now the following code, found in the last corner of
> the API :-), edited by myself and no I get the following error:
> [16.02.05 14:29:42:172 CET] 3b2a40c8 SystemErr R
> com.ibm.portal.state.accessors.exceptions.StateNotWriteableException:EJPEI0055E:
> Der Status-Holder <?xml version="1.0" encoding="UTF-8"?>
>
> <com.ibm.wps.state.StateHolderControllerImpl
> class="com.ibm.wps.state.StateHolderControllerImpl">
>
> <model class="com.ibm.wps.state.dom.DocumentModelImpl">
>
> <hash>1326874960</hash>
>
> <nodes>10</nodes>
>
> </model>
>
> </com.ibm.wps.state.StateHolderControllerImpl>
>
> , auf den im Geltungsbereich der Anforderung
> com.ibm.wps.pe.pc.legacy.impl.PortletRequestImpl@61c74150 zugegriffen wird,
> ist nicht beschreibbar.
>
> The Code is the following:
>
> // get an instance of the state manager service
> StateManagerService service = (StateManagerService)
> ServiceManager.getService(StateManagerService.class, true);
> // get the state manager from service for this thread
> StateManager manager = service.getStateManager();
> // fetch the StateAccessorFactory
> StateAccessorFactory stateFactory = (StateAccessorFactory)
> manager.getAccessorFactory(StateAccessorFactory.class);
>
> PortletAccessorFactory paf = (PortletAccessorFactory)
> manager. getAccessorFactory(PortletAccessorFactor
y.class);
>
> // ------------------------------------------------------
> StateAccessor stateAcc = stateFactory.getState();
> StateHolder state = stateAcc.getStateHolder(request);
>
> System.out.println(paf.getPortlet(coid,state ).getWindowState());
>
> StateAccessorController stateAccController =
> stateFactory.getStateController();
> StateHolderController stateController =
> stateAccController.getStateHolderController(request);
>
>
> The first part is out of the API and the last part comes from me, the error
> happens in the last row.
>
> I also understand the Exception in sense of I know what it tells me, but I
> don't know why I have no permission (wpsadmin), and how to deal whit it,
> because I'm able to change the permission of nearly all the things in the
> portal, but never heard of a StateNotWriteableException. So I guess that I
> have a little bit wrong access to the StateHolderController. Maybe you can
> help me with it.
>
> Greetings Carsten
>
>
>
>
>
>
| |
| Carsten Blieske 2005-02-23, 7:54 am |
| Hello Mike,
that code-snippet looks quite good, except from one thing. I have a problem
with this line
StateHolderController shc = state.getStateHolderController();
There is no Method getStateHolderController in the StateManager. And at the
end of the last week I tried out the example, which is given on the front
page of com.ibm.portal.state in the API, and that is the same direction like
your code, but there I got the stateholdercontroller from the url, and that
was also no success.
So maybe you have a small modifkation for me.
And by the way, a delay is never a problem, I'm happy for every answer,
because it looks like most of the people are still with earlier versions of
the portal,
or don't have strange applications running, like we do. :-)
And without your help I would have gone lost in the deep of the API.
Carsten
"Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
news:cvcbtt$4l06$1@news.boulder.ibm.com...[vbcol=seagreen]
> Hello Carsten,
>
> sorry for the delay in answering you. I had to check for myself how to use
> the State-Handling-API because I never used it before :-) And, you are
> right, it is not very easy to dive into this API using the provided
> Javadocs. However, try this this code-snippet:
>
> import com.ibm.portal.state.service.StateManagerHome;
> import com.ibm.portal.state.StateManager;
> ...
>
> // in init method
> // you can cache the home interface for later use
> Context ctx = new InitialContext();
> StateManagerHome home = (StateManagerHome)
> ctx.lookup("portalservice/com.ibm.portal.state.StateManager");
>
> ...
>
> // in processAction
> // you need to request the state manager on a per-thread basis
> StateManager state = home.getStateManager();
>
> StateHolderController shc = state.getStateHolderController();
> PortletAccessorFactory paf = (PortletAccessorFactory)
> state.getAccessorFactory(com.ibm.portal.state.accessors.portlet.PortletAccessFactory);
>
> PortletAccessorController pac = paf.getPortletController(id, shc);
>
> pac.setWindowState(WindowState.MAXIMIZED);
>
>
> You have used an read-only accessor for changing the state (see Javadoc).
> The com.ibm.portal.state.service.StateManagerHome is currently not visible
> in the Javadoc but that will be changed soon. Usually it should be part of
> the SPI.
>
> Maik
>
>
> Carsten Blieske wrote:
| |
| Carsten Blieske 2005-02-23, 7:54 am |
| Hi Mike,
I tried now the following code :
StateManager state = home.getStateManager();
// different from your example
StateHolderController shc = state.newState();
//StateHolderController shc = state.getStateHolderController();
// there was an error in this line, but I guess you ment this
PortletAccessorFactory paf =
(PortletAccessorFactory)state. getAccessorFactory(PortletAccessorFactor
y.class);
PortletAccessorController pac = paf.getPortletController(id, shc);
System.out.println(pac.getWindowState()); -->>> normal
pac.setWindowState(WindowState.MAXIMIZED);
System.out.println(pac.getWindowState()); -->>> Maximized
The problem is, that the state seems to be changed as you can see, but
nothing happens :-) ????????????
Carsten
"Carsten Blieske" <cb@ewetel.de> schrieb im Newsbeitrag
news:cvhijs$3th2$1@news.boulder.ibm.com...
> Hello Mike,
>
> that code-snippet looks quite good, except from one thing. I have a
> problem with this line
> StateHolderController shc = state.getStateHolderController();
> There is no Method getStateHolderController in the StateManager. And at
> the end of the last week I tried out the example, which is given on the
> front page of com.ibm.portal.state in the API, and that is the same
> direction like your code, but there I got the stateholdercontroller from
> the url, and that was also no success.
> So maybe you have a small modifkation for me.
> And by the way, a delay is never a problem, I'm happy for every answer,
> because it looks like most of the people are still with earlier versions
> of the portal,
> or don't have strange applications running, like we do. :-)
> And without your help I would have gone lost in the deep of the API.
>
> Carsten
>
>
> "Maik Weber" <maikweber@de.ibm.com> schrieb im Newsbeitrag
> news:cvcbtt$4l06$1@news.boulder.ibm.com...
>
| |
|
| you can change the window state while processing the action event:
using the ibm API:
request.getWindow().setWindowState(PortletWindow.State.MAXIMIZED);
| |
|
| you can change the window state while processing the action event:
using the ibm API:
request.getWindow().setWindowState(PortletWindow.State.MAXIMIZED);
|
|
|
|
|