Author: sohil.shah(a)jboss.com
Date: 2008-01-07 01:36:03 -0500 (Mon, 07 Jan 2008)
New Revision: 9443
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
Log:
Ajax User Agent - minor code cleanup
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-07
01:31:58 UTC (rev 9442)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-07
06:36:03 UTC (rev 9443)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.ajax.client.Session;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
@@ -70,6 +71,10 @@
{
AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
Session.getInstance().getUiContext().addObject(uiObject);
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
caller.callback(uiObject);
}
}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java 2008-01-07
01:31:58 UTC (rev 9442)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java 2008-01-07
06:36:03 UTC (rev 9443)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.ajax.client.Session;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
@@ -69,7 +70,10 @@
{
AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
Session.getInstance().getUiContext().addObject(uiObject);
- Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
caller.callback(uiObject);
}
}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07
01:31:58 UTC (rev 9442)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07
06:36:03 UTC (rev 9443)
@@ -61,17 +61,11 @@
*
*/
public class PortletWindow implements Caller
-{
- private static final int windowStateUpdate = 1;
- private static final int getActivation = 2;
- private static final int postActivation = 3;
-
+{
/**
*
*/
private AjaxUIWindow window = null;
- private String newWindowState = null;
- private int requestType = 0;
/**
*
@@ -166,70 +160,11 @@
*
*/
public void callback(Object result)
- {
- if(result instanceof AjaxUIPage)
- {
- if(requestType == PortletWindow.windowStateUpdate)
- {
- boolean valid = this.validateNewWindowState();
- if(valid)
- {
- this.refresh();
- if(this.newWindowState.equals(AjaxUIWindow.NORMAL))
- {
- LayoutManager.normal(this.getName());
- }
- else if(this.newWindowState.equals(AjaxUIWindow.MAXIMIZE))
- {
- LayoutManager.maximize(this.getName());
- }
- else if(this.newWindowState.equals(AjaxUIWindow.MINIMIZE))
- {
- LayoutManager.minimize(this.getName());
- }
- }
- else
- {
- //Do something to handle this situation in a user-friendly manner
- //Probably just laying out the current state of the page
- Util.displayPortalPage();
- }
- }
- else if(requestType == PortletWindow.getActivation)
- {
- Util.displayPortalPage();
- }
- else if(requestType == PortletWindow.postActivation)
- {
- Util.displayPortalPage();
- }
- }
-
- //local state cleanup
- this.newWindowState = null;
+ {
+ this.refresh();
+ Util.displayPortalPage();
}
-
- /**
- *
- *
- */
- private boolean validateNewWindowState()
- {
- boolean valid = false;
- String display = (String)Session.getInstance().getAttribute(Session.display);
- AjaxUIPage displayedPage =
(AjaxUIPage)Session.getInstance().getUiContext().getObject(display);
-
- AjaxUIWindow childWindow = (AjaxUIWindow)displayedPage.getChild(this.getName());
-
- if(childWindow != null &&
childWindow.getState().equals(this.newWindowState))
- {
- valid = true;
- }
-
- return valid;
- }
-
/**
*
*
@@ -251,7 +186,6 @@
private void handlePartialRefreshLink(String url, Widget windowContent)
{
AsyncActivateAction action = new AsyncActivateAction(url);
- this.requestType = PortletWindow.getActivation;
action.execute(this);
}
@@ -274,7 +208,6 @@
}
}
AsyncActivateAction action = new AsyncActivateAction(url);
- this.requestType = PortletWindow.getActivation;
action.execute(this);
}
@@ -397,23 +330,17 @@
//Process the action performed on the window
if(action.equals(AjaxUIWindow.NORMAL))
{
- AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.NORMAL);
- newWindowState = AjaxUIWindow.NORMAL;
- requestType = PortletWindow.windowStateUpdate;
+ AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.NORMAL);
stateAction.execute(this.portletWindow);
}
else if(action.equals(AjaxUIWindow.MAXIMIZE))
{
- AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MAXIMIZE);
- newWindowState = AjaxUIWindow.MAXIMIZE;
- requestType = PortletWindow.windowStateUpdate;
+ AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MAXIMIZE);
stateAction.execute(this.portletWindow);
}
else if(action.equals(AjaxUIWindow.MINIMIZE))
{
- AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
- newWindowState = AjaxUIWindow.MINIMIZE;
- requestType = PortletWindow.windowStateUpdate;
+ AjaxUpdateWindowStateAction stateAction = new
AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
stateAction.execute(this.portletWindow);
}
else if(action.equals("save"))
Show replies by date