Author: alexsmirnov
Date: 2007-10-05 19:30:08 -0400 (Fri, 05 Oct 2007)
New Revision: 3289
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ApplyValuesPhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/InvokeApplicationPhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ProcessValidatorsPhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RenderResponsePhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/UpdateModelPhase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
trunk/samples/seamIntegration/pom.xml
trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java
Log:
intermediate commit for a portal brige
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ApplyValuesPhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ApplyValuesPhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ApplyValuesPhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -5,7 +5,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -27,9 +26,8 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
- nextPhase.execute(context, listeners);
+ protected void executeNextPhase(FacesContext context) {
+ nextPhase.execute(context);
}
/* (non-Javadoc)
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/InvokeApplicationPhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/InvokeApplicationPhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/InvokeApplicationPhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -5,7 +5,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -24,8 +23,7 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
+ protected void executeNextPhase(FacesContext context) {
// do nothing.
}
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -33,11 +33,11 @@
/**
* Execute phase methods with
* @param context
- * @param listeners
*/
- public void execute(FacesContext context,PhaseListener[] listeners){
+ public void execute(FacesContext context){
int listenerToCall = 0;
- PhaseEvent event = new PhaseEvent(context,getPhaseId(),_lifecycle);
+ PhaseEvent event = new PhaseEvent(context,getPhaseId(),getLifecycle());
+ PhaseListener[] listeners = getLifecycle().getPhaseListeners();
// Execute listeners before phase.
try {
for(;listenerToCall<listeners.length;listenerToCall++){
@@ -71,16 +71,14 @@
}
if(!context.getRenderResponse() && !context.getResponseComplete()){
- executeNextPhase(context,listeners);
+ executeNextPhase(context);
}
}
/**
* @param context
- * @param listeners
*/
- protected abstract void executeNextPhase(FacesContext context,
- PhaseListener[] listeners);
+ protected abstract void executeNextPhase(FacesContext context);
/**
@@ -99,4 +97,12 @@
return 0 == getPhaseId().compareTo(phaseId) || 0 ==
PhaseId.ANY_PHASE.compareTo(phaseId);
}
+
+ /**
+ * @return the lifecycle
+ */
+ public Lifecycle getLifecycle() {
+ return _lifecycle;
+ }
+
}
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -79,7 +79,7 @@
* @see javax.faces.lifecycle.Lifecycle#execute(javax.faces.context.FacesContext)
*/
public void execute(FacesContext context) throws FacesException {
- executePhase.execute(context, getPhaseListeners());
+ executePhase.execute(context);
}
/**
@@ -88,7 +88,7 @@
* @see javax.faces.lifecycle.Lifecycle#render(javax.faces.context.FacesContext)
*/
public void render(FacesContext context) throws FacesException {
- renderPhase.execute(context, getPhaseListeners());
+ renderPhase.execute(context);
}
}
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ProcessValidatorsPhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ProcessValidatorsPhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/ProcessValidatorsPhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -5,7 +5,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -27,9 +26,8 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
- nextPhase.execute(context, listeners);
+ protected void executeNextPhase(FacesContext context) {
+ nextPhase.execute(context);
}
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RenderResponsePhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RenderResponsePhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RenderResponsePhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -8,7 +8,6 @@
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -27,8 +26,7 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
+ protected void executeNextPhase(FacesContext context) {
// do nothing.
}
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -5,7 +5,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -27,9 +26,8 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
- nextPhase.execute(context, listeners);
+ protected void executeNextPhase(FacesContext context) {
+ nextPhase.execute(context);
}
/* (non-Javadoc)
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/UpdateModelPhase.java
===================================================================
---
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/UpdateModelPhase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/lifecycle/UpdateModelPhase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -5,7 +5,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
@@ -26,9 +25,8 @@
/* (non-Javadoc)
* @see
org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext,
javax.faces.event.PhaseListener[])
*/
- protected void executeNextPhase(FacesContext context,
- PhaseListener[] listeners) {
- nextPhase.execute(context, listeners);
+ protected void executeNextPhase(FacesContext context) {
+ nextPhase.execute(context);
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -167,7 +167,7 @@
* @see org.ajax4jsf.chameleon.resource.InternetResource#getContentType()
*/
public String getContentType(ResourceContext resourceContext) {
- return getRenderer(null).getContentType();
+ return getRenderer(resourceContext).getContentType();
}
/**
@@ -230,7 +230,7 @@
* @return - any {@link java.io.Serializable} object, or null.
*/
protected Object getDataToStore(FacesContext context, Object data) {
- return getRenderer(null).getData(this, context, data);
+ return getRenderer(new FacesResourceContext(context)).getData(this, context, data);
}
/**
@@ -307,7 +307,7 @@
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(Messages.ENCODE_HTML_INFO, getKey()));
}
- getRenderer(null).encode(this, context, data);
+ getRenderer(new FacesResourceContext(context)).encode(this, context, data);
}
/*
@@ -322,8 +322,8 @@
log.debug(Messages.getMessage(Messages.ENCODE_HTML_INFO_2,
getKey(), attributes));
}
- getRenderer(null).encodeBegin(this, context, data, attributes);
- getRenderer(null).encodeEnd(this, context, data);
+ getRenderer(new FacesResourceContext(context)).encodeBegin(this, context, data,
attributes);
+ getRenderer(new FacesResourceContext(context)).encodeEnd(this, context, data);
}
@@ -339,7 +339,7 @@
log.debug(Messages.getMessage(Messages.ENCODE_BEGIN_HTML_INFO,
getKey(), attrs));
}
- getRenderer(null).encodeBegin(this, context, component, attrs);
+ getRenderer(new FacesResourceContext(context)).encodeBegin(this, context, component,
attrs);
}
@@ -355,7 +355,7 @@
log.debug(Messages.getMessage(Messages.ENCODE_END_HTML_INFO,
getKey()));
}
- getRenderer(null).encodeEnd(this, context, component);
+ getRenderer(new FacesResourceContext(context)).encodeEnd(this, context, component);
}
/*
@@ -370,9 +370,9 @@
.debug(Messages.getMessage(Messages.SEND_CONTENT_INFO,
getKey()));
}
- int total = getRenderer(null).send(this, context);
+ int total = getRenderer(context).send(this, context);
// For cacheable resources, store size.
- if (isCacheable(null)) {
+ if (isCacheable(context)) {
setContentLength(total);
}
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceLifecycle.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -54,7 +54,7 @@
public class ResourceLifecycle extends Lifecycle {
private Lifecycle lifecycle;
-
+
private static final Log _log = LogFactory.getLog(ResourceLifecycle.class);
/*
@@ -122,73 +122,107 @@
phaseListeners = facesLifecycle.getPhaseListeners();
PhaseEvent restoreViewEvent = new PhaseEvent(facesContext,
PhaseId.RESTORE_VIEW, this);
- // Invoke before restore view phase listeners
- for (int i = 0; i < phaseListeners.length; i++) {
- PhaseListener phaseListener = phaseListeners[i];
- if (PhaseId.RESTORE_VIEW.equals(phaseListener.getPhaseId())
- || PhaseId.ANY_PHASE.equals(phaseListener.getPhaseId())) {
- try {
- phaseListener.beforePhase(restoreViewEvent);
+ processPhaseListeners(phaseListeners, restoreViewEvent, true);
+ // Fix for a
http://jira.jboss.org/jira/browse/RF-1056
+ if (facesContext.getResponseComplete())
+ return;
+ // fix for a
http://jira.jboss.com/jira/browse/RF-1064 .
+ // viewRoot can be created outside.
+ UIViewRoot savedViewRoot = facesContext.getViewRoot();
+ try {
+ // create "dummy" viewRoot, to avoid problems in phase
+ // listeners.
+ UIViewRoot root = new UIViewRoot();
+ root.setViewId(resource.getKey());
+ root.setLocale(Locale.getDefault());
+ root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
+ facesContext.setViewRoot(root);
+ // Invoke after restore view phase listeners
+ processPhaseListeners(phaseListeners, restoreViewEvent, false);
+ // Fix for a
http://jira.jboss.org/jira/browse/RF-1056
+ if (!facesContext.getResponseComplete()) {
+ // Invoke before render view phase listeners
+ renderViewEvent = new PhaseEvent(facesContext,
+ PhaseId.RENDER_RESPONSE, this);
+ processPhaseListeners(phaseListeners, renderViewEvent, true);
+ sendResource(resourceContext, resource);
+ processPhaseListeners(phaseListeners, renderViewEvent,
+ false);
+ }
- } catch (Exception e) {
- _log.error("Exception in PhaseListener, restore view : beforePhase", e);
- }
+ } finally {
+ if (null != savedViewRoot) {
+ facesContext.setViewRoot(savedViewRoot);
}
}
- // create "dummy" viewRoot, to avoid problems in phase listeners.
- UIViewRoot root = new UIViewRoot();
- root.setViewId(resource.getKey());
- root.setLocale(Locale.getDefault());
- root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
- facesContext.setViewRoot(root);
- // Invoke after restore view phase listeners
- for (int i = phaseListeners.length - 1; i > 0; i--) {
- PhaseListener phaseListener = phaseListeners[i];
- if (PhaseId.RESTORE_VIEW.equals(phaseListener.getPhaseId())
- || PhaseId.ANY_PHASE.equals(phaseListener.getPhaseId())) {
- try {
- phaseListener.afterPhase(restoreViewEvent);
+ } else {
+ sendResource(resourceContext, resource);
+ }
+ }
- } catch (Exception e) {
- _log.error("Exception in PhaseListener, restore view : afterPhase", e);
- }
- }
- }
- // Invoke before render view phase listeners
- renderViewEvent = new PhaseEvent(facesContext,
- PhaseId.RENDER_RESPONSE, this);
+ /**
+ * Send phase event to all apropriate PhaseListener's
+ *
+ * @param phaseListeners
+ * @param phaseEvent
+ * @param beforePhase
+ * TODO
+ */
+ private void processPhaseListeners(PhaseListener[] phaseListeners,
+ PhaseEvent phaseEvent, boolean beforePhase) {
+ if (beforePhase) {
+ // Invoke before phase listeners
for (int i = 0; i < phaseListeners.length; i++) {
PhaseListener phaseListener = phaseListeners[i];
- if (PhaseId.RENDER_RESPONSE.equals(phaseListener.getPhaseId())
- || PhaseId.ANY_PHASE.equals(phaseListener.getPhaseId())) {
- try {
- phaseListener.beforePhase(renderViewEvent);
+ invokePhaseListener(phaseListener, phaseEvent, beforePhase);
+ }
- } catch (Exception e) {
- _log.error("Exception in PhaseListener, render view : beforePhase", e);
- }
- }
- }
- }
- resource.sendHeaders(resourceContext);
- resource.send(resourceContext);
- if (null != facesContext) {
- // Invoke after restore view phase listeners
+ } else {
+ // Invoke after phase listeners, in reverse order.
for (int i = phaseListeners.length - 1; i > 0; i--) {
PhaseListener phaseListener = phaseListeners[i];
- if (PhaseId.RENDER_RESPONSE.equals(phaseListener.getPhaseId())
- || PhaseId.ANY_PHASE.equals(phaseListener.getPhaseId())) {
- try {
- phaseListener.afterPhase(renderViewEvent);
+ invokePhaseListener(phaseListener, phaseEvent, beforePhase);
+ }
- } catch (Exception e) {
- _log.error("Exception in PhaseListener, render view : afterPhase", e);
- }
+ }
+ }
+
+ /**
+ * @param phaseListener
+ * @param phaseEvent
+ * @param beforePhase
+ */
+ private void invokePhaseListener(PhaseListener phaseListener,
+ PhaseEvent phaseEvent, boolean beforePhase) {
+ if (phaseEvent.getPhaseId().equals(phaseListener.getPhaseId())
+ || PhaseId.ANY_PHASE.equals(phaseListener.getPhaseId())) {
+ try {
+ if (beforePhase) {
+ phaseListener.beforePhase(phaseEvent);
+ } else {
+ phaseListener.afterPhase(phaseEvent);
}
+ } catch (Exception e) {
+ _log
+ .error("Exception in PhaseListener, phase :"
+ + phaseEvent.getPhaseId().toString()
+ + (beforePhase ? " : beforePhase"
+ : " : afterPhase"), e);
}
}
}
+ /**
+ * @param resourceContext
+ * @param resource
+ * @throws IOException
+ */
+ private void sendResource(ResourceContext resourceContext,
+ InternetResource resource) throws IOException {
+ resource.sendHeaders(resourceContext);
+ resource.send(resourceContext);
+ }
+
protected synchronized Lifecycle getFacesLifecycle() {
if (lifecycle == null) {
// Acquire our Lifecycle instance
Modified: trunk/samples/seamIntegration/pom.xml
===================================================================
--- trunk/samples/seamIntegration/pom.xml 2007-10-05 17:06:42 UTC (rev 3288)
+++ trunk/samples/seamIntegration/pom.xml 2007-10-05 23:30:08 UTC (rev 3289)
@@ -27,112 +27,72 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <webResources>
+ <!--
+ <webResources>
<resource>
- <directory>${seamHome}</directory>
- <targetPath>WEB-INF/lib</targetPath>
- <includes>
- <include>jboss-seam.jar</include>
- <include>jboss-seam-ui.jar</include>
- <include>jboss-seam-debug.jar</include>
- <include>
- jboss-seam-remoting.jar
- </include>
- <include>
- jboss-seam-pdf.jar
- </include>
- </includes>
+ <directory>${seamHome}</directory>
+ <targetPath>WEB-INF/lib</targetPath>
+ <includes>
+ <include>jboss-seam.jar</include>
+ <include>jboss-seam-ui.jar</include>
+ <include>jboss-seam-debug.jar</include>
+ <include>
+ jboss-seam-remoting.jar
+ </include>
+ <include>
+ jboss-seam-pdf.jar
+ </include>
+ </includes>
</resource>
<resource>
- <directory>${seamHome}/lib</directory>
- <targetPath>WEB-INF/lib</targetPath>
- <includes>
- <include>jboss-el.jar</include>
- </includes>
+ <directory>${seamHome}/lib</directory>
+ <targetPath>WEB-INF/lib</targetPath>
+ <includes>
+ <include>jboss-el.jar</include>
+ </includes>
</resource>
- </webResources>
+ </webResources>
+ -->
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>seam-core</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/jboss-seam.jar</systemPath>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>3.0.0.GA</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>seam-ui</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/jboss-seam-ui.jar</systemPath>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.0.ga</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>seam-debug</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/jboss-seam-debug.jar</systemPath>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.1.ga</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>seam-remoting</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/jboss-seam-remoting.jar</systemPath>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>2.0.0.CR2</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>seam-pdf</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/jboss-seam-pdf.jar</systemPath>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ <version>2.0.0.CR2</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-el</artifactId>
- <version>2.0.0.BETA</version>
- <scope>system</scope>
- <systemPath>${seamHome}/lib/jboss-el.jar</systemPath>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ioc</artifactId>
+ <version>2.0.0.CR2</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>javassist</artifactId>
- <version>3.4.ga</version>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-debug</artifactId>
+ <version>2.0.0.CR2</version>
</dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>1.6.1</version>
- </dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.4.ga</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>3.0.0.ga</version>
- </dependency>
- <dependency>
- <groupId>jstl</groupId>
- <artifactId>jstl</artifactId>
- <version>1.2</version>
- </dependency>
</dependencies>
</project>
Modified:
trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java
===================================================================
---
trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java 2007-10-05
17:06:42 UTC (rev 3288)
+++
trunk/ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java 2007-10-05
23:30:08 UTC (rev 3289)
@@ -64,8 +64,10 @@
return _renderers[0];
}
- public ResourceRenderer getRenderer(ResourceContext arg0) {
- return getRenderer();
+ public ResourceRenderer getRenderer(ResourceContext context) {
+ ImageData data = (ImageData) restoreData(context);
+ ImageRenderer renderer = _renderers[data._format];
+ return renderer;
}
/* (non-Javadoc)
* @see org.ajax4jsf.resource.InternetResourceBase#isCacheable()
@@ -73,6 +75,11 @@
public boolean isCacheable() {
return false;
}
+
+ public boolean isCacheable(ResourceContext resourceContext) {
+ ImageData data = (ImageData) restoreData(resourceContext);
+ return data.cacheable;
+ }
/* (non-Javadoc)
* @see org.ajax4jsf.resource.InternetResourceBase#requireFacesContext()
@@ -106,6 +113,7 @@
try {
dataToStore._bgColor = HtmlColor.decode(bgColor).getRGB();
} catch (Exception e) {}
+ dataToStore.cacheable = paint2D.isCacheable();
return dataToStore;
} else {
@@ -113,15 +121,16 @@
}
}
- private static class ImageData implements Serializable {
+ private static final class ImageData implements Serializable {
- private static final long serialVersionUID = 4452040100045367726L;
+ private static final long serialVersionUID = 4452040100045367728L;
int _width=1;
int _height = 1;
Object _data;
int _format = 0;
Object _paint;
+ boolean cacheable = false;
/*
* init color with transparent by default
*/
@@ -156,7 +165,7 @@
*/
public void send(ResourceContext context) throws IOException {
ImageData data = (ImageData) restoreData(context);
- ImageRenderer renderer = _renderers[data._format];
+ ImageRenderer renderer = (ImageRenderer) getRenderer(context);
FacesContext facesContext = FacesContext.getCurrentInstance();
try {
BufferedImage image = renderer.createImage(data._width,data._height);
@@ -184,14 +193,14 @@
}
}
- public String getContentType(ResourceContext context) {
- Object contentType = threadLocalContentType.get();
- if (contentType != null) {
- return (String) contentType;
- } else {
- return super.getContentType(context);
- }
- }
+// public String getContentType(ResourceContext context) {
+// Object contentType = threadLocalContentType.get();
+// if (contentType != null) {
+// return (String) contentType;
+// } else {
+// return super.getContentType(context);
+// }
+// }
/* (non-Javadoc)
* @see
org.ajax4jsf.resource.InternetResourceBase#sendHeaders(org.ajax4jsf.resource.ResourceContext)