JBoss Rich Faces SVN: r9723 - in trunk/framework/impl/src: main/java/org/ajax4jsf/context and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-07-21 15:21:27 -0400 (Mon, 21 Jul 2008)
New Revision: 9723
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXEndElementEvent.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXStartElementEvent.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXTextEvent.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/RenderPhaseViewResourcesVisitor.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/SAXResponseWriter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
Log:
Encoding for InternetResource implemented
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -22,6 +22,7 @@
package org.ajax4jsf.application;
import java.io.IOException;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
@@ -36,6 +37,7 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.webapp.BaseFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.event.RenderPhaseComponentListener;
@@ -193,6 +195,12 @@
} else {
super.renderView(context, root);
}
+
+ Map<String,Object> requestMap = context.getExternalContext().getRequestMap();
+ if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
+ // Save viewId for a parser selection
+ requestMap.put(AjaxViewHandler.VIEW_ID_KEY, context.getViewRoot().getViewId());
+ }
}
/**
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/RenderPhaseViewResourcesVisitor.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/RenderPhaseViewResourcesVisitor.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/RenderPhaseViewResourcesVisitor.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -3,29 +3,39 @@
*/
package org.ajax4jsf.context;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.regex.Pattern;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
+import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseEvent;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.faces.render.Renderer;
-import org.ajax4jsf.application.AjaxViewHandler;
+import org.ajax4jsf.io.SAXResponseWriter;
import org.ajax4jsf.renderkit.HeaderResourceProducer;
+import org.ajax4jsf.renderkit.HeaderResourceProducer2;
import org.ajax4jsf.renderkit.UserResourceRenderer;
+import org.ajax4jsf.renderkit.UserResourceRenderer2;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResourceBase;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceNotFoundException;
+import org.ajax4jsf.resource.ResourceRenderer;
import org.ajax4jsf.util.ELUtils;
import org.ajax4jsf.webapp.BaseFilter;
import org.apache.commons.logging.Log;
@@ -34,34 +44,164 @@
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
import org.richfaces.skin.SkinNotFoundException;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
public class RenderPhaseViewResourcesVisitor implements
RenderPhaseComponentVisitor {
+ public static final String COMPONENT_RESOURCE_LINK_CLASS = "component";
+
+ public static final String USER_RESOURCE_LINK_CLASS = "user";
+
+ private class ResponseWriterContentHandler implements ContentHandler {
+
+ private List<Object> events = new ArrayList<Object>();
+
+ private String linkClass;
+
+ public ResponseWriterContentHandler(String linkClass) {
+ super();
+ this.linkClass = linkClass;
+ }
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+
+ events.add(new SAXTextEvent(new String(ch, start, length)));
+ }
+
+ public void endDocument() throws SAXException {
+ }
+
+ public void endElement(String uri, String localName, String name)
+ throws SAXException {
+ events.add(new SAXEndElementEvent(localName));
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void ignorableWhitespace(char[] ch, int start, int length)
+ throws SAXException {
+ }
+
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setDocumentLocator(Locator locator) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void skippedEntity(String name) throws SAXException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void startDocument() throws SAXException {
+ }
+
+ public void startElement(String uri, String localName,
+ String name, Attributes atts) throws SAXException {
+
+ Map<String, String> attsMap = new HashMap<String, String>(atts.getLength());
+ int length = atts.getLength();
+
+ for (int i = 0; i < length; i++) {
+ attsMap.put(atts.getLocalName(i), atts.getValue(i));
+ }
+
+ if (HTML.LINK_ELEMENT.equals(localName)) {
+ attsMap.put(HTML.class_ATTRIBUTE, linkClass);
+ }
+
+ events.add(new SAXStartElementEvent(localName, attsMap));
+ }
+
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+
+ class HeadResponseWriter extends SAXResponseWriter {
+
+ public List getEventsList() {
+ return ((ResponseWriterContentHandler) getXmlConsumer()).events;
+ }
+
+ public HeadResponseWriter(String linkClass) {
+ super(new ResponseWriterContentHandler(linkClass));
+
+ }
+ }
+
private class State {
private RenderKit renderKit;
private boolean processStyles;
private boolean processScripts;
- private LinkedHashSet<String> scripts;
- private LinkedHashSet<String> styles;
- private LinkedHashSet<String> userScripts;
- private LinkedHashSet<String> userStyles;
- private State(boolean processScripts, boolean processStyles,
- RenderKit renderKit, LinkedHashSet<String> scripts,
- LinkedHashSet<String> styles,
- LinkedHashSet<String> userScripts,
- LinkedHashSet<String> userStyles) {
+ private HeadResponseWriter component;
+ private HeadResponseWriter user;
+
+ private InternetResourceBuilder resourceBuilder;
+ private ResourceRenderer scriptRenderer;
+ private ResourceRenderer styleRenderer;
+
+ protected ResourceRenderer getScriptRenderer() {
+ if (scriptRenderer == null) {
+ scriptRenderer = resourceBuilder.getRenderer(".js");
+ }
+
+ return scriptRenderer;
+ }
+
+ protected ResourceRenderer getStyleRenderer() {
+ if (styleRenderer == null) {
+ styleRenderer = resourceBuilder.getRenderer(".css");
+ }
+
+ return styleRenderer;
+ }
+
+ protected HeadResponseWriter getComponentWriter() {
+ return component;
+ }
+
+ protected HeadResponseWriter getUserWriter() {
+ return user;
+ }
+
+ protected Object[] getEvents() {
+ List componentList = component.getEventsList();
+ List userList = user.getEventsList();
+
+ Object[] result = new Object[componentList.size() + userList.size()];
+ componentList.toArray(result);
+ System.arraycopy(userList.toArray(), 0, result, componentList.size(), userList.size());
+
+ return result;
+ }
+
+ public State(boolean processScripts, boolean processStyles,
+ RenderKit renderKit, InternetResourceBuilder resourceBuilder,
+ HeadResponseWriter component,
+ HeadResponseWriter user) {
super();
this.processScripts = processScripts;
this.processStyles = processStyles;
this.renderKit = renderKit;
- this.scripts = scripts;
- this.styles = styles;
- this.userScripts = userScripts;
- this.userStyles = userStyles;
+ this.resourceBuilder = resourceBuilder;
+ this.component = component;
+ this.user = user;
}
+
}
private static final Log log = LogFactory.getLog(RenderPhaseViewResourcesVisitor.class);
@@ -70,9 +210,60 @@
public static final String RESOURCES_PROCESSED = "org.ajax4jsf.framework.HEADER_PROCESSED";
private static final String INIT_PARAMETER_PREFIX = "_init_parameter_";
private static final Object NULL = new Object();
- private static final Pattern USER_AGENTS = Pattern.compile(" AppleWebKit/|^Opera/| Opera ");
//todo
+ private static final Map<String, Object> EXTENDED_SKINNING = new HashMap<String, Object>(1);
+
+ static {
+ EXTENDED_SKINNING.put(HTML.media_ATTRIBUTE, "rich-extended-skinning");
+ }
+
+ public static final String SKINNING_STYLES_PATH = "/org/richfaces/renderkit/html/css/";
+
+ private boolean extendedSkinningAllowed = true;
+
+ private void encodeSkinningResources(FacesContext context, InternetResourceBuilder resourceBuilder) throws IOException, FacesException {
+ boolean useStdControlsSkinning = false;
+
+ String stdControlsSkinning = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_PARAM);
+ if (stdControlsSkinning != null) {
+ useStdControlsSkinning = InternetResourceBuilder.ENABLE.equals(stdControlsSkinning);
+ }
+
+ boolean useStdControlsSkinningClasses = true;
+
+ String stdControlsSkinningClasses = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_CLASSES_PARAM);
+ if (stdControlsSkinningClasses != null) {
+ useStdControlsSkinningClasses = InternetResourceBuilder.ENABLE.equals(stdControlsSkinningClasses);
+ }
+
+ String resourceSuffix = null;
+
+ if (useStdControlsSkinning) {
+ if (useStdControlsSkinningClasses) {
+ resourceSuffix = "_both.xcss";
+ } else {
+ resourceSuffix = ".xcss";
+ }
+ } else {
+ if (useStdControlsSkinningClasses) {
+ resourceSuffix = "_classes.xcss";
+ } else {
+ //no resources
+ }
+ }
+
+ if (resourceSuffix != null) {
+ resourceBuilder.createResource(
+ this, SKINNING_STYLES_PATH.concat("basic").concat(resourceSuffix)).encode(context, null);
+
+ if (extendedSkinningAllowed) {
+ resourceBuilder.createResource(
+ this, SKINNING_STYLES_PATH.concat("extended").concat(resourceSuffix)).encode(context, null, EXTENDED_SKINNING);
+ }
+ }
+ }
+
/* (non-Javadoc)
* @see org.richfaces.event.ComponentPhaseEventHandler#beforePhaseBegin(javax.faces.event.PhaseEvent)
*/
@@ -84,20 +275,15 @@
Map<String,Object> requestMap = externalContext.getRequestMap();
if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
-
- Boolean processStyles = true;
- Boolean processScripts = true;
- LinkedHashSet<String> scripts = new LinkedHashSet<String>();
- LinkedHashSet<String> styles = new LinkedHashSet<String>();
- LinkedHashSet<String> userScripts = new LinkedHashSet<String>();
- LinkedHashSet<String> userStyles = new LinkedHashSet<String>();
+ boolean processStyles = true;
+ boolean processScripts = true;
boolean ajaxRequest = AjaxContext.getCurrentInstance(context).isAjaxRequest(context);
-
+
if (log.isDebugEnabled()) {
log
- .debug("Process component tree for collect used scripts and styles");
+ .debug("Process component tree for collect used scripts and styles");
}
try {
Skin skin = SkinFactory.getInstance().getSkin(context);
@@ -110,133 +296,86 @@
log.warn("Current Skin is not found", e);
}
InternetResourceBuilder internetResourceBuilder = InternetResourceBuilder
- .getInstance();
- // Check init parameters for a resources processing.
- String scriptStrategy = externalContext
- .getInitParameter(InternetResourceBuilder.LOAD_SCRIPT_STRATEGY_PARAM);
- if (null != scriptStrategy) {
- if (InternetResourceBuilder.LOAD_NONE
- .equals(scriptStrategy)) {
- processScripts = false;
- } else if (InternetResourceBuilder.LOAD_ALL
- .equals(scriptStrategy)) {
- processScripts = false;
- // For an "ALL" strategy, it is not necessary to load scripts in the ajax request
- if (!ajaxRequest) {
- try {
- scripts.add(internetResourceBuilder
- .createResource(
- this,
- InternetResourceBuilder.COMMON_FRAMEWORK_SCRIPT)
- .getUri(context, null));
- scripts.add(internetResourceBuilder
- .createResource(
- this,
- InternetResourceBuilder.COMMON_UI_SCRIPT)
- .getUri(context, null));
+ .getInstance();
- } catch (ResourceNotFoundException e) {
- if (log.isWarnEnabled()) {
- log
- .warn("No aggregated javaScript library found "
- + e.getMessage());
+ ResponseWriter oldResponseWriter = context.getResponseWriter();
+
+ HeadResponseWriter componentWriter = new HeadResponseWriter("component");
+ HeadResponseWriter userWriter = new HeadResponseWriter("user");
+
+ try {
+ componentWriter.startDocument();
+ userWriter.startDocument();
+
+ context.setResponseWriter(componentWriter);
+
+ // Check init parameters for a resources processing.
+ String scriptStrategy = externalContext
+ .getInitParameter(InternetResourceBuilder.LOAD_SCRIPT_STRATEGY_PARAM);
+ if (null != scriptStrategy) {
+ if (InternetResourceBuilder.LOAD_NONE
+ .equals(scriptStrategy)) {
+ processScripts = false;
+ } else if (InternetResourceBuilder.LOAD_ALL
+ .equals(scriptStrategy)) {
+ processScripts = false;
+ // For an "ALL" strategy, it is not necessary to load scripts in the ajax request
+ if (!ajaxRequest) {
+ try {
+ internetResourceBuilder
+ .createResource(
+ this,
+ InternetResourceBuilder.COMMON_FRAMEWORK_SCRIPT).encode(context, null);
+ internetResourceBuilder
+ .createResource(
+ this,
+ InternetResourceBuilder.COMMON_UI_SCRIPT).encode(context, null);
+
+ } catch (ResourceNotFoundException e) {
+ if (log.isWarnEnabled()) {
+ log
+ .warn("No aggregated javaScript library found "
+ + e.getMessage());
+ }
}
+
}
-
}
}
- }
- boolean useStdControlsSkinning = false;
+ String styleStrategy = externalContext
+ .getInitParameter(InternetResourceBuilder.LOAD_STYLE_STRATEGY_PARAM);
- String stdControlsSkinning = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_PARAM);
- if (stdControlsSkinning != null) {
- useStdControlsSkinning = InternetResourceBuilder.ENABLE.equals(stdControlsSkinning);
- }
-
- boolean useStdControlsSkinningClasses = true;
+ if (InternetResourceBuilder.LOAD_NONE.equals(styleStrategy)) {
+ processStyles = false;
+ } else if (InternetResourceBuilder.LOAD_ALL
+ .equals(styleStrategy)) {
+ processStyles = false;
+ // For an "ALL" strategy, it is not necessary to load styles
+ // in the ajax request
+ if (!ajaxRequest) {
- String stdControlsSkinningClasses = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_CLASSES_PARAM);
- if (stdControlsSkinningClasses != null) {
- useStdControlsSkinningClasses = InternetResourceBuilder.ENABLE.equals(stdControlsSkinningClasses);
- }
-
- boolean useExtendedSkinning = isExtendedSkinningEnabled(externalContext);
-
- String styleStrategy = externalContext
- .getInitParameter(InternetResourceBuilder.LOAD_STYLE_STRATEGY_PARAM);
-
- if (InternetResourceBuilder.LOAD_NONE.equals(styleStrategy)) {
- processStyles = false;
- } else if (InternetResourceBuilder.LOAD_ALL
- .equals(styleStrategy)) {
- processStyles = false;
- // For an "ALL" strategy, it is not necessary to load styles
- // in the ajax request
- if (!ajaxRequest) {
- String commonStyle = InternetResourceBuilder.COMMON_STYLE_PREFIX;
+ try {
+ encodeSkinningResources(context, internetResourceBuilder);
- if (useStdControlsSkinning
- || useStdControlsSkinningClasses) {
- if (isExtendedSkinningEnabled(externalContext)) {
- commonStyle += "-ext";
- } else {
- commonStyle += "-bas";
- }
+ internetResourceBuilder
+ .createResource(this, InternetResourceBuilder.COMMON_STYLE).encode(context, null);
- if (useStdControlsSkinning
- && useStdControlsSkinningClasses) {
- commonStyle += "-both";
- } else if (useStdControlsSkinning) {
- commonStyle += "-styles";
- } else if (useStdControlsSkinningClasses) {
- commonStyle += "-classes";
+ } catch (ResourceNotFoundException e) {
+ if (log.isWarnEnabled()) {
+ log.warn("No stylesheet found "
+ + e.getMessage());
+ }
}
- }
- commonStyle += InternetResourceBuilder.COMMON_STYLE_EXTENSION;
-
- try {
- styles.add(internetResourceBuilder
- .createResource(this, commonStyle).getUri(
- context, null));
-
- } catch (ResourceNotFoundException e) {
- if (log.isWarnEnabled()) {
- log.warn("No aggregated stylesheet found "
- + e.getMessage());
- }
}
-
+ } else {
+ encodeSkinningResources(context, internetResourceBuilder);
}
- } else {
- if (useStdControlsSkinning) {
- styles.add(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_BASIC_STYLE)
- .getUri(context, null));
-
- if (useExtendedSkinning) {
- styles.add(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_EXTENDED_STYLE)
- .getUri(context, null));
- }
- }
-
- if (useStdControlsSkinningClasses) {
- styles.add(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_BASIC_CLASSES_STYLE)
- .getUri(context, null));
-
- if (useExtendedSkinning) {
- styles.add(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_EXTENDED_CLASSES_STYLE)
- .getUri(context, null));
- }
- }
+ } catch (IOException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ } finally {
+ context.setResponseWriter(oldResponseWriter);
}
RenderKitFactory rkFactory = (RenderKitFactory) FactoryFinder
@@ -244,12 +383,39 @@
RenderKit renderKit = rkFactory.getRenderKit(context, context
.getViewRoot().getRenderKitId());
- result = new State(processScripts, processStyles, renderKit, scripts, styles, userScripts, userStyles);
+ result = new State(processScripts, processStyles, renderKit, internetResourceBuilder, componentWriter, userWriter);
}
}
return result;
}
+ public static final class InternetResourceImpl extends InternetResourceBase {
+ public String getUri() {
+ return getKey();
+ }
+
+ public void setUri(String uri) {
+ setKey(uri);
+ }
+
+ @Override
+ public String getUri(FacesContext context, Object data) {
+ return getUri();
+ }
+ };
+
+ private void encodeResources(FacesContext context, ResourceRenderer renderer, Set<String> set) throws IOException {
+
+ if (set != null) {
+ InternetResourceImpl resourceImpl = new InternetResourceImpl();
+
+ for (String uri : set) {
+ resourceImpl.setUri(uri);
+ renderer.encode(resourceImpl, context, null);
+ }
+ }
+ }
+
/* (non-Javadoc)
* @see org.richfaces.event.ComponentPhaseEventHandler#componentBegin(javax.faces.component.UIComponent, javax.faces.event.PhaseEvent, java.lang.Object)
*/
@@ -260,38 +426,50 @@
FacesContext context = event.getFacesContext();
Renderer renderer = getRenderer(context, component, state.renderKit);
if (null != renderer) {
- if ((state.processScripts || state.processStyles)
- && renderer instanceof HeaderResourceProducer) {
- HeaderResourceProducer producer = (HeaderResourceProducer) renderer;
- if (state.processScripts) {
- Set<String> set = producer.getHeaderScripts(context,
- component);
- if (null != set) {
- state.scripts.addAll(set);
+ ResponseWriter oldResponseWriter = context.getResponseWriter();
+ try {
+ if ((state.processScripts || state.processStyles)
+ && (renderer instanceof HeaderResourceProducer2 || renderer instanceof HeaderResourceProducer)) {
+
+ context.setResponseWriter(state.getComponentWriter());
+
+ if (renderer instanceof HeaderResourceProducer2) {
+ HeaderResourceProducer2 producer = (HeaderResourceProducer2) renderer;
+
+ producer.encodeToHead(context, state.processStyles, state.processScripts);
+ } else if (renderer instanceof HeaderResourceProducer) {
+ HeaderResourceProducer producer = (HeaderResourceProducer) renderer;
+
+ if (state.processScripts) {
+ encodeResources(context, state.getScriptRenderer(), producer.getHeaderScripts(context,
+ component));
+ }
+ if (state.processStyles) {
+ encodeResources(context, state.getStyleRenderer(), producer.getHeaderStyles(context,
+ component));
+ }
}
+ } else if (renderer instanceof UserResourceRenderer2) {
+ context.setResponseWriter(state.getUserWriter());
- }
- if (state.processStyles) {
- Set<String> set = producer.getHeaderStyles(context,
- component);
- if (null != set) {
- state.styles.addAll(set);
- }
+ UserResourceRenderer2 producer = (UserResourceRenderer2) renderer;
+ producer.encodeToHead(context);
+ } else if (renderer instanceof UserResourceRenderer) {
+ context.setResponseWriter(state.getUserWriter());
+ UserResourceRenderer producer = (UserResourceRenderer) renderer;
+
+ encodeResources(context, state.getScriptRenderer(), producer.getHeaderScripts(context,
+ component));
+
+ encodeResources(context, state.getStyleRenderer(), producer.getHeaderStyles(context,
+ component));
}
- } else if (renderer instanceof UserResourceRenderer) {
- UserResourceRenderer producer = (UserResourceRenderer) renderer;
- Set<String> set = producer.getHeaderScripts(context,
- component);
- if (null != set) {
- state.userScripts.addAll(set);
- }
- set = producer.getHeaderStyles(context, component);
- if (null != set) {
- state.userStyles.addAll(set);
- }
+ } catch (IOException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ } finally {
+ context.setResponseWriter(oldResponseWriter);
}
-
}
}
}
@@ -311,19 +489,6 @@
ExternalContext externalContext = context.getExternalContext();
Map<String,Object> requestMap = externalContext.getRequestMap();
State state = (State) object;
- state.scripts.addAll(state.userScripts);
- if (state.scripts.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "Scripts for insert into head : \n");
- for (Iterator<String> iter = state.scripts.iterator(); iter.hasNext();) {
- String script = iter.next();
- buff.append(script).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(AjaxContext.SCRIPTS_PARAMETER, state.scripts);
- }
String skinStyleSheetUri = null;
String skinExtendedStyleSheetUri = null;
@@ -339,48 +504,39 @@
log.warn("Current Skin is not found", e);
}
- // Append Skin StyleSheet after a
- if (null != skinStyleSheetUri) {
- String resourceURL = context.getApplication()
- .getViewHandler().getResourceURL(context,
- skinStyleSheetUri);
- state.styles.add(resourceURL);
+ try {
+ // Append Skin StyleSheet after a
+ if (null != skinStyleSheetUri) {
+ String resourceURL = context.getApplication()
+ .getViewHandler().getResourceURL(context,
+ skinStyleSheetUri);
+ encodeResources(context, state.getStyleRenderer(), Collections.singleton(resourceURL));
+ }
+
+ if (null != skinExtendedStyleSheetUri && extendedSkinningAllowed) {
+ String resourceURL = context.getApplication().getViewHandler().getResourceURL(context,
+ skinExtendedStyleSheetUri);
+ encodeResources(context, state.getStyleRenderer(), Collections.singleton(resourceURL));
+ }
+
+ state.getComponentWriter().endDocument();
+ state.getUserWriter().endDocument();
+
+ } catch (IOException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
}
- if (null != skinExtendedStyleSheetUri && isExtendedSkinningEnabled(externalContext)) {
- String resourceURL = context.getApplication().getViewHandler().getResourceURL(context,
- skinExtendedStyleSheetUri);
- state.styles.add(resourceURL);
+ Object[] stateEvents = state.getEvents();
+
+ log.debug(Arrays.toString(stateEvents));
+ if (log.isDebugEnabled()) {
+ log.debug(Arrays.toString(stateEvents));
}
- if (state.styles.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "Styles for insert into head : \n");
- for (Iterator<String> iter = state.styles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- buff.append(style).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(AjaxContext.STYLES_PARAMETER, state.styles);
- }
- if (state.userStyles.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "User styles for insert into head : \n");
- for (Iterator<String> iter = state.userStyles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- buff.append(style).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(AjaxContext.USER_STYLES_PARAMETER, state.userStyles);
- }
+ requestMap.put(AjaxContext.HEAD_EVENTS_PARAMETER, stateEvents);
+
// Mark as processed.
requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
- // Save viewId for a parser selection
- requestMap.put(AjaxViewHandler.VIEW_ID_KEY, context.getViewRoot().getViewId());
}
}
@@ -453,23 +609,4 @@
}
}
- private static boolean isExtendedSkinningEnabled(ExternalContext context) {
- String userAgent = context.getRequestHeaderMap().get("User-Agent");
- if (userAgent != null) {
- boolean apply = !USER_AGENTS.matcher(userAgent).find();
-
- if (log.isDebugEnabled()) {
- log.debug("Got User-Agent: " + userAgent);
- log.debug("Applying extended CSS controls styling = " + apply);
- }
-
- return apply;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("User-Agent is null, applying extended CSS controls styling");
- }
-
- return true;
- }
- }
}
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXEndElementEvent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXEndElementEvent.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXEndElementEvent.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.context;
+
+
+/**
+ * Created 19.07.2008
+ * @author Nick Belaevski
+ * @since 3.2.2
+ */
+
+public class SAXEndElementEvent {
+
+ private String name;
+
+ public SAXEndElementEvent(String name) {
+ super();
+
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ return "</" + name + ">";
+ }
+}
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXStartElementEvent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXStartElementEvent.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXStartElementEvent.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.context;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created 19.07.2008
+ * @author Nick Belaevski
+ * @since 3.2.2
+ */
+
+public class SAXStartElementEvent {
+
+ private String name;
+
+ private Map<String, String> attributes;
+
+ /**
+ * Constructor that parses string into map for usage in unit tests
+ * @param name
+ * @param attributesString
+ */
+ public SAXStartElementEvent(String name, String attributesString) {
+ super();
+ this.name = name;
+
+ Map<String, String> attributes = null;
+ if (attributesString != null) {
+ attributes = new HashMap<String, String>();
+ String[] split = attributesString.split(",");
+ for (String s : split) {
+ String[] split2 = s.split("=");
+
+ attributes.put(split2[0], split2[1]);
+ }
+ }
+
+ this.attributes = attributes;
+ }
+
+ public SAXStartElementEvent(String name, Map<String, String> attributes) {
+ super();
+ this.name = name;
+ this.attributes = attributes;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public String toString() {
+ return "<" + name + " " + attributes + " >";
+ }
+}
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXTextEvent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXTextEvent.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/SAXTextEvent.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.context;
+
+/**
+ * Created 19.07.2008
+ * @author Nick Belaevski
+ * @since 3.2.2
+ */
+
+public class SAXTextEvent {
+ private String text;
+
+ public SAXTextEvent(String text) {
+ super();
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ @Override
+ public String toString() {
+ return "'" + text + "'";
+ }
+}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/SAXResponseWriter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/SAXResponseWriter.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/SAXResponseWriter.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -93,6 +93,10 @@
this.state = notDocumentState;
}
+ public ContentHandler getXmlConsumer() {
+ return xmlConsumer;
+ }
+
/**
* @return Returns the namespaceURI.
*/
@@ -544,4 +548,5 @@
writeText(cbuf, off, len);
}
}
+
}
\ No newline at end of file
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -27,9 +27,12 @@
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Field;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.LinkedList;
+import java.util.Map;
+import org.ajax4jsf.context.SAXEndElementEvent;
+import org.ajax4jsf.context.SAXStartElementEvent;
+import org.ajax4jsf.context.SAXTextEvent;
import org.ajax4jsf.io.FastBufferReader;
import org.ajax4jsf.webapp.HtmlParser;
import org.apache.commons.logging.Log;
@@ -46,12 +49,6 @@
private static final Log log = LogFactory.getLog(FastHtmlParser.class);
- private Set<String> scripts;
-
- private Set<String> styles;
-
- private Set<String> userStyles;
-
private String encoding;
private String doctype;
@@ -60,6 +57,8 @@
private String mimeType;
+ private Object[] headEvents;
+
public void parse(Reader in, Writer out) throws IOException {
boolean haveHtml = false;
boolean haveHead = false;
@@ -182,83 +181,73 @@
if (!haveHead) {
out.write("<head>");
}
- if (null != styles) {
- for (Iterator<String> iter = styles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- out.write("<link rel='stylesheet' class='" + COMPONENT_RESOURCE_LINK_CLASS + "'" +
- " type='text/css' href='");
- out.write(style);
- out.write("' />");
+
+ if (headEvents != null && headEvents.length > 0) {
+ LinkedList<Boolean> closedStack = new LinkedList<Boolean>();
+
+ for (Object event : headEvents) {
+ if (event instanceof SAXStartElementEvent) {
+ SAXStartElementEvent startElementEvent = (SAXStartElementEvent) event;
+
+ if (!closedStack.isEmpty() && Boolean.FALSE.equals(closedStack.peek())) {
+ out.write('>');
+ closedStack.set(0, Boolean.TRUE);
+ }
+
+ out.write('<');
+ out.write(startElementEvent.getName());
+
+ for (Map.Entry<String, String> entry : startElementEvent.getAttributes().entrySet()) {
+ String name = entry.getKey();
+ String value = entry.getValue();
+ out.write(' ');
+ out.write(name);
+ out.write("='");
+ out.write(value);
+ out.write('\'');
+ }
+
+ closedStack.addFirst(Boolean.FALSE);
+ } else if (event instanceof SAXTextEvent) {
+ SAXTextEvent textEvent = (SAXTextEvent) event;
+
+ if (!closedStack.isEmpty() && Boolean.FALSE.equals(closedStack.peek())) {
+ out.write('>');
+ closedStack.set(0, Boolean.TRUE);
+ }
+
+ out.write(textEvent.getText());
+
+ } else if (event instanceof SAXEndElementEvent) {
+ SAXEndElementEvent endElementEvent = (SAXEndElementEvent) event;
+ String elementName = endElementEvent.getName();
+
+ if (Boolean.FALSE.equals(closedStack.removeFirst())) {
+ if ("script".equals(elementName)) {
+ out.write('>');
+ out.write("</");
+ out.write(elementName);
+ out.write('>');
+ } else {
+ out.write(" />");
+ }
+ } else {
+ out.write("</");
+ out.write(elementName);
+ out.write('>');
+ }
+ } else {
+ throw new IllegalArgumentException();
+ }
}
}
- if (null != userStyles) {
- for (Iterator<String> iter = userStyles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- out.write("<link rel='stylesheet' class='" + USER_RESOURCE_LINK_CLASS + "'" +
- " type='text/css' href='");
- out.write(style);
- out.write("' />");
- }
- }
- if (null != scripts) {
- for (Iterator<String> iter = scripts.iterator(); iter.hasNext();) {
- String script = (String) iter.next();
- out.write("<script type='text/javascript' src='");
- out.write(script);
- out.write("'></script>");
- }
- }
+
if (!haveHead) {
out.write("</head>");
}
}
- /**
- * @return Returns the scripts.
- */
- public Set<String> getScripts() {
- return scripts;
- }
-
- /**
- * @param scripts
- * The scripts to set.
- */
- public void setScripts(Set<String> scripts) {
- this.scripts = scripts;
- }
-
- /**
- * @return Returns the styles.
- */
- public Set<String> getStyles() {
- return styles;
- }
-
- /**
- * @param styles
- * The styles to set.
- */
- public void setStyles(Set<String> styles) {
- this.styles = styles;
- }
-
- /**
- * @return Returns the user styles.
- */
- public Set<String> getUserStyles() {
- return userStyles;
- }
-
- /**
- * @param styles
- * The user styles to set.
- */
- public void setUserStyles(Set<String> userStyles) {
- this.userStyles = userStyles;
- }
-
public void parseHtml(InputStream input, Writer output) throws IOException {
parse(new InputStreamReader(input, encoding), output);
@@ -296,4 +285,8 @@
this.mimeType=mimeType;
return true;
}
+
+ public void setHeadEvents(Object[] events) {
+ this.headEvents = events;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -22,7 +22,6 @@
package org.ajax4jsf.renderkit;
import org.ajax4jsf.javascript.AjaxScript;
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
import org.ajax4jsf.resource.InternetResource;
@@ -33,7 +32,7 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:49 $
*
*/
-public abstract class AjaxComponentRendererBase extends HeaderResourcesRendererBase implements HeaderResourceProducer {
+public abstract class AjaxComponentRendererBase extends HeaderResourcesRendererBase implements HeaderResourceProducer2 {
// private InternetResource ajaxScript = getResource("/com/exadel/vcp/framework/ajax/scripts/AJAX.js");
private static final String AJAX_SCRIPT = AjaxScript.class.getName();
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -28,7 +28,6 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.webapp.BaseFilter;
@@ -42,7 +41,7 @@
*
*/
public abstract class HeaderResourcesRendererBase extends RendererBase
- implements HeaderResourceProducer {
+ implements HeaderResourceProducer2 {
/*
* (non-Javadoc)
@@ -147,4 +146,25 @@
}
}
+ public void encodeToHead(FacesContext context, boolean processStyles,
+ boolean processScripts) throws IOException {
+
+ if (processScripts) {
+ InternetResource[] scripts = getScripts();
+ if (scripts != null) {
+ for (InternetResource resource : scripts) {
+ resource.encode(context, null);
+ }
+ }
+ }
+
+ if (processStyles) {
+ InternetResource[] styles = getStyles();
+ if (styles != null) {
+ for (InternetResource resource : styles) {
+ resource.encode(context, null);
+ }
+ }
+ }
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/PrototypeBasedRendererBase.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -27,7 +27,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.javascript.PrototypeScript;
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
import org.ajax4jsf.resource.InternetResource;
@@ -35,7 +34,7 @@
* @author Maksim Kaszynski
*
*/
-public abstract class PrototypeBasedRendererBase extends RendererBase implements HeaderResourceProducer{
+public abstract class PrototypeBasedRendererBase extends RendererBase implements HeaderResourceProducer {
protected static final String[] EMPTY_ARRAY = {};
private InternetResource prototypeScript = getResource(PrototypeScript.class.getName());
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -200,6 +200,8 @@
public static final String src_ATTRIBUTE = "src";
+ public static final String media_ATTRIBUTE = "media";
+
// public static final String onreset_ATTRIBUTE = "onreset";
// attributes sets.
public static final String[] PASS_THRU = {
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/resource/OneTimeRenderer.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -27,7 +27,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.resource.InternetResource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -604,4 +604,8 @@
}
}
+ @Override
+ public ResourceRenderer getRenderer(String name) {
+ return renderers.get(name);
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/resource/TemplateCSSResource.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -78,7 +78,7 @@
* @param data
* @param attributes
* @throws IOException
- * @see org.ajax4jsf.resource.InternetResource#encode(javax.faces.context.FacesContext, java.lang.Object, java.util.Map)
+ * @see org.ajax4jsf.resource.InternetResource#encode(FacesContext, java.lang.Object, java.util.Map)
*/
public void encode(FacesContext context, Object data, Map<String, Object> attributes) throws IOException {
_resource.encode(context, data, attributes);
@@ -88,7 +88,7 @@
* @param context
* @param data
* @throws IOException
- * @see org.ajax4jsf.resource.InternetResource#encode(javax.faces.context.FacesContext, java.lang.Object)
+ * @see org.ajax4jsf.resource.InternetResource#encode(FacesContext, java.lang.Object)
*/
public void encode(FacesContext context, Object data) throws IOException {
_resource.encode(context, data);
@@ -99,7 +99,7 @@
* @param component
* @param attrs
* @throws IOException
- * @see org.ajax4jsf.resource.InternetResource#encodeBegin(javax.faces.context.FacesContext, java.lang.Object, java.util.Map)
+ * @see org.ajax4jsf.resource.InternetResource#encodeBegin(FacesContext, java.lang.Object, java.util.Map)
*/
public void encodeBegin(FacesContext context, Object component, Map<String, Object> attrs) throws IOException {
_resource.encodeBegin(context, component, attrs);
@@ -109,7 +109,7 @@
* @param context
* @param component
* @throws IOException
- * @see org.ajax4jsf.resource.InternetResource#encodeEnd(javax.faces.context.FacesContext, java.lang.Object)
+ * @see org.ajax4jsf.resource.InternetResource#encodeEnd(FacesContext, java.lang.Object)
*/
public void encodeEnd(FacesContext context, Object component) throws IOException {
_resource.encodeEnd(context, component);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -27,10 +27,8 @@
import java.io.Writer;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import javax.faces.application.ViewExpiredException;
-import javax.faces.context.FacesContext;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
@@ -40,7 +38,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.ajax4jsf.Filter;
import org.ajax4jsf.Messages;
import org.ajax4jsf.application.AjaxViewHandler;
import org.ajax4jsf.context.AjaxContext;
@@ -54,8 +51,6 @@
private static final Log log = LogFactory.getLog(BaseXMLFilter.class);
- public static final String RESPONSE_WRAPPER_ATTRIBUTE = "com.exade.vcp.Filter.ResponseWrapper";
-
public static final String APPLICATION_SCOPE_KEY = BaseXMLFilter.class.getName();
private String mimetype = "text/xml";
@@ -150,7 +145,7 @@
// in chain, self-rendered region write directly to wrapper stored in
// request-scope attribute.
try {
- request.setAttribute(RESPONSE_WRAPPER_ATTRIBUTE,
+ request.setAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE,
servletResponseWrapper);
chain.doFilter(request, servletResponseWrapper);
@@ -176,7 +171,7 @@
throw e;
}
} finally {
- request.removeAttribute(RESPONSE_WRAPPER_ATTRIBUTE);
+ request.removeAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE);
}
String viewId = (String) request
.getAttribute(AjaxViewHandler.VIEW_ID_KEY);
@@ -309,12 +304,8 @@
try {
// Setup scripts and styles
- parser.setScripts((Set<String>) request
- .getAttribute(AjaxContext.SCRIPTS_PARAMETER));
- parser.setStyles((Set<String>) request
- .getAttribute(AjaxContext.STYLES_PARAMETER));
- parser.setUserStyles((Set<String>) request
- .getAttribute(AjaxContext.USER_STYLES_PARAMETER));
+ parser.setHeadEvents((Object[]) request
+ .getAttribute(AjaxContext.HEAD_EVENTS_PARAMETER));
// Process parsing.
long startTimeMills = System.currentTimeMillis();
servletResponseWrapper.parseContent(output, parser);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -25,7 +25,6 @@
import java.io.InputStream;
import java.io.Reader;
import java.io.Writer;
-import java.util.Set;
public interface HtmlParser {
@@ -49,21 +48,8 @@
*/
public abstract void setMoveElements(boolean move);
- /**
- * @param scripts The scripts to set.
- */
- public abstract void setScripts(Set<String> scripts);
+ public abstract void setHeadEvents(Object[] events);
- /**
- * @param styles The styles to set.
- */
- public abstract void setStyles(Set<String> styles);
-
- /**
- * @param styles The user styles to set
- */
- public abstract void setUserStyles(Set<String> styles);
-
public abstract void setDoctype(String doctype);
/**
@@ -73,7 +59,4 @@
public abstract boolean setMime(String mimeType);
- public static final String COMPONENT_RESOURCE_LINK_CLASS = "component";
-
- public static final String USER_RESOURCE_LINK_CLASS = "user";
}
\ No newline at end of file
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -26,9 +26,9 @@
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
-import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import javax.servlet.ServletException;
import javax.xml.parsers.DocumentBuilder;
@@ -36,6 +36,9 @@
import javax.xml.parsers.ParserConfigurationException;
import org.ajax4jsf.application.AjaxViewHandler;
+import org.ajax4jsf.context.SAXEndElementEvent;
+import org.ajax4jsf.context.SAXStartElementEvent;
+import org.ajax4jsf.context.SAXTextEvent;
import org.ajax4jsf.webapp.BaseXMLFilter;
import org.ajax4jsf.webapp.HtmlParser;
import org.ajax4jsf.xml.serializer.Method;
@@ -91,12 +94,8 @@
private DocumentFragment fragment = null;
- private Set<String> _scripts;
-
- private Set<String> _styles;
-
- private Set<String> _userStyles;
-
+ private Object[] headEvents;
+
private String _viewState;
private String _encoding;
@@ -172,9 +171,7 @@
* Reset parser state
*/
public void reset() {
- _scripts = null;
- _styles = null;
- _userStyles = null;
+ headEvents = null;
_viewState = null;
_parser.reset();
_XMLserialiser.reset();
@@ -287,30 +284,6 @@
/*
* (non-Javadoc)
*
- * @see org.ajax4jsf.webapp.HtmlParser#setScripts(java.util.Set)
- */
- public void setScripts(Set<String> scripts) {
- _scripts = scripts;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.HtmlParser#setStyles(java.util.Set)
- */
- public void setStyles(Set<String> styles) {
- _styles = styles;
-
- }
-
- public void setUserStyles(Set<String> styles) {
- _userStyles = styles;
- }
-
- /*
- * (non-Javadoc)
- *
* @see org.ajax4jsf.webapp.HtmlParser#setDoctype(java.lang.String)
*/
public void setDoctype(String doctype) {
@@ -443,52 +416,52 @@
super.endElement(element, augs);
}
- private void insertStyle(String style, String className) {
- QName element = new QName(null, "link", "link", null);
- XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null, "href", "href", null),
- "CDATA", style);
- attrs.addAttribute(new QName(null, "type", "type", null),
- "CDATA", "text/css");
- attrs.addAttribute(new QName(null, "rel", "rel", null),
- "CDATA", "stylesheet");
- attrs.addAttribute(new QName(null, "class", "class", null),
- "CDATA", className);
- Augmentations augs = new HTMLAugmentations();
- super.emptyElement(element, attrs, augs);
- }
-
private void insertResources() {
headParsed = true;
- if (null != _styles) {
- for (Iterator<String> iter = _styles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- insertStyle(style, COMPONENT_RESOURCE_LINK_CLASS);
- }
- }
- if (null != _userStyles) {
- for (Iterator<String> iter = _userStyles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- insertStyle(style, USER_RESOURCE_LINK_CLASS);
+ if (headEvents != null && headEvents.length > 0) {
+ Augmentations augs = null;
+ LinkedList<QName> stack = new LinkedList<QName>();
+ int depth = 0;
+
+ for (Object event : headEvents) {
+ if (event instanceof SAXStartElementEvent) {
+ SAXStartElementEvent startElementEvent = (SAXStartElementEvent) event;
+
+ String elementName = startElementEvent.getName();
+ QName element = new QName(null, elementName, elementName, null);
+ stack.add(element);
+
+ XMLAttributes attrs = new XMLAttributesImpl();
+ for (Map.Entry<String, String> entry : startElementEvent.getAttributes().entrySet()) {
+ String name = entry.getKey();
+ String value = entry.getValue();
+ attrs.addAttribute(new QName(null, name, name, null), "CDATA", value);
+ }
+
+ if (depth++ == 0) {
+ augs = new HTMLAugmentations();
+ }
+
+ super.startElement(element, attrs, augs);
+ } else if (event instanceof SAXTextEvent) {
+ SAXTextEvent textEvent = (SAXTextEvent) event;
+
+ char[] ch = textEvent.getText().toCharArray();
+
+ super.characters(new XMLString(ch, 0, ch.length), augs);
+
+ } else if (event instanceof SAXEndElementEvent) {
+ super.endElement(stack.removeLast(), augs);
+
+ if (--depth == 0) {
+ augs = null;
+ }
+ } else {
+ throw new IllegalArgumentException();
+ }
}
}
-
- if (null != _scripts) {
- for (Iterator<String> iter = _scripts.iterator(); iter.hasNext();) {
- String script = (String) iter.next();
- QName element = new QName(null, "script", "script", null);
- XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null, "src", "src", null),
- "CDATA", script);
- attrs.addAttribute(new QName(null, "type", "type", null),
- "CDATA", "text/javascript");
- Augmentations augs = new HTMLAugmentations();
- super.startElement(element, attrs, augs);
- super.endElement(element, augs);
- }
- }
-
}
/*
@@ -799,5 +772,9 @@
}
return false;
}
+
+ public void setHeadEvents(Object[] headEvents) {
+ this.headEvents = headEvents;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -26,12 +26,15 @@
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
-import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import org.ajax4jsf.Messages;
import org.ajax4jsf.application.AjaxViewHandler;
+import org.ajax4jsf.context.SAXEndElementEvent;
+import org.ajax4jsf.context.SAXStartElementEvent;
+import org.ajax4jsf.context.SAXTextEvent;
import org.ajax4jsf.org.w3c.tidy.Lexer;
import org.ajax4jsf.org.w3c.tidy.Node;
import org.ajax4jsf.org.w3c.tidy.Tidy;
@@ -55,18 +58,14 @@
private Tidy tidy;
- private Set<String> _scripts;
-
- private Set<String> _styles;
-
- private Set<String> _userStyles;
-
private String _viewState;
private String _encoding;
private String _outputEncoding;
+ private Object[] headEvents;
+
private static final String[] _htmlTypes = { "text/html" };
private static final String[] _xmlTypes = { "text/xml" };// "text/xml"};
@@ -140,7 +139,7 @@
}
// Inserts scripts and styles to head.
- if (null != _scripts || null != _styles || null != _userStyles || null != _viewState) {
+ if ((null != headEvents && headEvents.length > 0) || null != _viewState) {
// find head
org.w3c.dom.Node head = documentElement
.getElementsByTagName("head").item(0);
@@ -163,40 +162,34 @@
}
child = null;
}
- if (null != _styles) {
- for (Iterator<String> iter = _styles.iterator(); iter.hasNext();) {
- String url = (String) iter.next();
- Element style = document.createElement("link");
- style.setAttribute("type", "text/css");
- style.setAttribute("rel", "stylesheet");
- style.setAttribute("href", url);
- style.setAttribute("class", COMPONENT_RESOURCE_LINK_CLASS);
- head.insertBefore(style, child);
- }
- }
- if (null != _userStyles) {
- for (Iterator<String> iter = _userStyles.iterator(); iter.hasNext();) {
- String url = (String) iter.next();
- Element style = document.createElement("link");
- style.setAttribute("type", "text/css");
- style.setAttribute("rel", "stylesheet");
- style.setAttribute("href", url);
- style.setAttribute("class", USER_RESOURCE_LINK_CLASS);
- head.insertBefore(style, child);
- }
- }
- // Scripts
- if (null != _scripts) {
- for (Iterator<String> iter = _scripts.iterator(); iter
- .hasNext();) {
- String url = (String) iter.next();
- Element script = document.createElement("script");
- script.setAttribute("type", "text/javascript");
- // script.setAttribute("defer", "defer");
- script.setAttribute("src", url);
- // script.appendChild(document.createTextNode(""));
- head.insertBefore(script, child);
+ LinkedList<Element> nodesStack = new LinkedList<Element>();
+
+ for (Object event : headEvents) {
+ if (event instanceof SAXStartElementEvent) {
+ SAXStartElementEvent startElement = (SAXStartElementEvent) event;
+
+ Element element = document.createElement(startElement.getName());
+ for (Map.Entry<String, String> attributeEntry : startElement.getAttributes().entrySet()) {
+ element.setAttribute(attributeEntry.getKey(), attributeEntry.getValue());
+ }
+
+ if (nodesStack.isEmpty()) {
+ head.insertBefore(element, child);
+ } else {
+ nodesStack.peek().appendChild(element);
+ }
+ nodesStack.addFirst(element);
+
+ } else if (event instanceof SAXTextEvent) {
+ SAXTextEvent textEvent = (SAXTextEvent) event;
+
+ nodesStack.peek().appendChild(document.createTextNode(textEvent.getText()));
+
+ } else if (event instanceof SAXEndElementEvent) {
+ nodesStack.removeFirst();
+ } else {
+ throw new IllegalArgumentException();
}
}
}
@@ -385,28 +378,6 @@
/*
* (non-Javadoc)
*
- * @see org.ajax4jsf.webapp.HtmlParser#setScripts(java.util.Set)
- */
- public void setScripts(Set<String> scripts) {
- this._scripts = scripts;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.HtmlParser#setStyles(java.util.Set)
- */
- public void setStyles(Set<String> styles) {
- this._styles = styles;
- }
-
- public void setUserStyles(Set<String> styles) {
- this._userStyles = styles;
- }
-
- /*
- * (non-Javadoc)
- *
* @see org.ajax4jsf.webapp.HtmlParser#setDoctype(java.lang.String)
*/
public void setDoctype(String doctype) {
@@ -421,4 +392,8 @@
public void setViewState(String viewState) {
_viewState = viewState;
}
+
+ public void setHeadEvents(Object[] headEvents) {
+ this.headEvents = headEvents;
+ }
}
Modified: trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2008-07-21 17:14:58 UTC (rev 9722)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2008-07-21 19:21:27 UTC (rev 9723)
@@ -24,11 +24,12 @@
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Set;
import junit.framework.TestCase;
+import org.ajax4jsf.context.SAXEndElementEvent;
+import org.ajax4jsf.context.SAXStartElementEvent;
+
public class FastParserTest extends TestCase {
@@ -126,10 +127,13 @@
FastHtmlParser parser = new FastHtmlParser();
StringReader in = new StringReader(toParse);
StringWriter out = new StringWriter();
- Set scripts = new HashSet();
- scripts.add("/some/script.js");
- parser.setScripts(scripts);
- parser.setStyles(scripts);
+ Object[] headEvents = new Object[] {
+ new SAXStartElementEvent("script", "src=/some/script.js"),
+ new SAXEndElementEvent("script"),
+ new SAXStartElementEvent("link", "href=/some/script.js"),
+ new SAXEndElementEvent("link")
+ };
+ parser.setHeadEvents(headEvents);
try {
parser.parse(in,out);
} catch (IOException e) {
17 years, 9 months
JBoss Rich Faces SVN: r9722 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-07-21 13:14:58 -0400 (Mon, 21 Jul 2008)
New Revision: 9722
Modified:
trunk/docs/userguide/en/src/main/docbook/included/fileUpload.xml
Log:
https://jira.jboss.org/jira/browse/RF-3890
Added more info about flash module
Modified: trunk/docs/userguide/en/src/main/docbook/included/fileUpload.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/fileUpload.xml 2008-07-21 16:28:01 UTC (rev 9721)
+++ trunk/docs/userguide/en/src/main/docbook/included/fileUpload.xml 2008-07-21 17:14:58 UTC (rev 9722)
@@ -210,31 +210,21 @@
</itemizedlist>
- <!--Flash Module-->
- <para>
- The <emphasis role="bold"><property><rich:fileUpload></property></emphasis> component has an embedded Flash module
- that adds extra functionality to the component. The module is enabled with <emphasis><property> "allowFlash"</property></emphasis>
-attribute set to "true".
- </para>
-<para>Apart from uploading files to the sever, without using AJAX, the Flash module provides a number of useful API functions that can be used to obtain information about the uploaded file. </para>
- <para>For instance, in case it's needed to check the file type of an uploaded file, the <code>entry.Type</code> can be applied. The example below illustrates how it can be done.</para>
-
-
- <programlisting role="XML"><![CDATA[...
-<rich:fileUpload maxFilesQuantity="2"/>
- ...]]></programlisting>
-
-
-
-
- <!--End of Flash Module-->
+
- <para>The <emphasis role="bold"><property><rich:fileUpload></property></emphasis> component
+ <para id="fileUploadEventAttributes">The <emphasis role="bold"><property><rich:fileUpload></property></emphasis> component
provides a number of specific event attributes:
</para>
<itemizedlist>
+
<listitem>
<para>
+ The <emphasis><property> "onadd"</property></emphasis>a event handler called on an add file operation
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
The <emphasis><property> "onupload"</property></emphasis> which gives you a possibility to cancel the upload at client side
</para>
</listitem>
@@ -255,7 +245,37 @@
</listitem>
</itemizedlist>
+
+
+
+ <!--Flash Module-->
+ <para>
+ The <emphasis role="bold"><property><rich:fileUpload></property></emphasis> component has an embedded Flash module
+ that adds extra functionality to the component. The module is enabled with <emphasis><property> "allowFlash"</property></emphasis>
+ attribute set to "true".
+ </para>
+ <para>Apart from uploading files to the sever without using AJAX, the Flash module provides a number of useful API functions that can be used to obtain information about the uploaded file. </para>
+
+ <para>There are 2 ways to obtain the data stored in the FileUploadEntry object. </para>
+
+ <itemizedlist>
+ <listitem><para>By means of JavaScript on the client side. Use the following syntax for that <code>entries[i].propertyName</code>. For example <code>entries[0].state</code> will return the state of the file the is being processed or has just been processed. A full list of properties can be found <link linkend="objectProperties">here</link>. </para></listitem>
+
+
+ <listitem><para>The properties of <code>FileUploadEntry</code> object can be retrieved using the <code>entry.propertyName</code> expression in the specific event attributes. For example, <code>onupload="alert(entry.fileName)"</code> will display a message with the name of the file at the moment when upload operation begins.</para></listitem>
+
+ </itemizedlist>
+
+
+
+
+ <!--End of Flash Module-->
+
+
+
+
+
<para>
In order to customize the information regarding the ongoing process you could use <emphasis><property>"label"</property></emphasis> facet
with the following macrosubstitution:
@@ -383,7 +403,7 @@
</para>
<programlisting role="XML"><![CDATA[...
<rich:fileUpload id="upload" disabled="false"/>
-<h:commandButton onclick="${rich:component('upload')}.disable(event); return false;" value="Disable" />
+<h:commandButton onclick="${rich:component('upload')}.disable();" value="Disable" />
...]]></programlisting>
<para>
@@ -469,7 +489,7 @@
</row>
<row>
<entry>clear()</entry>
- <entry>Removes all files from the list. The function can also get the $('id').component.entries[0] as a parameter to remove a particular file. </entry>
+ <entry>Removes all files from the list. The function can also get the $('id').component.entries[i] as a parameter to remove a particular file. </entry>
</row>
@@ -482,7 +502,7 @@
- <table d="objectProperties">
+ <table id="objectProperties">
<title>Client side object properties</title>
<tgroup cols="2">
<thead>
@@ -509,14 +529,14 @@
<row>
- <entry>entries[0].fileName</entry>
+ <entry>entries[i].fileName</entry>
<entry>Returns the file name, that is retrieved by the array index </entry>
</row>
<row>
- <entry>entries[0].state </entry>
+ <entry>entries[i].state </entry>
<entry>Returns the file state. Possible states are
<itemizedlist>
@@ -534,12 +554,74 @@
</entry>
</row>
+
+
<row>
+ <entry>entries[i].size</entry><entry> Returns the size of the file. Available in flash enabled version only</entry>
+ </row>
+ <row>
+ <entry>entries[i].Type</entry><entry>Returns the mime type of the file. Available in flash enabled version only</entry>
+ </row>
+ <row>
+ <entry>entries[i].creator </entry><entry>Returns the name of the author of the file. Available in flash enabled version only</entry>
+ </row>
+ <row>
+ <entry>entries[i].creationDate</entry><entry>Returns the date when the file was created. Available in flash enabled version only</entry>
+ </row>
+ <row>
+ <entry>entries[i].modificationDate</entry> <entry>Returns the date of the last file modification. Available in flash enabled version only</entry>
+ </row>
+
+
+
+
+ </tbody>
+ </tgroup>
+ </table>
+
+
+
+
+ <table d="objectPropertiesWithAttributes">
+ <title>Client side object properties available with specific <link linkend="fileUploadEventAttributes"> event attributes</link></title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Property</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+
+
+
+
+ <row>
+ <entry>entry.state </entry>
+ <entry>Returns the file state. Possible states are
+ <itemizedlist>
+
+ <listitem><para>"initialized" - the file is added, corresponds to FileUploadEntry.INITIALIZED constant </para> </listitem>
+ <listitem><para>"progress" - the file is being uploaded, corresponds to FileUploadEntry.UPLOAD_IN_PROGRESS constant</para> </listitem>
+ <listitem><para>"ready" - uploading is in process, corresponds to FileUploadEntry.READY constant The file will be uploaded on queue order.</para> </listitem>
+ <listitem><para>"canceled" - uploading of the file is canceled, corresponds to FileUploadEntry.UPLOAD_CANCELED constant </para> </listitem>
+ <listitem><para>"done" - the file is uploaded successfully, corresponds to FileUploadEntry.UPLOAD_SUCCESS constant</para> </listitem>
+ <listitem><para>"transfer_error" - a file transfer error occurred, corresponds to FileUploadEntry.UPLOAD_TRANSFER_ERROR constant </para> </listitem>
+ <listitem><para>"size_error" - the file exceeded maximum size, corresponds to FileUploadEntry.UPLOAD_SIZE_ERROR constant</para> </listitem>
+
+
+ </itemizedlist>
+
+
+ </entry>
+ </row>
+
+ <row>
<entry>entry.fileName </entry>
<entry>Returns the file's name. This property works with all event handlers except for "onadd".
- </entry>
- </row>
+ </entry>
+ </row>
@@ -553,17 +635,17 @@
<entry>entry.creator </entry><entry>Returns the name of the author of the file. Available in flash enabled version only</entry>
</row>
<row>
- <entry>entry.creationDate</entry><entry>Returns the date when the file was created. Available in flash enabled version only</entry>
+ <entry>entry.creationDate</entry><entry>Returns the date when the file was created. Available in flash enabled version only</entry>
</row>
<row>
- <entry>entry.modificationDate</entry> <entry>Returns the date of the last file modification. Available in flash enabled version only</entry>
+ <entry>entry.modificationDate</entry> <entry>Returns the date of the last file modification. Available in flash enabled version only</entry>
</row>
-
- </tbody>
- </tgroup>
+
+ </tbody>
+ </tgroup>
</table>
17 years, 9 months
JBoss Rich Faces SVN: r9721 - in trunk/docs: migrationguide/en/src/main/docbook and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-07-21 12:28:01 -0400 (Mon, 21 Jul 2008)
New Revision: 9721
Modified:
trunk/docs/cdkguide/en/src/main/docbook/master.xml
trunk/docs/migrationguide/en/src/main/docbook/master.xml
Log:
http://jira.jboss.com/jira/browse/RF-3875
links for PDF
Modified: trunk/docs/cdkguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-21 15:33:20 UTC (rev 9720)
+++ trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-21 16:28:01 UTC (rev 9721)
@@ -35,6 +35,14 @@
<holder>Red Hat</holder>
</copyright>
+<!--abstract>
+ <title/>
+ <para>
+ <ulink url="http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/...">PDF version</ulink>
+ </para>
+</abstract-->
+
+
</bookinfo>
<toc/> &intro; &roadmap; &setup; <!--
&ccreate;
Modified: trunk/docs/migrationguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/migrationguide/en/src/main/docbook/master.xml 2008-07-21 15:33:20 UTC (rev 9720)
+++ trunk/docs/migrationguide/en/src/main/docbook/master.xml 2008-07-21 16:28:01 UTC (rev 9721)
@@ -28,6 +28,13 @@
<year>2008</year>
<holder>Red Hat</holder>
</copyright>
+<abstract>
+ <title/>
+ <para>
+ <ulink url="http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/...">PDF version</ulink>
+ </para>
+</abstract>
+
</bookinfo>
<toc/>
17 years, 9 months
JBoss Rich Faces SVN: r9720 - in trunk/docs/cdkguide: en/src/main/docbook and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-07-21 11:33:20 -0400 (Mon, 21 Jul 2008)
New Revision: 9720
Added:
trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml
trunk/docs/cdkguide/en/src/main/resources/jspx/
trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx
Removed:
trunk/docs/cdkguide/en/src/main/docbook/includes/rssubclass.xml
Modified:
trunk/docs/cdkguide/en/src/main/docbook/includes/ccreate.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/protoui.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
trunk/docs/cdkguide/en/src/main/docbook/master.xml
trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl
trunk/docs/cdkguide/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-3692 - Templating section was added
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/ccreate.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/ccreate.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/ccreate.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -15,9 +15,7 @@
</emphasis> component. </para>
<para> You need to go to the <property>inputDate</property> directory and then launch the
following command: </para>
- <programlisting role="XML"><![CDATA[...
-mvn cdk:create -Dname=inputDate
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[mvn cdk:create -Dname=inputDate]]></programlisting>
<para> As a result three artifacts will be created: </para>
<itemizedlist>
<listitem>
@@ -32,9 +30,7 @@
</itemizedlist>
<para> In order to build the component you should stay in the <property>inputDate</property>
directory and launch the following command:</para>
- <programlisting role="XML"><![CDATA[...
-mvn install
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[mvn install]]></programlisting>
<para> This command generates and compiles the library and then creates a result JAR file. A
directory named <property>target</property> will be created along with a
<property>src</property> directory. If you get a file named
@@ -43,8 +39,6 @@
<para>
If you want to rebuild the component you could use the following command:
</para>
- <programlisting role="XML"><![CDATA[...
-mvn clean install
-...]]>
+ <programlisting role="XML"><![CDATA[mvn clean install]]>
</programlisting>
</section>
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -14,9 +14,7 @@
At first we need to create a project for the component itself. In the library directory
<property>Sandbox</property> you just created, launch the following command (all in one line):
</para>
- <programlisting role="XML"><![CDATA[...
-mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component -DarchetypeVersion=3.2.1.GA -DartifactId=inputDate
-...]]>
+ <programlisting role="XML"><![CDATA[mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component -DarchetypeVersion=3.2.1.GA -DartifactId=inputDate]]>
</programlisting>
<para>
As is easy to see a new directory with the name <property>inputDate</property> will be created.
@@ -92,8 +90,7 @@
...]]>
</programlisting>
<para> Finally your <property>inputDate/pom.xml</property> should look like this one: </para>
- <programlisting role="XML"><![CDATA[...
-<?xml version="1.0"?>
+ <programlisting role="XML"><![CDATA[<?xml version="1.0"?>
<project>
<parent>
<artifactId>sandbox</artifactId>
@@ -151,8 +148,7 @@
<version>3.2.1.GA</version>
</dependency>
</dependencies>
-</project>
-...]]>
- </programlisting>
+</project>]]>
+</programlisting>
</section>
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/protoui.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/protoui.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/protoui.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -20,7 +20,7 @@
<programlisting role="XML"><![CDATA[...
<div title="Date Field Component">
<input name="dateField" value="01 January 2008" />
- <img class="overlay" src="inputDateOverlay.gif" />
+ <img class="overlay" src="inputDateOverlay.png" />
</div>
...]]> </programlisting>
<para> As it is shown in the listing above there are three HTML attributes - <emphasis>
@@ -28,7 +28,7 @@
</emphasis>, <emphasis>
<property>"name"</property>
</emphasis>, and <emphasis>
- <property>" value"</property>
+ <property>"value"</property>
</emphasis> - are needed to be parameterize the generated markup. </para>
<para>
You map the HTML attributes to the corresponding <code>UIComponent</code> attributes:
@@ -36,7 +36,7 @@
<programlisting role="XML"><![CDATA[...
<div title="[title]">
<input name="[clientID]" value="[converted value]" />
- <img class="overlay" src="inputDateOverlay.gif" />
+ <img class="overlay" src="inputDateOverlay.png" />
</div>
...]]>
</programlisting>
Copied: trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml (from rev 9696, trunk/docs/cdkguide/en/src/main/docbook/includes/rssubclass.xml)
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml (rev 0)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section id="rendererbase" xreflabel="rendererbase">
+ <?dbhtml filename="rendererbase.html"?>
+ <sectioninfo>
+ <keywordset>
+ <keyword>renderer</keyword>
+ <keyword>UI</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Creating a Renderer Base class</title>
+ <para> How to create a base class </para>
+</section>
Property changes on: trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/docs/cdkguide/en/src/main/docbook/includes/rssubclass.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/rssubclass.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/rssubclass.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<section id="rssubclass" xreflabel="rssubclass">
- <?dbhtml filename="rssubclass.html"?>
- <sectioninfo>
- <keywordset>
- <keyword>renderer</keyword>
- <keyword>UI</keyword>
- <keyword>CDK</keyword>
- <keyword>Guide</keyword>
- </keywordset>
- </sectioninfo>
-<title>Creating a renderer-specific subclass</title>
-<para>
- renderer-specific subclass
-</para>
-</section>
-
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -1,19 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<section id="template" xreflabel="template">
-<?dbhtml filename="template.html"?>
-<sectioninfo>
-<keywordset>
-<keyword>templating</keyword>
-<keyword>UI</keyword>
-<keyword>CDK</keyword>
-<keyword>Guide</keyword>
-</keywordset>
-</sectioninfo>
-<title>Templating</title>
-<para>
-How to write your renderer with the help of a template.
-</para>
-<para>
-How to create a base class
-</para>
-</section>
\ No newline at end of file
+ <?dbhtml filename="template.html"?>
+ <sectioninfo>
+ <keywordset>
+ <keyword>templating</keyword>
+ <keyword>UI</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Templating</title>
+ <para> The <property>Component Development Kit (CDK)</property> allows to use the
+ <property>templates</property> for generation <property>Renderer</property> class. </para>
+ <para> Templates are JSP-like markup pages with special tags that are converted into
+ <property>Renderer</property> by a build script. </para>
+ <para> It's possible to use evaluated expressions in components templates.
+ It's also possible to create the <property>base class</property> for a template to
+ implement additional functions in it, so as the functions could be called from the template.
+ Hence, in the generated <property>Renderer</property> class there are corresponding function
+ calls on the place of these elements. </para>
+ <para> Let's create the template. At first you should proceed to the
+ <property>inputDate/src/main/templates/org/mycompany</property> directory where
+ <property>htmlInputDate.jspx</property> template file is stored. This file contains a
+ <property>Template Skeleton</property> like this one: </para>
+ <programlisting role="XML"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.mycompany.renderkit.html.InputDateRenderer"
+ baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
+ component="org.mycompany.component.UIInputDate"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
+ ]]></programlisting>
+ <para> According to the created <property>UI prototype</property> you need to extend
+ <property>Template Skeleton</property> with proper elements. Here is a full example for
+ the <emphasis role="bold">
+ <property><inputDate></property>
+ </emphasis> component: </para>
+ <ulink url="jspx/htmlInputDate.jspx">htmlInputDate.jspx</ulink>. </section>
Modified: trunk/docs/cdkguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -21,7 +21,7 @@
<!ENTITY skin SYSTEM "includes/skin.xml">
<!ENTITY register SYSTEM "includes/register.xml">
<!ENTITY taghandler SYSTEM "includes/taghandler.xml">
-<!ENTITY rssubclass SYSTEM "includes/rssubclass.xml">
+<!ENTITY rendererbase SYSTEM "includes/rendererbase.xml">
<!--Check the links page -->
<!ENTITY links SYSTEM "modules/links.xml">
]>
@@ -36,101 +36,73 @@
</copyright>
</bookinfo>
- <toc/>
- &intro;
- &roadmap;
- &setup;
-
-
-<!--
- &ccreate;
- &compdev;
+ <toc/> &intro; &roadmap; &setup; <!--
+ &ccreate;
+ &compdev;
-->
+ <chapter id="compdev" xreflabel="compdev">
+ <?dbhtml filename="compdev.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>inputDate</keyword>
+ <keyword>component</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+ <title>inputDate component development</title>
+ <para> We a going to create the <emphasis role="bold">
+ <property><inputDate></property>
+ </emphasis> component that can take a value, process that value, and then push it back
+ to the underlying model as a strongly typed <property>Date</property> object. </para>
+ <para> The <emphasis role="bold">
+ <property><inputDate></property>
+ </emphasis> component allows to attach a converter in order to set the desired date
+ format such as <property>mm/dd/yyyy</property>. So the component could convert and
+ validate the date entered by user. </para> &pcreate; &ccreate; &protoui;
+ <section id="crenderer" xreflabel="crenderer">
+ <?dbhtml filename="crenderer.html"?>
+ <sectioninfo>
+ <keywordset>
+ <keyword>renderer</keyword>
+ <keyword>UI</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Creating a Renderer</title>
+ <para> Renderer is responsible for the JSF component representation. It generates the
+ appropriate client-side markup, such as HTML, WML, XUL, etc. Renderer is also
+ responsible for the converting information coming from the client to the proper type
+ for the component (for example, a string value from the request is converted to a
+ strongly type <code>Date</code> object). </para>
+ <para> You could actually implement the renderer-specific component subclass that
+ exposes client-side attributes such as <emphasis>
+ <property>"style"</property>
+ </emphasis>, <emphasis>
+ <property>"class"</property>
+ </emphasis>, etc. It is common practice to implement the client-specific component
+ subclass to make some aspects of application development easier, but in our case we
+ do not need to do it. The <emphasis role="bold">
+ <property><inputDate></property>
+ </emphasis> is a simple <code>UIInput</code> component, therefore
+ <code>InputDateRenderer</code> class generates all the markup itself. </para>
+ <para> It is a time to start creating the <property>Renderer</property>. </para>
+ <para> One of the most convenient features of the <property>Component Development Kit
+ (CDK)</property> is a <property>Templating</property> mechanism. </para>
+ &template; &rendererbase; &skin; </section> ®ister; &ui;
+ &taghandler; </chapter> &test; &overview; <chapter id="button"
+ xreflabel="button">
+ <?dbhtml filename="button.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>button</keyword>
+ <keyword>component</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </chapterinfo>
+ <title>Button component development</title>
+ <para> Command Ajax components TBD with RichFaces CDK. </para>
-
-
-
-
-<chapter id="compdev" xreflabel="compdev">
- <?dbhtml filename="compdev.html"?>
- <chapterinfo>
- <keywordset>
- <keyword>inputDate</keyword>
- <keyword>component</keyword>
- <keyword>CDK</keyword>
- <keyword>Guide</keyword>
- </keywordset>
- </chapterinfo>
- <title>inputDate component development</title>
- <para>
- We a going to create the <emphasis role="bold"><property><inputDate></property></emphasis>
- component that can take a value, process that value, and then push it
- back to the underlying model as a strongly typed <property>Date</property> object.
- </para>
- <para>
- The <emphasis role="bold"><property><inputDate></property></emphasis> component allows to attach
- a converter in order to set the desired date format such as <property>mm/dd/yyyy</property>. So the component
- could convert and validate the date entered by user.
- </para>
-
- &pcreate;
- &ccreate;
- &protoui;
-
-<section id="crenderer" xreflabel="crenderer">
- <?dbhtml filename="crenderer.html"?>
- <sectioninfo>
- <keywordset>
- <keyword>renderer</keyword>
- <keyword>UI</keyword>
- <keyword>CDK</keyword>
- <keyword>Guide</keyword>
- </keywordset>
- </sectioninfo>
- <title>Creating a Renderer</title>
- <para>
- Renderer is responsible for the JSF component representation. It generates the appropriate client-side markup,
- such as HTML, WML, XUL, etc. Renderer is also responsible for the converting information coming from the client to the proper type
- for the component (for example, a string value from the request is converted to a strongly type <code>Date</code> object).
- </para>
- <para>
- You could actually implement the renderer-specific component subclass that exposes
- client-side attributes such as style, disabled, tooltip, etc.
- </para>
- &template;
- &skin;
-</section>
-
-
-
- &rssubclass;
- &ui;
- ®ister;
- &taghandler;
-
-</chapter>
-
- &test;
- &overview;
-
- <chapter id="button" xreflabel="button">
- <?dbhtml filename="button.html"?>
- <chapterinfo>
- <keywordset>
- <keyword>button</keyword>
- <keyword>component</keyword>
- <keyword>CDK</keyword>
- <keyword>Guide</keyword>
- </keywordset>
- </chapterinfo>
- <title>Button component development</title>
- <para>
- Command Ajax components TBD with RichFaces CDK.
- </para>
-
- </chapter>
- &ide;
- &namingconv;
- &ref;
- &temptags;
-</book>
+ </chapter> &ide; &namingconv; &ref; &temptags; </book>
Added: trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx (rev 0)
+++ trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx 2008-07-21 15:33:20 UTC (rev 9720)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:h=" http://ajax4jsf.org/cdk/h"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:jsp=" http://ajax4jsf.org/cdk/jsp"
+ class="org.mycompany.renderkit.html.InputDateRenderer"
+ baseclass="org.mycompany.renderkit.InputDateRendererBase"
+ component="org.mycompany.component.UIInputDate"
+ >
+ <f:clientid var="clientId"/>
+ <h:styles>/org/mycompany/renderkit/html/css/inputDate.xcss</h:styles>
+ <f:resource name="/org/mycompany/renderkit/html/images/inputDate.png" var="icon" />
+ <c:object var="caption" type="javax.faces.component.UIComponent" />
+ <jsp:scriptlet>
+ <![CDATA[
+ caption = component.getFacet("caption");
+ if(caption !=null && caption.isRendered()) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}_caption" class="my-inputDate-caption #{component.attributes['captionClass']}">
+ <f:insertComponent value="#{caption}" />
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" title="#{value}" x:passThruWithExclusions="value,name,type,id">
+ <input id="#{clientId}"
+ name="#{clientId}"
+ type="text"
+ value="#{this:getValueAsString(context, component)}"
+ class="my-inputDate-input #{component.attributes['inputClass']}"
+ style="#{component.attributes['inputStyle']}"/>
+
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {]]>
+ </jsp:scriptlet>
+ <u:insertFacet name="icon" />
+ <jsp:scriptlet>
+ <![CDATA[
+ }else{
+ ]]>
+ </jsp:scriptlet>
+ <img src="#{icon}" class="my-inputDate-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}"/>
+ <jsp:scriptlet>
+ <![CDATA[
+ }
+ ]]>
+ </jsp:scriptlet>
+ </div>
+</f:root>
\ No newline at end of file
Modified: trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml-common.xsl 2008-07-21 15:33:20 UTC (rev 9720)
@@ -1,69 +1,73 @@
-<?xml version='1.0'?>
-
-<!--
- Copyright 2008 JBoss, a division of Red Hat
- License: LGPL
- Author: Mark Newton <mark.newton(a)jboss.org>
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <!--xsl:import href="collapsing-navigation.xsl"/-->
-
- <xsl:param name="html.stylesheet" select="'css/html.css'"/>
- <xsl:param name="generate.toc" select="'book toc'"/>
- <xsl:param name="toc.section.depth" select="5"/>
- <!--
-From: xhtml/docbook.xsl
-Reason: Remove inline style for draft mode
-Version: 1.72.0
--->
-<xsl:template name="head.content">
- <xsl:param name="node" select="."/>
- <xsl:param name="title">
- <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
- </xsl:param>
-
- <title xmlns="http://www.w3.org/1999/xhtml" >
- <xsl:copy-of select="$title"/>
- </title>
-
- <xsl:if test="$html.stylesheet != ''">
- <xsl:call-template name="output.html.stylesheets">
- <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:if test="$link.mailto.url != ''">
- <link rev="made" href="{$link.mailto.url}"/>
- </xsl:if>
-
- <xsl:if test="$html.base != ''">
- <base href="{$html.base}"/>
- </xsl:if>
-
- <meta xmlns="http://www.w3.org/1999/xhtml" name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
-
- <xsl:if test="$generate.meta.abstract != 0">
- <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
- <xsl:if test="$info and $info/abstract">
- <meta xmlns="http://www.w3.org/1999/xhtml" name="description">
- <xsl:attribute name="content">
- <xsl:for-each select="$info/abstract[1]/*">
- <xsl:value-of select="normalize-space(.)"/>
- <xsl:if test="position() < last()">
- <xsl:text> </xsl:text>
- </xsl:if>
- </xsl:for-each>
- </xsl:attribute>
- </meta>
- </xsl:if>
- </xsl:if>
-
- <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="images/favicon.ico" />
-
- <xsl:apply-templates select="." mode="head.keywords.content"/>
-</xsl:template>
-
-
-</xsl:stylesheet>
+<?xml version='1.0'?>
+
+<!--
+ Copyright 2008 JBoss, a division of Red Hat
+ License: LGPL
+ Author: Mark Newton <mark.newton(a)jboss.org>
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <!--xsl:import href="collapsing-navigation.xsl"/-->
+
+ <xsl:param name="html.stylesheet" select="'css/html.css'"/>
+ <xsl:param name="generate.toc" select="'book toc'"/>
+ <xsl:param name="toc.section.depth" select="5"/>
+ <!--
+From: xhtml/docbook.xsl
+Reason: Remove inline style for draft mode
+Version: 1.72.0
+-->
+<xsl:template name="head.content">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="title">
+ <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+ </xsl:param>
+
+ <title xmlns="http://www.w3.org/1999/xhtml" >
+ <xsl:copy-of select="$title"/>
+ </title>
+
+ <xsl:if test="$html.stylesheet != ''">
+ <xsl:call-template name="output.html.stylesheets">
+ <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="$link.mailto.url != ''">
+ <link rev="made" href="{$link.mailto.url}"/>
+ </xsl:if>
+
+ <xsl:if test="$html.base != ''">
+ <base href="{$html.base}"/>
+ </xsl:if>
+
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+
+ <xsl:if test="$generate.meta.abstract != 0">
+ <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
+ <xsl:if test="$info and $info/abstract">
+ <meta xmlns="http://www.w3.org/1999/xhtml" name="description">
+ <xsl:attribute name="content">
+ <xsl:for-each select="$info/abstract[1]/*">
+ <xsl:value-of select="normalize-space(.)"/>
+ <xsl:if test="position() < last()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ </meta>
+ </xsl:if>
+ </xsl:if>
+
+ <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="images/favicon.ico" />
+
+ <xsl:apply-templates select="." mode="head.keywords.content"/>
+</xsl:template>
+
+<xsl:template match="//citebiblio">
+ <div>
+ <xsl:value-of select="." />
+</div>
+</xsl:template>
+</xsl:stylesheet>
Modified: trunk/docs/cdkguide/pom.xml
===================================================================
--- trunk/docs/cdkguide/pom.xml 2008-07-21 14:25:56 UTC (rev 9719)
+++ trunk/docs/cdkguide/pom.xml 2008-07-21 15:33:20 UTC (rev 9720)
@@ -84,6 +84,7 @@
${basedir}/src/main/resources
</directory>
</cssResource>
+
<sourceDocumentName>
master.xml
</sourceDocumentName>
17 years, 9 months
JBoss Rich Faces SVN: r9719 - trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-07-21 10:25:56 -0400 (Mon, 21 Jul 2008)
New Revision: 9719
Modified:
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
Log:
https://jira.jboss.org/jira/browse/RF-2613
Modified: trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
--- trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-07-21 14:25:27 UTC (rev 9718)
+++ trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-07-21 14:25:56 UTC (rev 9719)
@@ -262,6 +262,22 @@
this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems);
},
+ up : function() {
+ this.targetList.up();
+ },
+
+ down : function() {
+ this.targetList.down();
+ },
+
+ top : function() {
+ this.targetList.top();
+ },
+
+ bottom : function() {
+ this.targetList.bottom();
+ },
+
focusOrBlurHandlerLS : function(e) {
var componentID = e.target.id;
if (e.type == "keydown") {
17 years, 9 months
JBoss Rich Faces SVN: r9718 - trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-07-21 10:25:27 -0400 (Mon, 21 Jul 2008)
New Revision: 9718
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
Log:
https://jira.jboss.org/jira/browse/RF-2613
Modified: trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
--- trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-07-21 14:17:55 UTC (rev 9717)
+++ trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-07-21 14:25:27 UTC (rev 9718)
@@ -418,5 +418,9 @@
result[i] = this.selectedItems[i].item;
}
return result;
+ },
+
+ getItems : function() {
+ return this.shuttleTbody.rows;
}
}
\ No newline at end of file
17 years, 9 months
JBoss Rich Faces SVN: r9717 - trunk/docs/userguide/en/src/main/resources/css.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-07-21 10:17:55 -0400 (Mon, 21 Jul 2008)
New Revision: 9717
Modified:
trunk/docs/userguide/en/src/main/resources/css/html.css
Log:
http://jira.jboss.com/jira/browse/RF-3875
correcting font for PDF link
Modified: trunk/docs/userguide/en/src/main/resources/css/html.css
===================================================================
--- trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 14:17:29 UTC (rev 9716)
+++ trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 14:17:55 UTC (rev 9717)
@@ -35,7 +35,6 @@
font-size:10px;
}
-}
.docnav li.previous strong, .docnav li.next strong {
width: 200px;
height:22px;
17 years, 9 months
JBoss Rich Faces SVN: r9716 - trunk/docs/userguide/en/src/main/resources/css.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-07-21 10:17:29 -0400 (Mon, 21 Jul 2008)
New Revision: 9716
Modified:
trunk/docs/userguide/en/src/main/resources/css/html.css
Log:
http://jira.jboss.com/jira/browse/RF-3875
correcting font for PDF link
Modified: trunk/docs/userguide/en/src/main/resources/css/html.css
===================================================================
--- trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 14:16:40 UTC (rev 9715)
+++ trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 14:17:29 UTC (rev 9716)
@@ -29,6 +29,8 @@
margin:0 auto;
text-align:justify;
+}
+
div.abstract {
font-size:10px;
}
17 years, 9 months
JBoss Rich Faces SVN: r9715 - trunk/docs/userguide/en/src/main/resources/css.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-07-21 10:16:40 -0400 (Mon, 21 Jul 2008)
New Revision: 9715
Modified:
trunk/docs/userguide/en/src/main/resources/css/html.css
Log:
https://jira.jboss.org/jira/browse/RF-3875
Modified: trunk/docs/userguide/en/src/main/resources/css/html.css
===================================================================
--- trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 13:28:54 UTC (rev 9714)
+++ trunk/docs/userguide/en/src/main/resources/css/html.css 2008-07-21 14:16:40 UTC (rev 9715)
@@ -31,7 +31,6 @@
div.abstract {
font-size:10px;
-
}
}
17 years, 9 months
JBoss Rich Faces SVN: r9714 - trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable.
by richfaces-svn-commits@lists.jboss.org
Author: pkawiak
Date: 2008-07-21 09:28:54 -0400 (Mon, 21 Jul 2008)
New Revision: 9714
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js
Log:
isie7 => isie
Modified: trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
===================================================================
--- trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-07-21 13:18:29 UTC (rev 9713)
+++ trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-07-21 13:28:54 UTC (rev 9714)
@@ -168,7 +168,7 @@
var size = group.size();
for (var i=0; i<size; i++) {
group[i].style.display = sVisibility;
- if (ClientUILib.isIE7){
+ if (ClientUILib.isIE){
//prevent IE from showing borders of cells
//which parents have been hidden :|
var cells = group[i].childNodes;
@@ -314,7 +314,7 @@
},
update: function(refreshEvents) {
this.createControls();
- if ( !ClientUILib.isIE7 ) {
+ if ( !ClientUILib.isIE ) {
if (this.fakeIeRow) {
this.table.getElement().deleteRow(this.fakeIeRow);
this.fakeIeRow = null;
Modified: trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
===================================================================
--- trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2008-07-21 13:18:29 UTC (rev 9713)
+++ trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2008-07-21 13:28:54 UTC (rev 9714)
@@ -149,7 +149,7 @@
dropSpanRight.setStyle('width:'+(w/2)+'px');
}
this.lastColWidth = this.extDt.getColumnWidth(this.getColumnsNumber()-1);
- if (ClientUILib.isIE7){
+ if (ClientUILib.isIE){
this.lastColWidth -= 15;
}
},
@@ -228,7 +228,7 @@
if (delta > this.maxDelta) {
delta = this.maxDelta;
}
- if (ClientUILib.isIE7) {
+ if (ClientUILib.isIE) {
// sep span width
delta -= 6;
}
Modified: trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js
===================================================================
--- trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js 2008-07-21 13:18:29 UTC (rev 9713)
+++ trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js 2008-07-21 13:28:54 UTC (rev 9714)
@@ -283,7 +283,7 @@
var groupRow;
var lastGroupId = 0;
var bGroupExpanded;
- if (!ClientUILib.isIE7) {
+ if (!ClientUILib.isIE) {
//make first fake row visible to ensure proper rendering
bGroupExpanded = true;
}else{
@@ -318,7 +318,7 @@
groupItems[groupItem++] = nrows[i];
if (!bGroupExpanded) {
nrows[i].style.display = 'none';
- if (ClientUILib.isIE7){
+ if (ClientUILib.isIE){
//prevent IE from showing borders of cells
//which parents have been hidden :|
var cells = nrows[i].childNodes;
17 years, 9 months