JBoss Rich Faces SVN: r16764 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-04-15 07:00:24 -0400 (Thu, 15 Apr 2010)
New Revision: 16764
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
typo fix
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-04-15 10:40:49 UTC (rev 16763)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-04-15 11:00:24 UTC (rev 16764)
@@ -30,7 +30,7 @@
}
if (element) {
- return element["richfaces" || {}]["component"];
+ return (element["richfaces"] || {})["component"];
}
return;
14 years, 11 months
JBoss Rich Faces SVN: r16763 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-04-15 06:40:49 -0400 (Thu, 15 Apr 2010)
New Revision: 16763
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
RichFaces.$ was added
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-04-15 07:10:19 UTC (rev 16762)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-04-15 10:40:49 UTC (rev 16763)
@@ -16,8 +16,8 @@
(function (jQuery, richfaces, params) {
// Constructor definition
- richfaces.MyComponent = function(componentId) {
- $super.constructor.call(this, componentId);
+ richfaces.MyComponent = function(componentId, [options]) {
+ $super.constructor.call(this, componentId, [options]);
};
// Extend component class
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-04-15 07:10:19 UTC (rev 16762)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-04-15 10:40:49 UTC (rev 16763)
@@ -10,6 +10,32 @@
window.RichFaces = {};
(function(richfaces, jQuery) {
+
+ // get RichFaces component object by component id or DOM element or jQuery object
+ richfaces.$ = function (source) {
+ var type = typeof source;
+ var element;
+ if (type == "string") {
+ // id
+ element = document.getElementById(source);
+ } else if (type == "object") {
+ if (source.nodeType) {
+ // DOM element
+ element = source;
+ } else
+ if (source instanceof jQuery) {
+ // jQuery object
+ element = source.get(0);
+ }
+ }
+
+ if (element) {
+ return element["richfaces" || {}]["component"];
+ }
+
+ return;
+ }
+
//form.js
richfaces.submitForm = function(form, parameters, target) {
if (typeof form === "string") { form = jQuery(form) };
14 years, 11 months
JBoss Rich Faces SVN: r16762 - root/docs/trunk/Developer_Guide/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-15 03:10:19 -0400 (Thu, 15 Apr 2010)
New Revision: 16762
Modified:
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
Log:
Worked on skinning
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-14 21:48:59 UTC (rev 16761)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-15 07:10:19 UTC (rev 16762)
@@ -832,8 +832,100 @@
<section id="sect-Developer_Guide-Skinning_and_theming-Extended_skinning">
<title>Plug-n-skin</title>
<para>
- Incomplete
+ <emphasis>Plug-n-skin</emphasis> is an alternate method to create, customize, and add a skin. The skin can be based on an existing RichFaces skin, and can include support for skinning standard HTML controls.
</para>
+ <procedure id="proc-Developer_Guide-Skinning_and_theming-Using_plug-n-skin">
+ <title>Using plug-n-skin</title>
+ <step>
+ <title>Create a template</title>
+ <para>Use the <productname>Maven</productname> build and deployment tool to create the skin template by using the following command:</para>
+<screen>mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-plug-n-skin -DarchetypeVersion=<replaceable>RF-VERSION</replaceable> -DartifactId=<replaceable>ARTIFACT-ID</replaceable> -DgroupId=<replaceable>GROUP-ID</replaceable> -Dversion=<replaceable>VERSION</replaceable></screen>
+ <para>
+ Use the following keys for the command:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>archetypeVersion</parameter></term>
+ <listitem>
+ <para>
+ The version of RichFaces, for example, <literal>4.0.0.GA</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>artifactId</parameter></term>
+ <listitem>
+ <para>
+ The artifact identifier or name of the project. The Maven template will be created in a directory using this name.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>groupId</parameter></term>
+ <listitem>
+ <para>
+ The group identifier of the project.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>version</parameter></term>
+ <listitem>
+ <para>
+ The version of your project, for example, <literal>1.0</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </step>
+ <step>
+ <title>Add the skin to the CDK</title>
+ <para>Change to the newly-created directory. Ensure it contains the <filename>pom.xml</name> project file, then enter the following command to create a new skin and add it to the <acronym>CDK</acronym> (Component Development Kit):</para>
+<screen>mvn cdk:add-skin -Dname=<replaceable>SKIN-NAME</replaceable> -Dpackage=<replaceable>SKIN-PACKAGE</replaceable></screen>
+ <para>
+ Use the following keys for the command:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>name</parameter></term>
+ <listitem>
+ <para>
+ The name of your new skin.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>package</parameter></term>
+ <listitem>
+ <para>
+ The base package of the skin. By default, the group identifier is used.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+ Use the following optional keys for advanced features:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>baseSkin</parameter></term>
+ <listitem>
+ <para>
+ The skin to use as a base for the new skin.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>createExt</parameter></term>
+ <listitem>
+ <para>
+ Use <code>createExt=true</code> to add extended CSS classes for skinning standard HTML controls.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </step>
+ </procedure>
</section>
<section id="sect-Developer_Guide-Skinning_and_theming-Defining_skins_for_individual_components">
14 years, 11 months
JBoss Rich Faces SVN: r16761 - root/framework/trunk/impl/src/main/java/org/richfaces/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-14 17:48:59 -0400 (Wed, 14 Apr 2010)
New Revision: 16761
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
Log:
https://jira.jboss.org/jira/browse/RF-8589
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java 2010-04-14 17:18:38 UTC (rev 16760)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java 2010-04-14 21:48:59 UTC (rev 16761)
@@ -21,14 +21,10 @@
package org.richfaces.context;
-import java.util.Map;
-
import javax.faces.context.FacesContext;
import javax.faces.context.PartialViewContext;
import javax.faces.context.PartialViewContextFactory;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-
/**
* @author Nick Belaevski
* @since 4.0
@@ -44,15 +40,7 @@
@Override
public PartialViewContext getPartialViewContext(final FacesContext context) {
- Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
- String activatorComponentId = requestParameterMap.get(AjaxRendererUtils.AJAX_COMPONENT_ID_PARAMETER);
- if (activatorComponentId != null) {
- String behaviorEvent = requestParameterMap.get(AjaxRendererUtils.BEHAVIOR_EVENT_PARAMETER);
-
- return new PartialViewContextImpl(context, activatorComponentId, behaviorEvent);
- } else {
- return parentFactory.getPartialViewContext(context);
- }
+ return new PartialViewContextImpl(parentFactory.getPartialViewContext(context), context);
}
@Override
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-04-14 17:18:38 UTC (rev 16760)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-04-14 21:48:59 UTC (rev 16761)
@@ -21,10 +21,7 @@
*/
package org.richfaces.context;
-import static org.ajax4jsf.renderkit.AjaxRendererUtils.ALL;
-
import java.io.IOException;
-import java.io.Writer;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
@@ -58,20 +55,19 @@
private static final Logger LOG = RichfacesLogger.CONTEXT.getLogger();
- private static final String FACES_REQUEST_HEADER = "Faces-Request";
- private static final String PARTIAL_AJAX = "partial/ajax";
- private static final String PARTIAL_PROCESS = "partial/process";
-
private static final String ORIGINAL_WRITER = "org.richfaces.PartialViewContextImpl.ORIGINAL_WRITER";
+ private enum ContextMode {
+ WRAPPED, DIRECT
+ }
+
+ private ContextMode contextMode = null;
+
private FacesContext facesContext;
- private PartialResponseWriter partialResponseWriter;
private Collection<String> executeIds = null;
private Collection<String> renderIds = null;
- private Boolean ajaxRequest = null;
- private Boolean partialRequest = null;
private Boolean renderAll = null;
private String activatorComponentId = null;
@@ -81,187 +77,167 @@
private boolean limitRender = false;
- public PartialViewContextImpl(FacesContext facesContext, String activatorComponentId, String behaviorEvent) {
+ private PartialViewContext wrappedViewContext;
+
+ public PartialViewContextImpl(PartialViewContext wrappedViewContext, FacesContext facesContext) {
super();
+ this.wrappedViewContext = wrappedViewContext;
this.facesContext = facesContext;
-
- //activatorComponentId should not be null
- this.activatorComponentId = activatorComponentId;
- this.behaviorEvent = behaviorEvent;
}
@Override
public Collection<String> getExecuteIds() {
assertNotReleased();
- if (executeIds == null) {
- executeIds = new LinkedHashSet<String>();
- setupExecuteIds(executeIds);
- }
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (executeIds == null) {
+ executeIds = new LinkedHashSet<String>();
+ setupExecuteIds(executeIds);
+ }
- return executeIds;
+ return executeIds;
+ } else {
+ return wrappedViewContext.getExecuteIds();
+ }
}
@Override
public Collection<String> getRenderIds() {
assertNotReleased();
- if (renderIds == null) {
- renderIds = new LinkedHashSet<String>();
- }
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (renderIds == null) {
+ renderIds = new LinkedHashSet<String>();
+ }
- return renderIds;
+ return renderIds;
+ } else {
+ return wrappedViewContext.getRenderIds();
+ }
}
@Override
public boolean isAjaxRequest() {
assertNotReleased();
- if (ajaxRequest == null) {
- Map<String, String> requestHeaderMap = facesContext.getExternalContext().getRequestHeaderMap();
- ajaxRequest = PARTIAL_AJAX.equals(requestHeaderMap.get(FACES_REQUEST_HEADER));
- }
-
- return ajaxRequest.booleanValue();
+ return wrappedViewContext.isAjaxRequest();
}
@Override
public boolean isPartialRequest() {
assertNotReleased();
- if (partialRequest == null) {
- if (isAjaxRequest()) {
- partialRequest = true;
- } else {
- Map<String, String> requestHeaderMap = facesContext.getExternalContext().getRequestHeaderMap();
- partialRequest = PARTIAL_PROCESS.equals(requestHeaderMap.get(FACES_REQUEST_HEADER));
- }
- }
-
- return partialRequest.booleanValue();
+ return wrappedViewContext.isPartialRequest();
}
@Override
public void setPartialRequest(boolean isPartialRequest) {
assertNotReleased();
- partialRequest = isPartialRequest;
+ wrappedViewContext.setPartialRequest(isPartialRequest);
}
@Override
public boolean isExecuteAll() {
assertNotReleased();
- return getExecuteIds().contains(ALL);
+ if (detectContextMode() == ContextMode.DIRECT) {
+ return getExecuteIds().contains(AjaxRendererUtils.ALL);
+ } else {
+ return wrappedViewContext.isExecuteAll();
+ }
}
@Override
public boolean isRenderAll() {
assertNotReleased();
- if (renderAll == null) {
- renderAll = getRenderIds().contains(ALL);
- }
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (renderAll != null) {
+ return renderAll.booleanValue();
+ }
- return renderAll;
+ return getRenderIds().contains(AjaxRendererUtils.ALL);
+ } else {
+ return wrappedViewContext.isRenderAll();
+ }
}
@Override
public void setRenderAll(boolean isRenderAll) {
assertNotReleased();
- renderAll = isRenderAll;
+ if (detectContextMode() == ContextMode.DIRECT) {
+ renderAll = isRenderAll;
+ } else {
+ wrappedViewContext.setRenderAll(isRenderAll);
+ }
}
@Override
public PartialResponseWriter getPartialResponseWriter() {
- assertNotReleased();
-
- if (partialResponseWriter == null) {
- partialResponseWriter = new PartialDelayedInitializationResponseWriter(facesContext);
- }
-
- return partialResponseWriter;
+ return wrappedViewContext.getPartialResponseWriter();
}
@Override
public void processPartial(PhaseId phaseId) {
+ if (detectContextMode() == ContextMode.DIRECT && phaseId == PhaseId.RENDER_RESPONSE) {
+ processPartialRenderPhase();
+ } else {
+ wrappedViewContext.processPartial(phaseId);
+ }
+ }
+
+ protected void processPartialRenderPhase() {
PartialViewContext pvc = facesContext.getPartialViewContext();
UIViewRoot viewRoot = facesContext.getViewRoot();
+ Collection<String> phaseIds = pvc.getRenderIds();
+ setupRenderIds(phaseIds);
- Collection<String> executeIds = pvc.getExecuteIds();
- Collection<String> renderIds = pvc.getRenderIds();
+ try {
+ PartialResponseWriter writer = pvc.getPartialResponseWriter();
+ ResponseWriter orig = facesContext.getResponseWriter();
+ facesContext.getAttributes().put(ORIGINAL_WRITER, orig);
+ facesContext.setResponseWriter(writer);
- if (phaseId == PhaseId.APPLY_REQUEST_VALUES
- || phaseId == PhaseId.PROCESS_VALIDATIONS
- || phaseId == PhaseId.UPDATE_MODEL_VALUES) {
-
- // Skip this processing if "none" is specified in the render list,
- // or there were no execute phase client ids.
- if (executeIds == null || executeIds.isEmpty()) {
- // RELEASE_PENDING LOG ERROR OR WARNING
+ ExternalContext exContext = facesContext.getExternalContext();
+ exContext.setResponseContentType("text/xml");
+ exContext.addResponseHeader("Cache-Control", "no-cache");
+ writer.startDocument();
+ if (isRenderAll()) {
+ renderAll(facesContext, viewRoot);
+ renderState(facesContext);
+ writer.endDocument();
return;
}
- try {
- processComponents(viewRoot, phaseId, executeIds, facesContext);
- } catch (Exception e) {
- LOG.error(e.getMessage(), e);
- }
+ // Skip this processing if "none" is specified in the render list,
+ // or there were no render phase client ids.
+ if ((phaseIds != null && !phaseIds.isEmpty()) ||
+ (!limitRender && PartialViewContextAjaxOutputTracker.hasNestedAjaxOutputs(viewRoot))) {
- // If we have just finished APPLY_REQUEST_VALUES phase, install the
- // partial response writer. We want to make sure that any content
- // or errors generated in the other phases are written using the
- // partial response writer.
- //
- if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- facesContext.setResponseWriter(writer);
+ EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
+ VisitContext visitContext = new ExtendedPartialVisitContext(facesContext, phaseIds, hints, limitRender);
+ VisitCallback visitCallback = new RenderVisitCallback(facesContext);
+ viewRoot.visitTree(visitContext, visitCallback);
}
- } else if (phaseId == PhaseId.RENDER_RESPONSE) {
- setupRenderIds(renderIds);
- try {
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- ResponseWriter orig = facesContext.getResponseWriter();
- facesContext.getAttributes().put(ORIGINAL_WRITER, orig);
- facesContext.setResponseWriter(writer);
+ renderState(facesContext);
- ExternalContext exContext = facesContext.getExternalContext();
- exContext.setResponseContentType("text/xml");
- exContext.addResponseHeader("Cache-Control", "no-cache");
- writer.startDocument();
- if (isRenderAll()) {
- renderAll(facesContext, viewRoot);
- renderState(facesContext);
- writer.endDocument();
- return;
- }
+ //TODO - render extensions for renderAll?
+ renderExtensions(facesContext, viewRoot);
- // Skip this processing if "none" is specified in the render list,
- // or there were no render phase client ids.
- if ((renderIds != null && !renderIds.isEmpty()) ||
- (!limitRender && PartialViewContextAjaxOutputTracker.hasNestedAjaxOutputs(viewRoot))) {
- processComponents(viewRoot, phaseId, renderIds, facesContext);
- }
-
- renderState(facesContext);
-
- //TODO - render extensions for renderAll?
- renderExtensions(facesContext, viewRoot);
-
- writer.endDocument();
- } catch (IOException ex) {
- ex.printStackTrace();
- //TODO - review?
- this.cleanupAfterView();
- } catch (RuntimeException ex) {
- //TODO - review?
- this.cleanupAfterView();
- // Throw the exception
- throw ex;
- }
+ writer.endDocument();
+ } catch (IOException ex) {
+ this.cleanupAfterView();
+ //TODO - review?
+ ex.printStackTrace();
+ } catch (RuntimeException ex) {
+ //TODO - review?
+ this.cleanupAfterView();
+ // Throw the exception
+ throw ex;
}
}
@@ -271,7 +247,7 @@
if (visitActivatorComponent(activatorComponentId, callback)) {
ids.addAll(callback.getComponentIds());
- if (!ids.contains(ALL)) {
+ if (!ids.contains(AjaxRendererUtils.ALL)) {
addImplicitExecuteIds(ids);
}
} else {
@@ -288,8 +264,8 @@
ids.addAll(callback.getComponentIds());
limitRender = callback.isLimitRender();
- if (!Boolean.TRUE.equals(renderAll) && !ids.contains(ALL)) {
- addImplicitRenderIds(ids, callback.isLimitRender());
+ if (!Boolean.TRUE.equals(renderAll) && !ids.contains(AjaxRendererUtils.ALL)) {
+ addImplicitRenderIds(ids, limitRender);
//TODO - review
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
@@ -303,31 +279,6 @@
}
}
- // Process the components specified in the phaseClientIds list
- private void processComponents(UIComponent component, PhaseId phaseId,
- Collection<String> phaseClientIds, FacesContext context) throws IOException {
-
- // We use the tree visitor mechanism to locate the components to
- // process. Create our (partial) VisitContext and the
- // VisitCallback that will be invoked for each component that
- // is visited. Note that we use the SKIP_UNRENDERED hint as we
- // only want to visit the rendered subtree.
- EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
-
- VisitCallback visitCallback;
- VisitContext visitContext;
-
- if (PhaseId.RENDER_RESPONSE.equals(phaseId)) {
- visitContext = new ExtendedPartialVisitContext(facesContext, phaseClientIds, hints, limitRender);
- visitCallback = new RenderVisitCallback(facesContext);
- } else {
- visitContext = VisitContext.createVisitContext(facesContext, phaseClientIds, hints);
- visitCallback = new PhaseAwareExecuteVisitCallback(facesContext, phaseId);
- }
-
- component.visitTree(visitContext, visitCallback);
- }
-
private void renderAll(FacesContext context, UIViewRoot viewRoot) throws IOException {
// If this is a "render all via ajax" request,
// make sure to wrap the entire page in a <render> elemnt
@@ -370,19 +321,20 @@
released = true;
+ wrappedViewContext.release();
+ wrappedViewContext = null;
+
facesContext = null;
- partialResponseWriter = null;
+ renderAll = null;
executeIds = null;
renderIds = null;
- ajaxRequest = null;
- partialRequest = null;
- renderAll = null;
limitRender = false;
activatorComponentId = null;
behaviorEvent = null;
+ contextMode = null;
}
protected void addImplicitExecuteIds(Collection<String> ids) {
@@ -427,40 +379,20 @@
facesContext.setResponseWriter(orig);
}
- private static final class PhaseAwareExecuteVisitCallback implements VisitCallback {
+ protected ContextMode detectContextMode() {
+ if (contextMode == null) {
+ Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
+ activatorComponentId = requestParameterMap.get(AjaxRendererUtils.AJAX_COMPONENT_ID_PARAMETER);
- private PhaseId curPhase;
- private FacesContext ctx;
-
- private PhaseAwareExecuteVisitCallback(FacesContext ctx, PhaseId curPhase) {
- this.ctx = ctx;
- this.curPhase = curPhase;
- }
-
- public VisitResult visit(VisitContext context, UIComponent comp) {
- if (curPhase == PhaseId.APPLY_REQUEST_VALUES) {
-
- // RELEASE_PENDING handle immediate request(s)
- // If the user requested an immediate request
- // Make sure to set the immediate flag here.
-
- comp.processDecodes(ctx);
- } else if (curPhase == PhaseId.PROCESS_VALIDATIONS) {
- comp.processValidators(ctx);
- } else if (curPhase == PhaseId.UPDATE_MODEL_VALUES) {
- comp.processUpdates(ctx);
+ if (activatorComponentId != null) {
+ contextMode = ContextMode.DIRECT;
+ behaviorEvent = requestParameterMap.get(AjaxRendererUtils.BEHAVIOR_EVENT_PARAMETER);
} else {
- throw new IllegalStateException("I18N: Unexpected "
- + "PhaseId passed to PhaseAwareContextCallback: " + curPhase.toString());
+ contextMode = ContextMode.WRAPPED;
}
-
- // Once we visit a component, there is no need to visit
- // its children, since processDecodes/Validators/Updates and
- // encodeAll() already traverse the subtree. We return
- // VisitResult.REJECT to supress the subtree visit.
- return VisitResult.REJECT;
}
+ return contextMode;
}
private static final class RenderVisitCallback implements VisitCallback {
@@ -507,56 +439,4 @@
return VisitResult.REJECT;
}
}
-
- private static final class PartialDelayedInitializationResponseWriter extends PartialResponseWriter {
-
- private FacesContext facesContext;
-
- private ResponseWriter responseWriter;
-
- /**
- * @param facesContext
- */
- public PartialDelayedInitializationResponseWriter(FacesContext facesContext) {
- super(null);
- this.facesContext = facesContext;
- ExternalContext externalContext = facesContext.getExternalContext();
- externalContext.setResponseContentType("text/xml");
- externalContext.setResponseCharacterEncoding(externalContext.getRequestCharacterEncoding());
- }
-
- /* (non-Javadoc)
- * @see javax.faces.context.PartialResponseWriter#getWrapped()
- */
- @Override
- public ResponseWriter getWrapped() {
- if (responseWriter == null) {
- responseWriter = createResponseWriter();
- }
-
- return responseWriter;
- }
-
- private ResponseWriter createResponseWriter() {
- ExternalContext externalContext = facesContext.getExternalContext();
- String characterEncoding = externalContext.getRequestCharacterEncoding();
- externalContext.setResponseCharacterEncoding(characterEncoding);
-
- Writer outputWriter = null;
- try {
- outputWriter = externalContext.getResponseOutputWriter();
- } catch (IOException e) {
- LOG.error("Error creating partial context response writer: " + e.getMessage(), e);
- }
-
- if (outputWriter != null) {
- ResponseWriter newResponseWriter = facesContext.getRenderKit().
- createResponseWriter(outputWriter, "text/xml", characterEncoding);
-
- return newResponseWriter;
- }
-
- return null;
- }
- }
}
14 years, 11 months
JBoss Rich Faces SVN: r16760 - in root/ui-sandbox/trunk/components/tables/ui/src/test: java/org/richfaces and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-04-14 13:18:38 -0400 (Wed, 14 Apr 2010)
New Revision: 16760
Added:
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/
root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/
root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml
Log:
RF-8480
Added: root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-04-14 17:18:38 UTC (rev 16760)
@@ -0,0 +1,177 @@
+/**
+ *
+ */
+package org.richfaces.renderkit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.component.UIExtendedDataTable;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ExtendedDataTableRendererTest {
+
+ private HtmlUnitEnvironment environment = new HtmlUnitEnvironment();
+
+ @Before
+ public void setUp() {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File("src/test/resources"));
+ environment.start();
+ }
+
+ @After
+ public void tearDown() {
+ environment.release();
+ environment = null;
+ }
+
+ /**
+ * Test method for {@link org.richfaces.renderkit.ExtendedDataTableRenderer#getComponentClass()}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testGetComponentClass() throws IOException {
+ FacesRequest facesRequest = environment.createFacesRequest("http://localhost/extendedDataTableTest.jsf");
+ facesRequest.withViewId("/extendedDataTableTest.jsf");
+ facesRequest.start();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ViewHandler vh = facesContext.getApplication().getViewHandler();
+ ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext, facesContext.getViewRoot()
+ .getViewId());
+ vdl.buildView(facesContext, facesContext.getViewRoot());
+ UIExtendedDataTable component = (UIExtendedDataTable) facesContext.getViewRoot().findComponent("table");
+ ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance()
+ .getRenderKit().getRenderer(component.getFamily(), component.getRendererType());
+ assertEquals(UIExtendedDataTable.class, renderer.getComponentClass());
+ facesRequest.release();
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#doEncodeBegin(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testDoEncodeBegin() throws IOException {
+ HtmlPage page = environment.getPage("/extendedDataTableTest.jsf");
+ HtmlElement table = page.getElementById("table");
+ assertEquals("rich-extable", table.getAttribute("class"));
+ assertEquals("headerFacet", table.getElementById("table:headerFacet").getTextContent());
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#doEncodeChildren(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testDoEncodeChildren() throws IOException {
+ HtmlPage page = environment.getPage("/extendedDataTableTest.jsf");
+ HtmlElement table = page.getElementById("table");
+ String text = table.getElementsByTagName("style").get(0).getTextContent();
+ assertTrue(text.contains("rich-extable-part-width"));
+ assertTrue(text.contains("rich-extable-cell-width"));
+ HtmlElement header = table.getFirstByXPath("div[@class='rich-extable-header']");
+ HtmlElement frozenHeader = header.getElementById("table:frozenHeader");
+ HtmlElement normalHeader = header.getElementById("table:header");
+ assertTrue(normalHeader.getAttribute("class").contains("rich-extable-part-width"));
+ assertNotNull(frozenHeader.getFirstByXPath("descendant::*[@class='rich-extable-resizer']"));
+ assertNotNull(normalHeader.getFirstByXPath("descendant::*[@class='rich-extable-resizer']"));
+ assertEquals("headerColumnFacet1", ((HtmlElement) frozenHeader
+ .getFirstByXPath("//*[@class='rich-extable-header-cell-content']//*[@id='table:headerColumnFacet1']"))
+ .getTextContent());
+ assertEquals("headerColumnFacet2", ((HtmlElement) normalHeader
+ .getFirstByXPath("//*[@class='rich-extable-header-cell-content']//*[@id='table:headerColumnFacet2']"))
+ .getTextContent());
+ HtmlElement body = table.getElementById("table:b");
+ assertEquals("rich-extable-body", body.getAttribute("class"));
+ assertNotNull(body.getFirstByXPath("descendant::*[@class='rich-extable-spacer']"));
+ assertNotNull(body
+ .getFirstByXPath("descendant::*[@class='rich-extable-part rich-extable-part-width']//*[@id='table:tbn']"));
+ assertEquals("noDataFacet", ((HtmlElement) page
+ .getFirstByXPath("//*[@id='table2']//*[@id='table2:b']//*[@id='table2:noDataFacet']")).getTextContent());
+ HtmlElement footer = table.getFirstByXPath("div[@class='rich-extable-footer']");
+ HtmlElement frozenFooter = footer.getFirstByXPath("descendant::*[@class='rich-extable-footer-align']/div");
+ HtmlElement normalFooter = footer.getElementById("table:footer");
+ assertTrue(normalFooter.getAttribute("class").contains("rich-extable-part-width"));
+ assertEquals("footerColumnFacet1", ((HtmlElement) frozenFooter
+ .getFirstByXPath("descendant::*[@class='rich-extable-footer-cell-content']//*[@id='table:footerColumnFacet1']"))
+ .getTextContent());
+ assertEquals("footerColumnFacet2", ((HtmlElement) normalFooter
+ .getFirstByXPath("descendant::*[@class='rich-extable-footer-cell-content']//*[@id='table:footerColumnFacet2']"))
+ .getTextContent());
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#doEncodeEnd(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testDoEncodeEnd() throws IOException {
+ HtmlPage page = environment.getPage("/extendedDataTableTest.jsf");
+ HtmlElement table = page.getElementById("table");
+ assertEquals("footerFacet", table.getElementById("table:footerFacet").getTextContent());
+ assertEquals("rich-extable-drag", table.getElementById("table:d").getAttribute("class"));
+ assertEquals("rich-extable-reorder", table.getElementById("table:r").getAttribute("class"));
+ assertEquals("rich-extable-reorder-marker", table.getElementById("table:rm").getAttribute("class"));
+ assertEquals("table:wi", table.getElementById("table:wi").getAttribute("name"));
+ assertTrue(table.getElementsByTagName("script").get(0).getTextContent()
+ .contains("RichFaces.ExtendedDataTable"));
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#encodeRow(org.richfaces.renderkit.RowHolderBase)}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testEncodeRow() throws IOException {
+ HtmlPage page = environment.getPage("/extendedDataTableTest.jsf");
+ HtmlElement table = page.getElementById("table");
+ HtmlElement cell = table.getElementById("table:0:f").getElementsByTagName("div").get(0);
+ assertTrue(cell.getAttribute("class").contains("rich-extable-cell"));
+ HtmlElement cellContent = cell.getElementsByTagName("div").get(0);
+ assertEquals("rich-extable-cell-content", cellContent.getAttribute("class"));
+ assertEquals("value", cellContent.getElementById("table:0:outputText").getTextContent());
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#encodePartially(javax.faces.component.UIComponent,
+ * javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback, java.util.Collection)}.
+ */
+ @Test
+ public final void testEncodePartially() {
+ // TODO fail("Not yet implemented");
+ }
+
+}
Added: root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/test/resources/extendedDataTableTest.xhtml 2010-04-14 17:18:38 UTC (rev 16760)
@@ -0,0 +1,73 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:rich="http://richfaces.org/rich">
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+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.
+-->
+ <h:head>
+ <title>Richfaces ExtendedDataTable Test</title>
+ </h:head>
+
+ <h:body>
+ <rich:extendedDataTable id="table" frozenColumns="1" value="value" var="var">
+ <f:facet name="header">
+ <h:outputText id="headerFacet" value="headerFacet"/>
+ </f:facet>
+ <f:facet name="noData">
+ <h:outputText id="noDataFacet" value="noDataFacet"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText id="footerFacet" value="footerFacet"/>
+ </f:facet>
+ <rich:column id="column1">
+ <f:facet name="header">
+ <h:outputText id="headerColumnFacet1" value="headerColumnFacet1"/>
+ </f:facet>
+ <h:outputText id="outputText" value="#{var}"/>
+ <f:facet name="footer">
+ <h:outputText id="footerColumnFacet1" value="footerColumnFacet1"/>
+ </f:facet>
+ </rich:column>
+ <rich:column id="column2" >
+ <f:facet name="header">
+ <h:outputText id="headerColumnFacet2" value="headerColumnFacet2"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText id="footerColumnFacet2" value="footerColumnFacet2"/>
+ </f:facet>
+ </rich:column>
+ </rich:extendedDataTable>
+ <rich:extendedDataTable id="table2" >
+ <f:facet name="noData">
+ <h:outputText id="noDataFacet" value="noDataFacet"/>
+ </f:facet>
+ <rich:column></rich:column>
+ </rich:extendedDataTable>
+ </h:body>
+</html>
14 years, 11 months
JBoss Rich Faces SVN: r16759 - root/docs/trunk/Developer_Guide/en-US/extras.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-14 03:23:17 -0400 (Wed, 14 Apr 2010)
New Revision: 16759
Added:
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css
Log:
Added example skinning files
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample 2010-04-14 07:23:17 UTC (rev 16759)
@@ -0,0 +1,6 @@
+<u:selector name=".rich-component-name">
+ <u:style name="background-color" skin="additionalBackgroundColor" />
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="border-style" value="solid" />
+</u:selector>
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample 2010-04-14 07:23:17 UTC (rev 16759)
@@ -0,0 +1,3 @@
+<u:selector name=".rich-ordering-control-disabled, .rich-ordering-control-top, .rich-ordering-control-bottom, .rich-ordering-control-up, .rich-ordering-control-down">
+ <u:style name="border-color" skin="tableBorderColor" />
+</u:selector>
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css 2010-04-14 07:23:17 UTC (rev 16759)
@@ -0,0 +1,6 @@
+.rich-component-name {
+ background-color: additionalBackgroundColor; /*the value of the constant defined by your skin*/
+ border-color: tableBorderColor; /*the value of the constant defined by your skin*/
+ border-width: tableBorderWidth; /*the value of the constant defined by your skin*/
+ border-style: solid;
+}
14 years, 11 months
JBoss Rich Faces SVN: r16758 - root/docs/trunk/Developer_Guide/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-14 03:22:43 -0400 (Wed, 14 Apr 2010)
New Revision: 16758
Modified:
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
Log:
Work on skinning
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-13 08:10:25 UTC (rev 16757)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-14 07:22:43 UTC (rev 16758)
@@ -22,35 +22,6 @@
<section id="sect-Developer_Guide-Skinning_and_theming-Using_skins">
<title>Using skins</title>
<para>
- RichFaces skins are designed to use a combination of styling elements. Themes for components can be applied using any of the following style classes:
- </para>
- <variablelist>
- <varlistentry>
- <term>A default style class inserted into the framework</term>
- <listitem>
- <para>
- Style classes contain skin parameters linked to constant theme styles in the skin. Each component has a class style defining a default representation level. Application interfaces can be modified by altering the values of skin parameters in the skin itself.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>A style class extending the skin</term>
- <listitem>
- <para>
- A custom style class can be added to the skin, working in conjunction with CSS classes of the same name. All components referencing the class are extended in the same way.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>User style class</term>
- <listitem>
- <para>
- Components can use the <varname>styleClass</varname> attribute to redefine specific component elements. As such, the appearance of an individual component can be customized according to a CSS style parameter specified in the class.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <para>
RichFaces includes a number of predefined skins. These skins can be used in RichFaces web applications by specifying the skin name in the <varname>org.richfaces.SKIN</varname> context parameter in the <filename>web.xml</filename> settings file. The predefined skins are as follows:
</para>
<itemizedlist>
@@ -99,20 +70,75 @@
<literal>deepMarine</literal>
</para>
</listitem>
+ <listitem>
+ <para>
+ <literal>laguna</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>darkX</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>glassX</literal>
+ </para>
+ </listitem>
</itemizedlist>
+ <para>
+ To add one of these skins to your application, add the <literal>org.richfaces.SKIN</literal> context parameter to the <filename>web.xml</filename> configuration file:
+ </para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value><replaceable>skin_name</replaceable></param-value>
+</context-param></programlisting>
+ </section>
+
+ <section id="sect-Developer_Guide-Skinning_and_theming-Customizing_skins">
+ <title>Customizing skins</title>
+ <para>
+ RichFaces skins are designed to use a combination of styling elements. Themes for components can be applied using any of the following style classes:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>A default style class inserted into the framework</term>
+ <listitem>
+ <para>
+ Style classes contain skin parameters linked to constant theme styles in the skin. Each component has a class style defining a default representation level. Application interfaces can be modified by altering the values of skin parameters in the skin itself.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>A style class extending the skin</term>
+ <listitem>
+ <para>
+ A custom style class can be added to the skin, working in conjunction with CSS classes of the same name. All components referencing the class are extended in the same way.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>User style class</term>
+ <listitem>
+ <para>
+ Components can use the <varname>styleClass</varname> attribute to redefine specific component elements. As such, the appearance of an individual component can be customized according to a CSS style parameter specified in the class.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
<example id="exam-Developer_Guide-Using_skins-Simple_skinning_example">
<title>Simple skinning example</title>
<para>
Using any component, such as a panel, without specifying a <varname>styleClass</varname> will use the default skin parameters for that component.
</para>
-
+
<programlisting language="XML" role="XML"><rich:panel>...</rich:panel></programlisting>
<para>
When rendered for display, the panel consists of two HTML elements: a wrapper <sgmltag><div></sgmltag> element and a <sgmltag><div></sgmltag> element for the body of the panel. The wrapper element for a panel without a specified <varname>styleClass</varname> is rendered as follows:
</para>
-
+
<programlisting language="XML" role="XML"><div class="dr-pnl rich-panel">
- ...
+ ...
</div></programlisting>
<para>
<literal>dr-pnl</literal> refers to a CSS class specified in the framework. The CSS class uses skin parameters for generic theme styles:
@@ -135,7 +161,7 @@
<para>
If a <varname>styleClass</varname> attribute is used, the specified style class is applied to the component, which could extend or override the default styles.
</para>
-
+
<programlisting language="XML" role="XML"><rich:panel styleClass="customClass">...</rich:panel></programlisting>
<para>
The <literal>customClass</literal> style is added to the CSS, and is applied to the component when it is rendered for display:
@@ -150,7 +176,7 @@
<section id="sect-Developer_Guide-Skinning_and_theming-Skin_parameter_tables_in_RichFaces">
<title>Skin parameter tables in RichFaces</title>
<para>
- <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> lists the default values for the parameter settings in the <literal>blueSky</literal> skin. These values can be customized and extended for a unique application theme.
+ <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> lists the default values for the parameter settings in the <literal>blueSky</literal> skin. These values can be customized and extended for a unique application theme as described in <xref linkend="sect-Developer_Guide-Skinning_and-theming-Advanced_skinning" />.
</para>
<table id="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin">
<title>Parameter settings for the <literal>blueSky</literal> skin</title>
@@ -443,6 +469,75 @@
</table>
</section>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Changing_skins_at_runtime">
+ <title>Changing skins at runtime</title>
+ <para>
+ The user can change skins at runtime if a managed bean is used to access the skin.
+ </para>
+ <procedure>
+ <step>
+ <title>Create the skin bean</title>
+ <para>The skin bean is a simple interface to manage the skin:</para>
+<programlisting language="Java" role="JAVA">public class SkinBean {
+
+ private String skin;
+
+ public String getSkin() {
+ return skin;
+ }
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+}</programlisting>
+ </step>
+ <step>
+ <title>Reference the skin bean</title>
+ <para>Use <acronym>EL</acronym> (Expression Language) to reference the skin bean from the <filename>web.xml</filename> settings file.</para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+</context-param></programlisting>
+ </step>
+ <step>
+ <title>Set initial skin</title>
+ <para>
+ The application needs an initial skin to display before the user chooses an alternative skin. The initial skin is specified in the <filename>web.xml</filename> configuration file.
+ </para>
+<programlisting language="XML" role="XML"><managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>skin</property-name>
+ <value>classic</value>
+ </managed-property>
+</managed-bean></programlisting>
+ </step>
+ </procedure>
+ <example id="exam-Developer_Guide-Skinning_and_theming-Skin_changing_example">
+ <title>Skin changing example</title>
+ <para>
+ This example renders a list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
+ </para>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <blockquote>
+ <figure id="figu-Developer_Guide-Skinning_and_theming-Skin_changing_example">
+ <title>Skin changing example</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ </section>
+
<section id="sect-Developer_Guide-Creating_a_new_skin">
<title>Creating a new skin</title>
<procedure>
@@ -531,6 +626,17 @@
gradientType=plain
</programlisting>
</example>
+ <para>
+ Alternatively, instead of redefining an entire new skin, your skin can use an existing skin as a base on which to build new parameters. Specify a base skin by using the <varname>baseSkin</varname> parameter in the skin file, as shown in <xref linkend="exam-Developer_Guide-Skinning_and_theming-Using_a_base_skin" />.
+ </para>
+ <example id="exam-Developer_Guide-Skinning_and_theming-Using_a_base_skin">
+ <title>Using a base skin</title>
+ <para>
+ This example takes the <literal>blueSky</literal> skin as a base and only changes the <varname>generalSizeFont</varname> parameter.
+ </para>
+<programlisting>baseSkin=blueSky
+generalSizeFont=12pt</programlisting>
+ </example>
</step>
<step>
<title>Reference skin definition</title>
@@ -625,136 +731,135 @@
</listitem>
</itemizedlist>
<para>
- There are two levels of skinning for HTML controls, depending on whether the Internet browser viewing the application supports rich visual styling capabilities.
+ Skinning for standard HTML controls can be included in one of two ways:
</para>
- <remark>Browser lists may need to be updated.</remark>
- <itemizedlist>
- <title>Basic skinning</title>
- <listitem>
- <para>
- <productname>Apple Safari</productname>
- </para>
- </listitem>
- <listitem>
- <para>
- <productname>Microsoft Internet Explorer 6</productname>
- </para>
- </listitem>
- <listitem>
- <para>
- <productname>Microsoft Internet Explorer 7</productname> in <literal>BackCompat</literal> mode (refer to <citetitle pubwork="article"><varname>compatMode</varname> Property</citetitle> at <ulink url="http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx</ulink>
- </para>
- </listitem>
- <listitem>
- <para>
- <productname>Opera</productname>
- </para>
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <title>Extended skinning</title>
- <listitem>
- <para>
- <productname>Microsoft Internet Explorer 7</productname> in standards-compliant mode
- </para>
- </listitem>
- <listitem>
- <para>
- <productname>Mozilla Firefox</productname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- If the browser type cannot be identified, the extended level is used. Set the level explicitly by adding the following context parameter to the <filename>web.xml</filename> configuration file, and specifying the <sgmltag><param-value></sgmltag> element as either <literal>basic</literal> or <literal>extended</literal>:
- </para>
+ <variablelist>
+ <varlistentry>
+ <term>Automatic skinning</term>
+ <listitem>
+ <para>
+ The skinning style properties are automatically applied to controls based on their element names and attribute types. Specify the <literal>org.richfaces.CONTROL_SKINNING</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ </para>
<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+</context-param></programlisting>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Skinning with CSS classes</term>
+ <listitem>
+ <para>
+ The skinning style properties are determined through CSS. This method is available by default, but can be disabled through the <literal>org.richfaces.CONTROL_SKINNING_CLASSES</literal> context parameter in the <filename>web.xml</filename> configuration file:
+ </para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
+ <param-value>disable</param-value>
+</context-param></programlisting>
+ <para>
+ When enabled, the parameter offers a predefined CSS class named <literal>rich-container</literal>. Reference the class from any container-like component, and the standard HTML controls in the container will be skinned. Standard HTML controls can also be specifically defined in the CSS; refer to the <filename>org/richfaces/renderkit/html/css/basic_classes.xcss</filename> file in the <package>richfaces-ui.jar</package> package for examples of specially-defined CSS classes with skin parameters for HTML controls.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_levels_for_standard_HTML_controls">
+ <title>Skinning levels for standard HTML controls</title>
+ <para>
+ There are two levels of skinning for HTML controls, depending on whether the browser viewing the application includes rich visual styling capabilities, and whether the browser supports features of CSS2 and CSS3.
+ </para>
+ <remark>Browser lists may need to be updated.</remark>
+ <itemizedlist>
+ <title>Basic skinning</title>
+ <listitem>
+ <para>
+ <productname>Apple Safari</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 6</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in <literal>BackCompat</literal> mode (refer to <citetitle pubwork="article"><varname>compatMode</varname> Property</citetitle> at <ulink url="http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Opera</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <title>Extended skinning</title>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in standards-compliant mode
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Mozilla Firefox</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ If the browser type cannot be identified, the extended level is used. Set the level explicitly by adding the following context parameter to the <filename>web.xml</filename> configuration file, and specifying the <sgmltag><param-value></sgmltag> element as either <literal>basic</literal> or <literal>extended</literal>:
+ </para>
+<programlisting language="XML" role="XML"><context-param>
<param-name>org.richfaces.CONTROL_SKINNING_LEVEL</param-name>
<param-value>basic</param-value>
</context-param></programlisting>
+<!--
+ <para>
+ Browsers with rich visual styling for controls (such as Opera and Safari) will not work correctly with standard HTML control skinning. The RichFaces framework includes a client-side script (<filename>skinning.js</filename>) for determining the styling capabilities of the browser and enabling extended skinning accordingly.
+ </para>
+ <procedure id="proc-Developer_Guide-Skinning_and_theming-Using_the_skinning.js_script">
+ <title>Using the skinning.js script</title>
+ <step>
+ <title>Activate the script on the page</title>
+ <para>Add the following code to the head of the page:</para>
+<programlisting language="XML" role="XML"><script type="text/javascript">
+ window.RICH_FACES_EXTENDED_SKINNING_ON = true;
+</script></programlisting>
+ </step>
+ </procedure>
+-->
+ </section>
</section>
- <section id="sect-Developer_Guide-Skinning_and_theming-Customizing_skins">
- <title>Customizing skins</title>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Extended_skinning">
+ <title>Plug-n-skin</title>
<para>
Incomplete
</para>
</section>
- <section id="sect-Developer_Guide-Skinning_and_theming-Changing_skins_at_runtime">
- <title>Changing skins at runtime</title>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Defining_skins_for_individual_components">
+ <title>Defining skins for individual components</title>
<para>
- The user can change skins at runtime if a managed bean is used to access the skin.
+ RichFaces uses <acronym>XCSS</acronym> (XML-formatted CSS) files to add extra functionality to the skinning process. XCSS files can contain all the styling information for each RichFaces component in the library.
</para>
- <procedure>
- <step>
- <title>Create the skin bean</title>
- <para>The skin bean is a simple interface to manage the skin:</para>
-<programlisting language="Java" role="JAVA">public class SkinBean {
-
- private String skin;
-
- public String getSkin() {
- return skin;
- }
- public void setSkin(String skin) {
- this.skin = skin;
- }
-}</programlisting>
- </step>
- <step>
- <title>Reference the skin bean</title>
- <para>Use <acronym>EL</acronym> (Expression Language) to reference the skin bean from the <filename>web.xml</filename> settings file.</para>
-<programlisting language="XML" role="XML"><context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>#{skinBean.skin}</param-value>
-</context-param></programlisting>
- </step>
- <step>
- <title>Set initial skin</title>
- <para>
- The application needs an initial skin to display before the user chooses an alternative skin. The initial skin is specified in the <filename>web.xml</filename> configuration file.
- </para>
-<programlisting language="XML" role="XML"><managed-bean>
- <managed-bean-name>skinBean</managed-bean-name>
- <managed-bean-class>SkinBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>skin</property-name>
- <value>classic</value>
- </managed-property>
-</managed-bean></programlisting>
- </step>
- </procedure>
- <example id="exam-Developer_Guide-Skinning_and_theming-Skin_changing_example">
- <title>Skin changing example</title>
+ <para>
+ XCSS files contain mappings between CSS properties and skin parameters. The <varname>name</varname> attribute of the <sgmltag><u:selector></sgmltag> element is the name of the CSS selector. Each <sgmltag><u:style></sgmltag> element defines a CSS property with the <varname>name</varname> attribute as its name. Using the <varname>skin</varname> attribute specifies a skin parameter from the current skin file, while using the <varname>value</varname> attribute enters the literal value in the CSS file. An example of this is shown in <xref linkend="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings" />.
+ </para>
+ <example id="exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings">
+ <title>XCSS style mappings</title>
<para>
- This example renders a list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
+ The XCSS code for the CSS selector named <literal>.rich-component-name</literal> is as follows:
</para>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <blockquote>
- <figure id="figu-Developer_Guide-Skinning_and_theming-Skin_changing_example">
- <title>Skin changing example</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png" format="PNG" />
- </imageobject>
- <textobject>
- <para>
- A list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
- </para>
- </textobject>
- </mediaobject>
- </figure>
- </blockquote>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <para>
+ This renders the following CSS code to be read by a standard browser:
+ </para>
+<programlisting language="CSS" role="CSS"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings.css" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <para>
+ CSS selectors with identical skinning properties can be listed in a single <varname>name</varname> attribute of a <sgmltag><u:selector></sgmltag> element, separated by commas.
+ </para>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-XCSS_style_mappings-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</example>
</section>
-
- <section id="sect-Developer_Guide-Skinning_and_theming-Extended_skinning">
- <title>Extended skinning</title>
- <para>
- Incomplete
- </para>
- </section>
</chapter>
14 years, 11 months
JBoss Rich Faces SVN: r16757 - in root/docs/trunk/Developer_Guide/en-US: extras and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-04-13 04:10:25 -0400 (Tue, 13 Apr 2010)
New Revision: 16757
Added:
root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample
root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png
Modified:
root/docs/trunk/Developer_Guide/en-US/Author_Group.xml
root/docs/trunk/Developer_Guide/en-US/Book_Info.xml
root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml
root/docs/trunk/Developer_Guide/en-US/Preface.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
Log:
Updated skinning guide
Modified: root/docs/trunk/Developer_Guide/en-US/Author_Group.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Author_Group.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/Author_Group.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -1,7 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Developer_Guide.ent">
-%BOOK_ENTITIES;
]>
<authorgroup>
<author>
@@ -15,47 +13,36 @@
</affiliation>
<email>serogers(a)redhat.com</email>
</author>
- <collab>
- <collabname>Svetlana Mukhina</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
+ <collab><collabname>Svetlana Mukhina</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
+ </collab><collab><collabname>Anastasiya Bogachuk</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
+ </collab><collab><collabname>Gleb Galkin</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
+ </collab><collab><collabname>Mikhail Sorokin</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
+ </collab><collab><collabname>Alexander Tsebro</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
+ </collab><collab><collabname>Olga Chikvina</collabname>
+ <affiliation>
+ <orgname>Exadel</orgname>
+ <orgdiv>Documentation</orgdiv>
+ </affiliation>
</collab>
- <collab>
- <collabname>Anastasiya Bogachuk</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
- </collab>
- <collab>
- <collabname>Gleb Galkin</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
- </collab>
- <collab>
- <collabname>Mikhail Sorokin</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
- </collab>
- <collab>
- <collabname>Alexander Tsebro</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
- </collab>
- <collab>
- <collabname>Olga Chikvina</collabname>
- <affiliation>
- <orgname>Exadel</orgname>
- <orgdiv>Documentation</orgdiv>
- </affiliation>
- </collab>
</authorgroup>
Modified: root/docs/trunk/Developer_Guide/en-US/Book_Info.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Book_Info.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/Book_Info.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -11,11 +11,8 @@
<pubsnumber>1</pubsnumber>
<abstract>
<para>
-Read this book for a comprehensive guide to getting started and
-working with RichFaces &VERSION;. It includes details of the
-architecture, the framework's use in different applications,
-and skinning implementations.
-</para>
+ Read this book for a comprehensive guide to getting started and working with RichFaces &VERSION;. It includes details of the architecture, the framework's use in different applications, and skinning implementations.
+ </para>
</abstract>
<corpauthor>
<inlinemediaobject>
@@ -31,7 +28,7 @@
<year>&YEAR;</year>
<holder>&HOLDER;</holder>
</copyright>
- <!-- FOR PUBLICAN --><xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK: --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- FOR PUBLICAN --><xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK: --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/Developer_Guide.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -3,7 +3,7 @@
]>
<book status="draft">
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <!-- <xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include> --><xi:include href="chap-Developer_Guide-Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- <xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include> --><xi:include href="chap-Developer_Guide-Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Developer_Guide-Getting_started_with_RichFaces.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Developer_Guide-RichFaces_overview.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Developer_Guide-Basic_concepts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: root/docs/trunk/Developer_Guide/en-US/Preface.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/Preface.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/Preface.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -3,10 +3,10 @@
]>
<preface id="pref-Developer_Guide-Preface">
<title>Preface</title>
- <!-- FOR JDOCBOOK --><xi:include href="Common_Content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR PUBLICAN --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- FOR JDOCBOOK --><xi:include href="Common_Content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR PUBLICAN --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
- <!-- PUBLICAN'S ORIGINAL XINCLUDES --><xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- PUBLICAN'S ORIGINAL XINCLUDES --><xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
</xi:fallback>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Advanced_features.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -56,14 +56,16 @@
RichFaces uses a filter to correct the code received on an Ajax request. During a regular JSF request, a browser makes corrections independently. For Ajax requests, a filter is needed to prevent layout destruction. This is because a received code could differ from a code validated by a browser, and a browser does not make any corrections. Refer to <xref linkend="sect-Developer_Guide-Architecture-Ajax_Filter" /> for further details on how the Ajax filter works.
</para>
<para>
- <xref linkend="exam-Developer_Guide-Advanced_features-Example_filter" /> shows how to set a filter in the <filename>web.xml</filename> file of an application.
+ <xref linkend="exam-Developer_Guide-Filters-Example_filter" /> shows how to set a filter in the <filename>web.xml</filename> file of an application.
</para>
- <example id="exam-Developer_Guide-Advanced_features-Example_filter">
+ <example id="exam-Developer_Guide-Filters-Example_filter">
<title>Example filter</title>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-Example_filter.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Developer_Guide-Advanced_features-Example_filter.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</example>
<para>
- Different types of filters can be configured for pages in the same application. There are three filter types:
+ Different types of filters can be configured for pages in the same application. There are three filter types:
<variablelist>
<varlistentry>
<term><literal>TIDY</literal></term>
@@ -92,14 +94,16 @@
</variablelist>
</para>
<para>
- <xref linkend="exam-Developer_Guide-Advanced_features-Example_filter_configuration" /> shows how to configure a filter through the <filename>web.xml</filename> file.
+ <xref linkend="exam-Developer_Guide-Filters-Example_filter_configuration" /> shows how to configure a filter through the <filename>web.xml</filename> file.
</para>
- <example id="exam-Developer_Guide-Advanced_features-Example_filter_configuration">
+ <example id="exam-Developer_Guide-Filters-Example_filter_configuration">
<title>Example filter configuration</title>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-Example_filter_configuration.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Developer_Guide-Advanced_features-Example_filter_configuration.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</example>
<para>
- The <parameter>ORDER</parameter> parameter specifies the order in which particular filter types are used for code correction: first <literal>NONE</literal>, then <literal>NEKO</literal>, then <literal>TIDY</literal>. Two sets of pages are specified as using specific filter types:
+ The <parameter>ORDER</parameter> parameter specifies the order in which particular filter types are used for code correction: first <literal>NONE</literal>, then <literal>NEKO</literal>, then <literal>TIDY</literal>. Two sets of pages are specified as using specific filter types:
<variablelist>
<varlistentry>
<term><code>/pages/performance\.xhtml,/pages/default.*\.xhtml</code></term>
@@ -121,23 +125,24 @@
</para>
</section>
- <section id="sect-Developer_Guide-Advanced_features-Scripts_and_styles">
+ <section id="sect-Developer_Guide-Advanced_features-Script_and_style_loading">
<title>Script and style loading</title>
<para>
Scripts and styles are normally loaded into a RichFaces application on demand. The default loading strategy can be altered to suit certain applications by specifying the strategy in the <filename>web.xml</filename> file.
</para>
- <section>
+ <section id="sect-Developer_Guide-Script_and_style_loading-org.richfaces.LoadScriptStrategy">
<title><code>org.richfaces.LoadScriptStrategy</code></title>
<para>
The script-loading strategy is specified as follows:
</para>
+
<programlisting language="XML" role="XML"><context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
</programlisting>
<para>
- The <sgmltag><param-value></sgmltag> element can be set to one of three values:
+ The <sgmltag><param-value></sgmltag> element can be set to one of three values:
<variablelist>
<varlistentry>
<term><literal>ALL</literal></term>
@@ -172,18 +177,20 @@
</variablelist>
</para>
</section>
- <section>
+
+ <section id="sect-Developer_Guide-Script_and_style_loading-org.richfaces.LoadStyleStrategy">
<title><code>org.richfaces.LoadStyleStrategy</code></title>
<para>
The style-loading strategy is specified as follows:
</para>
+
<programlisting language="XML" role="XML"><context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
</programlisting>
<para>
- The <sgmltag><param-value></sgmltag> element can be set to one of three values:
+ The <sgmltag><param-value></sgmltag> element can be set to one of three values:
<variablelist>
<varlistentry>
<term><literal>ALL</literal></term>
@@ -212,6 +219,7 @@
</variablelist>
</para>
</section>
+
</section>
<section id="sect-Developer_Guide-Advanced_features-Error_handling">
@@ -222,6 +230,7 @@
<para>
To define handlers for application exceptions, add the following code to your <filename>web.xml</filename> file:
</para>
+
<programlisting language="XML" role="XML"><context-param>
<param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
<param-value>true</param-value>
@@ -232,23 +241,26 @@
<para>
Custom error handlers for the <methodname>onError</methodname> and <methodname>onExpire</methodname> events do not work under MyFaces. MyFaces handles exceptions through its internal debug page. Use the following code in the <filename>web.xml</filename> file to prevent this behavior in MyFaces:
</para>
+
<programlisting language="XML" role="XML"><context-param>
<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
<param-value>false</param-value>
</context-param>
</programlisting>
</note>
- <section id="sect-Developer_Guide-Advanced_features-Handling_request_errors">
+ <section id="sect-Developer_Guide-Error_handling-Handling_request_errors">
<title>Handling request errors</title>
<para>
- To execute custom JavaScript code on the client when an error occurs during an Ajax request, redefine the standard <methodname>A4J.AJAX.onError</methodname> method, as shown in <xref linkend="exam-Developer_Guide-Advanced_features-Example_request_error" />.
+ To execute custom JavaScript code on the client when an error occurs during an Ajax request, redefine the standard <methodname>A4J.AJAX.onError</methodname> method, as shown in <xref linkend="exam-Developer_Guide-Handling_request_errors-Example_request_error" />.
</para>
- <example id="exam-Developer_Guide-Advanced_features-Example_request_error">
+ <example id="exam-Developer_Guide-Handling_request_errors-Example_request_error">
<title>Example request error</title>
-<programlisting language="Java" role="JAVA"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-Example_request_error.js" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+
+<programlisting language="Java" role="JAVA"><xi:include href="extras/exam-Developer_Guide-Advanced_features-Example_request_error.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</example>
<para>
- The function accepts three parameters:
+ The function accepts three parameters:
<variablelist>
<varlistentry>
<term><parameter>req</parameter></term>
@@ -277,18 +289,20 @@
</variablelist>
</para>
</section>
- <section id="sect-Developer_Guide-Advanced_features-Handling_session_expiration_errors">
+
+ <section id="sect-Developer_Guide-Error_handling-Handling_session_expiration_errors">
<title>Handling session expiration errors</title>
<para>
- Redefine the <methodname>A4J.AJAX.onExpired</methodname> method to handle the expiration of a user's session, as shown in <xref linkend="exam-Developer_Guide-Advanced_features-Example_session_expiration_error" />.
+ Redefine the <methodname>A4J.AJAX.onExpired</methodname> method to handle the expiration of a user's session, as shown in <xref linkend="exam-Developer_Guide-Handling_session_expiration_errors-Example_session_expiration_error" />.
</para>
- <example id="exam-Developer_Guide-Advanced_features-Example_session_expiration_error">
+ <example id="exam-Developer_Guide-Handling_session_expiration_errors-Example_session_expiration_error">
<title>Example session expiration error</title>
-<programlisting language="Java" role="JAVA"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-Example_session_expiration_error.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+<programlisting language="Java" role="JAVA"><xi:include href="extras/exam-Developer_Guide-Advanced_features-Example_session_expiration_error.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</example>
<para>
- The function accepts two parameters:
+ The function accepts two parameters:
<variablelist>
<varlistentry>
<term><parameter>loc</parameter></term>
@@ -309,6 +323,7 @@
</variablelist>
</para>
</section>
+
</section>
<section id="sect-Developer_Guide-Advanced_features-Managing_states" status="draft">
@@ -326,31 +341,35 @@
<para>
To check whether the logged-in user belongs to a certain user role, use the <function>rich:isUserInRole(Object)</function> function in RichFaces. The example demonstrates the function's use to render controls only for users with administrator privileges.
</para>
- <example id="exam-Developer_Guide-Advanced_features-User_role_example">
+ <example id="exam-Developer_Guide-User_roles-User_role_example">
<title>User role example</title>
<para>
Certain controls only need to be rendered for administrators.
</para>
<procedure>
- <step>
+ <step id="step-Developer_Guide-User_role_example-Create_admin_role">
<title>Create <literal>admin</literal> role</title>
<para>
Create the <literal>admin</literal> role in the <filename>web.xml</filename> file:
</para>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-User_role_example-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Developer_Guide-Advanced_features-User_role_example-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</step>
- <step>
+ <step id="step-Developer_Guide-User_role_example-Implement_authorization_for_users">
<title>Implement authorization for users</title>
<para>
Assign the <literal>admin</literal> role to users when they log in to the application as administrators.
</para>
</step>
- <step>
+ <step id="step-Developer_Guide-User_role_example-Use_the_richisUserInRoleObject_function">
<title>Use the <function>rich:isUserInRole(Object)</function> function</title>
<para>
The <function>rich:isUserInRole(Object)</function> function can be used with the <varname>rendered</varname> attribute of any component:
</para>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Advanced_features-User_role_example-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Developer_Guide-Advanced_features-User_role_example-1.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</step>
</procedure>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Basic_concepts.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -9,7 +9,7 @@
<section id="sect-Developer_Guide-Basic_concepts-Sending_an_Ajax_request">
<title>Sending an Ajax request</title>
<para>
- Many of the tags in the <classname>a4j</classname> and <classname>rich</classname> tag libraries are capable of sending Ajax requests from a JavaServer Faces (JSF) page. RichFaces tags hide the usual JavaScript activities that are required for an XMHTTPRequest object building and an Ajax request sending. Additionally the tags can determine which components of a JSF page are to be re-rendered as a result of the Ajax response; refer to <xref linkend="sect-Developer_Guide-Basic_concepts-Partial_page_updates" /> for details.
+ Many of the tags in the <classname>a4j</classname> and <classname>rich</classname> tag libraries are capable of sending Ajax requests from a JavaServer Faces (JSF) page. RichFaces tags hide the usual JavaScript activities that are required for an XMHTTPRequest object building and an Ajax request sending. Additionally the tags can determine which components of a JSF page are to be re-rendered as a result of the Ajax response; refer to <xref linkend="sect-Developer_Guide-Receiving_events_and_updates-Partial_page_updates" /> for details.
</para>
<itemizedlist>
<listitem>
@@ -33,7 +33,6 @@
</para>
</listitem>
</itemizedlist>
-
</section>
<section id="sect-Developer_Guide-Basic_concepts-Receiving_events_and_updates">
@@ -47,8 +46,7 @@
If the content of an Ajax response needs to be rendered outside the active region, then the value of the <varname>renderRegionOnly</varname> attribute should be set to <literal>false</literal>. Otherwise, your Ajax updates are limited to elements of the active region. If not defined, the default setting is <code>renderRegionOnly="false"</code>.
</para>
</note>
-
- <section id="sect-Developer_Guide-Basic_concepts-Partial_page_updates">
+ <section id="sect-Developer_Guide-Receiving_events_and_updates-Partial_page_updates">
<title>Partial page updates</title>
<para>
Specific regions of a page can be defined through the use of container components such as <sgmltag><a4j:region></sgmltag>. These regions can then be specified with their <varname>id</varname> identifiers in the <varname>render</varname> attribute of a component so that when the component sends an Ajax request, only the specified regions are updated. In this way you can control which part of the JSF View is decoded on the server side when the Ajax request is sent. Multiple regions can be defined and sent, and regions can be nested inside other regions.
@@ -63,7 +61,7 @@
Refer to the <citetitle>RichFaces Component Reference</citetitle> for further details on the common Ajax attributes used for partial page updates.
</para>
</section>
-
+
</section>
<section id="sect-Developer_Guide-Basic_concepts-Processing_data_on_the_server">
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Getting_started_with_RichFaces.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -267,6 +267,7 @@
<para>
The RichFaces tag libraries need to be referenced on each XHTML page in your project:
</para>
+
<programlisting language="XML" role="XML"><ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
@@ -293,6 +294,7 @@
<para>
A structure for the Maven project with minimal content can be created with the Maven archetype named <filename>maven-archetype-jsfwebapp</filename> included as part of the RichFaces Component Development Kit (<acronym>CDK</acronym>). The archetype and the project itself require extra repositories to be provided, namely <filename>http://snapshots.jboss.org/maven2/</filename> and <filename>http://repository.jboss.com/maven2/</filename>. To make the repositories accessible to Maven, add a profile in the <filename>maven_installation_folder/conf/settings.xml</filename> file under the <sgmltag><profiles></sgmltag> element:
</para>
+
<programlisting language="XML" role="XML"><profiles>
<profile>
<id>jsf-app-profile</id>
@@ -331,6 +333,7 @@
<para>
The profile then needs to be activated in the <sgmltag><activeProfiles></sgmltag> element:
</para>
+
<programlisting language="XML" role="XML"><activeProfiles>
<activeProfile>jsf-app-profile</activeProfile>
</activeProfiles>
@@ -392,11 +395,12 @@
</screen>
</para>
</step>
- <step>
+ <step id="step-Developer_Guide-Using_RichFaces_with_Maven-Add_dependencies">
<title>Add dependencies</title>
<para>
The <filename>jsf-app</filename> directory contains a project descriptor file, <filename>pom.xml</filename>. To add RichFaces libraries to your project, edit the project descriptor to add dependencies to the <sgmltag><dependencies></sgmltag> element as follows:
</para>
+
<programlisting language="XML" role="XML"><dependencies>
<dependency>
<groupId>junit</groupId>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-RichFaces_overview.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -13,10 +13,10 @@
<title>Request processing flow</title>
<mediaobject>
<imageobject role="html">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png" format="PNG" contentwidth="660px" />
+ <imagedata contentwidth="660px" fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png" format="PNG" width="444" />
</imageobject>
<imageobject role="fo">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png" format="PNG" contentwidth="150mm" />
+ <imagedata contentwidth="150mm" fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_flow.png" format="PNG" width="444" />
</imageobject>
<textobject>
<para>
@@ -70,10 +70,10 @@
<title>Request processing sequences</title>
<mediaobject>
<imageobject role="html">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png" format="PNG" contentwidth="660px" />
+ <imagedata contentwidth="660px" fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png" format="PNG" width="444" />
</imageobject>
<imageobject role="fo">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png" format="PNG" contentwidth="150mm" />
+ <imagedata contentwidth="150mm" fileref="images/figu-Developer_Guide-RichFaces_overview-Request_processing_sequences.png" format="PNG" width="444" />
</imageobject>
<textobject>
<para>
@@ -89,10 +89,10 @@
<title>Resource request sequence</title>
<mediaobject>
<imageobject role="html">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png" format="PNG" contentwidth="660px" />
+ <imagedata contentwidth="660px" fileref="images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png" format="PNG" width="444" />
</imageobject>
<imageobject role="fo">
- <imagedata fileref="images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png" format="PNG" contentwidth="150mm" />
+ <imagedata contentwidth="150mm" fileref="images/figu-Developer_Guide-RichFaces_overview-Resource_request_sequence.png" format="PNG" width="444" />
</imageobject>
<textobject>
<para>
Modified: root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-12 15:00:43 UTC (rev 16756)
+++ root/docs/trunk/Developer_Guide/en-US/chap-Developer_Guide-Skinning_and_theming.xml 2010-04-13 08:10:25 UTC (rev 16757)
@@ -4,22 +4,675 @@
<chapter id="chap-Developer_Guide-Skinning_and_theming">
<title>Skinning and theming</title>
<para>
- Incomplete
+ Read this chapter for a guide to skinning and theming RichFaces applications, including how to implement themes, and details on customizing and extending skins.
</para>
- <section id="sect-Developer_Guide-Skinning_and_theming-What_are_skins_and_themes">
- <title>What are skins and themes?</title>
+ <section id="sect-Developer_Guide-Skinning_and_theming-What_are_skins">
+ <title>What are skins?</title>
<para>
- Incomplete
+ Application skins are used with the RichFaces framework to change the appearance of an application through setting the colors and decoration of controls and components. Typically the appearance of web applications is handled through the <acronym>CSS</acronym> (Cascading Style Sheet) files associated with the application, but skinning allows the settings in a CSS file to be abstracted and easily edited. Using skins avoids repetitive coding and duplication in CSS files through the use of style variables and generalization. CSS files are not completely replaced: skins work as a high-level extension to standard CSS.
</para>
+ <para>
+ Each skin has a set of <varname>skin-parameters</varname>, which are used to define the theme palette and other elements of the user interface. These parameters work together with regular CSS declarations, and can be referred to from within CSS using JavaServer Faces Expression Language (<acronym>EL</acronym>).
+ </para>
+ <para>
+ The skinning feature of RichFaces also allows themes to be changed at runtime, so users can personalize an application's appearance.
+ </para>
</section>
<section id="sect-Developer_Guide-Skinning_and_theming-Using_skins">
<title>Using skins</title>
<para>
- Incomplete
+ RichFaces skins are designed to use a combination of styling elements. Themes for components can be applied using any of the following style classes:
</para>
+ <variablelist>
+ <varlistentry>
+ <term>A default style class inserted into the framework</term>
+ <listitem>
+ <para>
+ Style classes contain skin parameters linked to constant theme styles in the skin. Each component has a class style defining a default representation level. Application interfaces can be modified by altering the values of skin parameters in the skin itself.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>A style class extending the skin</term>
+ <listitem>
+ <para>
+ A custom style class can be added to the skin, working in conjunction with CSS classes of the same name. All components referencing the class are extended in the same way.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>User style class</term>
+ <listitem>
+ <para>
+ Components can use the <varname>styleClass</varname> attribute to redefine specific component elements. As such, the appearance of an individual component can be customized according to a CSS style parameter specified in the class.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+ RichFaces includes a number of predefined skins. These skins can be used in RichFaces web applications by specifying the skin name in the <varname>org.richfaces.SKIN</varname> context parameter in the <filename>web.xml</filename> settings file. The predefined skins are as follows:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>DEFAULT</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>plain</literal>, which contains no skin parameters and is intended for embedding RichFaces components into existing projects with their own styles.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>emeraldTown</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>blueSky</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>wine</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>japanCherry</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ruby</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>classic</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>deepMarine</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <example id="exam-Developer_Guide-Using_skins-Simple_skinning_example">
+ <title>Simple skinning example</title>
+ <para>
+ Using any component, such as a panel, without specifying a <varname>styleClass</varname> will use the default skin parameters for that component.
+ </para>
+
+<programlisting language="XML" role="XML"><rich:panel>...</rich:panel></programlisting>
+ <para>
+ When rendered for display, the panel consists of two HTML elements: a wrapper <sgmltag><div></sgmltag> element and a <sgmltag><div></sgmltag> element for the body of the panel. The wrapper element for a panel without a specified <varname>styleClass</varname> is rendered as follows:
+ </para>
+
+<programlisting language="XML" role="XML"><div class="dr-pnl rich-panel">
+ ...
+</div></programlisting>
+ <para>
+ <literal>dr-pnl</literal> refers to a CSS class specified in the framework. The CSS class uses skin parameters for generic theme styles:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ The <varname>background-color</varname> CSS class attribute is defined by the <literal>generalBackgroundColor</literal> skin parameter.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <varname>border-color</varname> CSS class attribute is defined by the <literal>panelBorderColor</literal> skin parameter.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Changing the definitions for <literal>generalBackgroundColor</literal> or <literal>panelBorderColor</literal> in the skin will cause all panels in the application to change.
+ </para>
+ <para>
+ If a <varname>styleClass</varname> attribute is used, the specified style class is applied to the component, which could extend or override the default styles.
+ </para>
+
+<programlisting language="XML" role="XML"><rich:panel styleClass="customClass">...</rich:panel></programlisting>
+ <para>
+ The <literal>customClass</literal> style is added to the CSS, and is applied to the component when it is rendered for display:
+ </para>
+
+<programlisting language="XML" role="XML"><div class="dr-pnl rich-panel customClass">
+ ...
+</div></programlisting>
+ </example>
</section>
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skin_parameter_tables_in_RichFaces">
+ <title>Skin parameter tables in RichFaces</title>
+ <para>
+ <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> lists the default values for the parameter settings in the <literal>blueSky</literal> skin. These values can be customized and extended for a unique application theme.
+ </para>
+ <table id="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin">
+ <title>Parameter settings for the <literal>blueSky</literal> skin</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>
+ Parameter name
+ </entry>
+ <entry>
+ Default value
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><varname>
+ headerBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #BED6F8
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ headerGradientColor
+ </varname></entry>
+ <entry><literal>
+ #F2F7FF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ headTextColor
+ </varname></entry>
+ <entry><literal>
+ #000000
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ headerWeightFont
+ </varname></entry>
+ <entry><literal>
+ bold
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ generalBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #FFFFFF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ generalTextColor
+ </varname></entry>
+ <entry><literal>
+ #000000
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ generalSizeFont
+ </varname></entry>
+ <entry><literal>
+ 11px
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ generalFamilyFont
+ </varname></entry>
+ <entry><literal>
+ Arial, Verdana, sans-serif
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ controlTextColor
+ </varname></entry>
+ <entry><literal>
+ #000000
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ controlBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #ffffff
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ additionalBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #ECF4FE
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ shadowBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #000000
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ shadowOpacity
+ </varname></entry>
+ <entry><literal>
+ 1
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ panelBorderColor
+ </varname></entry>
+ <entry><literal>
+ #BED6F8
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ subBorderColor
+ </varname></entry>
+ <entry><literal>
+ #ffffff
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tabBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #C6DEFF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tabDisabledTextColor
+ </varname></entry>
+ <entry><literal>
+ #8DB7F3
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ trimColor
+ </varname></entry>
+ <entry><literal>
+ #D6E6FB
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tipBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #FAE6B0
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tipBorderColor
+ </varname></entry>
+ <entry><literal>
+ #E5973E
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ selectControlColor
+ </varname></entry>
+ <entry><literal>
+ #E79A00
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ generalLinkColor
+ </varname></entry>
+ <entry><literal>
+ #0078D0
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ hoverLinkColor
+ </varname></entry>
+ <entry><literal>
+ #0090FF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ visitedLinkColor
+ </varname></entry>
+ <entry><literal>
+ #0090FF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ headerSizeFont
+ </varname></entry>
+ <entry><literal>
+ 11px
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ headerFamilyFont
+ </varname></entry>
+ <entry><literal>
+ Arial, Verdana, sans-serif
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tabSizeFont
+ </varname></entry>
+ <entry><literal>
+ 11px
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tabFamilyFont
+ </varname></entry>
+ <entry><literal>
+ Arial, Verdana, sans-serif
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ buttonSizeFont
+ </varname></entry>
+ <entry><literal>
+ 11px
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ buttonFamilyFont
+ </varname></entry>
+ <entry><literal>
+ Arial, Verdana, sans-serif
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tableBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #FFFFFF
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tableFooterBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #cccccc
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tableSubfooterBackgroundColor
+ </varname></entry>
+ <entry><literal>
+ #f1f1f1
+ </literal></entry>
+ </row>
+ <row>
+ <entry><varname>
+ tableBorderColor
+ </varname></entry>
+ <entry><literal>
+ #C0C0C0
+ </literal></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section id="sect-Developer_Guide-Creating_a_new_skin">
+ <title>Creating a new skin</title>
+ <procedure>
+ <step>
+ <title>Create the skin file</title>
+ <para>The name of the skin file should follow the format <filename><replaceable>new_skin_name</replaceable>.skin.properties</filename> and is placed in either the <filename>META-INF/skins/</filename> directory or the classpath directory of your project.</para>
+ </step>
+ <step>
+ <title>Define skin constants</title>
+ <para>Add skin parameter constants and values to the file. <xref linkend="exam-Developer_Guide-Skinning_and_theming-blueSky.skin.properties_file" /> shows how the skin parameters listed in <xref linkend="tabl-Developer_Guide-Skin_parameter_tables_in_RichFaces-Parameter_settings_for_the_blueSky_skin" /> are included in the skin file.</para>
+ <example id="exam-Developer_Guide-Skinning_and_theming-blueSky.skin.properties_file">
+ <title><filename>blueSky.skin.properties</filename> file</title>
+ <para>
+ The <filename>blueSky.skin.properties</filename> file lists all the skin parameter constants for the skin. It can be extracted from the <filename>/META-INF/skins</filename> directory in the <package>richfaces-impl-<replaceable>version</replaceable>.jar</package> package.
+ </para>
+<programlisting>#Colors
+headerBackgroundColor=#BED6F8
+headerGradientColor=#F2F7FF
+headerTextColor=#000000
+headerWeightFont=bold
+
+generalBackgroundColor=#FFFFFF
+generalTextColor=#000000
+generalSizeFont=11px
+generalFamilyFont=Arial, Verdana, sans-serif
+
+controlTextColor=#000000
+controlBackgroundColor=#ffffff
+additionalBackgroundColor=#ECF4FE
+
+shadowBackgroundColor=#000000
+shadowOpacity=1
+
+panelBorderColor=#BED6F8
+subBorderColor=#ffffff
+
+tabBackgroundColor=#C6DEFF
+tabDisabledTextColor=#8DB7F3
+
+trimColor=#D6E6FB
+
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
+
+selectControlColor=#E79A00
+
+generalLinkColor=#0078D0
+hoverLinkColor=#0090FF
+visitedLinkColor=#0090FF
+
+# Fonts
+headerSizeFont=11px
+headerFamilyFont=Arial, Verdana, sans-serif
+
+tabSizeFont=11
+tabFamilyFont=Arial, Verdana, sans-serif
+
+buttonSizeFont=11
+buttonFamilyFont=Arial, Verdana, sans-serif
+
+tableBackgroundColor=#FFFFFF
+tableFooterBackgroundColor=#cccccc
+tableSubfooterBackgroundColor=#f1f1f1
+tableBorderColor=#C0C0C0
+tableBorderWidth=1px
+
+#Calendar colors
+calendarWeekBackgroundColor=#F5F5F5
+
+calendarHolidaysBackgroundColor=#FFEBDA
+calendarHolidaysTextColor=#FF7800
+
+calendarCurrentBackgroundColor=#FF7800
+calendarCurrentTextColor=#FFEBDA
+
+calendarSpecBackgroundColor=#E4F5E2
+calendarSpecTextColor=#000000
+
+warningColor=#FFE6E6
+warningBackgroundColor=#FF0000
+
+editorBackgroundColor=#F1F1F1
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
+</programlisting>
+ </example>
+ </step>
+ <step>
+ <title>Reference skin definition</title>
+ <para>Add a skin definition <sgmltag><context-param></sgmltag> to the <filename>web.xml</filename> settings file of your application:</para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value><replaceable>new_skin_name</replaceable></param-value>
+</context-param></programlisting>
+ </step>
+ </procedure>
+ <section id="sect-Developer_Guide-Skinning_and_Theming-Skinning_standard_JSF_components">
+ <title>Skinning standard JSF components</title>
+ <para>
+ The RichFaces framework can also use skinning to theme JSF (JavaServer Faces) components in addition to RichFaces components. Follow these additional steps to skin JSF components.
+ </para>
+ <procedure>
+ <step>
+ <title>Register a custom render kit</title>
+ <para>The custom render kit is created by registering it in the <filename>faces-config.xml</filename> configuration file:</para>
+<programlisting language="XML" role="XML"><render-kit>
+ <render-kit-id><replaceable>new_skin_name</replaceable></render-kit-id>
+ <render-kit-class>org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl</render-kit-class>
+</render-kit></programlisting>
+ </step>
+ <step>
+ <title>Register custom renderers for the JSF component</title>
+ <para>Add custom renderers in the <filename>faces-config.xml</filename> configuration file for each JSF component you want to skin:</para>
+<programlisting language="XML" role="XML"><renderer>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>javax.faces.Link</renderer-type>
+ <renderer-class><replaceable>new_skin_name</replaceable>.HtmlCommandLinkRenderer</renderer-class>
+</renderer></programlisting>
+ </step>
+ <step>
+ <title>Reference the render kit in the skin file</title>
+ <para>Add the following to the top of the skin parameters file: <code>render.kit=<replaceable>new_skin_name</replaceable></code></para>
+ </step>
+ </procedure>
+ </section>
+ </section>
+
+ <section id="sect-Developer_Guide-Skinning_and_theming-Skinning_standard_HTML_controls">
+ <title>Skinning standard HTML controls</title>
+ <para>
+ Standard HTML controls and components used alongside RichFaces and JSF components can also be themed to create a cohesive user interface. The following HTML elements accept skinning:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <sgmltag><a></sgmltag> (including <sgmltag>a:hover</sgmltag>, <sgmltag>a:visited</sgmltag> and other elements)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><fieldset></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><hr></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><input></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><isindex></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><keygen></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><legend></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><select></sgmltag>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <sgmltag><textarea></sgmltag>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ There are two levels of skinning for HTML controls, depending on whether the Internet browser viewing the application supports rich visual styling capabilities.
+ </para>
+ <remark>Browser lists may need to be updated.</remark>
+ <itemizedlist>
+ <title>Basic skinning</title>
+ <listitem>
+ <para>
+ <productname>Apple Safari</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 6</productname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in <literal>BackCompat</literal> mode (refer to <citetitle pubwork="article"><varname>compatMode</varname> Property</citetitle> at <ulink url="http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533687(VS.85).aspx</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Opera</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <title>Extended skinning</title>
+ <listitem>
+ <para>
+ <productname>Microsoft Internet Explorer 7</productname> in standards-compliant mode
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <productname>Mozilla Firefox</productname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ If the browser type cannot be identified, the extended level is used. Set the level explicitly by adding the following context parameter to the <filename>web.xml</filename> configuration file, and specifying the <sgmltag><param-value></sgmltag> element as either <literal>basic</literal> or <literal>extended</literal>:
+ </para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_LEVEL</param-name>
+ <param-value>basic</param-value>
+</context-param></programlisting>
+ </section>
+
<section id="sect-Developer_Guide-Skinning_and_theming-Customizing_skins">
<title>Customizing skins</title>
<para>
@@ -30,8 +683,70 @@
<section id="sect-Developer_Guide-Skinning_and_theming-Changing_skins_at_runtime">
<title>Changing skins at runtime</title>
<para>
- Incomplete
+ The user can change skins at runtime if a managed bean is used to access the skin.
</para>
+ <procedure>
+ <step>
+ <title>Create the skin bean</title>
+ <para>The skin bean is a simple interface to manage the skin:</para>
+<programlisting language="Java" role="JAVA">public class SkinBean {
+
+ private String skin;
+
+ public String getSkin() {
+ return skin;
+ }
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+}</programlisting>
+ </step>
+ <step>
+ <title>Reference the skin bean</title>
+ <para>Use <acronym>EL</acronym> (Expression Language) to reference the skin bean from the <filename>web.xml</filename> settings file.</para>
+<programlisting language="XML" role="XML"><context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+</context-param></programlisting>
+ </step>
+ <step>
+ <title>Set initial skin</title>
+ <para>
+ The application needs an initial skin to display before the user chooses an alternative skin. The initial skin is specified in the <filename>web.xml</filename> configuration file.
+ </para>
+<programlisting language="XML" role="XML"><managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>skin</property-name>
+ <value>classic</value>
+ </managed-property>
+</managed-bean></programlisting>
+ </step>
+ </procedure>
+ <example id="exam-Developer_Guide-Skinning_and_theming-Skin_changing_example">
+ <title>Skin changing example</title>
+ <para>
+ This example renders a list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
+ </para>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <blockquote>
+ <figure id="figu-Developer_Guide-Skinning_and_theming-Skin_changing_example">
+ <title>Skin changing example</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A list of radio buttons from which the user can choose their desired skin. The chosen skin is then applied to the panel bar items.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
</section>
<section id="sect-Developer_Guide-Skinning_and_theming-Extended_skinning">
Added: root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample
===================================================================
--- root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample (rev 0)
+++ root/docs/trunk/Developer_Guide/en-US/extras/exam-Developer_Guide-Skinning_and_theming-Skin_changing_example.xml_sample 2010-04-13 08:10:25 UTC (rev 16757)
@@ -0,0 +1,27 @@
+<h:form>
+ <div style="display: block; float: left">
+ <h:selectOneRadio value="#{skinBean.skin}" border="0" layout="pageDirection" title="Changing skin" style="font-size: 8; font-family: comic" onchange="submit()">
+ <f:selectItem itemLabel="plain" itemValue="plain" />
+ <f:selectItem itemLabel="emeraldTown" itemValue="emeraldTown" />
+ <f:selectItem itemLabel="blueSky" itemValue="blueSky" />
+ <f:selectItem itemLabel="wine" itemValue="wine" />
+ <f:selectItem itemLabel="japanCherry" itemValue="japanCherry" />
+ <f:selectItem itemLabel="ruby" itemValue="ruby" />
+ <f:selectItem itemLabel="classic" itemValue="classic" />
+ <f:selectItem itemLabel="laguna" itemValue="laguna" />
+ <f:selectItem itemLabel="deepMarine" itemValue="deepMarine" />
+ <f:selectItem itemLabel="blueSky Modified" itemValue="blueSkyModify" />
+ </h:selectOneRadio>
+ </div>
+ <div style="display: block; float: left">
+ <rich:panelBar height="100" width="200">
+ <rich:panelBarItem label="Item 1" style="font-family: monospace; font-size: 12;">
+ Changing skin in runtime
+ </rich:panelBarItem>
+
+ <rich:panelBarItem label="Item 2" style="font-family: monospace; font-size: 12;">
+ This is a result of the modification "blueSky" skin
+ </rich:panelBarItem>
+ </rich:panelBar>
+ </div>
+</h:form>
Added: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Developer_Guide/en-US/images/figu-Developer_Guide-Skinning_and_theming-Skin_changing_example.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 11 months
JBoss Rich Faces SVN: r16756 - in root/ui-sandbox/trunk/components/tables/ui/src/main: resources/META-INF/resources and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-04-12 11:00:43 -0400 (Mon, 12 Apr 2010)
New Revision: 16756
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
small fixes
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-04-09 18:52:56 UTC (rev 16755)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-04-12 15:00:43 UTC (rev 16756)
@@ -487,7 +487,7 @@
writer.startElement(HTML.TBOBY_ELEMENT, table);
writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":tb"
+ partName.toString().charAt(0), null);
- table.walk(context, this, state); // TODO encodeRows(context, table);
+ encodeRows(state);
writer.endElement(HTML.TBOBY_ELEMENT);
writer.endElement(HTML.TABLE_ELEMENT);
writer.endElement(HTML.DIV_ELEM);
@@ -661,7 +661,7 @@
} else {
updateAttribute(context, component.findComponent(values[0]), "filterValue", values[1]);
}
- context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); // Use partial re-rendering here.
+ context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); // TODO Use partial re-rendering here.
}
}
@@ -690,13 +690,13 @@
sortPriority.add(values[0]);
}
updateAttribute(context, component, "sortPriority", sortPriority);
- context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); // Use partial re-rendering here.
+ context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); // TODO Use partial re-rendering here.
}
}
/**
* @deprecated
- * TODO Remove this method when width in relative units in columns will be implimented.
+ * TODO Remove this method when width in relative units in columns will be implemented.
* @param column
* @return width
*/
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-04-09 18:52:56 UTC (rev 16755)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-04-12 15:00:43 UTC (rev 16756)
@@ -79,7 +79,7 @@
var updateLayout = function() {
var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
var width = Math.max(0, element.clientWidth - offsetWidth);
- if (width) {
+ if (width && scrollElement) {
normalPartStyle.width = width + "px";
normalPartStyle.display = "";
var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
@@ -101,7 +101,7 @@
};
var adjustResizers = function() {
- var scrollLeft = scrollElement.scrollLeft;
+ var scrollLeft = scrollElement ? scrollElement.scrollLeft : 0;
var clientWidth = element.clientWidth - 3;
var i = 0;
for (; i < frozenColumnCount; i++) {
@@ -137,13 +137,16 @@
}
};
- var updateScrollPosition = function() {
- var scrollLeft = scrollElement.scrollLeft;
- for (var i = 0; i < idSuffixs.length; i++) {
- document.getElementById(id + idSuffixs[i]).scrollLeft = scrollLeft;//TODO Not use getElementById here
- }
- adjustResizers();
- };
+ if (scrollElement) {
+ var updateScrollPosition = function() {
+ var scrollLeft = scrollElement.scrollLeft;
+ for (var i = 0; i < idSuffixs.length; i++) {
+ document.getElementById(id + idSuffixs[i]).scrollLeft = scrollLeft;//TODO Not use getElementById here
+ }
+ adjustResizers();
+ };
+ jQuery(scrollElement).bind("scroll", updateScrollPosition);
+ }
var initializeLayout = function() {
//TODO Use "var rowHeight" instead of "dataTableElement.offsetHeight / rows"
@@ -151,7 +154,9 @@
contentElement.style.height = (rowCount * dataTableElement.offsetHeight / rows) + "px";
}
updateLayout();
- updateScrollPosition(); //TODO Restore horizontal scroll position
+ if (scrollElement) {
+ updateScrollPosition(); //TODO Restore horizontal scroll position
+ }
};
var drag = function(event) {
@@ -274,7 +279,6 @@
jQuery(document).ready(initializeLayout);
jQuery(window).bind("resize", updateLayout);
- jQuery(scrollElement).bind("scroll", updateScrollPosition);
jQuery(element).children(".rich-extable-header").find(".rich-extable-resizer").bind("mousedown", beginResize);
jQuery(element).children(".rich-extable-header").find(".rich-extable-header-cell").bind("mousedown", beginReorder);
jQuery(bodyElement).bind("scroll", bodyScrollListener);
14 years, 11 months
JBoss Rich Faces SVN: r16755 - in root/framework/trunk: impl/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-04-09 14:52:56 -0400 (Fri, 09 Apr 2010)
New Revision: 16755
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/context/NamingContainerVisitContext.java
root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxOutputComponentImpl.java
root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxTableComponentImpl.java
root/framework/trunk/impl/src/test/java/org/richfaces/context/ExtendedPartialVisitContextTest.java
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/ExtendedPartialVisitContext.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java
Log:
https://jira.jboss.org/jira/browse/RF-7856
Modified: root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java 2010-04-09 16:28:30 UTC (rev 16754)
+++ root/framework/trunk/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -21,22 +21,101 @@
*/
package org.richfaces.context;
+import static org.richfaces.component.MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR;
+
import java.util.Collection;
+import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
/**
* @author Nick Belaevski
*
*/
-public interface ExtendedVisitContext {
+public abstract class ExtendedVisitContext extends VisitContext {
- public static final String SUB_COMPONENT_ID = "org.richfaces.SubComponentId";
+ public static final String META_COMPONENT_ID = "org.richfaces.MetaComponentId";
- public ExtendedVisitContextMode getVisitMode();
+ private final FacesContext facesContext;
- public Collection<String>getDirectSubtreeIdsToVisit(UIComponent component);
+ private final ExtendedVisitContextMode visitMode;
- public VisitContext createDirectChildrenVisitContext(UIComponent component, Collection<String> directIds);
+ protected ExtendedVisitContext(FacesContext facesContext, ExtendedVisitContextMode visitMode) {
+ super();
+
+ if (facesContext == null) {
+ throw new NullPointerException();
+ }
+
+ this.facesContext = facesContext;
+ this.visitMode = visitMode;
+ }
+
+ public ExtendedVisitContextMode getVisitMode() {
+ return visitMode;
+ }
+
+ public VisitResult invokeMetaComponentVisitCallback(UIComponent component, VisitCallback callback,
+ String metaComponentId) {
+
+ if (metaComponentId != null) {
+ Map<Object, Object> attributes = getFacesContext().getAttributes();
+ try {
+ attributes.put(META_COMPONENT_ID, metaComponentId);
+ return invokeVisitCallback(component, callback);
+ } finally {
+ attributes.remove(META_COMPONENT_ID);
+ }
+ } else {
+ return invokeVisitCallback(component, callback);
+ }
+ }
+
+ public String buildExtendedClientId(UIComponent component) {
+ String extendedClientId = component.getClientId(facesContext);
+ String subComponentId = (String) facesContext.getAttributes().get(META_COMPONENT_ID);
+ if (subComponentId != null) {
+ StringBuilder sb = new StringBuilder(extendedClientId.length() + 1 /* separator length */ +
+ subComponentId.length());
+
+ sb.append(extendedClientId);
+ sb.append(META_COMPONENT_SEPARATOR_CHAR);
+ sb.append(subComponentId);
+
+ extendedClientId = sb.toString();
+ }
+
+ return extendedClientId;
+ }
+
+ public String buildExtendedComponentId(UIComponent component) {
+ String componentId = component.getId();
+ String subComponentId = (String) facesContext.getAttributes().get(META_COMPONENT_ID);
+ if (subComponentId != null) {
+ StringBuilder sb = new StringBuilder(componentId.length() + 1 /* separator length */ +
+ subComponentId.length());
+
+ sb.append(componentId);
+ sb.append(META_COMPONENT_SEPARATOR_CHAR);
+ sb.append(subComponentId);
+
+ componentId = sb.toString();
+ }
+
+ return componentId;
+ }
+
+ @Override
+ public FacesContext getFacesContext() {
+ return facesContext;
+ }
+
+ public abstract Collection<String>getDirectSubtreeIdsToVisit(UIComponent component);
+
+ public abstract VisitContext createNamingContainerVisitContext(UIComponent component,
+ Collection<String> directIds);
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-04-09 16:28:30 UTC (rev 16754)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -1308,7 +1308,7 @@
return false;
} else {
VisitContext directChildrenVisitContext =
- extendedVisitContext.createDirectChildrenVisitContext(this, directSubtreeIdsToVisit);
+ extendedVisitContext.createNamingContainerVisitContext(this, directSubtreeIdsToVisit);
if (visitFixedChildren(directChildrenVisitContext, STUB_CALLBACK, visitRows)) {
return false;
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/ExtendedPartialVisitContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/ExtendedPartialVisitContext.java 2010-04-09 16:28:30 UTC (rev 16754)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/ExtendedPartialVisitContext.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -48,7 +48,7 @@
* @author Nick Belaevski
*
*/
-public class ExtendedPartialVisitContext extends VisitContext implements ExtendedVisitContext {
+public class ExtendedPartialVisitContext extends ExtendedVisitContext {
/**
*
@@ -111,9 +111,7 @@
public void remove() {
if (current != null) {
ComponentMatcherNode node = directNodesMap.get(current);
- if (node != null) {
- removeNode(node);
- }
+ removeNode(node);
current = null;
}
@@ -122,117 +120,6 @@
}
}
- private final class DirectSubtreeVisitContext extends VisitContext implements ExtendedVisitContext {
-
- private final class IdsProxyCollection extends AbstractCollection<String> {
-
- @Override
- public Iterator<String> iterator() {
- throw new UnsupportedOperationException(
- "iterator() method is not supported by this collection implementation");
- }
-
- @Override
- public int size() {
- throw new UnsupportedOperationException(
- "size() method is not supported by this collection implementation");
- }
-
- @Override
- public boolean isEmpty() {
- return ids.isEmpty();
- }
- };
-
- private Collection<String> ids;
-
- private IdsProxyCollection idsToVisit;
-
- private UIComponent startingComponent;
-
- public DirectSubtreeVisitContext(UIComponent component, Collection<String> ids) {
- super();
-
- this.ids = copyCollection(ids);
- this.idsToVisit = new IdsProxyCollection();
- this.startingComponent = component;
- }
-
- @Override
- public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback) {
- // cancel visiting children for nested naming containers
- if (component instanceof NamingContainer && !component.equals(startingComponent)) {
- return VisitResult.REJECT;
- }
-
- if (ids == VisitContext.ALL_IDS) {
- return VisitResult.ACCEPT;
- }
-
- String id = buildExtendedComponentId(component);
- if (ids.contains(id)) {
- VisitResult result = callback.visit(this, component);
- ids.remove(id);
-
- if (!ids.isEmpty()) {
- return result;
- } else {
- return VisitResult.COMPLETE;
- }
- }
-
- return VisitResult.ACCEPT;
- }
-
- @Override
- public Collection<String> getSubtreeIdsToVisit(UIComponent component) {
- if (!(component instanceof NamingContainer)) {
- throw new IllegalArgumentException(component.toString());
- }
-
- if (startingComponent.equals(component)) {
- return VisitContext.ALL_IDS;
- }
-
- return Collections.emptySet();
- }
-
- public Collection<String> getDirectSubtreeIdsToVisit(UIComponent component) {
- if (!(component instanceof NamingContainer)) {
- throw new IllegalArgumentException(component.toString());
- }
-
- if (startingComponent.equals(component)) {
- return Collections.unmodifiableCollection(ids);
- }
-
- return Collections.emptySet();
- }
-
- @Override
- public FacesContext getFacesContext() {
- return ExtendedPartialVisitContext.this.getFacesContext();
- }
-
- @Override
- public Set<VisitHint> getHints() {
- return Collections.emptySet();
- }
-
- @Override
- public Collection<String> getIdsToVisit() {
- return idsToVisit;
- }
-
- public ExtendedVisitContextMode getVisitMode() {
- return ExtendedPartialVisitContext.this.getVisitMode();
- }
-
- public VisitContext createDirectChildrenVisitContext(UIComponent component, Collection<String> directIds) {
- return ExtendedPartialVisitContext.this.createDirectChildrenVisitContext(component, directIds);
- }
- }
-
private IdParser idParser;
private boolean limitRender;
@@ -242,9 +129,6 @@
private Collection<String> shortIds;
- // The FacesContext for this request
- private FacesContext facesContext;
-
// Our visit hints
private Set<VisitHint> hints;
@@ -281,12 +165,8 @@
public ExtendedPartialVisitContext(FacesContext facesContext, Collection<String> clientIds, Set<VisitHint> hints,
boolean limitRender) {
- if (facesContext == null) {
- throw new NullPointerException();
- }
+ super(facesContext, ExtendedVisitContextMode.RENDER);
- this.facesContext = facesContext;
-
// Initialize our various collections
initializeCollections(clientIds);
@@ -301,7 +181,8 @@
private IdParser getIdParser(String id) {
if (idParser == null) {
- idParser = new IdParser(UINamingContainer.getSeparatorChar(facesContext), META_COMPONENT_SEPARATOR_CHAR);
+ idParser = new IdParser(UINamingContainer.getSeparatorChar(getFacesContext()),
+ META_COMPONENT_SEPARATOR_CHAR);
}
idParser.setId(id);
@@ -309,30 +190,6 @@
return idParser;
}
- private static Collection<String> copyCollection(Collection<String> r) {
- if (r != VisitContext.ALL_IDS) {
- if (r != null) {
- return new HashSet<String>(r);
- } else {
- return new HashSet<String>();
- }
- }
-
- return r;
- }
-
- private static Collection<String> wrapIntoUnmodifiableCollection(Collection<String> c) {
- if (c != VisitContext.ALL_IDS) {
- if (c != null && !c.isEmpty()) {
- return Collections.unmodifiableCollection(c);
- } else {
- return Collections.emptySet();
- }
- } else {
- return c;
- }
- }
-
private ComponentMatcherNode createNode(String patternId) {
ComponentMatcherNode node = rootNode;
@@ -476,49 +333,7 @@
return false;
}
- private String buildExtendedClientId(UIComponent component) {
- String extendedClientId = component.getClientId(facesContext);
- String subComponentId = (String) facesContext.getAttributes().get(SUB_COMPONENT_ID);
- if (subComponentId != null) {
- StringBuilder sb = new StringBuilder(extendedClientId.length() + 1 /* separator length */ +
- subComponentId.length());
-
- sb.append(extendedClientId);
- sb.append(META_COMPONENT_SEPARATOR_CHAR);
- sb.append(subComponentId);
-
- extendedClientId = sb.toString();
- }
-
- return extendedClientId;
- }
-
- private String buildExtendedComponentId(UIComponent component) {
- String componentId = component.getId();
- String subComponentId = (String) facesContext.getAttributes().get(SUB_COMPONENT_ID);
- if (subComponentId != null) {
- StringBuilder sb = new StringBuilder(componentId.length() + 1 /* separator length */ +
- subComponentId.length());
-
- sb.append(componentId);
- sb.append(META_COMPONENT_SEPARATOR_CHAR);
- sb.append(subComponentId);
-
- componentId = sb.toString();
- }
-
- return componentId;
- }
-
/**
- * @see VisitContext#getFacesContext VisitContext.getFacesContext()
- */
- @Override
- public FacesContext getFacesContext() {
- return facesContext;
- }
-
- /**
* @see VisitContext#getHints VisitContext.getHints
*/
@Override
@@ -564,6 +379,7 @@
if (subtreeIds != null) {
return Collections.unmodifiableCollection(subtreeIds);
} else {
+ //TODO nick - this code addresses the case of parent pattern nodes, and can be optimized
if (node.hasDirectIdChildren()) {
return VisitContext.ALL_IDS;
} else {
@@ -582,37 +398,36 @@
throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
}
- Collection<String> result = null;
- String clientId = component.getClientId(facesContext);
+ String clientId = component.getClientId(getFacesContext());
ComponentMatcherNode node = findMatchingNode(clientId);
- boolean hasDirectPatternChildren = false;
- if (node != null) {
- if (node.hasDirectPatternChildren()) {
- hasDirectPatternChildren = true;
- result = VisitContext.ALL_IDS;
- } else {
- if (node.hasDirectIdChildren()) {
- result = new HashSet<String>();
- result.addAll(node.getIdChildren().keySet());
- }
- }
+ if (node != null && node.hasDirectPatternChildren()) {
+ return VisitContext.ALL_IDS;
}
- if (!hasDirectPatternChildren && !limitRender) {
- Collection<String> ajaxOutputs =
- PartialViewContextAjaxOutputTracker.getNestedAjaxOutputs(component);
+ Set<String> result = null;
+ if (node != null && node.hasDirectIdChildren()) {
+ result = new HashSet<String>();
+ result.addAll(node.getIdChildren().keySet());
+ }
- if (ajaxOutputs != null && !ajaxOutputs.isEmpty()) {
+ if (!limitRender) {
+
+ Collection<String> directChildrenIds = PartialViewContextAjaxOutputTracker.getDirectChildrenIds(component);
+ if (directChildrenIds != null && !directChildrenIds.isEmpty()) {
if (result == null) {
result = new HashSet<String>();
}
- result.addAll(ajaxOutputs);
+ result.addAll(directChildrenIds);
}
}
- return wrapIntoUnmodifiableCollection(result);
+ if (result != null && !result.isEmpty()) {
+ return Collections.unmodifiableCollection(result);
+ } else {
+ return Collections.emptySet();
+ }
}
/**
@@ -659,17 +474,7 @@
this.clientIds.addAll(clientIds);
}
- public VisitContext createDirectChildrenVisitContext(UIComponent component, Collection<String> directIds) {
- // Make sure component is a NamingContainer
- if (!(component instanceof NamingContainer)) {
- throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
- }
-
- return new DirectSubtreeVisitContext(component, directIds);
+ public VisitContext createNamingContainerVisitContext(UIComponent component, Collection<String> directIds) {
+ return new NamingContainerVisitContext(getFacesContext(), getVisitMode(), component, directIds);
}
-
- public ExtendedVisitContextMode getVisitMode() {
- //TODO version of this context for "execute"
- return ExtendedVisitContextMode.RENDER;
- }
}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/context/NamingContainerVisitContext.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/NamingContainerVisitContext.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/NamingContainerVisitContext.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * 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.richfaces.context;
+
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+
+final class NamingContainerVisitContext extends ExtendedVisitContext {
+
+ private final class IdsProxyCollection extends AbstractCollection<String> {
+
+ @Override
+ public Iterator<String> iterator() {
+ throw new UnsupportedOperationException(
+ "iterator() method is not supported by this collection implementation");
+ }
+
+ @Override
+ public int size() {
+ throw new UnsupportedOperationException(
+ "size() method is not supported by this collection implementation");
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return ids.isEmpty();
+ }
+ };
+
+ private Set<String> ids;
+
+ private IdsProxyCollection idsToVisit;
+
+ private UIComponent startingComponent;
+
+ public NamingContainerVisitContext(FacesContext facesContext, ExtendedVisitContextMode visitMode,
+ UIComponent component, Collection<String> ids) {
+
+ super(facesContext, visitMode);
+
+ // Make sure component is a NamingContainer
+ if (!(component instanceof NamingContainer)) {
+ throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
+ }
+
+ this.ids = new HashSet<String>(ids);
+ this.idsToVisit = new IdsProxyCollection();
+ this.startingComponent = component;
+ }
+
+ @Override
+ public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback) {
+ VisitResult result = VisitResult.ACCEPT;
+ String id = buildExtendedComponentId(component);
+ if (ids.contains(id)) {
+ result = callback.visit(this, component);
+ ids.remove(id);
+
+ if (ids.isEmpty()) {
+ return VisitResult.COMPLETE;
+ }
+ }
+
+ // cancel visiting children for nested naming containers
+ if (component instanceof NamingContainer && !component.equals(startingComponent)) {
+ return VisitResult.REJECT;
+ }
+
+ return result;
+ }
+
+ @Override
+ public Collection<String> getSubtreeIdsToVisit(UIComponent component) {
+ if (!(component instanceof NamingContainer)) {
+ throw new IllegalArgumentException(component.toString());
+ }
+
+ //TODO nick - check clientId, e.g. to avoid visiting components with client ids like
+ // "table:0:nested" ("table" is a starting component)
+ if (startingComponent.equals(component)) {
+ return VisitContext.ALL_IDS;
+ }
+
+ return Collections.emptySet();
+ }
+
+ public Collection<String> getDirectSubtreeIdsToVisit(UIComponent component) {
+ if (!(component instanceof NamingContainer)) {
+ throw new IllegalArgumentException(component.toString());
+ }
+
+ if (startingComponent.equals(component)) {
+ return Collections.unmodifiableCollection(ids);
+ }
+
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<VisitHint> getHints() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Collection<String> getIdsToVisit() {
+ return idsToVisit;
+ }
+
+ public VisitContext createNamingContainerVisitContext(UIComponent component, Collection<String> directIds) {
+ return new NamingContainerVisitContext(getFacesContext(), getVisitMode(), component, directIds);
+ }
+}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java 2010-04-09 16:28:30 UTC (rev 16754)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextAjaxOutputTracker.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -61,20 +61,17 @@
component.getAttributes().remove(ATTRIBUTE_NAME);
}
- static Collection<String> getNestedAjaxOutputs(UIComponent component) {
+ static Collection<String> getDirectChildrenIds(UIComponent component) {
if (!isContainerComponent(component)) {
throw new IllegalArgumentException(component.toString());
}
- Set<String> trackedChildrenSet = getTrackedChildrenSet(component, false);
-
- return trackedChildrenSet;
+ return getTrackedChildrenSet(component, false);
}
static boolean hasNestedAjaxOutputs(UIComponent component) {
- Collection<String> trackedChildrenSet = getNestedAjaxOutputs(component);
-
- return trackedChildrenSet != null && !trackedChildrenSet.isEmpty();
+ Collection<String> childrenIds = getDirectChildrenIds(component);
+ return childrenIds != null && !childrenIds.isEmpty();
}
private static String getId(UIComponent component) {
@@ -120,11 +117,11 @@
UIComponent child = c;
UIComponent parent;
while ((parent = findParentContainerComponent(child)) != null) {
- Set<String> ajaxOutputSet = getTrackedChildrenSet(parent, false);
- if (ajaxOutputSet != null) {
- ajaxOutputSet.remove(getId(child));
+ Set<String> trackingSet = getTrackedChildrenSet(parent, false);
+ if (trackingSet != null) {
+ trackingSet.remove(getId(child));
- if (ajaxOutputSet.isEmpty()) {
+ if (trackingSet.isEmpty()) {
clearTrackedChildrenSet(parent);
} else {
break;
Added: root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxOutputComponentImpl.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxOutputComponentImpl.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxOutputComponentImpl.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * 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.richfaces.context;
+
+import javax.faces.component.UIOutput;
+
+import org.ajax4jsf.component.AjaxOutput;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxOutputComponentImpl extends UIOutput implements AjaxOutput {
+
+ private enum PropertyKeys {
+ ajaxRendered
+ }
+
+ public AjaxOutputComponentImpl() {
+ setRendererType("javax.faces.Text");
+ }
+
+ public boolean isAjaxRendered() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.ajaxRendered)));
+ }
+
+ public boolean isKeepTransient() {
+ return false;
+ }
+
+ public void setAjaxRendered(boolean ajaxRendered) {
+ getStateHelper().put(PropertyKeys.ajaxRendered, ajaxRendered);
+ }
+
+ public void setKeepTransient(boolean ajaxRendered) {
+ throw new UnsupportedOperationException();
+ }
+}
+
Added: root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxTableComponentImpl.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxTableComponentImpl.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/context/AjaxTableComponentImpl.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * 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.richfaces.context;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+
+import org.richfaces.component.UISequence;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AjaxTableComponentImpl extends UISequence {
+
+ private boolean visitMetaComponent(String name, ExtendedVisitContext visitContext, VisitCallback callback) {
+ UIComponent facet = getFacet(name);
+ if (facet != null) {
+ VisitResult result = visitContext.invokeMetaComponentVisitCallback(this, callback, name);
+
+ if (result == VisitResult.ACCEPT) {
+ if (facet.visitTree(visitContext, callback)) {
+ result = VisitResult.COMPLETE;
+ }
+ }
+
+ return result == VisitResult.COMPLETE;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback callback,
+ boolean resetKeyBeforeVisit) {
+
+ if (visitContext instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
+
+ //TODO - review
+ if (resetKeyBeforeVisit) {
+ setRowKey(visitContext.getFacesContext(), null);
+ }
+
+ if (visitMetaComponent("header", extendedVisitContext, callback)) {
+ return true;
+ }
+
+ if (visitMetaComponent("footer", extendedVisitContext, callback)) {
+ return true;
+ }
+
+ return false;
+ } else {
+ return super.visitFixedChildren(visitContext, callback, resetKeyBeforeVisit);
+ }
+ }
+
+}
Added: root/framework/trunk/impl/src/test/java/org/richfaces/context/ExtendedPartialVisitContextTest.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/context/ExtendedPartialVisitContextTest.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/context/ExtendedPartialVisitContextTest.java 2010-04-09 18:52:56 UTC (rev 16755)
@@ -0,0 +1,719 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * 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.richfaces.context;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.application.Application;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+
+import org.jboss.test.faces.FacesEnvironment;
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Tested view structure:
+ * <pre>
+ * <h:form id="myForm">
+ * <a4j:outputText id="outerOutput" />
+ *
+ * <h:dataTable id="table" var="item" value="['Item 0',... ,'Item 1']">
+ * <f:facet name="header">
+ * <h:outputText id="theHeader" />
+ * </f:facet>
+ *
+ * <h:column id="col">
+ * <a4j:outputText id="nestedOutput" value="#{item}" />
+ *
+ * <h:outputText id="nestedText" value="#{item}" />
+ *
+ * <a4j:table id="nestedTable" value="['Nested item 0',... ,'Nested item 2']" var="nestedItem">
+ * <f:facet name="footer">
+ * <h:outputText id="nestedTableFooter" value="#{item}" />
+ * </f:facet>
+ *
+ * <h:outputText id="nestedTableText" value="#{nestedItem}" />
+ * </a4j:table>
+ * </h:column>
+ * </h:dataTable>
+ * </h:form>
+ * </pre>
+ *
+ *
+ * @author Nick Belaevski
+ *
+ */
+public class ExtendedPartialVisitContextTest {
+
+ private class TrackingVisitCallback implements VisitCallback {
+
+ private List<String> visitedIds = new ArrayList<String>();
+
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ if (context instanceof ExtendedVisitContext) {
+ visitedIds.add(((ExtendedVisitContext) context).buildExtendedClientId(target));
+ } else {
+ visitedIds.add(target.getClientId(context.getFacesContext()));
+ }
+
+
+ return VisitResult.REJECT;
+ }
+
+ public List<String> getVisitedIds() {
+ return visitedIds;
+ }
+
+ public void reset() {
+ visitedIds.clear();
+ }
+ }
+
+ private FacesEnvironment environment;
+
+ private FacesRequest facesRequest;
+
+ private FacesContext facesContext;
+
+ private Application application;
+
+ private UIViewRoot viewRoot;
+
+ private UIForm form;
+
+ private AjaxOutputComponentImpl outerOutput;
+
+ private UIData table;
+
+ private UIColumn column;
+
+ private UIOutput dataHeader;
+
+ private AjaxOutputComponentImpl nestedOutput;
+
+ private UIOutput nestedText;
+
+ private List<String> tableData;
+
+ private ExtendedPartialVisitContext renderingContext;
+
+ private TrackingVisitCallback trackingVisitCallback;
+
+ private ArrayList<String> nestedTableData;
+
+ private AjaxTableComponentImpl nestedTable;
+
+ private UIOutput nestedTableText;
+
+ private UIOutput nestedTableFooter;
+
+ private static void assertEqualSets(Collection<?> expected, Collection<?> actual) {
+ assertEquals(asSet(expected), asSet(actual));
+ }
+
+ private static <T> Set<T> asSet(Collection<T> c) {
+ if (c instanceof Set) {
+ return (Set) c;
+ } else {
+ if (c != null) {
+ return new HashSet<T>(c);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ private static <T> Set<T> asSet(T... args) {
+ Set<T> set = new HashSet<T>();
+ for (T argItem : args) {
+ set.add(argItem);
+ }
+
+ return set;
+ }
+
+ private void createVisitContext(boolean limitRender) {
+ renderingContext = new ExtendedPartialVisitContext(facesContext, Collections.<String>emptySet(),
+ EnumSet.<VisitHint>of(VisitHint.SKIP_UNRENDERED), limitRender);
+ }
+
+ private void createNestedTableData() {
+ nestedTableData = new ArrayList<String>();
+ for (int i = 0; i < 3; i++) {
+ nestedTableData.add(MessageFormat.format("Nested item {0}", i));
+ }
+ }
+
+ private void createTableData() {
+ tableData = new ArrayList<String>();
+ for (int i = 0; i < 2; i++) {
+ tableData.add(MessageFormat.format("Item {0}", i));
+ }
+ }
+
+ private ValueExpression createTableVarValueExpression() {
+ ExpressionFactory expressionFactory = application.getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+
+ return expressionFactory.createValueExpression(elContext, "#{item}", String.class);
+ }
+
+ private ValueExpression createNestedTableVarValueExpression() {
+ ExpressionFactory expressionFactory = application.getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+
+ return expressionFactory.createValueExpression(elContext, "#{nestedItem}", String.class);
+ }
+
+ private void createNestedText() {
+ nestedText = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ nestedText.setId("nestedText");
+ nestedText.setValueExpression("value", createTableVarValueExpression());
+
+ column.getChildren().add(nestedText);
+ }
+
+ private void createNestedOutput() {
+ nestedOutput = new AjaxOutputComponentImpl();
+ nestedOutput.setAjaxRendered(true);
+ nestedOutput.setId("nestedOutput");
+ nestedOutput.setValueExpression("value", createTableVarValueExpression());
+
+ column.getChildren().add(nestedOutput);
+ }
+
+ private void createOuterOutput() {
+ outerOutput = new AjaxOutputComponentImpl();
+ outerOutput.setAjaxRendered(true);
+ outerOutput.setId("outerOutput");
+
+ form.getChildren().add(outerOutput);
+ }
+
+ private void createTableHeader() {
+ dataHeader = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ dataHeader.setId("theHeader");
+
+ table.getFacets().put("header", dataHeader);
+ }
+
+ private void createTableColumn() {
+ column = (UIColumn) application.createComponent(UIColumn.COMPONENT_TYPE);
+ column.setId("col");
+
+ table.getChildren().add(column);
+ createNestedOutput();
+ createNestedText();
+ createNestedTable();
+ }
+
+ private void createNestedTable() {
+ nestedTable = new AjaxTableComponentImpl();
+ nestedTable.setId("nestedTable");
+ nestedTable.setVar("nestedItem");
+
+ createNestedTableData();
+ nestedTable.setValue(nestedTableData);
+
+ column.getChildren().add(nestedTable);
+
+ createNestedTableText();
+ createNestedTableFooter();
+ }
+
+ private void createNestedTableFooter() {
+ nestedTableFooter = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ nestedTableFooter.setId("nestedTableFooter");
+ nestedTableFooter.setValueExpression("value", createTableVarValueExpression());
+
+ nestedTable.getFacets().put("footer", nestedTableFooter);
+ }
+
+ private void createNestedTableText() {
+ nestedTableText = (UIOutput) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ nestedTableText.setId("nestedTableText");
+ nestedTableText.setValueExpression("value", createNestedTableVarValueExpression());
+
+ nestedTable.getChildren().add(nestedTableText);
+ }
+
+ private void createTable() {
+ table = (UIData) application.createComponent(UIData.COMPONENT_TYPE);
+ table.setId("table");
+ table.setVar("item");
+
+ createTableData();
+ table.setValue(tableData);
+
+ form.getChildren().add(table);
+ createTableColumn();
+ createTableHeader();
+ }
+
+ private void createForm() {
+ form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
+ form.setId("myForm");
+
+ viewRoot.getChildren().add(form);
+
+ createOuterOutput();
+ createTable();
+ }
+
+ private void createView() {
+ viewRoot = (UIViewRoot) application.createComponent(UIViewRoot.COMPONENT_TYPE);
+
+ createForm();
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ environment = FacesEnvironment.createEnvironment();
+ environment.start();
+
+ facesRequest = environment.createFacesRequest();
+ facesRequest.start();
+
+ facesContext = FacesContext.getCurrentInstance();
+ application = facesContext.getApplication();
+
+ createView();
+
+ trackingVisitCallback = new TrackingVisitCallback();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ renderingContext = null;
+ trackingVisitCallback = null;
+
+ facesContext = null;
+ application = null;
+
+ column = null;
+ table = null;
+ dataHeader = null;
+ form = null;
+ nestedOutput = null;
+ nestedTable = null;
+ nestedTableData = null;
+ nestedTableFooter = null;
+ nestedTableText = null;
+ nestedText = null;
+ outerOutput = null;
+ tableData = null;
+ viewRoot = null;
+
+ facesRequest.release();
+ facesRequest = null;
+
+ environment.release();
+ environment = null;
+ }
+
+ @Test
+ public void testCollectionProxy() throws Exception {
+ createVisitContext(false);
+
+ Iterator<String> iterator;
+
+ Collection<String> idsToVisit = renderingContext.getIdsToVisit();
+ assertTrue(idsToVisit.isEmpty());
+ assertTrue(idsToVisit.size() == 0);
+
+ iterator = idsToVisit.iterator();
+ assertNotNull(iterator);
+ assertFalse(iterator.hasNext());
+
+ Set<String> idsToAdd = asSet("someIds", "thisIs:evenBetter", "id:*:x");
+ idsToVisit.addAll(idsToAdd);
+
+ assertFalse(idsToVisit.isEmpty());
+ assertTrue(idsToVisit.size() == 3);
+
+ iterator = idsToVisit.iterator();
+
+ while (iterator.hasNext()) {
+ String nextId = iterator.next();
+
+ assertTrue(idsToAdd.remove(nextId));
+
+ iterator.remove();
+ }
+
+ assertTrue(idsToVisit.isEmpty());
+ assertTrue(idsToVisit.size() == 0);
+ assertTrue(idsToAdd.isEmpty());
+
+ iterator = idsToVisit.iterator();
+
+ try {
+ iterator.remove();
+
+ fail();
+ } catch (IllegalStateException e) {
+ //ignore
+ }
+
+ idsToVisit.add("testId");
+ assertFalse(idsToVisit.isEmpty());
+
+ iterator = idsToVisit.iterator();
+
+ try {
+ iterator.remove();
+
+ fail();
+ } catch (IllegalStateException e) {
+ //ignore
+ }
+ }
+
+ @Test
+ public void testSubtreeIdsToForAjaxOutputs() throws Exception {
+ createVisitContext(false);
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(asSet("table", "outerOutput"), renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertEqualSets(asSet("nestedOutput"), renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(nestedTable).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(nestedTable).isEmpty());
+ }
+
+ @Test
+ public void testSubtreeIdsForEmptyIdsWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(form).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(form).isEmpty());
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(table).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(table).isEmpty());
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(nestedTable).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(nestedTable).isEmpty());
+ }
+
+ @Test
+ public void testSubtreeIdsForOuterOutputWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ renderingContext.getIdsToVisit().add("myForm:outerOutput");
+
+ assertEqualSets(asSet("myForm:outerOutput"), renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(asSet("outerOutput"), renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(table).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(table).isEmpty());
+ }
+
+ @Test
+ public void testSubtreeIdsForNestedComponentsWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ renderingContext.getIdsToVisit().add("myForm:outerOutput");
+ renderingContext.getIdsToVisit().add("myForm:table:theHeader");
+ renderingContext.getIdsToVisit().add("myForm:table:1:nestedOutput");
+ renderingContext.getIdsToVisit().add("myForm:table:0:nestedText");
+ renderingContext.getIdsToVisit().add("myForm:table:0:nestedTable:1");
+ renderingContext.getIdsToVisit().add("myForm:table:0:nestedTable:nestedFooter");
+
+ Set<String> formClientIds = asSet("myForm:outerOutput", "myForm:table:0:nestedText",
+ "myForm:table:1:nestedOutput", "myForm:table:theHeader", "myForm:table:0:nestedTable:1",
+ "myForm:table:0:nestedTable:nestedFooter");
+
+ Set<String> formIds = asSet("table", "outerOutput");
+
+ assertEqualSets(formClientIds, renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(formIds, renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ Set<String> tableClientIds = asSet("myForm:table:0:nestedText", "myForm:table:1:nestedOutput",
+ "myForm:table:theHeader", "myForm:table:0:nestedTable:1", "myForm:table:0:nestedTable:nestedFooter");
+ Set<String> tableIds = asSet("0", "1", "theHeader");
+
+ assertEqualSets(tableClientIds, renderingContext.getSubtreeIdsToVisit(table));
+ assertEqualSets(tableIds, renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ table.setRowIndex(0);
+
+ Set<String> nestedTableClientIds = asSet("myForm:table:0:nestedTable:1",
+ "myForm:table:0:nestedTable:nestedFooter");
+
+ Set<String> nestedTableIds = asSet("nestedFooter", "1");
+ assertEqualSets(nestedTableClientIds, renderingContext.getSubtreeIdsToVisit(nestedTable));
+ assertEqualSets(nestedTableIds, renderingContext.getDirectSubtreeIdsToVisit(nestedTable));
+
+ table.setRowIndex(-1);
+ }
+
+ @Test
+ public void testSubtreeIdsForWildcardIds() throws Exception {
+ createVisitContext(false);
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedText");
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedTable:0");
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(asSet("table", "outerOutput"), renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertSame(VisitContext.ALL_IDS, renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ for (int i = 0; i < tableData.size(); i++) {
+ table.setRowIndex(i);
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertEqualSets(asSet("nestedText", "nestedTable", "nestedOutput"),
+ renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(nestedTable));
+ assertEqualSets(asSet("0"), renderingContext.getDirectSubtreeIdsToVisit(nestedTable));
+ }
+
+ table.setRowIndex(-1);
+ }
+
+ @Test
+ public void testSubtreeIdsForWildcardIdsWithLimitRender() throws Exception {
+ createVisitContext(true);
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedText");
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedTable:0");
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(asSet("table"), renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertSame(VisitContext.ALL_IDS, renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ for (int i = 0; i < tableData.size(); i++) {
+ table.setRowIndex(i);
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertEqualSets(asSet("nestedText", "nestedTable"), renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(nestedTable));
+ assertEqualSets(asSet("0"), renderingContext.getDirectSubtreeIdsToVisit(nestedTable));
+ }
+
+ table.setRowIndex(-1);
+ }
+
+ @Test
+ public void testSubtreeIdsForWildcardIds2WithLimitRender() throws Exception {
+ createVisitContext(true);
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedTable");
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(form));
+ assertEqualSets(asSet("table"), renderingContext.getDirectSubtreeIdsToVisit(form));
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertSame(VisitContext.ALL_IDS, renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ for (int i = 0; i < tableData.size(); i++) {
+ table.setRowIndex(i);
+
+ assertSame(VisitContext.ALL_IDS, renderingContext.getSubtreeIdsToVisit(table));
+ assertEqualSets(asSet("nestedTable"), renderingContext.getDirectSubtreeIdsToVisit(table));
+
+ assertTrue(renderingContext.getSubtreeIdsToVisit(nestedTable).isEmpty());
+ assertTrue(renderingContext.getDirectSubtreeIdsToVisit(nestedTable).isEmpty());
+ }
+
+ table.setRowIndex(-1);
+ }
+
+ @Test
+ public void testVisitCallbackForEmptyIds() throws Exception {
+ createVisitContext(false);
+
+ viewRoot.visitTree(renderingContext, trackingVisitCallback);
+
+ assertEquals(Arrays.asList("myForm:outerOutput", "myForm:table:0:nestedOutput", "myForm:table:1:nestedOutput"),
+ trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testVisitCallbackForEmptyIdsWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ viewRoot.visitTree(renderingContext, trackingVisitCallback);
+
+ assertEquals(Arrays.asList(), trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testVisitCallbackForEmptyIdsForFalseAjaxRendered() throws Exception {
+ outerOutput.setAjaxRendered(false);
+ createVisitContext(false);
+
+ viewRoot.visitTree(renderingContext, trackingVisitCallback);
+
+ assertEquals(Arrays.asList("myForm:table:0:nestedOutput", "myForm:table:1:nestedOutput"),
+ trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testVisitCallback() throws Exception {
+ createVisitContext(false);
+
+ renderingContext.getIdsToVisit().add("myForm:table:1:nestedTable:0");
+ renderingContext.getIdsToVisit().add("myForm:table:1:nestedTable:1:nestedTableText");
+ renderingContext.getIdsToVisit().add("myForm:table:1:nestedTable:nestedTableFooter");
+
+ viewRoot.visitTree(renderingContext, trackingVisitCallback);
+
+ assertEquals(Arrays.asList("myForm:outerOutput", "myForm:table:0:nestedOutput", "myForm:table:1:nestedOutput",
+ "myForm:table:1:nestedTable:nestedTableFooter", "myForm:table:1:nestedTable:0",
+ "myForm:table:1:nestedTable:1:nestedTableText"), trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testVisitMetaComponentsWithLimitRender() throws Exception {
+ createVisitContext(true);
+ renderingContext.getIdsToVisit().add("myForm:table:1:nestedTable@footer");
+
+ boolean visitResult = viewRoot.visitTree(renderingContext, trackingVisitCallback);
+ assertTrue(visitResult);
+
+ assertEquals(Arrays.asList("myForm:table:1:nestedTable@footer"), trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testVisitMetaComponentsWithWildcardsWithLimitRender() throws Exception {
+ createVisitContext(true);
+ renderingContext.getIdsToVisit().add("myForm:table:*:nestedTable@footer");
+
+ viewRoot.visitTree(renderingContext, trackingVisitCallback);
+
+ assertEquals(Arrays.asList("myForm:table:0:nestedTable@footer", "myForm:table:1:nestedTable@footer"),
+ trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testFormVisitContext() throws Exception {
+ createVisitContext(false);
+
+ Collection<String> formDirectIds = renderingContext.getDirectSubtreeIdsToVisit(form);
+ assertNotSame(VisitContext.ALL_IDS, formDirectIds);
+ ExtendedVisitContext formVisitContext = (ExtendedVisitContext) renderingContext.
+ createNamingContainerVisitContext(form, formDirectIds);
+
+ assertFalse(formVisitContext.getIdsToVisit().isEmpty());
+ assertSame(VisitContext.ALL_IDS, formVisitContext.getSubtreeIdsToVisit(form));
+ assertTrue(formVisitContext.getSubtreeIdsToVisit(table).isEmpty());
+
+ Collection<String> directIds = formVisitContext.getDirectSubtreeIdsToVisit(form);
+ assertEqualSets(asSet("outerOutput", "table"), directIds);
+ assertTrue(formVisitContext.getDirectSubtreeIdsToVisit(table).isEmpty());
+
+ boolean visitResult = form.visitTree(formVisitContext, trackingVisitCallback);
+ assertTrue(visitResult);
+
+ assertEquals(Arrays.asList("myForm:outerOutput", "myForm:table"), trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testFormVisitContextWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ renderingContext.getIdsToVisit().add("myForm:table:0");
+
+ Collection<String> formDirectIds = renderingContext.getDirectSubtreeIdsToVisit(form);
+ assertNotSame(VisitContext.ALL_IDS, formDirectIds);
+ ExtendedVisitContext formVisitContext = (ExtendedVisitContext) renderingContext.
+ createNamingContainerVisitContext(form, formDirectIds);
+
+ assertFalse(formVisitContext.getIdsToVisit().isEmpty());
+ assertSame(VisitContext.ALL_IDS, formVisitContext.getSubtreeIdsToVisit(form));
+ assertTrue(formVisitContext.getSubtreeIdsToVisit(table).isEmpty());
+
+ Collection<String> directIds = formVisitContext.getDirectSubtreeIdsToVisit(form);
+ assertEqualSets(asSet("table"), directIds);
+ assertTrue(formVisitContext.getSubtreeIdsToVisit(table).isEmpty());
+
+ boolean visitResult = form.visitTree(formVisitContext, trackingVisitCallback);
+ assertTrue(visitResult);
+
+ assertEquals(Arrays.asList("myForm:table"), trackingVisitCallback.getVisitedIds());
+ }
+
+ @Test
+ public void testFormVisitContextNonexistentIdsWithLimitRender() throws Exception {
+ createVisitContext(true);
+
+ renderingContext.getIdsToVisit().add("myForm:nonExistentId");
+ Collection<String> formDirectIds = renderingContext.getDirectSubtreeIdsToVisit(form);
+ assertNotSame(VisitContext.ALL_IDS, formDirectIds);
+ ExtendedVisitContext formVisitContext = (ExtendedVisitContext) renderingContext.
+ createNamingContainerVisitContext(form, formDirectIds);
+
+ assertFalse(formVisitContext.getIdsToVisit().isEmpty());
+ assertSame(VisitContext.ALL_IDS, formVisitContext.getSubtreeIdsToVisit(form));
+ assertTrue(formVisitContext.getSubtreeIdsToVisit(table).isEmpty());
+
+ Collection<String> directIds = formVisitContext.getDirectSubtreeIdsToVisit(form);
+ assertEqualSets(asSet("nonExistentId"), directIds);
+ assertTrue(formVisitContext.getSubtreeIdsToVisit(table).isEmpty());
+
+ boolean visitResult = form.visitTree(formVisitContext, trackingVisitCallback);
+ assertFalse(visitResult);
+
+ assertEquals(Arrays.asList(), trackingVisitCallback.getVisitedIds());
+ }
+}
+
14 years, 11 months