Author: alexsmirnov
Date: 2008-05-13 18:43:48 -0400 (Tue, 13 May 2008)
New Revision: 8565
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
trunk/ui/assembly/src/main/resources/
trunk/ui/assembly/src/main/resources/META-INF/
trunk/ui/assembly/src/main/resources/META-INF/jsp.taglib.xml
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/fileUpload/File.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/fileUpload/examples/fileUpload.xhtml
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UISubTable.java
Log:
fix
http://jira.jboss.com/jira/browse/RF-3344
start progress on
http://jira.jboss.com/jira/browse/RF-3410
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-05-13
18:17:54 UTC (rev 8564)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -98,7 +98,7 @@
Iterator<UIComponent> childIterator = dataChildren();
while (childIterator.hasNext()) {
UIComponent component = childIterator.next();
- processComponent(context, component, argument);
+ processComponent(context, component, argument);
}
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-13
18:17:54 UTC (rev 8564)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -415,8 +415,8 @@
if (contentLength > 0) {
context.setIntHeader("Content-Length",
contentLength);
- } else {
- context.setHeader("Transfer-Encoding", "chunked");
+// } else {
+// context.setHeader("Transfer-Encoding", "chunked");
}
context.setHeader("Cache-control", "max-age=0, no-store,
no-cache");
context.setHeader("Pragma", "no-cache");
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -0,0 +1,38 @@
+/**
+ *
+ */
+package org.ajax4jsf.webapp.taglib;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.TagHandler;
+
+/**
+ * This if "empty" facelets tag handler stub. This handler used to ignore tags
on a page.
+ * At most, it used to bypass <jsp:root> and other tags, so we can use same
markup for an facelets an jsp pages.
+ * @author asmirnov
+ *
+ */
+public class EmptyHandler extends TagHandler {
+
+ public EmptyHandler(TagConfig config) {
+ super(config);
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ this.nextHandler.apply(ctx, parent);
+
+ }
+
+}
Property changes on:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/fileUpload/File.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/fileUpload/File.java 2008-05-13
18:17:54 UTC (rev 8564)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/fileUpload/File.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -3,6 +3,7 @@
public class File {
private String Name;
+ private String mime;
private long length;
private byte[] data;
public byte[] getData() {
@@ -16,6 +17,21 @@
}
public void setName(String name) {
Name = name;
+ int extDot = name.lastIndexOf('.');
+ if(extDot > 0){
+ String extension = name.substring(extDot +1);
+ if("bmp".equals(extension)){
+ mime="image/bmp";
+ } else if("jpg".equals(extension)){
+ mime="image/jpeg";
+ } else if("gif".equals(extension)){
+ mime="image/gif";
+ } else if("png".equals(extension)){
+ mime="image/png";
+ } else {
+ mime = "image/unknown";
+ }
+ }
}
public long getLength() {
return length;
@@ -23,4 +39,8 @@
public void setLength(long length) {
this.length = length;
}
+
+ public String getMime(){
+ return mime;
+ }
}
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/fileUpload/examples/fileUpload.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/fileUpload/examples/fileUpload.xhtml 2008-05-13
18:17:54 UTC (rev 8564)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/fileUpload/examples/fileUpload.xhtml 2008-05-13
22:43:48 UTC (rev 8565)
@@ -36,7 +36,7 @@
var="file" rowKeyVar="row">
<rich:panel>
<h:panelGrid columns="2">
- <a4j:mediaOutput element="img" mimeType="image/jpeg"
+ <a4j:mediaOutput element="img" mimeType="#{file.mime}"
createContent="#{fileUploadBean.paint}" value="#{row}"
style="width:100px; height:100px;" />
<h:panelGrid columns="2">
Added: trunk/ui/assembly/src/main/resources/META-INF/jsp.taglib.xml
===================================================================
--- trunk/ui/assembly/src/main/resources/META-INF/jsp.taglib.xml
(rev 0)
+++ trunk/ui/assembly/src/main/resources/META-INF/jsp.taglib.xml 2008-05-13 22:43:48 UTC
(rev 8565)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE facelet-taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+ "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib
xmlns="http://java.sun.com/JSF/Facelet">
+ <
namespace>http://java.sun.com/JSP/Page</namespace>
+ <tag>
+ <tag-name>root</tag-name>
+ <handler-class>
+ org.ajax4jsf.webapp.taglib.EmptyHandler
+ </handler-class>
+ </tag>
+</facelet-taglib>
\ No newline at end of file
Property changes on: trunk/ui/assembly/src/main/resources/META-INF/jsp.taglib.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java 2008-05-13
18:17:54 UTC (rev 8564)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -22,25 +22,21 @@
@Override
protected UIComponent nextColumn() {
UIComponent nextColumn = null;
- while (childrenIterator.hasNext()) {
+ while (null == nextColumn && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
if (child.isRendered()) {
if (child instanceof UIColumn || child instanceof Column) {
nextColumn = child;
- break;
} else if (checkAjaxComponent(child)) {
nextColumn = child;
- break;
}
}
}
- if (null == nextColumn) {
- while (facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if (checkAjaxComponent(child)) {
- nextColumn = child;
- break;
- }
+ while (null == nextColumn && facetsIterator.hasNext()) {
+ UIComponent child = facetsIterator.next();
+ if (checkAjaxComponent(child)) {
+ nextColumn = child;
+ break;
}
}
return nextColumn;
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2008-05-13
18:17:54 UTC (rev 8564)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -10,29 +10,30 @@
class FixedChildrenIterator extends DataIterator {
- private Iterator<UIComponent> currentColumnIterator;
+ private Iterator<UIComponent> currentColumnIterator;
-
public FixedChildrenIterator(UIComponent dataTable) {
super(dataTable);
}
-
+
@Override
protected UIComponent nextColumn() {
UIComponent nextColumn = null;
- if(null != currentColumnIterator){
+ if (null != currentColumnIterator) {
nextColumn = currentColumnIterator.next();
checkNextColumnChild();
} else {
- while (childrenIterator.hasNext()) {
+ while (null == nextColumn && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if ( child instanceof UIColumn || child instanceof Column ) {
+ if (child instanceof UIColumn || child instanceof Column) {
boolean rendered = true;
try {
rendered = child.isRendered();
} catch (Exception e) {
- // This exception can be thrown for a header/footer facets
- // there column rendered attribute was binded to a row variable.
+ // This exception can be thrown for a header/footer
+ // facets
+ // there column rendered attribute was binded to a row
+ // variable.
}
if (rendered) {
Iterator<UIComponent> iterator = getColumnChildrenIterator(child);
@@ -40,23 +41,30 @@
currentColumnIterator = iterator;
nextColumn = currentColumnIterator.next();
checkNextColumnChild();
- break;
}
}
} else if (checkAjaxComponent(child)) {
nextColumn = child;
- break;
}
}
}
- if(null == nextColumn){
- while (facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if(checkAjaxComponent(child)){
- nextColumn = child;
- break;
- }
+ if (null == nextColumn) {
+ nextColumn = getNextFacet();
+ }
+ return nextColumn;
+ }
+
+ /**
+ * @param nextColumn
+ * @return
+ */
+ protected UIComponent getNextFacet() {
+ UIComponent nextColumn = null;
+ while (null == nextColumn && facetsIterator.hasNext()) {
+ UIComponent child = facetsIterator.next();
+ if (checkAjaxComponent(child)) {
+ nextColumn = child;
}
}
return nextColumn;
@@ -66,17 +74,16 @@
protected boolean checkAjaxComponent(UIComponent child) {
return !super.checkAjaxComponent(child);
}
-
+
@Override
- protected Iterator<UIComponent> getColumnChildrenIterator(
- UIComponent child) {
+ protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
return child.getFacets().values().iterator();
}
-
- protected void checkNextColumnChild() {
- if(!currentColumnIterator.hasNext()){
- currentColumnIterator = null;
- }
+
+ protected void checkNextColumnChild() {
+ if (!currentColumnIterator.hasNext()) {
+ currentColumnIterator = null;
}
+ }
}
\ No newline at end of file
Added:
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
(rev 0)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class SubtableFixedChildrenIterator extends FixedChildrenIterator {
+
+ public SubtableFixedChildrenIterator(UIComponent dataTable) {
+ super(dataTable);
+ }
+
+ @Override
+ protected UIComponent getNextFacet() {
+ return null;
+ }
+}
Property changes on:
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-05-13
18:17:54 UTC (rev 8564)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -26,8 +26,10 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.AjaxSupport;
import org.richfaces.model.ExtendedFilterField;
import org.richfaces.model.FilterField;
import org.richfaces.model.Ordering;
@@ -169,4 +171,44 @@
filterValue = (String)states[1];
sortOrder = (Ordering)states[2];
}
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ for (UIComponent component : getChildren()) {
+ component.processDecodes(context);
+ }
+ for (UIComponent component : getFacets().values()) {
+ if (isAjaxComponent(component)) {
+ component.processDecodes(context);
+ }
+ }
+ decode(context);
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ for (UIComponent component : getChildren()) {
+ component.processValidators(context);
+ }
+ for (UIComponent component : getFacets().values()) {
+ if (isAjaxComponent(component)) {
+ component.processValidators(context);
+ }
+ }
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ for (UIComponent component : getChildren()) {
+ component.processUpdates(context);
+ }
+ for (UIComponent component : getFacets().values()) {
+ if (isAjaxComponent(component)) {
+ component.processUpdates(context);
+ }
+ }
+ }
+ private boolean isAjaxComponent(UIComponent component) {
+ return component instanceof AjaxSupport;
+ }
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UISubTable.java 2008-05-13
18:17:54 UTC (rev 8564)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UISubTable.java 2008-05-13
22:43:48 UTC (rev 8565)
@@ -37,6 +37,11 @@
public static final String COMPONENT_FAMILY = "org.richfaces.SubTable";
+ @Override
+ public Iterator<UIComponent> fixedChildren() {
+ return new SubtableFixedChildrenIterator(this);
+ }
+
/* (non-Javadoc)
* @see org.richfaces.component.Column#isBreakBefore()
*/