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/08 02:15:06 UTC
svn commit: r1056584 - in
/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main:
java/org/apache/myfaces/html5/behavior/
java/org/apache/myfaces/html5/component/animation/
java/org/apache/myfaces/html5/component/effect/ java/org/apache/myface...
Author: aliok
Date: Sat Jan 8 01:15:04 2011
New Revision: 1056584
URL: http://svn.apache.org/viewvc?rev=1056584&view=rev
Log:
Html5
Added initial drop of effects.
Improved animations
Added:
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsActivationBehavior.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/AnimationsBehavior.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsDeactivationBehavior.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractBaseEffect.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractBaseAnimation.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectScale.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/EventProperty.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/effect/TransitionProperties.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java
- copied, changed from r1056122, 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/renderkit/behavior/EffectsActivationBehaviorRenderer.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/AnimationsBehaviorRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsDeactivationBehaviorRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/BaseEffectRenderer.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/BaseAnimationRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectScaleRenderer.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationScaleRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java
- copied, changed from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/DefaultActivationEvents.java
Modified:
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractAnimations.java
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/renderkit/animation/AnimationsRenderer.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/CSS.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java
myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/faces-config20.vm
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsActivationBehavior.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/AnimationsBehavior.java)
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsActivationBehavior.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsActivationBehavior.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/AnimationsBehavior.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/AnimationsBehavior.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsActivationBehavior.java Sat Jan 8 01:15:04 2011
@@ -29,20 +29,20 @@ import javax.faces.component.behavior.Fa
@ResourceDependency(name = "common.js", library = "org.apache.myfaces.html5", target = "head"),
@ResourceDependency(name = "effect.js", library = "org.apache.myfaces.html5", target = "head")
})
-@FacesBehavior("org.apache.myfaces.html5.AnimationsBehavior")
-public class AnimationsBehavior extends javax.faces.component.behavior.ClientBehaviorBase {
+@FacesBehavior("org.apache.myfaces.html5.EffectsActivationBehavior")
+public class EffectsActivationBehavior extends javax.faces.component.behavior.ClientBehaviorBase {
- public static final String ID = "org.apache.myfaces.html5.AnimationsBehavior";
- public static final String RENDERER_ID = "org.apache.myfaces.html5.AnimationsBehavior";
+ public static final String ID = "org.apache.myfaces.html5.EffectsActivationBehavior";
+ public static final String RENDERER_ID = "org.apache.myfaces.html5.EffectsActivationBehaviorRenderer";
- private String animationIdToHandle;
+ private String effectIdToHandle;
- public String getAnimationIdToHandle() {
- return animationIdToHandle;
+ public String getEffectIdToHandle() {
+ return effectIdToHandle;
}
- public void setAnimationIdToHandle(String animationIdToHandle) {
- this.animationIdToHandle = animationIdToHandle;
+ public void setEffectIdToHandle(String effectIdToHandle) {
+ this.effectIdToHandle = effectIdToHandle;
}
@Override
@@ -50,4 +50,6 @@ public class AnimationsBehavior extends
{
return RENDERER_ID;
}
+
+
}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsDeactivationBehavior.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsDeactivationBehavior.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsDeactivationBehavior.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/behavior/EffectsDeactivationBehavior.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.behavior;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.behavior.FacesBehavior;
+
+@ResourceDependencies(
+{
+ @ResourceDependency(name = "jsf.js", library = "javax.faces", target = "head"),
+ @ResourceDependency(name = "common.js", library = "org.apache.myfaces.html5", target = "head"),
+ @ResourceDependency(name = "effect.js", library = "org.apache.myfaces.html5", target = "head")
+})
+@FacesBehavior("org.apache.myfaces.html5.EffectsDeactivationBehavior")
+public class EffectsDeactivationBehavior extends javax.faces.component.behavior.ClientBehaviorBase {
+
+ public static final String ID = "org.apache.myfaces.html5.EffectsDeactivationBehavior";
+ public static final String RENDERER_ID = "org.apache.myfaces.html5.EffectsDeactivationBehaviorRenderer";
+
+ private String effectIdToHandle;
+
+ public String getEffectIdToHandle() {
+ return effectIdToHandle;
+ }
+
+ public void setEffectIdToHandle(String effectIdToHandle) {
+ this.effectIdToHandle = effectIdToHandle;
+ }
+
+ @Override
+ public String getRendererType()
+ {
+ return RENDERER_ID;
+ }
+}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractAnimations.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/animation/AbstractAnimations.java?rev=1056584&r1=1056583&r2=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractAnimations.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractAnimations.java Sat Jan 8 01:15:04 2011
@@ -21,6 +21,8 @@ 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.effect.TransitionProperties;
@JSFComponent(
name = "fx:animations",
@@ -30,21 +32,12 @@ import org.apache.myfaces.buildtools.mav
family = "org.apache.myfaces.Animations",
type = "org.apache.myfaces.html5.Animations"
)
-public abstract class AbstractAnimations extends javax.faces.component.UIComponentBase {
-
- @JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getDuration();
+public abstract class AbstractAnimations extends javax.faces.component.UIComponentBase implements TransitionProperties, EventProperty {
@JSFProperty(deferredValueType = "java.lang.String")
public abstract String getIteration();
@JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getTimingFunction();
-
- @JSFProperty(deferredValueType = "java.lang.String")
public abstract String getDirection();
- @JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getDelay();
-
}
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractBaseEffect.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractBaseAnimation.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/AbstractBaseEffect.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractBaseEffect.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractBaseAnimation.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/animation/AbstractBaseAnimation.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractBaseEffect.java Sat Jan 8 01:15:04 2011
@@ -5,7 +5,7 @@
* 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
+ * with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,14 +17,12 @@
* under the License.
*/
-package org.apache.myfaces.html5.component.animation;
+package org.apache.myfaces.html5.component.effect;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
-import org.apache.myfaces.html5.component.properties.*;
-import org.apache.myfaces.html5.holder.MediaSourceHolder;
@JSFComponent(
- clazz = "org.apache.myfaces.html5.component.animation.BaseAnimation",
+ clazz = "org.apache.myfaces.html5.component.effect.BaseEffect",
configExcluded = true)
-public abstract class AbstractBaseAnimation extends javax.faces.component.UIComponentBase{
+public abstract class AbstractBaseEffect extends javax.faces.component.UIComponentBase{
}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectScale.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/AbstractEffectScale.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectScale.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/effect/AbstractEffectScale.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+@JSFComponent(
+ name = "fx:effectScale",
+ clazz = "org.apache.myfaces.html5.component.effect.EffectScale",
+ tagClass = "org.apache.myfaces.html5.tag.effect.EffectScaleTag",
+ defaultRendererType = "org.apache.myfaces.html5.EffectScale",
+ family = "org.apache.myfaces.EffectScale",
+ type = "org.apache.myfaces.html5.EffectScale"
+)
+public abstract class AbstractEffectScale extends org.apache.myfaces.html5.component.effect.BaseEffect{
+
+ @JSFProperty(deferredValueType = "java.lang.Double", required = true)
+ public abstract double getSize();
+}
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=1056584&r1=1056583&r2=1056584&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 Sat Jan 8 01:15:04 2011
@@ -21,6 +21,8 @@ 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.effect.TransitionProperties;
@JSFComponent(
name = "fx:effects",
@@ -30,7 +32,16 @@ import org.apache.myfaces.buildtools.mav
family = "org.apache.myfaces.Effects",
type = "org.apache.myfaces.html5.Effects"
)
-public abstract class AbstractEffects extends javax.faces.component.UIComponentBase {
+public abstract class AbstractEffects extends javax.faces.component.UIComponentBase implements TransitionProperties, EventProperty {
+ private String transitionComponentId;
+
+ public void setTransitionComponentId(String transitionComponentId) {
+ this.transitionComponentId = transitionComponentId;
+ }
+
+ public String getTransitionComponentId() {
+ return transitionComponentId;
+ }
@JSFProperty(deferredValueType = "java.lang.String")
public abstract String getEvent();
@@ -40,14 +51,4 @@ public abstract class AbstractEffects ex
@JSFProperty(deferredValueType = "java.lang.String")
public abstract String getAdditionalStyleClassToActivate();
-
- @JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getDuration();
-
- @JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getIteration();
-
- @JSFProperty(deferredValueType = "java.lang.String")
- public abstract String getTimingFunction();
-
}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/EventProperty.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/EventProperty.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/EventProperty.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/EventProperty.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+public interface EventProperty {
+
+ //TODO: not used?
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getEvent();
+
+}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/effect/TransitionProperties.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/effect/TransitionProperties.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/effect/TransitionProperties.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/component/properties/effect/TransitionProperties.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.effect;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+public interface TransitionProperties {
+
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getDuration();
+
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getTimingFunction();
+
+ @JSFProperty(deferredValueType = "java.lang.String")
+ public abstract String getDelay();
+
+}
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java (from r1056122, 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/EffectsHandler.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/EffectsHandler.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/handler/AnimationsHandler.java&r1=1056122&r2=1056584&rev=1056584&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/EffectsHandler.java Sat Jan 8 01:15:04 2011
@@ -21,9 +21,11 @@ package org.apache.myfaces.html5.handler
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
-import org.apache.myfaces.html5.behavior.AnimationsBehavior;
-import org.apache.myfaces.html5.component.animation.AbstractAnimations;
-import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
+import org.apache.myfaces.html5.behavior.EffectsActivationBehavior;
+import org.apache.myfaces.html5.behavior.EffectsDeactivationBehavior;
+import org.apache.myfaces.html5.component.effect.AbstractEffects;
+import org.apache.myfaces.html5.renderkit.util.DefaultActivationEvents;
+import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
import javax.faces.FacesException;
import javax.faces.application.Application;
@@ -33,14 +35,17 @@ import javax.faces.context.FacesContext;
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.TagAttribute;
+import java.util.Set;
-@JSFFaceletTag(name = "fx:animations", componentClass = "org.apache.myfaces.html5.component.animation.Animations")
-public class AnimationsHandler extends javax.faces.view.facelets.ComponentHandler {
+@JSFFaceletTag(name = "fx:effects", componentClass = "org.apache.myfaces.html5.component.effect.Effects")
+public class EffectsHandler extends javax.faces.view.facelets.ComponentHandler {
private final TagAttribute event;
+ private final TagAttribute deactivationEvents;
- public AnimationsHandler(ComponentConfig config) {
+ public EffectsHandler(ComponentConfig config) {
super(config);
event = getAttribute("event");
+ deactivationEvents = getAttribute("deactivationEvents");
}
@Override
@@ -50,22 +55,36 @@ public class AnimationsHandler extends j
if (!(parent instanceof ClientBehaviorHolder))
throw new FacesException("Parent is not ClientBehaviorHolder");
- if (!(uiComponent instanceof AbstractAnimations))
- throw new FacesException("Created component is not a AbstractAnimations");
+ if (!(uiComponent instanceof AbstractEffects))
+ throw new FacesException("Created component is not a AbstractEffects");
+
+ AbstractEffects component = (AbstractEffects) uiComponent;
FacesContext context = faceletContext.getFacesContext();
Application app = context.getApplication();
- String behaviorId = AnimationsBehavior.ID;
- AnimationsBehavior behavior = (AnimationsBehavior) app.createBehavior(behaviorId);
- behavior.setAnimationIdToHandle(uiComponent.getClientId(faceletContext.getFacesContext()));
+ EffectsActivationBehavior activationBehavior = (EffectsActivationBehavior) app.createBehavior(EffectsActivationBehavior.ID);
+
+ activationBehavior.setEffectIdToHandle(component.getClientId(faceletContext.getFacesContext()));
String eventName = getEventName(faceletContext);
if(StringUtils.isBlank(eventName))
eventName = ((ClientBehaviorHolder) parent).getDefaultEventName();
- ((ClientBehaviorHolder) parent).addClientBehavior(eventName, behavior);
- ((ClientBehaviorHolder) parent).addClientBehavior(ClientBehaviorEvents.ANIMATIONEND_EVENT, behavior);
+ ((ClientBehaviorHolder) parent).addClientBehavior(eventName, activationBehavior);
+
+ if(!StringUtils.isBlank(eventName) || deactivationEvents!=null){
+ EffectsDeactivationBehavior deactivationBehavior = (EffectsDeactivationBehavior) app.createBehavior(EffectsDeactivationBehavior.ID);
+
+ deactivationBehavior.setEffectIdToHandle(component.getClientId(faceletContext.getFacesContext()));
+
+ String[] deactivationEventNames = getDeactivationEventNames(faceletContext);
+ if(deactivationEventNames!=null){
+ for (String deactivationEventName : deactivationEventNames) {
+ ((ClientBehaviorHolder) parent).addClientBehavior(deactivationEventName, deactivationBehavior);
+ }
+ }
+ }
}
public String getEventName(FaceletContext faceletContext) {
@@ -74,4 +93,20 @@ public class AnimationsHandler extends j
return event.getValue(faceletContext);
}
+
+ public String[] getDeactivationEventNames(FaceletContext faceletContext) {
+ if(deactivationEvents==null)
+ return getDefaultDeactivationEvents(this.getEventName(faceletContext));
+
+ final Object objDeactivationEventNames = deactivationEvents.getObject(faceletContext);
+
+ return Html5RendererUtils.resolveStrings(objDeactivationEventNames, getDefaultDeactivationEvents(this.getEventName(faceletContext)));
+ }
+
+ private String[] getDefaultDeactivationEvents(String eventName) {
+ final Set<String> stringSet = DefaultActivationEvents.map.get(eventName);
+ if(stringSet==null || stringSet.isEmpty())
+ return null;
+ return stringSet.toArray(new String[stringSet.size()]);
+ }
}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.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/animation/AnimationsRenderer.java?rev=1056584&r1=1056583&r2=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.java Sat Jan 8 01:15:04 2011
@@ -24,6 +24,7 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.html5.component.animation.AbstractAnimations;
import org.apache.myfaces.html5.renderkit.util.CSS;
import org.apache.myfaces.html5.renderkit.util.HTML5;
+import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
import org.apache.myfaces.shared_html5.renderkit.html.HTML;
import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
@@ -74,7 +75,7 @@ public class AnimationsRenderer extends
//TODO: what happens if id has colon? Will CSS accept it?
//write key frames (let child components render themselves)
- writer.writeText("@-webkit-keyframes " + id + " { ", component, null);
+ writer.writeText("@-webkit-keyframes " + Html5RendererUtils.escapeCssSelector(id) + " { ", component, null);
//TODO: allow only BaseAnimation children!
super.encodeChildren(facesContext, component);
@@ -103,10 +104,10 @@ public class AnimationsRenderer extends
final String delay = getTimeValue(component.getDelay());
StringBuilder builder = new StringBuilder();
- builder.append(".").append(id);
+ builder.append(".").append(Html5RendererUtils.escapeCssSelector(id));
builder.append(" { ");
- appendIfNotNull(builder, CSS.ANIMATION_NAME_PROP, id);
+ appendIfNotNull(builder, CSS.ANIMATION_NAME_PROP, Html5RendererUtils.escapeCssSelector(id));
appendIfNotNull(builder, CSS.ANIMATION_DURATION_PROP, duration);
appendIfNotNull(builder, CSS.ANIMATION_ITERATION_COUNT_PROP, iteration);
appendIfNotNull(builder, CSS.ANIMATION_TIMING_FUNCTION_PROP, timingFunction);
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsActivationBehaviorRenderer.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/AnimationsBehaviorRenderer.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/behavior/EffectsActivationBehaviorRenderer.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsActivationBehaviorRenderer.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/AnimationsBehaviorRenderer.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/AnimationsBehaviorRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsActivationBehaviorRenderer.java Sat Jan 8 01:15:04 2011
@@ -16,9 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.myfaces.html5.renderkit.behavior;
-import org.apache.myfaces.html5.behavior.AnimationsBehavior;
+import org.apache.myfaces.html5.behavior.EffectsActivationBehavior;
import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
import javax.faces.FacesException;
@@ -26,28 +27,22 @@ import javax.faces.component.behavior.Cl
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.render.ClientBehaviorRenderer;
-public class AnimationsBehaviorRenderer extends ClientBehaviorRenderer
+public class EffectsActivationBehaviorRenderer extends ClientBehaviorRenderer
{
@Override
public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior)
{
- if (!(behavior instanceof AnimationsBehavior))
+ if (!(behavior instanceof EffectsActivationBehavior))
{
- throw new FacesException("Behavior is not a AnimationsBehavior.");
+ throw new FacesException("Behavior is not a EffectsActivationBehavior.");
}
- AnimationsBehavior effectBehavior = (AnimationsBehavior) behavior;
+ EffectsActivationBehavior effectBehavior = (EffectsActivationBehavior) behavior;
- String strEffects = effectBehavior.getAnimationIdToHandle();
+ String strEffects = effectBehavior.getEffectIdToHandle();
- String format;
- if(ClientBehaviorEvents.ANIMATIONEND_EVENT.equals(behaviorContext.getEventName())){
- format = "myfaces.html5.effect.removeEffect(this, '%s');";
- }
- else{
- format = "myfaces.html5.effect.addEffect(this, '%s');";
- }
+ String format = "myfaces.html5.effect.addEffect(this, '%s');";
return String.format(format, strEffects);
}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsDeactivationBehaviorRenderer.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/behavior/EffectsDeactivationBehaviorRenderer.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsDeactivationBehaviorRenderer.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/EffectsDeactivationBehaviorRenderer.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,50 @@
+/*
+ * 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.renderkit.behavior;
+
+import org.apache.myfaces.html5.behavior.EffectsActivationBehavior;
+import org.apache.myfaces.html5.behavior.EffectsDeactivationBehavior;
+import org.apache.myfaces.html5.renderkit.util.ClientBehaviorEvents;
+
+import javax.faces.FacesException;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.render.ClientBehaviorRenderer;
+
+public class EffectsDeactivationBehaviorRenderer extends ClientBehaviorRenderer
+{
+
+ @Override
+ public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior)
+ {
+ if (!(behavior instanceof EffectsDeactivationBehavior))
+ {
+ throw new FacesException("Behavior is not a EffectsDeactivationBehavior.");
+ }
+
+ EffectsDeactivationBehavior effectBehavior = (EffectsDeactivationBehavior) behavior;
+
+ String strEffects = effectBehavior.getEffectIdToHandle();
+
+ String format = "myfaces.html5.effect.removeEffect(this, '%s');";
+
+ return String.format(format, strEffects);
+ }
+}
\ No newline at end of file
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/BaseEffectRenderer.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/BaseAnimationRenderer.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/BaseEffectRenderer.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/BaseEffectRenderer.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/BaseAnimationRenderer.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/BaseAnimationRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/BaseEffectRenderer.java Sat Jan 8 01:15:04 2011
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.myfaces.html5.renderkit.animation;
+package org.apache.myfaces.html5.renderkit.effect;
-import org.apache.myfaces.html5.component.animation.AbstractBaseAnimation;
+import org.apache.myfaces.html5.component.effect.AbstractBaseEffect;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
@@ -28,20 +28,20 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
-public abstract class BaseAnimationRenderer extends HtmlRenderer {
+public abstract class BaseEffectRenderer extends HtmlRenderer {
@Override
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
super.encodeBegin(facesContext, uiComponent);
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractBaseAnimation.class);
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractBaseEffect.class);
- AbstractBaseAnimation component = (AbstractBaseAnimation) uiComponent;
+ AbstractBaseEffect component = (AbstractBaseEffect) uiComponent;
ResponseWriter writer = facesContext.getResponseWriter();
- writer.write(" " + getKeyFrameBodyDefinition(facesContext, component) + " ");
+ writer.write(" " + getEffectDefinition(facesContext, component) + " ");
}
- protected abstract String getKeyFrameBodyDefinition(FacesContext facesContext, AbstractBaseAnimation component);
+ protected abstract String getEffectDefinition(FacesContext facesContext, AbstractBaseEffect component);
}
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectScaleRenderer.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationScaleRenderer.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/EffectScaleRenderer.java?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectScaleRenderer.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationScaleRenderer.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationScaleRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectScaleRenderer.java Sat Jan 8 01:15:04 2011
@@ -17,36 +17,34 @@
* under the License.
*/
-package org.apache.myfaces.html5.renderkit.animation;
+package org.apache.myfaces.html5.renderkit.effect;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
-import org.apache.myfaces.html5.component.animation.AbstractAnimationScale;
-import org.apache.myfaces.html5.component.animation.AbstractBaseAnimation;
+import org.apache.myfaces.html5.component.effect.AbstractBaseEffect;
+import org.apache.myfaces.html5.component.effect.AbstractEffectScale;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
import javax.faces.context.FacesContext;
import java.text.NumberFormat;
import java.util.Locale;
-@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.AnimationScale", type = "org.apache.myfaces.html5.AnimationScale")
-public class AnimationScaleRenderer extends BaseAnimationRenderer {
+@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.EffectScale", type = "org.apache.myfaces.html5.EffectScale")
+public class EffectScaleRenderer extends BaseEffectRenderer {
@Override
- protected String getKeyFrameBodyDefinition(FacesContext facesContext, AbstractBaseAnimation uiComponent) {
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractAnimationScale.class);
+ protected String getEffectDefinition(FacesContext facesContext, AbstractBaseEffect uiComponent) {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffectScale.class);
- AbstractAnimationScale component = (AbstractAnimationScale) uiComponent;
+ AbstractEffectScale component = (AbstractEffectScale) uiComponent;
- final double minSize = component.getMinSize(); //default value set, if not defined
- final double maxSize = component.getMaxSize(); //default value set, if not defined
+ final double size = component.getSize();
- String format = "0%% {-webkit-transform: scale(%s);} 50%% {-webkit-transform: scale(%s);} 100%% {-webkit-transform: scale(%s);}";
+ String format = "scale(%s)";
final NumberFormat numberFormat = NumberFormat.getInstance(Locale.ENGLISH);
- final String strMaxSize = numberFormat.format(maxSize);
- final String strMinSize = numberFormat.format(minSize);
+ final String strSize = numberFormat.format(size);
- return String.format(format, strMaxSize, strMinSize, strMaxSize);
+ return String.format(format,strSize);
}
}
\ No newline at end of file
Copied: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java (from r1056122, myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.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?p2=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java&p1=myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.java&r1=1056122&r2=1056584&rev=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/animation/AnimationsRenderer.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/effect/EffectsRenderer.java Sat Jan 8 01:15:04 2011
@@ -17,13 +17,14 @@
* under the License.
*/
-package org.apache.myfaces.html5.renderkit.animation;
+package org.apache.myfaces.html5.renderkit.effect;
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
-import org.apache.myfaces.html5.component.animation.AbstractAnimations;
+import org.apache.myfaces.html5.component.effect.AbstractEffects;
import org.apache.myfaces.html5.renderkit.util.CSS;
import org.apache.myfaces.html5.renderkit.util.HTML5;
+import org.apache.myfaces.html5.renderkit.util.Html5RendererUtils;
import org.apache.myfaces.shared_html5.renderkit.RendererUtils;
import org.apache.myfaces.shared_html5.renderkit.html.HTML;
import org.apache.myfaces.shared_html5.renderkit.html.HtmlRenderer;
@@ -39,8 +40,8 @@ import java.io.IOException;
@ListenerFor(systemEventClass = PostAddToViewEvent.class),
@ListenerFor(systemEventClass = PostBuildComponentTreeOnRestoreViewEvent.class)
})
-@JSFRenderer(renderKitId = "HTML_BASIC", family = "org.apache.myfaces.Animations", type = "org.apache.myfaces.html5.Animations")
-public class AnimationsRenderer extends HtmlRenderer implements ComponentSystemEventListener {
+@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() {
@@ -51,9 +52,9 @@ public class AnimationsRenderer extends
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
super.encodeBegin(facesContext, uiComponent);
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractAnimations.class);
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
- AbstractAnimations component = (AbstractAnimations) uiComponent;
+ AbstractEffects component = (AbstractEffects) uiComponent;
ResponseWriter writer = facesContext.getResponseWriter();
@@ -62,9 +63,9 @@ public class AnimationsRenderer extends
@Override
public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractAnimations.class);
+ RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractEffects.class);
- AbstractAnimations component = (AbstractAnimations) uiComponent;
+ AbstractEffects component = (AbstractEffects) uiComponent;
ResponseWriter writer = facesContext.getResponseWriter();
@@ -74,14 +75,14 @@ public class AnimationsRenderer extends
//TODO: what happens if id has colon? Will CSS accept it?
//write key frames (let child components render themselves)
- writer.writeText("@-webkit-keyframes " + id + " { ", component, null);
- //TODO: allow only BaseAnimation children!
+ writer.writeText("." + Html5RendererUtils.escapeCssSelector(id) + " { -webkit-transform: ", component, null);
+ //TODO: allow only BaseEffect children!
super.encodeChildren(facesContext, component);
- writer.writeText(" } ", component, null);
+ writer.writeText(" ; } ", component, null);
//write CSS class definition with animation definition
- writer.writeText(getAnimationDefinition(facesContext, component),component, null);
+ writer.writeText(getTransitionDefinition(component),component, null);
}
@Override
@@ -94,24 +95,19 @@ public class AnimationsRenderer extends
writer.endElement(HTML.STYLE_ELEM);
}
- protected String getAnimationDefinition(FacesContext facesContext, AbstractAnimations component){
- final String id = component.getClientId(facesContext);
- final String duration = getTimeValue(component.getDuration());
- final String iteration = component.getIteration();
+ protected String getTransitionDefinition(AbstractEffects component){
final String timingFunction = component.getTimingFunction();
- final String direction = component.getDirection();
+ final String duration = getTimeValue(component.getDuration());
final String delay = getTimeValue(component.getDelay());
StringBuilder builder = new StringBuilder();
- builder.append(".").append(id);
+ builder.append("#").append(Html5RendererUtils.escapeCssSelector(component.getTransitionComponentId()));
builder.append(" { ");
- appendIfNotNull(builder, CSS.ANIMATION_NAME_PROP, id);
- appendIfNotNull(builder, CSS.ANIMATION_DURATION_PROP, duration);
- appendIfNotNull(builder, CSS.ANIMATION_ITERATION_COUNT_PROP, iteration);
- appendIfNotNull(builder, CSS.ANIMATION_TIMING_FUNCTION_PROP, timingFunction);
- appendIfNotNull(builder, CSS.ANIMATION_DIRECTION_PROP, direction);
- appendIfNotNull(builder, CSS.ANIMATION_DELAY_PROP, delay);
+ 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("} ");
@@ -140,6 +136,9 @@ public class AnimationsRenderer extends
UIComponent component = event.getComponent();
FacesContext facesContext = FacesContext.getCurrentInstance();
+ if(StringUtils.isBlank(((AbstractEffects)component).getTransitionComponentId()))
+ ((AbstractEffects)component).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=1056584&r1=1056583&r2=1056584&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 Sat Jan 8 01:15:04 2011
@@ -27,4 +27,9 @@ public interface CSS {
String ANIMATION_TIMING_FUNCTION_PROP = "-webkit-animation-timing-function";
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";
}
Added: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/DefaultActivationEvents.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/DefaultActivationEvents.java?rev=1056584&view=auto
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/DefaultActivationEvents.java (added)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/DefaultActivationEvents.java Sat Jan 8 01:15:04 2011
@@ -0,0 +1,122 @@
+/*
+ * 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.renderkit.util;
+
+import java.util.*;
+
+public abstract class DefaultActivationEvents {
+ public final static Map<String, Set<String>> map = new DeactivationEventMap().
+ add(event("blur"). deactivationEvent("focus")).
+ add(event("drag"). deactivationEvent("dragend")).
+ add(event("dragend"). deactivationEvent("drag")).
+ add(event("dragenter"). deactivationEvent("dragleave") .deactivationEvent("drop")).
+ add(event("dragleave"). deactivationEvent("dragenter")).
+ add(event("dragover"). deactivationEvent("dragleave") .deactivationEvent("drop")).
+ add(event("dragstart"). deactivationEvent("dragend")).
+ add(event("focus"). deactivationEvent("blur")).
+ add(event("invalid"). deactivationEvent("input")).
+ add(event("keydown"). deactivationEvent("keyup")).
+ add(event("loadstart"). deactivationEvent("load")).
+ add(event("mousedown"). deactivationEvent("mouseup")).
+ add(event("mouseout"). deactivationEvent("mouseover")).
+ add(event("mouseover"). deactivationEvent("mouseout")).
+ add(event("pause"). deactivationEvent("play") .deactivationEvent("playing")).
+ add(event("play"). deactivationEvent("pause")).
+ add(event("playing"). deactivationEvent("pause")).
+ add(event("reset"). deactivationEvent("input")).
+ add(event("seeked"). deactivationEvent("seeking")).
+ add(event("seeking"). deactivationEvent("seeked")).
+ //add(event("abort").
+ //add(event("canplay").
+ //add(event("canplaythrough").
+ //add(event("change").
+ //add(event("click").
+ //add(event("contextmenu").
+ //add(event("cuechange").
+ //add(event("dblclick").
+ //add(event("drop").
+ //add(event("durationchange").
+ //add(event("emptied").
+ //add(event("ended").
+ //add(event("error").
+ //add(event("formchange").
+ //add(event("forminput").
+ //add(event("input").
+ //add(event("keypress").
+ //add(event("keyup").
+ //add(event("load").
+ //add(event("loadeddata").
+ //add(event("loadedmetadata").
+ //add(event("mousemove").
+ //add(event("mouseup").
+ //add(event("mousewheel").
+ //add(event("progress").
+ //add(event("ratechange").
+ //add(event("readystatechange").
+ //add(event("scroll").
+ //add(event("select").
+ //add(event("show").
+ //add(event("stalled").
+ //add(event("submit").
+ //add(event("suspend").
+ //add(event("timeupdate").
+ //add(event("volumechange").
+ //add(event("waiting").
+ unmodifiable();
+
+ private static DeactivationEventSet event(String event) {
+ return new DeactivationEventSet(event);
+ }
+
+ private static class DeactivationEventMap {
+ private List<DeactivationEventSet> deactivationEventLists = new ArrayList<DeactivationEventSet>();
+
+ private DeactivationEventMap add(DeactivationEventSet deactivationEventList){
+ deactivationEventLists.add(deactivationEventList);
+ return this;
+ }
+
+ private Map<String, Set<String>> unmodifiable(){
+ Map<String, Set<String>> map = new HashMap<String, Set<String>>();
+ for (DeactivationEventSet deactivationEventList : deactivationEventLists) {
+ map.put(deactivationEventList.event, deactivationEventList.deactivationEventSet);
+ }
+
+ return map;
+ }
+ }
+
+ private static class DeactivationEventSet {
+ private String event;
+ private Set<String> deactivationEventSet = new HashSet<String>();
+
+ private DeactivationEventSet(String event) {
+ this.event = event;
+ }
+
+ private DeactivationEventSet deactivationEvent(String deactivationEvent){
+ this.deactivationEventSet.add(deactivationEvent);
+ return this;
+ }
+
+
+ }
+
+}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.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/Html5RendererUtils.java?rev=1056584&r1=1056583&r2=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java Sat Jan 8 01:15:04 2011
@@ -248,4 +248,10 @@ public class Html5RendererUtils
return HtmlRendererUtils.findUIOutputConverterFailSafe(facesContext, component);
}
+ public static String escapeCssSelector(String selector) {
+ if(selector==null)
+ return null;
+
+ return selector.replace(":", "\\:");
+ }
}
Modified: myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/faces-config20.vm
URL: http://svn.apache.org/viewvc/myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/faces-config20.vm?rev=1056584&r1=1056583&r2=1056584&view=diff
==============================================================================
--- myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/faces-config20.vm (original)
+++ myfaces/gsoc/html5-comp-lib/trunk/html5-comp-lib-core/src/main/resources/META-INF/faces-config20.vm Sat Jan 8 01:15:04 2011
@@ -95,6 +95,14 @@ $baseContent
<client-behavior-renderer-type>org.apache.myfaces.html5.AnimationsBehavior</client-behavior-renderer-type>
<client-behavior-renderer-class>org.apache.myfaces.html5.renderkit.behavior.AnimationsBehaviorRenderer</client-behavior-renderer-class>
</client-behavior-renderer>
+ <client-behavior-renderer>
+ <client-behavior-renderer-type>org.apache.myfaces.html5.EffectsActivationBehaviorRenderer</client-behavior-renderer-type>
+ <client-behavior-renderer-class>org.apache.myfaces.html5.renderkit.behavior.EffectsActivationBehaviorRenderer</client-behavior-renderer-class>
+ </client-behavior-renderer>
+ <client-behavior-renderer>
+ <client-behavior-renderer-type>org.apache.myfaces.html5.EffectsDeactivationBehaviorRenderer</client-behavior-renderer-type>
+ <client-behavior-renderer-class>org.apache.myfaces.html5.renderkit.behavior.EffectsDeactivationBehaviorRenderer</client-behavior-renderer-class>
+ </client-behavior-renderer>
</render-kit>
#end