Author: thomas.heute(a)jboss.com
Date: 2008-10-31 08:22:33 -0400 (Fri, 31 Oct 2008)
New Revision: 12221
Removed:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
Log:
- Rollback
Deleted:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java 2008-10-31
12:05:41 UTC (rev 12220)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/Constants.java 2008-10-31
12:22:33 UTC (rev 12221)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * 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;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class Constants
-{
-
- /** . */
- public static final String LAYOUT_ID =
"org.jboss.portal.presentation.layout_id";
-
- /** . */
- public static final String SIMPLE_LAYOUT = "simple";
-
- /** . */
- public static final String REGION_LAYOUT = "region";
-
- /** . */
- public static final String DESKTOP_LAYOUT = "desktop";
-
- /** . */
- public static final String SIMPLE_LAYOUT_ORIENTATION =
"org.jboss.portal.presentation.layout.simple.orientation";
-
- /** . */
- public static final String SIMPLE_LAYOUT_INDEX =
"org.jboss.portal.presentation.layout.simple.index";
-
- /** . */
- public static final String VERTICAL_ORIENTATION = "vertical";
-
- /** . */
- public static final String HORIZONTAL_ORIENTATION = "horizontal";
-
- /** . */
- public static final String REGION_LAYOUT_TEMPLATE =
"org.jboss.portal.presentation.layout.region.template";
-
- /** . */
- public static final String REGION_LAYOUT_NAME =
"org.jboss.portal.presentation.layout.region.name";
-
- /** . */
- public static final String REGION_LAYOUT_INDEX =
"org.jboss.portal.presentation.layout.region.index";
-
- /** . */
- public static final String DESKTOP_LAYOUT_X =
"org.jboss.portal.presentation.layout.desktop.x";
-
- /** . */
- public static final String DESKTOP_LAYOUT_Y =
"org.jboss.portal.presentation.layout.desktop.y";
-
-}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-10-31
12:05:41 UTC (rev 12220)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-10-31
12:22:33 UTC (rev 12221)
@@ -31,10 +31,10 @@
import java.util.Iterator;
import java.util.Map;
-import org.jboss.portal.presentation.ajax.client.Constants;
import org.jboss.portal.presentation.ajax.client.protocol.MoveObjectAction;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
+import org.jboss.portal.presentation.layout.Constants;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-10-31
12:05:41 UTC (rev 12220)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-10-31
12:22:33 UTC (rev 12221)
@@ -23,31 +23,42 @@
package org.jboss.portal.presentation.classic;
import java.io.IOException;
+import java.io.PrintWriter;
import java.io.Writer;
+import java.util.Collection;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.io.SerializationFilter;
import org.jboss.portal.common.servlet.URLFormat;
import org.jboss.portal.common.util.Base64;
import org.jboss.portal.presentation.classic.protocol.ClassicActionDecoderContext;
import org.jboss.portal.presentation.classic.protocol.ClassicActionEncoderContext;
-import org.jboss.portal.presentation.classic.theme.Renderer;
-import org.jboss.portal.presentation.classic.theme.RendererContext;
-import org.jboss.portal.presentation.classic.theme.TemplateInfo;
-import org.jboss.portal.presentation.classic.theme.impl.XHTMLTemplateImpl;
-import org.jboss.portal.presentation.classic.theme.info.ThemeInfo;
import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
import org.jboss.portal.presentation.impl.model.pull.DetachedViewPortContext;
import
org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import
org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
+import org.jboss.portal.presentation.layout.Layout;
+import org.jboss.portal.presentation.layout.LayoutFactory;
+import org.jboss.portal.presentation.layout.ModelLayoutAdapter;
+import org.jboss.portal.presentation.layout.Orientation;
+import org.jboss.portal.presentation.layout.SimpleLayout;
import org.jboss.portal.presentation.model.UIModel;
+import org.jboss.portal.presentation.model.UINode;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.model.ui.UIContext;
+import org.jboss.portal.presentation.model.ui.UILayout;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPage;
+import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
import org.jboss.portal.presentation.protocol.codec.ActionDecoderContext;
import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
@@ -238,14 +249,149 @@
//
DetachedUINode node = context.getNode(nodeId);
-
- // TEST
- ThemeInfo theme = new ThemeInfo(null, null);
- TemplateInfo template = new XHTMLTemplateImpl();
- Renderer renderSet = new Renderer(theme, template);
-
- RendererContext ctx = new RendererContext(encoder, encoderContext, req, resp);
- renderSet.renderDocument(ctx, server, this, node);
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("<html><head>");
+
+ writer.print("</head><body>");
+ renderNode(node, writer);
+ writer.print("</body></html>");
}
+ private void renderNode(UINode node, PrintWriter writer)
+ {
+ UIObject object = node.getObject();
+
+ //
+ writer.println("<div style=\"border: 1px solid
black\">");
+
+ //
+ if (object instanceof UIContext)
+ {
+ renderChildren(node, writer);
+ }
+ else if (object instanceof UILayout)
+ {
+ if (node.getChildren() != null)
+ {
+ renderPane(node, writer);
+ }
+ else
+ {
+ if (object instanceof UIPage)
+ {
+ ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
+
+ String url = encoder.encode(viewPage, encoderContext);
+
+ writer.print("<div>Link to page <a href=\"" + url
+ "\">" + object.getId() + "</a></div>");
+ }
+ }
+ }
+ else if (object instanceof UIWindow)
+ {
+ try
+ {
+ ContentFragment content = server.renderWindow(this, object.getId());
+
+ //
+ writer.print("<li class=\"element\">");
+ writer.print("<div>");
+ writer.print("Window " + object.getId());
+ writer.print("</div>");
+ writer.print("<div>");
+ writer.print(content.getMarkup());
+ writer.print("</div>");
+ writer.print("</li>");
+ }
+ catch (PresentationServerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ //
+ writer.println("</div>");
+ }
+
+ private void renderPane(UINode node, PrintWriter writer)
+ {
+ LayoutFactory<UINode> layoutFactory = new LayoutFactory<UINode>(new
ModelLayoutAdapter());
+
+ //
+ Layout<UINode> layout = layoutFactory.getLayout(node);
+
+ //
+ if (layout instanceof SimpleLayout)
+ {
+ //
+ SimpleLayout<UINode> simpleLayout = (SimpleLayout<UINode>)layout;
+
+ //
+ Orientation orientation = simpleLayout.getOrientation();
+
+ //
+ writer.print("<table>");
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<tr>");
+ }
+
+ //
+ Collection<? extends UINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (UINode child : children)
+ {
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<td>");
+ renderNode(child, writer);
+ writer.print("</td>");
+ }
+ else
+ {
+ writer.print("<tr><td>");
+ renderNode(child, writer);
+ writer.print("</td></tr>");
+ }
+ }
+ }
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("</tr>");
+ }
+
+ //
+ writer.print("</table>");
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ private void renderChildren(UINode node, PrintWriter writer)
+ {
+ Collection<? extends UINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (UINode child : children)
+ {
+ renderNode(child, writer);
+ }
+ }
+ }
}