Author: julien(a)jboss.com
Date: 2008-07-22 09:40:07 -0400 (Tue, 22 Jul 2008)
New Revision: 11543
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
Log:
retrieves full content from a window (expiration+title+markup) instead of just the markup
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-07-22
13:19:51 UTC (rev 11542)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-07-22
13:40:07 UTC (rev 11543)
@@ -24,6 +24,7 @@
import com.google.gwt.user.client.rpc.RemoteService;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
+import org.jboss.portal.presentation.ajax.client.model.ContentFragment;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
@@ -42,12 +43,12 @@
ModelUpdate[] getRoot();
/**
- * Renders the content of a window.
+ * Renders the content of a window into a fragment
*
* @param windowId the window id
* @return the window rendition
*/
- String render(String windowId);
+ ContentFragment render(String windowId);
/**
* Process an ajax request.
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-22
13:19:51 UTC (rev 11542)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-22
13:40:07 UTC (rev 11543)
@@ -36,6 +36,7 @@
import com.google.gwt.core.client.GWT;
import org.jboss.portal.presentation.ajax.client.PresentationClientRemoteAsync;
import org.jboss.portal.presentation.ajax.client.PresentationClientRemote;
+import org.jboss.portal.presentation.ajax.client.model.ContentFragment;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
@@ -323,10 +324,11 @@
public void onSuccess(Object o)
{
- String content = (String)o;
+ ContentFragment content = (ContentFragment)o;
//
- markup.setHTML(content);
+ markup.setHTML(content.getMarkup());
+ title.setText(content.getTitle());
}
};
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/ContentFragment.java 2008-07-22
13:40:07 UTC (rev 11543)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.model;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContentFragment implements IsSerializable
+{
+
+ /** . */
+ private long expirationMillis;
+
+ /** . */
+ private String title;
+
+ /** . */
+ private String markup;
+
+
+ public ContentFragment(long expirationMillis, String title, String markup)
+ {
+ this.expirationMillis = expirationMillis;
+ this.title = title;
+ this.markup = markup;
+ }
+
+ public ContentFragment()
+ {
+ }
+
+ public long getExpirationMillis()
+ {
+ return expirationMillis;
+ }
+
+ public void setExpirationMillis(long expirationMillis)
+ {
+ this.expirationMillis = expirationMillis;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public String getMarkup()
+ {
+ return markup;
+ }
+
+ public void setMarkup(String markup)
+ {
+ this.markup = markup;
+ }
+}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-22
13:19:51 UTC (rev 11542)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-22
13:40:07 UTC (rev 11543)
@@ -72,8 +72,6 @@
public class PresentationClientServlet extends RemoteServiceServlet implements
PresentationClientRemote
{
-
-
public void init() throws ServletException
{
super.init();
@@ -118,7 +116,7 @@
return new PresentationClientImpl(req, dispatcher, encoder);
}
- public String render(String windowId)
+ public org.jboss.portal.presentation.ajax.client.model.ContentFragment render(String
windowId)
{
PresentationClient client = createPresentationClient();
PresentationServer server = getPresentationServer();
@@ -127,11 +125,22 @@
try
{
ContentFragment fragment = server.renderWindow(client, windowId);
- return fragment.getMarkup();
+
+ //
+ return new org.jboss.portal.presentation.ajax.client.model.ContentFragment(
+ fragment.getExpirationMillis(),
+ fragment.getTitle(),
+ fragment.getMarkup()
+ );
}
catch (PresentationServerException e)
{
- return "An error occured";
+ // todo : improve that
+ return new org.jboss.portal.presentation.ajax.client.model.ContentFragment(
+ 0,
+ "Error",
+ "An error occured"
+ );
}
}