taylor 2005/05/24 14:12:36
Modified: fusion/src/java/org/apache/jetspeed/fusion/portal/portlets
JetspeedFusionPortlet.java
fusion/src/java/org/apache/jetspeed/fusion/modules/actions
FusionAccessController.java
Log:
http://issues.apache.org/jira/browse/JS1-548
Revision Changes Path
1.12 +58 -46
jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/portlets/JetspeedFusionPortlet.java
Index: JetspeedFusionPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/portlets/JetspeedFusionPortlet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- JetspeedFusionPortlet.java 28 Dec 2004 05:16:25 -0000 1.11
+++ JetspeedFusionPortlet.java 24 May 2005 21:12:36 -0000 1.12
@@ -289,60 +289,72 @@
String action = data.getAction();
boolean targeted = isTargeted(data, instance, action);
- if (targeted && action.equals(J1_HELP_ACTION))
- {
- nav.setMode(window, PortletMode.HELP);
- nav.sync(context);
- return;
- }
- if (targeted && action.equals(J1_RESTORE_ACTION))
- {
- nav.setMode(window, PortletMode.VIEW);
- nav.setState(window, WindowState.NORMAL);
- nav.sync(context);
- return;
- }
- if (targeted && action.equals(J1_EDIT_ACTION))
- {
- nav.setMode(window, PortletMode.EDIT);
- nav.sync(context);
- return;
- }
boolean syncRequired = false;
-
- switch (mode)
+
+ if (!targeted)
{
- case JetspeedRunData.NORMAL:
- if (!mode2.equals(PortletMode.VIEW))
+ if (mode2 != null && mode2.equals(PortletMode.VIEW))
{
- nav.setMode(window, PortletMode.VIEW);
- syncRequired = true;
+
}
- if (!state.equals(WindowState.NORMAL))
+ }
+ else
+ {
+ if (targeted && action.equals(J1_HELP_ACTION))
{
+ nav.setMode(window, PortletMode.HELP);
+ nav.sync(context);
+ return;
+ }
+ if (targeted && action.equals(J1_RESTORE_ACTION))
+ {
+ nav.setMode(window, PortletMode.VIEW);
nav.setState(window, WindowState.NORMAL);
- syncRequired = true;
- }
- break;
- case JetspeedRunData.MAXIMIZE:
- if (!state.equals(WindowState.MAXIMIZED))
- {
- nav.setState(window, WindowState.MAXIMIZED);
- syncRequired = true;
- }
- break;
- case JetspeedRunData.CUSTOMIZE:
- if (!mode2.equals(PortletMode.EDIT))
+ nav.sync(context);
+ return;
+ }
+ if (targeted && action.equals(J1_EDIT_ACTION))
{
nav.setMode(window, PortletMode.EDIT);
- syncRequired = true;
- }
- break;
- }
- if (syncRequired)
- {
- nav.sync(context);
+ nav.sync(context);
+ return;
+ }
+
+ switch (mode)
+ {
+ case JetspeedRunData.NORMAL:
+ if (!mode2.equals(PortletMode.VIEW))
+ {
+ nav.setMode(window, PortletMode.VIEW);
+ syncRequired = true;
+ }
+ if (!state.equals(WindowState.NORMAL))
+ {
+ nav.setState(window, WindowState.NORMAL);
+ syncRequired = true;
+ }
+ break;
+ case JetspeedRunData.MAXIMIZE:
+ if (!state.equals(WindowState.MAXIMIZED))
+ {
+ nav.setState(window, WindowState.MAXIMIZED);
+ syncRequired = true;
+ }
+ break;
+ case JetspeedRunData.CUSTOMIZE:
+ if (!mode2.equals(PortletMode.EDIT))
+ {
+ nav.setMode(window, PortletMode.EDIT);
+ syncRequired = true;
+ }
+ break;
+ }
+
+ if (syncRequired)
+ {
+ nav.sync(context);
+ }
}
}
1.7 +40 -8
jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/modules/actions/FusionAccessController.java
Index: FusionAccessController.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/modules/actions/FusionAccessController.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FusionAccessController.java 9 Nov 2004 00:42:29 -0000 1.6
+++ FusionAccessController.java 24 May 2005 21:12:36 -0000 1.7
@@ -17,6 +17,7 @@
import java.util.Iterator;
+import javax.portlet.PortletMode;
import javax.portlet.WindowState;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
@@ -24,6 +25,7 @@
import org.apache.jetspeed.Jetspeed;
import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.container.state.MutableNavigationalState;
import org.apache.jetspeed.container.state.NavigationalState;
import org.apache.jetspeed.container.state.NavigationalStateComponent;
import org.apache.jetspeed.container.url.PortalURL;
@@ -116,8 +118,32 @@
PortalURL url = context.getPortalURL();
if (url != null)
{
- NavigationalState state = url.getNavigationalState();
+ NavigationalState state = url.getNavigationalState();
PortletWindow actionWindow =
state.getPortletWindowOfAction();
+ if (actionWindow == null)
+ {
+ Iterator windows = state.getWindowIdIterator();
+ while (windows.hasNext())
+ {
+ String windowId = (String)windows.next();
+ PortletMode mode = state.getMode(windowId);
+ WindowState wstate = state.getState(windowId);
+ if (wstate != null || mode != null)
+ {
+ String windowState = "";
+ if (wstate != null)
+ windowState = wstate.toString();
+
+ String portletMode = "";
+ if (mode != null)
+ portletMode = mode.toString();
+
+ Portlets portlets =
((JetspeedRunData)data).getProfile().getDocument().getPortlets();
+ traverse(portlets, windowId, windowState,
portletMode, (JetspeedRunData)data);
+ }
+ }
+
+ }
if (actionWindow != null)
{
String windowId = actionWindow.getId().toString();
@@ -130,7 +156,12 @@
{
windowState = "";
}
- traverse(portlets, windowId, windowState,
(JetspeedRunData)data);
+ PortletMode mode = state.getMode(actionWindow);
+ String portletMode = "";
+ if (mode != null)
+ portletMode = mode.toString();
+
+ traverse(portlets, windowId, windowState, portletMode,
(JetspeedRunData)data);
throwit = true;
}
}
@@ -152,7 +183,7 @@
}
}
- private boolean traverse(Portlets portlets, String windowId, String
action, JetspeedRunData jdata)
+ private boolean traverse(Portlets portlets, String windowId, String
windowAction, String modeAction, JetspeedRunData jdata)
{
// First let's add all the Entries in the current level
Iterator eItr = portlets.getEntriesIterator();
@@ -169,16 +200,16 @@
if (windowId.equals(param.getValue()))
{
//System.out.println("GOT A MATCH: " + entry.getId());
- if (action.equals(WindowState.MAXIMIZED.toString()))
+ if (windowAction.equals(WindowState.MAXIMIZED.toString()))
{
jdata.getUser().setTemp("js_peid", entry.getId());
}
- else if (action.equals(WindowState.NORMAL.toString()))
+ else if (windowAction.equals(WindowState.NORMAL.toString()))
{
// restore
jdata.getUser().removeTemp("js_peid");
}
- else if (action.equals(WindowState.MINIMIZED.toString()))
+ else if
(windowAction.equals(WindowState.MINIMIZED.toString()))
{
try
{
@@ -196,6 +227,7 @@
}
}
+
return true;
}
@@ -207,7 +239,7 @@
while(pItr.hasNext())
{
Portlets childPortlets = (Portlets)pItr.next();
- if (traverse(childPortlets, windowId, action, jdata))
+ if (traverse(childPortlets, windowId, windowAction,
modeAction, jdata))
{
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]