You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2006/09/29 17:37:34 UTC
svn commit: r451358 - in /incubator/adffaces/trunk/trinidad:
trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/
trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/ ...
Author: awiner
Date: Fri Sep 29 10:37:32 2006
New Revision: 451358
URL: http://svn.apache.org/viewvc?view=rev&rev=451358
Log:
Add CoreRenderer and RenderUtils to the public API, leaving behind deprecated stubs this time... Add a new pair of methods to RequestContext to save and restore the state of a component tree, basically just trivially exposing existing StateManagerImpl functionality in our public API
Added:
incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
Modified:
incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java
incubator/adffaces/trunk/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/MockRequestContext.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderUtils.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TreeTableRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pages/GenericEntry.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/MacOSSwitcherIcon.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/AccessKeyUtils.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DesktopPanelPageHeaderRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailHeaderRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/DetailColumnRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/SelectionColumnRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableRenderingContext.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelAccordionRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelChoiceRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/HtmlCommandLinkRenderer.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java
incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java
Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/RequestContext.java Fri Sep 29 10:37:32 2006
@@ -393,6 +393,27 @@
public abstract Agent getAgent();
/**
+ * Saves the state of a UIComponent tree into an Object. The
+ * Object will be serializable, unless a UIComponent
+ * in this tree contains a non-serializable property. This
+ * method does not check that condition.
+ * @param UIComponent the component
+ * @return an Object that can be passed to restoreComponent()
+ * to reinstantiate the state
+ */
+ public abstract Object saveComponent(UIComponent component);
+
+ /**
+ * Restores the state of a component.
+ * @param state an Object created by a prior call to saveComponent().
+ * @return the component
+ */
+ public abstract UIComponent restoreComponent(Object state)
+ throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException;
+
+ /**
* Releases the RequestContext object. This method must only
* be called by the code that created the RequestContext.
* @exception IllegalStateException if no RequestContext is attached
Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java?view=auto&rev=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java Fri Sep 29 10:37:32 2006
@@ -0,0 +1,620 @@
+/*
+ * Copyright 2005,2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.render;
+
+import java.io.IOException;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.component.UIXComponent;
+import org.apache.myfaces.trinidad.context.Agent;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+import org.apache.myfaces.trinidad.context.RenderingContext;
+
+/**
+ * Basic implementation of the core rendering functionality
+ * across render kits.
+ */
+public class CoreRenderer extends Renderer
+{
+ /**
+ * @todo Move elsewhere?
+ */
+ static public final char CHAR_UNDEFINED = (char) -1;
+ static public final int NO_CHILD_INDEX = -1;
+
+ protected CoreRenderer()
+ {
+ }
+
+
+ //
+ // COERCION HELPERS
+ //
+
+ /**
+ * Coerces an object into a String.
+ */
+ static public String toString(Object o)
+ {
+ if (o == null)
+ return null;
+ return o.toString();
+ }
+
+
+ /**
+ * Coerces an object into a URI, accounting for JSF rules
+ * with initial slashes.
+ */
+ static public String toUri(Object o)
+ {
+ if (o == null)
+ return null;
+
+ String uri = o.toString();
+ if (uri.startsWith("/"))
+ {
+ // Treat two slashes as server-relative
+ if (uri.startsWith("//"))
+ {
+ uri = uri.substring(1);
+ }
+ else
+ {
+ FacesContext fContext = FacesContext.getCurrentInstance();
+ uri = fContext.getExternalContext().getRequestContextPath() + uri;
+ }
+ }
+
+ return uri;
+ }
+
+
+ /**
+ * Returns the integer value of an object; this does
+ * not support null (which must be substituted with a default
+ * before calling).
+ */
+ static public int toInt(Object o)
+ {
+ return ((Number) o).intValue();
+ }
+
+
+
+ /**
+ * Returns the integer value of an object; this does
+ * not support null (which must be substituted with a default
+ * before calling).
+ */
+ static public long toLong(Object o)
+ {
+ return ((Number) o).longValue();
+ }
+
+ /**
+ * Returns the character value of an object, XhtmlConstants.CHAR_UNDEFINED
+ * if there is none.
+ */
+ static public char toChar(Object o)
+ {
+ if (o == null)
+ return CHAR_UNDEFINED;
+
+ if (o instanceof Character)
+ return ((Character) o).charValue();
+
+ // If it's not a Character object, then let's turn it into
+ // a CharSequence and grab the first character
+ CharSequence cs;
+ if (o instanceof CharSequence)
+ {
+ cs = (CharSequence) o;
+ }
+ else
+ {
+ cs = o.toString();
+ }
+
+ if (cs.length() == 0)
+ return CHAR_UNDEFINED;
+
+ return cs.charAt(0);
+ }
+
+
+ @Override
+ public final void encodeBegin(FacesContext context,
+ UIComponent component) throws IOException
+ {
+ if (!getRendersChildren())
+ {
+ RenderingContext arc = RenderingContext.getCurrentInstance();
+ if (arc == null)
+ throw new IllegalStateException("No RenderingContext");
+
+ FacesBean bean = getFacesBean(component);
+ encodeBegin(context, arc, component, bean);
+ }
+ }
+
+ @Override
+ public final void encodeChildren(FacesContext context, UIComponent component)
+ {
+ // encodeChildren() is fairly useless - it's simpler to just
+ // put the output in encodeEnd(), or use the encodeAll() hook
+ }
+
+ @Override
+ public final void encodeEnd(FacesContext context,
+ UIComponent component) throws IOException
+ {
+ RenderingContext arc = RenderingContext.getCurrentInstance();
+ if (arc == null)
+ throw new IllegalStateException("No RenderingContext");
+
+ FacesBean bean = getFacesBean(component);
+ if (getRendersChildren())
+ {
+ encodeAll(context, arc, component, bean);
+ }
+ else
+ {
+ encodeEnd(context, arc, component, bean);
+ }
+ }
+
+ /**
+ * Hook for rendering the start of a component; only
+ * called if getRendersChildren() is <em>false</em>.
+ */
+ protected void encodeBegin(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean) throws IOException
+ {
+ if (getRendersChildren())
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Hook for rendering the end of a component; only
+ * called if getRendersChildren() is <em>false</em>.
+ */
+ protected void encodeEnd(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean) throws IOException
+ {
+ if (getRendersChildren())
+ throw new IllegalStateException();
+ }
+
+
+ /**
+ * Hook for rendering all of a component; only
+ * called if getRendersChildren() is <em>true</em>.
+ */
+ protected void encodeAll(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean) throws IOException
+ {
+ if (!getRendersChildren())
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Hook for encoding a child; this assumes that isRendered()
+ * has already been called. (RenderUtils.encodeRecursive()
+ * can be used if you don't need that check.)
+ * =-=AEW Ugh.
+ */
+ @SuppressWarnings("unchecked")
+ protected void encodeChild(
+ FacesContext context,
+ UIComponent child) throws IOException
+ {
+ assert(child.isRendered());
+ child.encodeBegin(context);
+ if (child.getRendersChildren())
+ {
+ child.encodeChildren(context);
+ }
+ else
+ {
+ if (child.getChildCount() > 0)
+ {
+ for(UIComponent subChild : (List<UIComponent>)child.getChildren())
+ {
+ RenderUtils.encodeRecursive(context, subChild);
+ }
+ }
+ }
+
+ child.encodeEnd(context);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ protected final void encodeAllChildren(
+ FacesContext context,
+ UIComponent component) throws IOException
+ {
+ int childCount = component.getChildCount();
+ if (childCount == 0)
+ return;
+
+ for(UIComponent child : (List<UIComponent>)component.getChildren())
+ {
+ if (child.isRendered())
+ {
+ encodeChild(context, child);
+ }
+ }
+ }
+
+ /**
+ * @todo Fix reference to CoreRenderer
+ */
+ protected void delegateRenderer(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean,
+ CoreRenderer renderer) throws IOException
+ {
+ if (renderer.getRendersChildren())
+ {
+ renderer.encodeAll(context, arc, component, bean);
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * @todo Fix reference to CoreRenderer
+ */
+ protected void delegateRendererBegin(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean,
+ CoreRenderer renderer) throws IOException
+ {
+ if (renderer.getRendersChildren())
+ {
+ throw new IllegalStateException();
+ }
+ else
+ {
+ renderer.encodeBegin(context, arc, component, bean);
+ }
+ }
+
+ /**
+ * @todo Fix reference to CoreRenderer
+ */
+ protected void delegateRendererEnd(
+ FacesContext context,
+ RenderingContext arc,
+ UIComponent component,
+ FacesBean bean,
+ CoreRenderer renderer) throws IOException
+ {
+ if (renderer.getRendersChildren())
+ {
+ throw new IllegalStateException();
+ }
+ else
+ {
+ renderer.encodeEnd(context, arc, component, bean);
+ }
+ }
+
+ /**
+ * Renders the client ID as an "id".
+ */
+ protected void renderId(
+ FacesContext context,
+ UIComponent component) throws IOException
+ {
+ if (shouldRenderId(context, component))
+ {
+ String clientId = getClientId(context, component);
+ context.getResponseWriter().writeAttribute("id", clientId, "id");
+ }
+ }
+
+ /**
+ * Returns the client ID that should be used for rendering (if
+ * {@link #shouldRenderId} returns true).
+ */
+ protected String getClientId(
+ FacesContext context,
+ UIComponent component)
+ {
+ return component.getClientId(context);
+ }
+
+ /**
+ * Returns true if the component should render an ID. Components
+ * that deliver events should always return "true".
+ * @todo Is this a bottleneck? If so, optimize!
+ */
+ protected boolean shouldRenderId(
+ FacesContext context,
+ UIComponent component)
+ {
+ String id = component.getId();
+
+ // Otherwise, if ID isn't set, don't bother
+ if (id == null)
+ return false;
+
+ // ... or if the ID was generated, don't bother
+ if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ return false;
+
+ return true;
+ }
+
+ protected boolean skipDecode(FacesContext context)
+ {
+ return false;
+ }
+
+ protected FacesBean getFacesBean(UIComponent component)
+ {
+ return ((UIXComponent) component).getFacesBean();
+ }
+
+ static protected final Object getRenderingProperty(
+ RenderingContext arc,
+ Object key)
+ {
+ return arc.getProperties().get(key);
+ }
+
+ static protected final Object setRenderingProperty(
+ RenderingContext arc,
+ Object key,
+ Object value)
+ {
+ return arc.getProperties().put(key, value);
+ }
+
+ /**
+ * Gets a facet, verifying that the facet should be rendered.
+ */
+ static public UIComponent getFacet(
+ UIComponent component,
+ String name)
+ {
+ UIComponent facet = component.getFacet(name);
+ if ((facet == null) || !facet.isRendered())
+ return null;
+
+ return facet;
+ }
+
+ /**
+ * Returns true if the component has children and at least
+ * one has rendered=="true".
+ */
+ @SuppressWarnings("unchecked")
+ static public boolean hasRenderedChildren(UIComponent component)
+ {
+ int count = component.getChildCount();
+ if (count == 0)
+ return false;
+
+ for(UIComponent child : (List<UIComponent>)component.getChildren())
+ {
+ if (child.isRendered())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the total number of children with rendered=="true".
+ */
+ @SuppressWarnings("unchecked")
+ static public int getRenderedChildCount(UIComponent component)
+ {
+ int count = component.getChildCount();
+ if (count == 0)
+ return 0;
+
+ int total = 0;
+ for(UIComponent child : (List<UIComponent>)component.getChildren())
+ {
+ if (child.isRendered())
+ {
+ total++;
+ }
+ }
+
+ return total;
+ }
+
+
+ /**
+ * @param afterChildIndex The children coming after this index, will
+ * be considered.
+ * @return the index of the next child that must be rendered, or
+ * {@link #NO_CHILD_INDEX} if there is none.
+ */
+ public static int getNextRenderedChildIndex(
+ List<UIComponent> components,
+ int afterChildIndex
+ )
+ {
+ int childIndex = afterChildIndex + 1;
+ Iterator<UIComponent> iter = components.listIterator(childIndex);
+ for(; iter.hasNext(); childIndex++)
+ {
+ if(iter.next().isRendered())
+ {
+ return childIndex;
+ }
+ }
+
+ return NO_CHILD_INDEX;
+ }
+
+
+ //
+ // AGENT CAPABILITY CONVENIENCE METHODS
+ //
+
+ static public boolean isDesktop(RenderingContext arc)
+ {
+ return (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP));
+ }
+
+ static public boolean isPDA(RenderingContext arc)
+ {
+ return (arc.getAgent().getType().equals(Agent.TYPE_PDA));
+ }
+
+ static public boolean isIE(RenderingContext arc)
+ {
+ return (arc.getAgent().getAgentName().equals(Agent.AGENT_IE));
+ }
+
+ static public boolean isGecko(RenderingContext arc)
+ {
+ return (arc.getAgent().getAgentName().equals(Agent.AGENT_GECKO));
+ }
+
+ static public boolean isInaccessibleMode(RenderingContext arc)
+ {
+ return (arc.getAccessibilityMode() ==
+ RequestContext.Accessibility.INACCESSIBLE);
+ }
+
+ static public boolean isScreenReaderMode(RenderingContext arc)
+ {
+ return (arc.getAccessibilityMode() ==
+ RequestContext.Accessibility.SCREEN_READER);
+ }
+
+ //
+ // Rendering convenience methods.
+ //
+
+ protected void renderEncodedActionURI(
+ FacesContext context,
+ String name,
+ Object value) throws IOException
+ {
+ if (value != null)
+ {
+ value = context.getExternalContext().encodeActionURL(value.toString());
+ context.getResponseWriter().writeURIAttribute(name, value, null);
+ }
+ }
+
+ protected void renderEncodedResourceURI(
+ FacesContext context,
+ String name,
+ Object value) throws IOException
+ {
+ if (value != null)
+ {
+ value = context.getExternalContext().encodeResourceURL(value.toString());
+ context.getResponseWriter().writeURIAttribute(name, value, null);
+ }
+ }
+
+
+
+ /**
+ * Render a generic CSS styleClass (not one derived from an attribute).
+ * The styleclass will be passed through the RenderingContext
+ * getStyleClass() API.
+ * @param context the FacesContext
+ * @param styleClass the style class
+ */
+ static public void renderStyleClass(
+ FacesContext context,
+ RenderingContext arc,
+ String styleClass) throws IOException
+ {
+ if (styleClass != null)
+ {
+ styleClass = arc.getStyleClass(styleClass);
+ context.getResponseWriter().writeAttribute("class", styleClass, null);
+ }
+ }
+
+ /**
+ * Render an array of CSS styleClasses as space-separated values.
+ * NOTE: the array is mutated during this method, and cannot
+ * be reused! Each styleclass will be passed through the RenderingContext
+ * getStyleClass() API.
+ * @param context the FacesContext
+ * @param styleClass the style class
+ */
+ static public void renderStyleClasses(
+ FacesContext context,
+ RenderingContext arc,
+ String[] styleClasses) throws IOException
+ {
+ int length = 0;
+ for (int i = 0; i < styleClasses.length; i++)
+ {
+ if (styleClasses[i] != null)
+ {
+ String styleClass = arc.getStyleClass(styleClasses[i]);
+ length += styleClass.length() + 1;
+ styleClasses[i] = styleClass;
+ }
+ }
+
+ StringBuilder builder = new StringBuilder(length);
+ for (int i = 0; i < styleClasses.length; i++)
+ {
+ if (styleClasses[i] != null)
+ {
+ if (builder.length() != 0)
+ builder.append(' ');
+ builder.append(styleClasses[i]);
+ }
+ }
+
+ context.getResponseWriter().writeAttribute("class", builder.toString(), null);
+ }
+}
Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java?view=auto&rev=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java Fri Sep 29 10:37:32 2006
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2004-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.render;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.component.UIXForm;
+
+/**
+ * Generic utilities for rendering.
+ *
+ * @author The Oracle ADF Faces Team
+ */
+public class RenderUtils
+{
+ private RenderUtils()
+ {
+ }
+
+
+ /**
+ * Encodes a component and all of its children.
+ */
+ @SuppressWarnings("unchecked")
+ static public void encodeRecursive(FacesContext context,
+ UIComponent component)
+ throws IOException
+ {
+ if (component.isRendered())
+ {
+ component.encodeBegin(context);
+ if (component.getRendersChildren())
+ {
+ component.encodeChildren(context);
+ }
+ else
+ {
+ if (component.getChildCount() > 0)
+ {
+ for(UIComponent child : (List<UIComponent>)component.getChildren())
+ {
+ encodeRecursive(context, child);
+ }
+ }
+ }
+
+ component.encodeEnd(context);
+ }
+ }
+
+ /**
+ * Retrieves id of the form the component is contained in.
+ *
+ * @param context the faces context object
+ * @param component UIComponent whose container form id is to be retuirned
+ *
+ * @return String id of the form if one exists in component's hierarchy,
+ * otherwise null
+ */
+ public static String getFormId(
+ FacesContext context,
+ UIComponent component)
+ {
+ UIComponent form = null;
+ while (component != null)
+ {
+ if ((component instanceof UIForm) ||
+ (component instanceof UIXForm))
+ {
+ form = component;
+ break;
+ }
+
+ component = component.getParent();
+ }
+
+ if (form == null)
+ return null;
+
+ return form.getClientId(context);
+ }
+}
Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/MockRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/MockRequestContext.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/MockRequestContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/MockRequestContext.java Fri Sep 29 10:37:32 2006
@@ -279,6 +279,20 @@
throw new UnsupportedOperationException("Not implemented yet");
}
+ @Override
+ public Object saveComponent(UIComponent component)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+
+ @Override
+ public UIComponent restoreComponent(Object state)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+
static private final TimeZone _FIXED_TIME_ZONE =
TimeZone.getTimeZone("America/Los_Angeles");
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java Fri Sep 29 10:37:32 2006
@@ -621,7 +621,7 @@
}
else if (agent.indexOf("Mac", paren) > 0)
{
- agentObj.setPlatform(Agent.PLATFORM_MAC);
+ agentObj.setPlatform(Agent.PLATFORM_MACOS);
}
else if (agent.indexOf("Linux", paren) > 0)
{
@@ -655,7 +655,7 @@
agentObj.setType(Agent.TYPE_DESKTOP);
agentObj.setAgent(Agent.AGENT_WEBKIT);
agentObj.setAgentVersion(version);
- agentObj.setPlatform(Agent.PLATFORM_MAC);
+ agentObj.setPlatform(Agent.PLATFORM_MACOS);
}
/**
@@ -720,7 +720,7 @@
}
else if (agent.indexOf("Mac", paren) > 0)
{
- agentObj.setPlatform(Agent.PLATFORM_MAC);
+ agentObj.setPlatform(Agent.PLATFORM_MACOS);
}
else if (agent.indexOf("Linux", paren) > 0)
{
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentNameUtil.java Fri Sep 29 10:37:32 2006
@@ -95,7 +95,7 @@
return TrinidadAgent.OS_WINDOWS;
}
- if (TrinidadAgent.PLATFORM_MAC.equals(platformName))
+ if (TrinidadAgent.PLATFORM_MACOS.equals(platformName))
{
return TrinidadAgent.OS_MACOS;
}
@@ -200,7 +200,7 @@
case TrinidadAgent.OS_WINDOWS:
return TrinidadAgent.PLATFORM_WINDOWS;
case TrinidadAgent.OS_MACOS:
- return TrinidadAgent.PLATFORM_MAC;
+ return TrinidadAgent.PLATFORM_MACOS;
case TrinidadAgent.OS_LINUX:
return TrinidadAgent.PLATFORM_LINUX;
case TrinidadAgent.OS_SOLARIS:
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Fri Sep 29 10:37:32 2006
@@ -124,6 +124,43 @@
_delegate = delegate;
}
+ static public Object saveComponentTree(
+ FacesContext context,
+ UIComponent component)
+ {
+ // Don't remove transient components...
+ Object structure = new Structure(component);
+ Object state = component.processSaveState(context);
+ return new PageState(structure, state, null);
+ }
+
+ static public UIComponent restoreComponentTree(
+ FacesContext context,
+ Object savedState) throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException
+ {
+ if (savedState == null)
+ throw new NullPointerException();
+
+ if (!(savedState instanceof PageState))
+ throw new IllegalArgumentException("Invalid saved state object");
+
+ PageState viewState = (PageState) savedState;
+
+ Object structure = viewState.getStructure();
+ Object state = viewState.getState();
+
+ UIComponent component =
+ ((Structure) structure).createComponent();
+
+ if (state != null)
+ component.processRestoreState(context, state);
+
+ return component;
+ }
+
+
/**
* Save a view root. Doesn't return a SerializedView because
* SerializedView is a non-static inner class, and this needs
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java Fri Sep 29 10:37:32 2006
@@ -49,6 +49,8 @@
import org.apache.myfaces.trinidadinternal.agent.AgentFactory;
import org.apache.myfaces.trinidadinternal.agent.AgentFactoryImpl;
+import org.apache.myfaces.trinidadinternal.application.StateManagerImpl;
+
import org.apache.myfaces.trinidadinternal.change.NullChangeManager;
import org.apache.myfaces.trinidadinternal.el.FormatterMap;
@@ -574,6 +576,21 @@
}
return _agent;
+ }
+
+ public Object saveComponent(UIComponent component)
+ {
+ return StateManagerImpl.saveComponentTree(__getFacesContext(),
+ component);
+ }
+
+ public UIComponent restoreComponent(Object state)
+ throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException
+ {
+ return StateManagerImpl.restoreComponentTree(__getFacesContext(),
+ state);
}
void __setPageResolver(PageResolver pageResolver)
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderUtils.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderUtils.java Fri Sep 29 10:37:32 2006
@@ -16,19 +16,15 @@
package org.apache.myfaces.trinidadinternal.renderkit;
import java.io.IOException;
-import java.util.List;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-
import javax.faces.context.FacesContext;
-import org.apache.myfaces.trinidad.component.UIXForm;
-
/**
- * Generic utilities for rendering.
+ * Stub for temporary backwards compatibility.
*
* @author The Oracle ADF Faces Team
+ * @deprecated
*/
public class RenderUtils
{
@@ -45,26 +41,8 @@
UIComponent component)
throws IOException
{
- if (component.isRendered())
- {
- component.encodeBegin(context);
- if (component.getRendersChildren())
- {
- component.encodeChildren(context);
- }
- else
- {
- if (component.getChildCount() > 0)
- {
- for(UIComponent child : (List<UIComponent>)component.getChildren())
- {
- encodeRecursive(context, child);
- }
- }
- }
-
- component.encodeEnd(context);
- }
+ org.apache.myfaces.trinidad.render.RenderUtils.encodeRecursive(context,
+ component);
}
/**
@@ -80,22 +58,7 @@
FacesContext context,
UIComponent component)
{
- UIComponent form = null;
- while (component != null)
- {
- if ((component instanceof UIForm) ||
- (component instanceof UIXForm))
- {
- form = component;
- break;
- }
-
- component = component.getParent();
- }
-
- if (form == null)
- return null;
-
- return form.getClientId(context);
+ return org.apache.myfaces.trinidad.render.RenderUtils.getFormId(context,
+ component);
}
}
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java Fri Sep 29 10:37:32 2006
@@ -68,7 +68,7 @@
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidadinternal.renderkit.RenderKitBase;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
+import org.apache.myfaces.trinidad.render.RenderUtils;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContextImpl;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderer.java Fri Sep 29 10:37:32 2006
@@ -15,607 +15,14 @@
*/
package org.apache.myfaces.trinidadinternal.renderkit.core;
-import java.io.IOException;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.render.Renderer;
-
-import org.apache.myfaces.trinidad.bean.FacesBean;
-import org.apache.myfaces.trinidad.component.UIXComponent;
-import org.apache.myfaces.trinidad.context.Agent;
-import org.apache.myfaces.trinidad.context.RequestContext;
-
-import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
-
/**
- * Basic implementation of the core rendering functionality
- * across render kits.
+ * Stub for temporary backwards compatibility.
+ * @Deprecated
*/
-public class CoreRenderer extends Renderer
+public class CoreRenderer extends org.apache.myfaces.trinidad.render.CoreRenderer
{
- /**
- * @todo Move elsewhere?
- */
- static public final char CHAR_UNDEFINED = (char) -1;
- static public final int NO_CHILD_INDEX = -1;
-
protected CoreRenderer()
{
}
-
- //
- // COERCION HELPERS
- //
-
- /**
- * Coerces an object into a String.
- */
- static public String toString(Object o)
- {
- if (o == null)
- return null;
- return o.toString();
- }
-
-
- /**
- * Coerces an object into a URI, accounting for JSF rules
- * with initial slashes.
- */
- static public String toUri(Object o)
- {
- if (o == null)
- return null;
-
- String uri = o.toString();
- if (uri.startsWith("/"))
- {
- // Treat two slashes as server-relative
- if (uri.startsWith("//"))
- {
- uri = uri.substring(1);
- }
- else
- {
- FacesContext fContext = FacesContext.getCurrentInstance();
- uri = fContext.getExternalContext().getRequestContextPath() + uri;
- }
- }
-
- return uri;
- }
-
-
- /**
- * Returns the integer value of an object; this does
- * not support null (which must be substituted with a default
- * before calling).
- */
- static public int toInt(Object o)
- {
- return ((Number) o).intValue();
- }
-
-
-
- /**
- * Returns the integer value of an object; this does
- * not support null (which must be substituted with a default
- * before calling).
- */
- static public long toLong(Object o)
- {
- return ((Number) o).longValue();
- }
-
- /**
- * Returns the character value of an object, XhtmlConstants.CHAR_UNDEFINED
- * if there is none.
- */
- static public char toChar(Object o)
- {
- if (o == null)
- return CHAR_UNDEFINED;
-
- if (o instanceof Character)
- return ((Character) o).charValue();
-
- // If it's not a Character object, then let's turn it into
- // a CharSequence and grab the first character
- CharSequence cs;
- if (o instanceof CharSequence)
- {
- cs = (CharSequence) o;
- }
- else
- {
- cs = o.toString();
- }
-
- if (cs.length() == 0)
- return CHAR_UNDEFINED;
-
- return cs.charAt(0);
- }
-
-
- @Override
- public final void encodeBegin(FacesContext context,
- UIComponent component) throws IOException
- {
- if (!getRendersChildren())
- {
- RenderingContext arc = RenderingContext.getCurrentInstance();
- if (arc == null)
- throw new IllegalStateException("No RenderingContext");
-
- FacesBean bean = getFacesBean(component);
- encodeBegin(context, arc, component, bean);
- }
- }
-
- @Override
- public final void encodeChildren(FacesContext context, UIComponent component)
- {
- // encodeChildren() is fairly useless - it's simpler to just
- // put the output in encodeEnd(), or use the encodeAll() hook
- }
-
- @Override
- public final void encodeEnd(FacesContext context,
- UIComponent component) throws IOException
- {
- RenderingContext arc = RenderingContext.getCurrentInstance();
- if (arc == null)
- throw new IllegalStateException("No RenderingContext");
-
- FacesBean bean = getFacesBean(component);
- if (getRendersChildren())
- {
- encodeAll(context, arc, component, bean);
- }
- else
- {
- encodeEnd(context, arc, component, bean);
- }
- }
-
- /**
- * Hook for rendering the start of a component; only
- * called if getRendersChildren() is <em>false</em>.
- */
- protected void encodeBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- if (getRendersChildren())
- throw new IllegalStateException();
- }
-
- /**
- * Hook for rendering the end of a component; only
- * called if getRendersChildren() is <em>false</em>.
- */
- protected void encodeEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- if (getRendersChildren())
- throw new IllegalStateException();
- }
-
-
- /**
- * Hook for rendering all of a component; only
- * called if getRendersChildren() is <em>true</em>.
- */
- protected void encodeAll(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean) throws IOException
- {
- if (!getRendersChildren())
- throw new IllegalStateException();
- }
-
- /**
- * Hook for encoding a child; this assumes that isRendered()
- * has already been called. (RenderUtils.encodeRecursive()
- * can be used if you don't need that check.)
- * =-=AEW Ugh.
- */
- @SuppressWarnings("unchecked")
- protected void encodeChild(
- FacesContext context,
- UIComponent child) throws IOException
- {
- assert(child.isRendered());
- child.encodeBegin(context);
- if (child.getRendersChildren())
- {
- child.encodeChildren(context);
- }
- else
- {
- if (child.getChildCount() > 0)
- {
- for(UIComponent subChild : (List<UIComponent>)child.getChildren())
- {
- RenderUtils.encodeRecursive(context, subChild);
- }
- }
- }
-
- child.encodeEnd(context);
- }
-
-
- @SuppressWarnings("unchecked")
- protected final void encodeAllChildren(
- FacesContext context,
- UIComponent component) throws IOException
- {
- int childCount = component.getChildCount();
- if (childCount == 0)
- return;
-
- for(UIComponent child : (List<UIComponent>)component.getChildren())
- {
- if (child.isRendered())
- {
- encodeChild(context, child);
- }
- }
- }
-
- /**
- * @todo Fix reference to CoreRenderer
- */
- protected void delegateRenderer(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- CoreRenderer renderer) throws IOException
- {
- if (renderer.getRendersChildren())
- {
- renderer.encodeAll(context, arc, component, bean);
- }
- else
- {
- throw new IllegalStateException();
- }
- }
-
- /**
- * @todo Fix reference to CoreRenderer
- */
- protected void delegateRendererBegin(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- CoreRenderer renderer) throws IOException
- {
- if (renderer.getRendersChildren())
- {
- throw new IllegalStateException();
- }
- else
- {
- renderer.encodeBegin(context, arc, component, bean);
- }
- }
-
- /**
- * @todo Fix reference to CoreRenderer
- */
- protected void delegateRendererEnd(
- FacesContext context,
- RenderingContext arc,
- UIComponent component,
- FacesBean bean,
- CoreRenderer renderer) throws IOException
- {
- if (renderer.getRendersChildren())
- {
- throw new IllegalStateException();
- }
- else
- {
- renderer.encodeEnd(context, arc, component, bean);
- }
- }
-
- /**
- * Renders the client ID as an "id".
- */
- protected void renderId(
- FacesContext context,
- UIComponent component) throws IOException
- {
- if (shouldRenderId(context, component))
- {
- String clientId = getClientId(context, component);
- context.getResponseWriter().writeAttribute("id", clientId, "id");
- }
- }
-
- /**
- * Returns the client ID that should be used for rendering (if
- * {@link #shouldRenderId} returns true).
- */
- protected String getClientId(
- FacesContext context,
- UIComponent component)
- {
- return component.getClientId(context);
- }
-
- /**
- * Returns true if the component should render an ID. Components
- * that deliver events should always return "true".
- * @todo Is this a bottleneck? If so, optimize!
- */
- protected boolean shouldRenderId(
- FacesContext context,
- UIComponent component)
- {
- String id = component.getId();
-
- // Otherwise, if ID isn't set, don't bother
- if (id == null)
- return false;
-
- // ... or if the ID was generated, don't bother
- if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
- return false;
-
- return true;
- }
-
- protected boolean skipDecode(FacesContext context)
- {
- return false;
- }
-
- protected FacesBean getFacesBean(UIComponent component)
- {
- return ((UIXComponent) component).getFacesBean();
- }
-
- static protected final Object getRenderingProperty(
- RenderingContext arc,
- Object key)
- {
- return arc.getProperties().get(key);
- }
-
- static protected final Object setRenderingProperty(
- RenderingContext arc,
- Object key,
- Object value)
- {
- return arc.getProperties().put(key, value);
- }
-
- /**
- * Gets a facet, verifying that the facet should be rendered.
- */
- static public UIComponent getFacet(
- UIComponent component,
- String name)
- {
- UIComponent facet = component.getFacet(name);
- if ((facet == null) || !facet.isRendered())
- return null;
-
- return facet;
- }
-
- /**
- * Returns true if the component has children and at least
- * one has rendered=="true".
- */
- @SuppressWarnings("unchecked")
- static public boolean hasRenderedChildren(UIComponent component)
- {
- int count = component.getChildCount();
- if (count == 0)
- return false;
-
- for(UIComponent child : (List<UIComponent>)component.getChildren())
- {
- if (child.isRendered())
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns the total number of children with rendered=="true".
- */
- @SuppressWarnings("unchecked")
- static public int getRenderedChildCount(UIComponent component)
- {
- int count = component.getChildCount();
- if (count == 0)
- return 0;
-
- int total = 0;
- for(UIComponent child : (List<UIComponent>)component.getChildren())
- {
- if (child.isRendered())
- {
- total++;
- }
- }
-
- return total;
- }
-
-
- /**
- * @param afterChildIndex The children coming after this index, will
- * be considered.
- * @return the index of the next child that must be rendered, or
- * {@link #NO_CHILD_INDEX} if there is none.
- */
- public static int getNextRenderedChildIndex(
- List<UIComponent> components,
- int afterChildIndex
- )
- {
- int childIndex = afterChildIndex + 1;
- Iterator<UIComponent> iter = components.listIterator(childIndex);
- for(; iter.hasNext(); childIndex++)
- {
- if(iter.next().isRendered())
- {
- return childIndex;
- }
- }
-
- return NO_CHILD_INDEX;
- }
-
-
- //
- // AGENT CAPABILITY CONVENIENCE METHODS
- //
-
- static public boolean isDesktop(RenderingContext arc)
- {
- return (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP));
- }
-
- static public boolean isPDA(RenderingContext arc)
- {
- return (arc.getAgent().getType().equals(Agent.TYPE_PDA));
- }
-
- static public boolean isIE(RenderingContext arc)
- {
- return (arc.getAgent().getAgentName().equals(Agent.AGENT_IE));
- }
-
- static public boolean isGecko(RenderingContext arc)
- {
- return (arc.getAgent().getAgentName().equals(Agent.AGENT_GECKO));
- }
-
- static public boolean isInaccessibleMode(RenderingContext arc)
- {
- return (arc.getAccessibilityMode() ==
- RequestContext.Accessibility.INACCESSIBLE);
- }
-
- static public boolean isScreenReaderMode(RenderingContext arc)
- {
- return (arc.getAccessibilityMode() ==
- RequestContext.Accessibility.SCREEN_READER);
- }
-
- //
- // Rendering convenience methods.
- //
-
- protected void renderEncodedActionURI(
- FacesContext context,
- String name,
- Object value) throws IOException
- {
- if (value != null)
- {
- value = context.getExternalContext().encodeActionURL(value.toString());
- context.getResponseWriter().writeURIAttribute(name, value, null);
- }
- }
-
- protected void renderEncodedResourceURI(
- FacesContext context,
- String name,
- Object value) throws IOException
- {
- if (value != null)
- {
- value = context.getExternalContext().encodeResourceURL(value.toString());
- context.getResponseWriter().writeURIAttribute(name, value, null);
- }
- }
-
-
-
- /**
- * Render a generic CSS styleClass (not one derived from an attribute).
- * The styleclass will be passed through the RenderingContext
- * getStyleClass() API.
- * @param context the FacesContext
- * @param styleClass the style class
- */
- static public void renderStyleClass(
- FacesContext context,
- RenderingContext arc,
- String styleClass) throws IOException
- {
- if (styleClass != null)
- {
- styleClass = arc.getStyleClass(styleClass);
- context.getResponseWriter().writeAttribute("class", styleClass, null);
- }
- }
-
- /**
- * Render an array of CSS styleClasses as space-separated values.
- * NOTE: the array is mutated during this method, and cannot
- * be reused! Each styleclass will be passed through the RenderingContext
- * getStyleClass() API.
- * @param context the FacesContext
- * @param styleClass the style class
- */
- static public void renderStyleClasses(
- FacesContext context,
- RenderingContext arc,
- String[] styleClasses) throws IOException
- {
- int length = 0;
- for (int i = 0; i < styleClasses.length; i++)
- {
- if (styleClasses[i] != null)
- {
- String styleClass = arc.getStyleClass(styleClasses[i]);
- length += styleClass.length() + 1;
- styleClasses[i] = styleClass;
- }
- }
-
- StringBuilder builder = new StringBuilder(length);
- for (int i = 0; i < styleClasses.length; i++)
- {
- if (styleClasses[i] != null)
- {
- if (builder.length() != 0)
- builder.append(' ');
- builder.append(styleClasses[i]);
- }
- }
-
- context.getResponseWriter().writeAttribute("class", builder.toString(), null);
- }
}
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java Fri Sep 29 10:37:32 2006
@@ -32,7 +32,7 @@
import org.apache.myfaces.trinidad.component.core.data.CoreTable;
import org.apache.myfaces.trinidadinternal.io.RepeatIdResponseWriter;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ShowDetailRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TreeTableRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TreeTableRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TreeTableRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TreeTableRenderer.java Fri Sep 29 10:37:32 2006
@@ -36,7 +36,7 @@
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.context.FormData;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ResourceKeyUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pages/GenericEntry.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pages/GenericEntry.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pages/GenericEntry.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pages/GenericEntry.java Fri Sep 29 10:37:32 2006
@@ -31,8 +31,8 @@
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.render.InternalView;
+import org.apache.myfaces.trinidad.render.RenderUtils;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/MacOSSwitcherIcon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/MacOSSwitcherIcon.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/MacOSSwitcherIcon.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/MacOSSwitcherIcon.java Fri Sep 29 10:37:32 2006
@@ -103,7 +103,7 @@
private Icon _getIcon(RenderingContext arc)
{
return (arc.getAgent().getPlatformName().equals(
- Agent.PLATFORM_MAC)) ?
+ Agent.PLATFORM_MACOS)) ?
_macOSIcon :
_icon;
}
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/AccessKeyUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/AccessKeyUtils.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/AccessKeyUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/AccessKeyUtils.java Fri Sep 29 10:37:32 2006
@@ -21,7 +21,7 @@
import javax.faces.context.ResponseWriter;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
/**
* Utilities for working with access keys.
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DesktopPanelPageHeaderRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DesktopPanelPageHeaderRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DesktopPanelPageHeaderRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DesktopPanelPageHeaderRenderer.java Fri Sep 29 10:37:32 2006
@@ -26,7 +26,7 @@
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.component.core.layout.CorePanelPageHeader;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java Fri Sep 29 10:37:32 2006
@@ -24,7 +24,7 @@
import org.apache.myfaces.trinidad.component.core.CoreDocument;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
/**
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java Fri Sep 29 10:37:32 2006
@@ -32,7 +32,7 @@
import org.apache.myfaces.trinidadinternal.share.config.UIXCookie;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
/**
* Renderer for meta data section of the document--a.k.a <head>.
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailHeaderRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailHeaderRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailHeaderRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailHeaderRenderer.java Fri Sep 29 10:37:32 2006
@@ -28,7 +28,7 @@
import org.apache.myfaces.trinidad.component.core.layout.CoreShowDetailHeader;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
public class ShowDetailHeaderRenderer
extends PanelHeaderRenderer
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TableRenderer.java Fri Sep 29 10:37:32 2006
@@ -46,7 +46,7 @@
import org.apache.myfaces.trinidad.model.SortCriterion;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.CellUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.DetailColumnRenderer;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java Fri Sep 29 10:37:32 2006
@@ -30,12 +30,12 @@
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidad.render.TypedRenderer;
import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
import org.apache.myfaces.trinidadinternal.util.FormattedTextParser;
import org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/DetailColumnRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/DetailColumnRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/DetailColumnRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/DetailColumnRenderer.java Fri Sep 29 10:37:32 2006
@@ -24,7 +24,7 @@
import org.apache.myfaces.trinidad.component.UIXTable;
import org.apache.myfaces.trinidad.component.core.data.CoreTable;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ShowDetailRenderer;
import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/SelectionColumnRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/SelectionColumnRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/SelectionColumnRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/SelectionColumnRenderer.java Fri Sep 29 10:37:32 2006
@@ -22,7 +22,7 @@
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.component.core.data.CoreColumn;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableRenderingContext.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableRenderingContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableRenderingContext.java Fri Sep 29 10:37:32 2006
@@ -29,7 +29,7 @@
import org.apache.myfaces.trinidad.component.core.data.CoreTable;
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java Fri Sep 29 10:37:32 2006
@@ -36,7 +36,7 @@
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils;
public class TableSelectManyRenderer extends TableSelectOneRenderer
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java Fri Sep 29 10:37:32 2006
@@ -35,7 +35,7 @@
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectBooleanCheckboxRenderer;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelAccordionRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelAccordionRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelAccordionRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelAccordionRenderer.java Fri Sep 29 10:37:32 2006
@@ -25,7 +25,7 @@
import org.apache.myfaces.trinidad.component.UIXShowDetail;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
+import org.apache.myfaces.trinidad.render.RenderUtils;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelChoiceRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelChoiceRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelChoiceRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelChoiceRenderer.java Fri Sep 29 10:37:32 2006
@@ -27,7 +27,7 @@
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
+import org.apache.myfaces.trinidad.render.RenderUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
import org.apache.myfaces.trinidadinternal.share.url.URLEncoder;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/CorePanelRadioRenderer.java Fri Sep 29 10:37:32 2006
@@ -25,8 +25,9 @@
import org.apache.myfaces.trinidad.component.UIXShowDetail;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
+import org.apache.myfaces.trinidad.render.RenderUtils;
+
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
import org.apache.myfaces.trinidadinternal.share.url.URLEncoder;
import org.apache.myfaces.trinidadinternal.ui.UIConstants;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/layout/ShowOneListRendererBase.java Fri Sep 29 10:37:32 2006
@@ -27,7 +27,7 @@
import org.apache.myfaces.trinidad.component.UIXShowDetail;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
+import org.apache.myfaces.trinidad.render.RenderUtils;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/HtmlCommandLinkRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/HtmlCommandLinkRenderer.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/HtmlCommandLinkRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/htmlBasic/HtmlCommandLinkRenderer.java Fri Sep 29 10:37:32 2006
@@ -23,8 +23,8 @@
import javax.faces.render.Renderer;
import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.render.RenderUtils;
-import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.CommandLinkRenderer;
/**
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java Fri Sep 29 10:37:32 2006
@@ -15,11 +15,21 @@
*/
package org.apache.myfaces.trinidadinternal.context;
-import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.apache.myfaces.trinidad.context.RequestContext;
-public class RequestContextTest extends TestCase
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelGroupLayout;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputText;
+
+import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
+
+public class RequestContextTest extends FacesTestCase
{
public RequestContextTest(
String testName)
@@ -27,6 +37,24 @@
super(testName);
}
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RequestContextTest.class);
+ }
+
+
public void testPageResolver()
{
RequestContext context = _createContext();
@@ -47,6 +75,42 @@
{
assertTrue(context.getPageFlowScopeProvider()
instanceof TestPageFlowScopeProvider);
+ }
+ finally
+ {
+ context.release();
+ }
+ }
+
+ public void testComponentState() throws Exception
+ {
+ RequestContext context = _createContext();
+
+ try
+ {
+ CorePanelGroupLayout cpgl = new CorePanelGroupLayout();
+ cpgl.setLayout("horizontal");
+ HtmlOutputText hot = new HtmlOutputText();
+ hot.setValue("foo");
+ CoreOutputText cot = new CoreOutputText();
+ cot.setValue("bar");
+
+ cpgl.getChildren().add(hot);
+ cpgl.getChildren().add(cot);
+
+ Object state = context.saveComponent(cpgl);
+ UIComponent restored = context.restoreComponent(state);
+
+ assertTrue(restored instanceof CorePanelGroupLayout);
+ assertEquals(restored.getChildCount(), 2);
+ assertEquals(restored.getAttributes().get("layout"), "horizontal");
+ UIComponent childOne = (UIComponent) restored.getChildren().get(0);
+ assertTrue(childOne instanceof HtmlOutputText);
+ assertEquals(childOne.getAttributes().get("value"), "foo");
+
+ UIComponent childTwo = (UIComponent) restored.getChildren().get(1);
+ assertTrue(childTwo instanceof CoreOutputText);
+ assertEquals(childTwo.getAttributes().get("value"), "bar");
}
finally
{
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java?view=diff&rev=451358&r1=451357&r2=451358
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java Fri Sep 29 10:37:32 2006
@@ -259,6 +259,19 @@
throw new UnsupportedOperationException("Not implemented yet");
}
+ @Override
+ public Object saveComponent(UIComponent component)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+
+ @Override
+ public UIComponent restoreComponent(Object state)
+ {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
private String _skin;
private Accessibility _accMode;
private Agent _agent;