You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by al...@apache.org on 2011/01/17 23:55:28 UTC
svn commit: r1060121 - in
/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5:
component/effect/ component/properties/ handler/ renderkit/effect/
renderkit/util/
Author: aliok
Date: Mon Jan 17 22:55:28 2011
New Revision: 1060121
URL: http://svn.apache.org/viewvc?rev=1060121&view=rev
Log:
Html5
Refactored effect and animation components
Added:
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectOutput.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TargetProperty.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectOutputRenderer.java
- copied, changed from r1057057, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java
Modified:
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffects.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectOutput.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectOutput.java?rev=1060121&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectOutput.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectOutput.java Mon Jan 17 22:55:28 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.html5.component.effect;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.html5.component.properties.TargetProperty;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * Provides support for rendering the style generated respect to children effects.
+ * @author Ali Ok
+ */
+@JSFComponent(
+ name = "fx:effectOutput",
+ clazz = "org.apache.myfaces.html5.component.effect.EffectOutput",
+ tagClass = "org.apache.myfaces.html5.tag.effect.EffectOutputTag",
+ defaultRendererType = "org.apache.myfaces.html5.EffectOutput",
+ family = "org.apache.myfaces.EffectOutput",
+ type = "org.apache.myfaces.html5.EffectOutput"
+)
+public abstract class AbstractEffectOutput extends javax.faces.component.UIComponentBase implements TargetProperty {
+
+}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffects.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffects.java?rev=1060121&r1=1060120&r2=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffects.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffects.java Mon Jan 17 22:55:28 2011
@@ -22,6 +22,7 @@ package org.apache.myfaces.html5.compone
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
import org.apache.myfaces.html5.component.properties.EventProperty;
+import org.apache.myfaces.html5.component.properties.TargetProperty;
import org.apache.myfaces.html5.component.properties.effect.TransitionProperties;
/**
@@ -38,7 +39,7 @@ import org.apache.myfaces.html5.componen
family = "org.apache.myfaces.Effects",
type = "org.apache.myfaces.html5.Effects"
)
-public abstract class AbstractEffects extends javax.faces.component.UIComponentBase implements TransitionProperties, EventProperty {
+public abstract class AbstractEffects extends org.apache.myfaces.html5.component.effect.EffectOutput implements TransitionProperties{
private String transitionComponentId;
public void setTransitionComponentId(String transitionComponentId) {
@@ -49,6 +50,9 @@ public abstract class AbstractEffects ex
return transitionComponentId;
}
+ @JSFProperty(tagExcluded = true)
+ public abstract String getEvent();
+
/**
* Event(s) to deactivate to effect. The effect is activated on the event defined with the 'event' attribute, and deactivated
* on any of the events defined with this attribute. Value can be strings separated with comma, list of strings or array of strings.
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TargetProperty.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TargetProperty.java?rev=1060121&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TargetProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/TargetProperty.java Mon Jan 17 22:55:28 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.html5.component.properties;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ *
+ * @author Ali Ok
+ */
+public interface TargetProperty {
+
+ /**
+ * The <em>target</em> area for which this resource will be rendered. For example, <em>target="head"</em> would
+ * cause the resource to be rendered within the <em>head</em> element.<br/>
+ * If not defined and component is not nested inside of a ClientBehaviorHolder <em>head</em> will be used.<br/>
+ * If component is nested inside of a ClientBehaviorHolder and this attribute is not defined <em>body</em> will be used.<br/>
+ */
+ @JSFProperty(deferredValueType = "java.lang.String", defaultValue = "body")
+ public abstract String getTarget();
+
+}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java?rev=1060121&r1=1060120&r2=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java Mon Jan 17 22:55:28 2011
@@ -47,8 +47,16 @@ public class AnimationsHandler extends j
public void onComponentCreated(FaceletContext faceletContext, UIComponent uiComponent, UIComponent parent) {
super.onComponentPopulated(faceletContext, uiComponent, parent);
- if (!(parent instanceof ClientBehaviorHolder))
- throw new FacesException("Parent is not ClientBehaviorHolder");
+ String eventName = getEventName(faceletContext);
+
+ if ((!(parent instanceof ClientBehaviorHolder))){
+ if(StringUtils.isNotBlank(eventName))
+ throw new FacesException("Parent component is not a ClientBehaviorHolder, however event attribute is defined.");
+ else{
+ //then only render children animations, do not attach a client behavior
+ return;
+ }
+ }
if (!(uiComponent instanceof AbstractAnimations))
throw new FacesException("Created component is not a AbstractAnimations");
@@ -60,7 +68,6 @@ public class AnimationsHandler extends j
behavior.setAnimationIdToHandle(uiComponent.getClientId(faceletContext.getFacesContext()));
- String eventName = getEventName(faceletContext);
if(StringUtils.isBlank(eventName))
eventName = ((ClientBehaviorHolder) parent).getDefaultEventName();
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java?rev=1060121&r1=1060120&r2=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java Mon Jan 17 22:55:28 2011
@@ -52,8 +52,11 @@ public class EffectsHandler extends java
public void onComponentCreated(FaceletContext faceletContext, UIComponent uiComponent, UIComponent parent) {
super.onComponentPopulated(faceletContext, uiComponent, parent);
- if (!(parent instanceof ClientBehaviorHolder))
- throw new FacesException("Parent is not ClientBehaviorHolder");
+ String eventName = getEventName(faceletContext);
+
+ if (!(parent instanceof ClientBehaviorHolder)){
+ throw new FacesException("Created component is not a ClientBehaviorHolder");
+ }
if (!(uiComponent instanceof AbstractEffects))
throw new FacesException("Created component is not a AbstractEffects");
@@ -71,7 +74,6 @@ public class EffectsHandler extends java
activationBehavior.setEffectIdToHandle(effectsIdToHandle);
- String eventName = getEventName(faceletContext);
if(StringUtils.isBlank(eventName))
eventName = ((ClientBehaviorHolder) parent).getDefaultEventName();
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectOutputRenderer.java (from r1057057, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java)
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectOutputRenderer.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectOutputRenderer.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java&r1=1057057&r2=1060121&rev=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectOutputRenderer.java Mon Jan 17 22:55:28 2011
@@ -21,6 +21,7 @@ package org.apache.myfaces.html5.renderk
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
+import org.apache.myfaces.html5.component.effect.AbstractEffectOutput;
import org.apache.myfaces.html5.component.effect.AbstractEffects;
import org.apache.myfaces.html5.renderkit.util.CSS;
import org.apache.myfaces.html5.renderkit.util.HTML5;
@@ -40,8 +41,8 @@ import java.io.IOException;
@ListenerFor(systemEventClass = PostAddToViewEvent.class),
@ListenerFor(systemEventClass = PostBuildComponentTreeOnRestoreViewEvent.class)
})
-@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Effects", type = "org.apache.myfaces.html5.Effects")
-public class EffectsRenderer extends HtmlRenderer implements ComponentSystemEventListener {
+@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.EffectOutput", type = "org.apache.myfaces.html5.EffectOutput")
+public class EffectOutputRenderer extends HtmlRenderer implements ComponentSystemEventListener {
@Override
public boolean getRendersChildren() {
@@ -52,9 +53,9 @@ public class EffectsRenderer extends Htm
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
super.encodeBegin(facesContext, uiComponent);
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffectOutput.class);
- AbstractEffects component = (AbstractEffects) uiComponent;
+ AbstractEffectOutput component = (AbstractEffectOutput) uiComponent;
ResponseWriter writer = facesContext.getResponseWriter();
@@ -63,9 +64,9 @@ public class EffectsRenderer extends Htm
@Override
public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffectOutput.class);
- AbstractEffects component = (AbstractEffects) uiComponent;
+ AbstractEffectOutput component = (AbstractEffectOutput) uiComponent;
ResponseWriter writer = facesContext.getResponseWriter();
@@ -73,15 +74,13 @@ public class EffectsRenderer extends Htm
final String id = component.getClientId(facesContext);
writer.writeAttribute(HTML5.ID_ATTR, id, null);
- //write key frames (let child components render themselves)
+ //let child components render themselves
writer.writeText("." + Html5RendererUtils.escapeCssSelector(id) + " { ", component, null);
//TODO: allow only BaseEffect children!
super.encodeChildren(facesContext, component);
writer.writeText(" } ", component, null);
- //write CSS class definition with animation definition
- writer.writeText(getTransitionDefinition(component),component, null);
}
@Override
@@ -94,51 +93,15 @@ public class EffectsRenderer extends Htm
writer.endElement(HTML.STYLE_ELEM);
}
- protected String getTransitionDefinition(AbstractEffects component){
- final String timingFunction = component.getTimingFunction();
- final String duration = getTimeValue(component.getDuration());
- final String delay = getTimeValue(component.getDelay());
-
- StringBuilder builder = new StringBuilder();
- builder.append("#").append(Html5RendererUtils.escapeCssSelector(component.getTransitionComponentId()));
- builder.append(" { ");
-
- appendIfNotNull(builder, CSS.TRANSITION_PROPERTY_PROP, "all");
- appendIfNotNull(builder, CSS.TRANSITION_DURATION_PROP, duration);
- appendIfNotNull(builder, CSS.TRANSITION_TIMING_FUNCTION_PROP, timingFunction);
- appendIfNotNull(builder, CSS.TRANSITION_DELAY_PROP, delay);
-
- builder.append("} ");
-
- return builder.toString();
- }
-
- private static void appendIfNotNull(StringBuilder builder, String propName, String propValue) {
- if(StringUtils.isBlank(propName))
- throw new RuntimeException("Propname cannot be null");
-
- if(!StringUtils.isBlank(propValue))
- builder.append(propName).append(": ").append(propValue).append("; ");
- }
-
- private static String getTimeValue(String s) {
- if(StringUtils.isBlank(s))
- return null;
- else if(s.endsWith("s") || s.endsWith("ms"))
- return s;
- else
- return s + "s";
- }
-
-
public void processEvent(ComponentSystemEvent event) {
UIComponent component = event.getComponent();
FacesContext facesContext = FacesContext.getCurrentInstance();
- if(StringUtils.isBlank(((AbstractEffects)component).getTransitionComponentId()))
- ((AbstractEffects)component).setTransitionComponentId(component.getParent().getClientId(facesContext));
+ final AbstractEffectOutput abstractEffects = (AbstractEffectOutput) component;
+
+ String target = abstractEffects.getTarget();
- //TODO: other alternative than body? think about ajax PPR
- facesContext.getViewRoot().addComponentResource(facesContext, component, "body");
+ //TODO: think about ajax PPR
+ facesContext.getViewRoot().addComponentResource(facesContext, component, target);
}
}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java?rev=1060121&r1=1060120&r2=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java Mon Jan 17 22:55:28 2011
@@ -31,6 +31,7 @@ import org.apache.myfaces.shared_html5.r
import org.apache.myfaces.view.facelets.PostBuildComponentTreeOnRestoreViewEvent;
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.*;
@@ -41,59 +42,20 @@ import java.io.IOException;
@ListenerFor(systemEventClass = PostBuildComponentTreeOnRestoreViewEvent.class)
})
@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Effects", type = "org.apache.myfaces.html5.Effects")
-public class EffectsRenderer extends HtmlRenderer implements ComponentSystemEventListener {
-
- @Override
- public boolean getRendersChildren() {
- return true;
- }
-
- @Override
- public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- super.encodeBegin(facesContext, uiComponent);
-
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
-
- AbstractEffects component = (AbstractEffects) uiComponent;
-
- ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.STYLE_ELEM, component);
- }
+public class EffectsRenderer extends EffectOutputRenderer implements ComponentSystemEventListener {
@Override
public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
-
AbstractEffects component = (AbstractEffects) uiComponent;
-
ResponseWriter writer = facesContext.getResponseWriter();
- // write id
- final String id = component.getClientId(facesContext);
- writer.writeAttribute(HTML5.ID_ATTR, id, null);
-
- //write key frames (let child components render themselves)
- writer.writeText("." + Html5RendererUtils.escapeCssSelector(id) + " { ", component, null);
- //TODO: allow only BaseEffect children!
-
super.encodeChildren(facesContext, component);
- writer.writeText(" } ", component, null);
//write CSS class definition with animation definition
writer.writeText(getTransitionDefinition(component),component, null);
}
- @Override
- public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- // just close the element
- super.encodeEnd(facesContext, uiComponent);
-
- ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.endElement(HTML.STYLE_ELEM);
- }
-
protected String getTransitionDefinition(AbstractEffects component){
final String timingFunction = component.getTimingFunction();
final String duration = getTimeValue(component.getDuration());
@@ -103,10 +65,16 @@ public class EffectsRenderer extends Htm
builder.append("#").append(Html5RendererUtils.escapeCssSelector(component.getTransitionComponentId()));
builder.append(" { ");
- appendIfNotNull(builder, CSS.TRANSITION_PROPERTY_PROP, "all");
- appendIfNotNull(builder, CSS.TRANSITION_DURATION_PROP, duration);
- appendIfNotNull(builder, CSS.TRANSITION_TIMING_FUNCTION_PROP, timingFunction);
- appendIfNotNull(builder, CSS.TRANSITION_DELAY_PROP, delay);
+ //for now
+ appendIfNotNull(builder, "-webkit-" + CSS.TRANSITION_PROPERTY_PROP, "all");
+ appendIfNotNull(builder, "-webkit-" + CSS.TRANSITION_DURATION_PROP, duration);
+ appendIfNotNull(builder, "-webkit-" + CSS.TRANSITION_TIMING_FUNCTION_PROP, timingFunction);
+ appendIfNotNull(builder, "-webkit-" + CSS.TRANSITION_DELAY_PROP, delay);
+
+ appendIfNotNull(builder, "-o-" + CSS.TRANSITION_PROPERTY_PROP, "all");
+ appendIfNotNull(builder, "-o-" + CSS.TRANSITION_DURATION_PROP, duration);
+ appendIfNotNull(builder, "-o-" + CSS.TRANSITION_TIMING_FUNCTION_PROP, timingFunction);
+ appendIfNotNull(builder, "-o-" + CSS.TRANSITION_DELAY_PROP, delay);
builder.append("} ");
@@ -135,10 +103,12 @@ public class EffectsRenderer extends Htm
UIComponent component = event.getComponent();
FacesContext facesContext = FacesContext.getCurrentInstance();
- if(StringUtils.isBlank(((AbstractEffects)component).getTransitionComponentId()))
- ((AbstractEffects)component).setTransitionComponentId(component.getParent().getClientId(facesContext));
+ final AbstractEffects abstractEffects = (AbstractEffects) component;
+
+ if(StringUtils.isBlank(abstractEffects.getTransitionComponentId())) {
+ abstractEffects.setTransitionComponentId(component.getParent().getClientId(facesContext));
+ }
- //TODO: other alternative than body? think about ajax PPR
facesContext.getViewRoot().addComponentResource(facesContext, component, "body");
}
}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java?rev=1060121&r1=1060120&r2=1060121&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java Mon Jan 17 22:55:28 2011
@@ -21,6 +21,7 @@ package org.apache.myfaces.html5.renderk
public interface CSS {
+ //animations are only supported on Webkit
String ANIMATION_NAME_PROP = "-webkit-animation-name";
String ANIMATION_DURATION_PROP = "-webkit-animation-duration";
String ANIMATION_ITERATION_COUNT_PROP = "-webkit-animation-iteration-count";
@@ -28,10 +29,10 @@ public interface CSS {
String ANIMATION_DIRECTION_PROP = "-webkit-animation-direction";
String ANIMATION_DELAY_PROP = "-webkit-animation-delay";
- String TRANSITION_PROPERTY_PROP = "-webkit-transition-property";
- String TRANSITION_DURATION_PROP = "-webkit-transition-duration";
- String TRANSITION_TIMING_FUNCTION_PROP = "-webkit-transition-timing-function";
- String TRANSITION_DELAY_PROP = "-webkit-transition-delay";
+ String TRANSITION_PROPERTY_PROP = "transition-property";
+ String TRANSITION_DURATION_PROP = "transition-duration";
+ String TRANSITION_TIMING_FUNCTION_PROP = "transition-timing-function";
+ String TRANSITION_DELAY_PROP = "transition-delay";
String TRANSFORMATION_FUNCTION_ROTATE = "rotate";
String TRANSFORMATION_FUNCTION_SCALE_X = "scaleX";