myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmuel...@apache.org
Subject svn commit: r502433 - in /myfaces/tomahawk/trunk/sandbox: core/src/main/java/org/apache/myfaces/custom/imageloop/ core/src/main/resources-facesconfig/META-INF/ core/src/main/resources/org/apache/myfaces/custom/imageloop/ core/src/main/resources/org/apa...
Date Fri, 02 Feb 2007 01:31:53 GMT
Author: gmuellan
Date: Thu Feb  1 17:31:52 2007
New Revision: 502433

URL: http://svn.apache.org/viewvc?view=rev&rev=502433
Log:
Added new slide-show component ImageLoop https://issues.apache.org/jira/browse/TOMAHAWK-876. Many thx to Felix Röthenbacher for contributing this cool component. 

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/GraphicItem.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoop.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItem.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItems.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsIterator.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js
    myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloop_attributes.xml
    myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloopitems_attributes.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/
    myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/ImageLoopBean.java
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/imageloop.jsp
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop1.png   (with props)
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop2.png   (with props)
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop3.png   (with props)
Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
    myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/GraphicItem.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/GraphicItem.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/GraphicItem.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/GraphicItem.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.custom.imageloop;
+
+import java.io.Serializable;
+
+/**
+ * Graphic item.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class GraphicItem implements Serializable {
+
+    private static final long serialVersionUID = 771865529707804687L;
+    
+    private String _url;
+    
+    public GraphicItem(String url) {
+        if (url == null)
+            throw new NullPointerException("url may not be null");
+        _url = url;
+    }
+    
+    public String getUrl() {
+        return _url;
+    }
+    
+    public void setUrl(String url) {
+        _url = url;
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoop.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoop.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoop.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoop.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,152 @@
+/*
+ * 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.custom.imageloop;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+
+/**
+ * HTML image loop component.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class HtmlImageLoop extends UIComponentBase {
+
+    public static final String COMPONENT_FAMILY = "javax.faces.Output";
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlImageLoop";
+    public static final String RENDERER_TYPE = "org.apache.myfaces.HtmlImageLoop";
+    
+    // Value binding constants
+    public static final String VB_DELAY = "delay";
+    public static final String VB_MIN_DELAY = "minDelay";
+    public static final String VB_MAX_DELAY = "maxDelay";
+    public static final String VB_TRANSITION_TIME = "transitionTime";
+    public static final String VB_WIDTH = "width";
+    public static final String VB_HEIGHT = "height";
+    
+    private Integer _delay = null;
+    private Integer _minDelay = null;
+    private Integer _maxDelay = null;
+    private Integer _transitionTime = null;
+    private Integer _width = null;
+    private Integer _height = null;
+    
+    public HtmlImageLoop() {
+        setRendererType(RENDERER_TYPE);
+    }
+    
+    public String getClientId(FacesContext context) {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+        return clientId;
+    }
+
+    public Object saveState(FacesContext facesContext) {
+        Object values[] = new Object[7];
+        values[0] = super.saveState(facesContext);
+        values[1] = _delay;
+        values[2] = _minDelay;
+        values[3] = _maxDelay;
+        values[4] = _transitionTime;
+        values[5] = _width;
+        values[6] = _height;
+        return values;
+    }
+
+    public void restoreState(FacesContext facesContext, Object state) {
+        Object values[] = (Object[])state;
+        super.restoreState(facesContext, values[0]);
+        _delay = (Integer)values[1];
+        _minDelay = (Integer)values[2];
+        _maxDelay = (Integer)values[3];
+        _transitionTime = (Integer)values[4];
+        _width = (Integer)values[5];
+        _height = (Integer)values[6];
+    }
+    
+    public String getFamily() {
+        return COMPONENT_FAMILY;
+    }
+    
+    public Integer getDelay() {
+        if (_delay != null) return _delay;
+        ValueBinding vb = getValueBinding(VB_DELAY);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+    }
+    
+    public void setDelay(Integer delay) {
+        _delay = delay;
+    }
+    
+    public Integer getMinDelay() {
+        if (_minDelay != null) return _minDelay;
+        ValueBinding vb = getValueBinding(VB_MIN_DELAY);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null; 
+    }
+    
+    public void setMinDelay(Integer minDelay) {
+        _minDelay = minDelay;
+    }
+
+    public Integer getMaxDelay() {
+        if (_maxDelay != null) return _maxDelay;
+        ValueBinding vb = getValueBinding(VB_MAX_DELAY);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null; 
+    }
+
+    public void setMaxDelay(Integer maxDelay) {
+        _maxDelay = maxDelay;
+    }
+
+    public Integer getTransitionTime() {
+        if (_transitionTime != null) return _transitionTime;
+        ValueBinding vb = getValueBinding(VB_TRANSITION_TIME);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null; 
+    }
+    
+    public void setTransitionTime(Integer transitionTime) {
+        _transitionTime = transitionTime;
+    }
+    
+    public Integer getWidth() {
+        if (_width != null) return _width;
+        ValueBinding vb = getValueBinding(VB_WIDTH);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null; 
+    }
+    
+    public void setWidth(Integer width) {
+        _width = width;
+    }
+
+    public Integer getHeight() {
+        if (_height != null) return _height;
+        ValueBinding vb = getValueBinding(VB_HEIGHT);
+        return vb != null ? (Integer)vb.getValue(getFacesContext()) : null; 
+    }
+    
+    public void setHeight(Integer height) {
+        _height = height;
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopRenderer.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopRenderer.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopRenderer.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,155 @@
+/*
+ * 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.custom.imageloop;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.renderkit.html.util.AddResource;
+import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+
+import org.apache.myfaces.custom.dojo.DojoConfig;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+
+/**
+ * HTML image loop renderer. 
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class HtmlImageLoopRenderer extends HtmlRenderer {
+    
+    private static final Integer DEFAULT_DELAY = Integer.valueOf(1000);
+    private static final Integer DEFAULT_TRANSITION_TIME = Integer.valueOf(1000);
+
+    /**
+     * Add the javascript files needed by Dojo and the custom javascript for
+     * this component
+     */
+    private void encodeJavascript(FacesContext context, UIComponent uiComponent)
+    throws IOException
+    {
+        String javascriptLocation = (String) uiComponent.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+        DojoUtils.addMainInclude(context, uiComponent, javascriptLocation, new DojoConfig());
+        DojoUtils.addRequire(context, uiComponent, "dojo.event.*");
+        DojoUtils.addRequire(context, uiComponent, "dojo.lfx.*");
+        DojoUtils.addRequire(context, uiComponent, "dojo.html.*");
+
+        AddResource addResource = AddResourceFactory.getInstance(context);
+
+        addResource.addJavaScriptAtPosition(context,
+            AddResource.HEADER_BEGIN, HtmlImageLoop.class, "javascript/imageloop.js");
+    }
+
+    public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+        // Component is rendered in encodeEnd().
+    }
+
+    public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+        // Children are rendered in encodeEnd().
+    }
+
+    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+        RendererUtils.checkParamValidity(facesContext, uiComponent,
+                HtmlImageLoop.class);
+        
+        encodeJavascript(facesContext, uiComponent);
+
+        ResponseWriter writer = facesContext.getResponseWriter();
+        
+        String clientId = uiComponent.getClientId(facesContext);
+        String clientIdImage1 = clientId + ":IMG1";
+        String clientIdImage2 = clientId + ":IMG2";
+        
+        HtmlImageLoop imageLoop = (HtmlImageLoop)uiComponent;
+        
+        Integer delay = imageLoop.getDelay() != null ? imageLoop.getDelay() : DEFAULT_DELAY;
+        Integer minDelay = imageLoop.getMinDelay() != null ? imageLoop.getMinDelay() : DEFAULT_DELAY;
+        Integer maxDelay = imageLoop.getMaxDelay() != null ? imageLoop.getMaxDelay() : DEFAULT_DELAY;
+        Integer transitionTime =
+            imageLoop.getTransitionTime() != null ? imageLoop.getTransitionTime() : DEFAULT_TRANSITION_TIME;
+        Integer width = imageLoop.getWidth();
+        Integer height = imageLoop.getHeight();
+        
+        writer.startElement(HTML.DIV_ELEM, uiComponent);
+        writer.writeAttribute(HTML.ID_ATTR, clientId, null);
+        writer.writeAttribute(HTML.STYLE_ATTR,
+                "position:relative;" +
+                "width:" + width + ";" +
+                "height:" + height, null);
+
+        writer.startElement(HTML.IMG_ELEM, uiComponent);
+        writer.writeAttribute(HTML.ID_ATTR, clientIdImage1, null);
+        writer.writeAttribute(HTML.SRC_ATTR, "", null);
+        writer.writeAttribute(HTML.STYLE_ATTR,
+                "position:absolute;" +
+                "top:0px;" +
+                "left:0px;" +
+                "border-style:none", null);
+        writer.endElement(HTML.IMG_ELEM);
+        
+        writer.startElement(HTML.IMG_ELEM, uiComponent);
+        writer.writeAttribute(HTML.ID_ATTR, clientIdImage2, null);
+        writer.writeAttribute(HTML.SRC_ATTR, "", null);
+        writer.writeAttribute(HTML.STYLE_ATTR,
+                "position:absolute;" +
+                "top:0px;" +
+                "left:0px;" +
+                "border-style:none", null);
+        writer.endElement(HTML.IMG_ELEM);
+        
+        writer.startElement(HTML.SCRIPT_ELEM, uiComponent);
+        writer.writeAttribute(HTML.SCRIPT_LANGUAGE_ATTR, HTML.SCRIPT_LANGUAGE_JAVASCRIPT, null);
+        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+        String jsImageArray = getJavascriptImageArray(facesContext, uiComponent);
+        writer.writeText("new ImageLoop('" + clientId + "', " +
+                jsImageArray + ", " + delay + ", " + minDelay + ", " + maxDelay + ", "+ transitionTime + ")", null);
+        writer.endElement(HTML.SCRIPT_ELEM);
+        
+        writer.endElement(HTML.DIV_ELEM);
+    }
+    
+    private String getJavascriptImageArray(FacesContext facesContext, UIComponent uiComponent) {
+        String jsArray = new String();
+
+        ImageLoopItemsIterator itemIter = new ImageLoopItemsIterator(uiComponent);
+
+        while(itemIter.hasNext()) {
+            GraphicItem graphicItem = (GraphicItem)itemIter.next();
+            String url = graphicItem.getUrl();
+            String src = facesContext.getApplication().getViewHandler().getResourceURL(facesContext, url);
+                
+            if (jsArray.length() == 0)
+                jsArray += "'" + facesContext.getExternalContext().encodeResourceURL(src) + "'";
+            else
+                jsArray += ",'" + facesContext.getExternalContext().encodeResourceURL(src) + "'";
+        }
+        return "[" + jsArray + "]";
+    }
+    
+    public boolean getRendersChildren() {
+        return true;
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopTag.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/HtmlImageLoopTag.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,91 @@
+/*
+ * 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.custom.imageloop;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.myfaces.custom.imageloop.HtmlImageLoop;
+import org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase;
+
+/**
+ * HTML image loop tag.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class HtmlImageLoopTag extends UIComponentTagBase {
+    
+    private String _delay;
+    private String _minDelay;
+    private String _maxDelay;
+    private String _transitionTime;
+    private String _width;
+    private String _height;
+
+    public String getComponentType() {
+        return HtmlImageLoop.COMPONENT_TYPE;
+    }
+
+    public String getRendererType() {
+        return HtmlImageLoop.RENDERER_TYPE;
+    }
+
+    protected void setProperties(UIComponent uiComponent) {
+        super.setProperties(uiComponent);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_DELAY, _delay);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_MIN_DELAY, _minDelay);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_MAX_DELAY, _maxDelay);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_TRANSITION_TIME, _transitionTime);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_WIDTH, _width);
+        setIntegerProperty(uiComponent, HtmlImageLoop.VB_HEIGHT, _height);
+    }
+    
+    public void release() {
+        super.release();
+        _delay = null;
+        _minDelay = null;
+        _maxDelay = null;
+        _transitionTime = null;
+        _width = null;
+        _height = null;
+    }
+    
+    public void setDelay(String delay) {
+        _delay = delay;
+    }
+    
+    public void setMinDelay(String minDelay) {
+        _minDelay = minDelay;
+    }
+    
+    public void setMaxDelay(String maxDelay) {
+        _maxDelay = maxDelay;
+    }
+    
+    public void setTransitionTime(String transitionTime) {
+        _transitionTime = transitionTime;
+    }
+    
+    public void setWidth(String width) {
+        _width = width;
+    }
+    
+    public void setHeight(String height) {
+        _height = height;
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItem.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItem.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItem.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItem.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,14 @@
+package org.apache.myfaces.custom.imageloop;
+
+import javax.faces.component.UIGraphic;
+
+/**
+ * Image loop item. 
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopItem extends UIGraphic {
+    
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.ImageLoopItem";
+    
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemTag.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemTag.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.custom.imageloop;
+
+import javax.faces.component.UIComponent;
+
+
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase;
+
+/**
+ * Image loop item tag.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopItemTag extends UIComponentTagBase
+{
+    private String _url;
+    
+    public String getComponentType() {
+        return ImageLoopItem.COMPONENT_TYPE;
+    }
+
+    public String getRendererType() {
+        return null;
+    }
+    
+    public String getUrl() {
+        return _url;
+    }
+    
+    public void setUrl(String url) {
+        _url = url;
+    }
+
+    public void release() {
+        super.release();
+        _url = null;
+    }
+
+    protected void setProperties(UIComponent component) {
+        super.setProperties(component);
+        setStringProperty(component, JSFAttr.URL_ATTR, _url);
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItems.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItems.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItems.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItems.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.custom.imageloop;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * Image loop items.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopItems extends UIComponentBase {
+    
+    public static final String COMPONENT_FAMILY = "org.apache.myfaces.ImageLoopItems";
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.ImageLoopItems";
+    
+    // Value binding constants.
+    private static final String VB_VALUE = "value";
+
+    private Object _value;
+
+    public String getFamily() {
+        return COMPONENT_FAMILY;
+    }
+    
+    public void setValue(Object value)
+    {
+        _value = value;
+    }
+
+    public Object getValue()
+    {
+        if (_value != null) return _value;
+        ValueBinding vb = getValueBinding(VB_VALUE);
+        return vb != null ? vb.getValue(getFacesContext()) : null;
+    }
+
+
+    public Object saveState(FacesContext facesContext)
+    {
+        Object values[] = new Object[2];
+        values[0] = super.saveState(facesContext);
+        values[1] = _value;
+        return values;
+    }
+
+    public void restoreState(FacesContext facesContext, Object state)
+    {
+        Object values[] = (Object[])state;
+        super.restoreState(facesContext, values[0]);
+        _value = values[1];
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsIterator.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsIterator.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsIterator.java Thu Feb  1 17:31:52 2007
@@ -0,0 +1,151 @@
+/*
+ * 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.custom.imageloop;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIGraphic;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+
+/**
+ * Image items iterator.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopItemsIterator implements Iterator {
+
+    private final Iterator _childs;
+    private Iterator _nestedItems;
+    private Object _nextItem;
+    private ImageLoopItems _currentImageLoopItems;
+    private String _collectionLabel;
+    
+    public ImageLoopItemsIterator(UIComponent htmlImageLoopItemsParent) {
+        _childs = htmlImageLoopItemsParent.getChildren().iterator();
+    }
+
+    public boolean hasNext() {
+        if(_nextItem != null)
+        {
+            return true;
+        }
+        if(_nestedItems != null)
+        {
+            if(_nestedItems.hasNext())
+            {
+                return true;
+            }
+            _nestedItems = null;
+        }
+        if (_childs.hasNext())
+        {
+            UIComponent child = (UIComponent) _childs.next();
+            if (child instanceof UIGraphic)
+            {
+                UIGraphic uiGraphic = (UIGraphic) child;
+                // UIGraphic.getUrl() is an alias for UIGraphic.getValue()
+                String url = uiGraphic.getUrl();
+                GraphicItem item = new GraphicItem(url);
+                _nextItem = item;
+                return true;
+            }
+            else if (child instanceof ImageLoopItems)
+            {
+                _currentImageLoopItems = ((ImageLoopItems) child);
+                Object value = _currentImageLoopItems.getValue();
+
+                if (value instanceof GraphicItem)
+                {
+                    _nextItem = value;
+                    return true;
+                }
+                else if (value instanceof GraphicItem[])
+                {
+                    _nestedItems = Arrays.asList((GraphicItem[]) value)
+                                    .iterator();
+                    _collectionLabel = "Array";
+                    return hasNext();
+                }
+                else if (value instanceof Collection)
+                {
+                    _nestedItems = ((Collection)value).iterator();
+                    _collectionLabel = "Collection";
+                    return hasNext();
+                }
+                else
+                {
+                    ValueBinding binding = _currentImageLoopItems.getValueBinding("value");
+
+                    throw new IllegalArgumentException(
+                        "Value binding '"
+                        + (binding == null ? null : binding
+                                        .getExpressionString())
+                        + "'of ImageLoopItems with component-path "
+                        + RendererUtils.getPathToComponent(child)
+                        + " does not reference an Object of type GraphicItem, GraphicItem[] or Collection but of type : "
+                        + ((value == null) ? null : value.getClass().getName()));
+                }
+            }
+            else
+            {
+            }
+        }
+        return false;
+
+    }
+
+    public Object next() {
+        if (!hasNext())
+        {
+            throw new NoSuchElementException();
+        }
+        if(_nextItem != null)
+        {
+            Object value = _nextItem;
+            _nextItem = null;
+            return value;
+        }
+        if (_nestedItems != null)
+        {
+            Object item = _nestedItems.next();
+            if (!(item instanceof GraphicItem))
+            {
+                ValueBinding binding = _currentImageLoopItems
+                                .getValueBinding("value");
+                throw new IllegalArgumentException(
+                _collectionLabel + " referenced by ImageLoopItems with binding '"
+                + binding.getExpressionString()
+                + "' and Component-Path : " + RendererUtils.getPathToComponent(_currentImageLoopItems)
+                + " does not contain objects of type GraphicItem");
+            }
+            return item;
+        }
+        throw new NoSuchElementException();
+    }
+
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
+}

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsTag.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/imageloop/ImageLoopItemsTag.java Thu Feb  1 17:31:52 2007
@@ -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.custom.imageloop;
+
+import org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase;
+
+/**
+ * Image loop items tag.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopItemsTag extends UIComponentTagBase
+{
+    public String getComponentType() {
+        return ImageLoopItems.COMPONENT_TYPE;
+    }
+
+    public String getRendererType() {
+        return null;
+    }
+}

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml?view=diff&rev=502433&r1=502432&r2=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml Thu Feb  1 17:31:52 2007
@@ -259,6 +259,22 @@
       <component-class>org.apache.myfaces.custom.table.SortableColumn</component-class>
     </component>
 
+  <component>
+    <component-type>org.apache.myfaces.HtmlImageLoop</component-type>
+    <component-class>org.apache.myfaces.custom.imageloop.HtmlImageLoop</component-class>
+  </component>
+  
+  <component>
+    <component-type>org.apache.myfaces.ImageLoopItem</component-type>
+    <component-class>org.apache.myfaces.custom.imageloop.ImageLoopItem</component-class>
+  </component>
+  
+  <component>
+    <component-type>org.apache.myfaces.ImageLoopItems</component-type>
+    <component-class>org.apache.myfaces.custom.imageloop.ImageLoopItems</component-class>
+  </component>
+
+
   <!-- sandbox converters -->
 
   <converter>
@@ -541,6 +557,13 @@
         <renderer-type>org.apache.myfaces.MessagesSandbox</renderer-type>
         <renderer-class>org.apache.myfaces.custom.inputAjax.HtmlMessagesRenderer</renderer-class>
     </renderer> -->
+    
+    <renderer>
+      <component-family>javax.faces.Output</component-family>
+      <renderer-type>org.apache.myfaces.HtmlImageLoop</renderer-type>
+      <renderer-class>org.apache.myfaces.custom.imageloop.HtmlImageLoopRenderer</renderer-class>
+    </renderer>
+    
 
   </render-kit>
 

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/imageloop/resource/javascript/imageloop.js Thu Feb  1 17:31:52 2007
@@ -0,0 +1,191 @@
+
+if (!imageLoops) {
+    var imageLoops = new Object();
+}
+
+getImageLoop = function(clientId) {
+    return imageLoops[clientId];
+}
+
+function ImageLoop(clientId, images, delay, minDelay, maxDelay, transitionTime) {
+
+    this._clientId = clientId;
+    this._clientIdImg1 = clientId + ":IMG1";
+    this._clientIdImg2 = clientId + ":IMG2";
+    this._images = images;
+    this._numImagesLoaded = 0;
+    this._index = 0;
+    
+    this._imgState = [ this._clientIdImg1, this._clientIdImg2 ];
+    dojo.html.hide(dojo.byId(this._imgState[0]));
+    dojo.html.hide(dojo.byId(this._imgState[1]));
+
+    this._timer = null;
+    this._speedModificationFactor = 2;
+    
+    this._delay = delay;
+    this._originalDelay = delay;
+    if (minDelay > delay) {
+        dojo.debug("Minimum delay may not be greater than delay");
+        this._minDelay = delay;
+    } else {
+        this._minDelay = minDelay;
+    }
+    if (maxDelay < delay) {
+        dojo.debug("Maximum delay may not be less than delay"); 
+        this._maxDelay = maxDelay;
+    } else {
+        this._maxDelay = maxDelay;
+    }
+    if (transitionTime <= 0) {
+        this._transitionTime = 1;
+    } else {
+        this._transitionTime = transitionTime;
+    }
+    
+    this._animsCombined = null;
+    
+    if (imageLoops[clientId]) {
+        imageLoops[clientId].stop();
+    }
+    imageLoops[clientId] = this;
+    
+    this._preload();
+}
+
+ImageLoop.prototype.start = function() {
+    if (this._timer === null && this._numImagesLoaded === this._images.length && this._images.length > 1) {
+        dojo.debug("Starting loop");
+        this._timer = -1;
+        this._loopImages();
+    }
+}
+
+ImageLoop.prototype.stop = function() {
+    if (this._timer !== null) {
+        dojo.debug("Stopping loop.");
+        dojo.lang.clearTimeout(this._timer);
+        this._timer = null;
+    }
+}
+    
+ImageLoop.prototype.forward = function() {
+    if (this._numImagesLoaded === this._images.length && this._images.length > 1) {
+        this.stop();
+        if (this._animsCombined !== null) {
+            this._animsCombined.stop();
+        }
+        this._index = (this._index+1) % this._images.length;
+        var url = this._images[this._index];
+        this._showImage(url, 1);
+    }
+}
+
+ImageLoop.prototype.back = function() {
+    if (this._numImagesLoaded === this._images.length && this._images.length > 1) {
+        this.stop();
+        if (this._animsCombined !== null) {
+            this._animsCombined.stop();
+        }
+        this._index = (this._images.length + this._index - 1) % this._images.length;
+        var url = this._images[this._index];
+        this._showImage(url, 1);
+    }
+}
+
+ImageLoop.prototype.accelerate = function() {
+    var newDelay = this._delay / this._speedModificationFactor;
+    if (newDelay < this._minDelay) {
+        this._delay = this._minDelay;
+        dojo.debug("Minimum delay reached.");
+    } else {
+        this._delay = newDelay;
+    }
+}
+
+ImageLoop.prototype.decelerate = function() {
+    var newDelay = this._delay * this._speedModificationFactor;
+    if (newDelay > this._maxDelay) {
+        this._delay = this._maxDelay;
+        dojo.debug("Maximum delay reached.");
+    } else {
+        this._delay = newDelay;
+    }
+}
+
+ImageLoop.prototype.reset = function() {
+    dojo.debug("Delay reset.");
+    this._delay = this._originalDelay;
+}
+
+ImageLoop.prototype.getImageCount = function() {
+    return this._images.length;
+}
+
+ImageLoop.prototype.setImageIndex = function(index) {
+    if (this._numImagesLoaded === this._images.length) {
+        if (index >= this._images.length) {
+            throw RangeError; 
+        }
+        this.stop();
+        if (this._animsCombined !== null) {
+            this._animsCombined.stop();
+        }
+        this._index = index;
+        var url = this._images[this._index];
+        this._showImage(url, 1);
+    }
+}
+
+ImageLoop.prototype._imagePreloaded = function(evt) {
+    this._numImagesLoaded++;
+    dojo.debug("Image " + this._numImagesLoaded + "/" + this._images.length + " loaded [" + evt.currentTarget.src + "]");
+    if (this._numImagesLoaded === this._images.length) {
+        dojo.debug("Finished loading: " + this._numImagesLoaded + " images loaded.");
+        // Set index to last image. Loop will start with first image.
+        this._index = this._images.length - 1;
+        this.start();
+    }
+}
+
+ImageLoop.prototype._preload = function() {
+    dojo.debug("Pre-loading " + this._images.length + " images.");
+    for (var i=0; i<this._images.length; i++) {
+        var image = new Image();
+        dojo.event.connect(image, "onload", this, "_imagePreloaded");
+        image.src = this._images[i];
+    }
+}
+
+ImageLoop.prototype._loopImages = function() {
+    this._index++;
+    this._index = this._index % this._images.length;
+    var url = this._images[this._index];
+    this._showImage(url, this._transitionTime);
+}
+
+ImageLoop.prototype._showImageOnEnd = function() {
+    this._animsCombined = null;
+    if (this._timer !== null) {
+        this._timer = dojo.lang.setTimeout(this, "_loopImages", this._delay);
+    }
+}
+
+ImageLoop.prototype._showImage = function(imgUrl, transitionTime) {
+    var imgShow = dojo.byId(this._imgState[0]);
+    var imgHide = dojo.byId(this._imgState[1]);
+    // Switch image id's for next loop.
+    this._imgState[0] = imgHide.id;
+    this._imgState[1] = imgShow.id;
+    imgShow.src = imgUrl;
+    
+    var anims = [];
+    var animImgShow = dojo.lfx.html.fadeShow(imgShow, transitionTime);
+    anims.push(animImgShow);
+    var animImgHide = dojo.lfx.html.fadeHide(imgHide, transitionTime);
+    anims.push(animImgHide);
+    this._animsCombined = dojo.lfx.combine(anims);
+    dojo.event.connect(this._animsCombined, "onEnd", this, "_showImageOnEnd");
+    this._animsCombined.play();
+}
+

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloop_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloop_attributes.xml?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloop_attributes.xml (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloop_attributes.xml Thu Feb  1 17:31:52 2007
@@ -0,0 +1,42 @@
+<attribute>
+    <name>delay</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.Integer</type>
+    <description>The delay between transitions</description>
+</attribute>
+<attribute>
+    <name>minDelay</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.Integer</type>
+    <description>The minimum delay allowed when decreasing delay time</description>
+</attribute>
+<attribute>
+    <name>maxDelay</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.Integer</type>
+    <description>The maximum delay allowed when increasing delay time</description>
+</attribute>
+<attribute>
+    <name>transitionTime</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.Integer</type>
+    <description>Transition time in milliseconds. Set to -1 for immediate image switch.</description>
+</attribute>
+<attribute>
+  <name>width</name>
+  <required>true</required>
+  <rtexprvalue>false</rtexprvalue>
+  <type>java.lang.Integer</type>
+  <description>Width</description>
+</attribute>
+<attribute>
+  <name>height</name>
+  <required>true</required>
+  <rtexprvalue>false</rtexprvalue>
+  <type>java.lang.Integer</type>
+  <description>Height</description>
+</attribute>

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloopitems_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloopitems_attributes.xml?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloopitems_attributes.xml (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/html_imageloopitems_attributes.xml Thu Feb  1 17:31:52 2007
@@ -0,0 +1,20 @@
+<!-- ImageLoopItems attributes -->
+&faces_binding_attribute;
+
+<attribute>
+    <name>value</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.String</type>
+    <description><![CDATA[
+        An EL expression that specifies the elements of the image loop.
+        The expression can refer to one of the following:
+        <ol>
+            <li>A single GraphicItem</li>
+            <li>An array or Collection of GraphicItem instances</li>
+        </ol>
+        The value properties of each of the ImageLoopItems must be of the same
+        basic type as the parent component's value.
+        ]]>
+    </description>
+</attribute>

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld?view=diff&rev=502433&r1=502432&r2=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld Thu Feb  1 17:31:52 2007
@@ -144,6 +144,8 @@
 <!ENTITY floatingpane_base_attributes	SYSTEM "entities/floatingpane_base_attributes.xml">
 <!ENTITY filter_table_attributes  	SYSTEM "entities/filter_table_attributes.xml">
 <!ENTITY sortable_column_attributes 	SYSTEM "entities/sortable_column_attributes.xml">
+<!ENTITY html_imageloop_attributes	SYSTEM "entities/html_imageloop_attributes.xml">
+<!ENTITY html_imageloopitems_attributes	SYSTEM "entities/html_imageloopitems_attributes.xml">
 ]>
 
 <taglib>
@@ -615,6 +617,47 @@
 			<description>The fieldset's legend.</description>
 		</attribute>
 	</tag>
+	
+	<!-- imageLoop-->
+    <tag>
+        <name>imageLoop</name>
+        <tag-class>org.apache.myfaces.custom.imageloop.HtmlImageLoopTag</tag-class>
+        <body-content>JSP</body-content>
+        <description>
+            Image loop/slide show component. Provides Javascript methods to control
+            image loop behaviour.
+            Methods:
+              getImageLoop(id) - get image loop object with id,
+              play() - play loop,
+              stop() - stop loop,
+              accelerate() - accelerate loop until minDelay reached,
+              decelerate() - decelerate loop until maxDelay reached,
+              setImageIndex(index) - show image with index,
+              reset() - reset settings to origin values,
+              getImageCount() - get number of images loaded
+        </description>
+        &ext_forceId_attribute;
+        &faces_id_optional_attribute;
+        &html_imageloop_attributes;
+	</tag>
+
+    <!--  imageLoopItem -->
+    <tag>
+        <name>imageLoopItem</name>
+        <tag-class>org.apache.myfaces.custom.imageloop.ImageLoopItemTag</tag-class>
+        <body-content>empty</body-content>
+        <description>Image loop item.</description>
+        &ui_graphic_attributes;
+    </tag>
+
+    <!--  imageLoopItems -->
+    <tag>
+        <name>imageLoopItems</name>
+        <tag-class>org.apache.myfaces.custom.imageloop.ImageLoopItemsTag</tag-class>
+        <body-content>empty</body-content>
+        <description>Image loop items.</description>
+        &html_imageloopitems_attributes;
+    </tag>
 
 	<!-- graphicImageDynamic -->
 	<tag>

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/ImageLoopBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/ImageLoopBean.java?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/ImageLoopBean.java (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/java/org/apache/myfaces/examples/imageloop/ImageLoopBean.java Thu Feb  1 17:31:52 2007
@@ -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.examples.imageloop;
+
+import org.apache.myfaces.custom.imageloop.GraphicItem;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Example image loop bean.
+ * @author Felix Röthenbacher (latest modification by $Author:$)
+ * @version $Revision:$ $Date:$
+ */
+public class ImageLoopBean {
+    private Collection _imageCollection;
+    private GraphicItem[] _imageArray;
+    
+    public ImageLoopBean() {
+        GraphicItem item2 = new GraphicItem("images/imageloop2.png");
+        GraphicItem item3 = new GraphicItem("images/imageloop3.png");
+
+        _imageCollection = new ArrayList();
+        _imageCollection.add(item2);
+        
+        _imageArray = new GraphicItem[1];
+        _imageArray[0] = item3;
+    }
+    
+    public Collection getImageCollection() {
+        return _imageCollection;
+    }
+    
+    public GraphicItem[] getImageArray() {
+        return _imageArray;
+    }
+}

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?view=diff&rev=502433&r1=502432&r2=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Thu Feb  1 17:31:52 2007
@@ -505,7 +505,14 @@
         <managed-bean-class>org.apache.myfaces.examples.data.SortableTableBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-
+    
+  <!-- managed bean for imageLoop -->
+  <managed-bean>
+    <managed-bean-name>imageLoopBean</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.examples.imageloop.ImageLoopBean</managed-bean-class>
+    <managed-bean-scope>application</managed-bean-scope>
+  </managed-bean>
+  
 	<!-- navigation rules -->
     <navigation-rule>
 		<navigation-case>

Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp?view=diff&rev=502433&r1=502432&r2=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp Thu Feb  1 17:31:52 2007
@@ -23,6 +23,7 @@
 
             <h:outputText value="New in 1.5" style="font-weight:bold;color:red"/>
             <h:panelGrid style="padding-left:25px">
+                <f:verbatim><a href="#imageLoop">Image loop - slide show component</a></f:verbatim>
                 <f:verbatim><a href="#partialPageRendering">Partial Page Rendering</a></f:verbatim>
                 <f:verbatim><a href="#filterTable">Filter Table</a></f:verbatim>
             </h:panelGrid>
@@ -31,7 +32,8 @@
             <h:outputText value="Partial Page Rendering"/>
             <h:panelGrid style="padding-left:25px">
 	            <h:outputLink value="pprPanelGroup.jsf" ><f:verbatim>PPRPanelGroup - parts of a page are getting manually refreshed by AJAX-Calls</f:verbatim></h:outputLink>
-                 <h:outputLink value="pprPanelGroupPeriodicalUpdate.jsf" ><f:verbatim>PPRPanelGroup - parts of a page are getting automatically refreshed by AJAX-Calls (through periodic intervals)</f:verbatim></h:outputLink>
+                <h:outputLink value="pprScroller.jsf" ><f:verbatim>PPRPanelGroup - another example where a scrollable table gets refreshed</f:verbatim></h:outputLink>
+                <h:outputLink value="pprPanelGroupPeriodicalUpdate.jsf" ><f:verbatim>PPRPanelGroup - parts of a page are getting automatically refreshed by AJAX-Calls (through periodic intervals)</f:verbatim></h:outputLink>
             </h:panelGrid>
             <h:outputText value="Resource Serving"/>
             <h:panelGrid style="padding-left:25px">
@@ -106,6 +108,7 @@
             <h:panelGrid style="padding-left:25px">
 	 			<h:commandLink action="go_scope_shop"><f:verbatim>Scopeshop1, an extended saveState Example showing a wizard</f:verbatim></h:commandLink>
            		<h:outputLink value="effect.jsf" ><f:verbatim>Effect - DOJO and script.aculo.us effects</f:verbatim></h:outputLink>
+                <f:verbatim><a name="imageLoop" /></f:verbatim><h:outputLink value="imageloop.jsf" ><f:verbatim>Image loop/slide show with fading effects based on Dojo</f:verbatim></h:outputLink>
 	            <h:outputLink value="killSession.jsf"><f:verbatim>Kill Session - refreshes state</f:verbatim></h:outputLink>
                 <h:outputLink value="typedNumberConvert.jsf"><f:verbatim>automatically convert the number to the correct type</f:verbatim></h:outputLink>
 
@@ -145,6 +148,8 @@
             </h:panelGrid>
 
         </h:panelGrid>
+    
+        <f:verbatim><br/><br/><br/><br/><br/><br/><br/></f:verbatim>
     </h:form>
     </f:view>
 

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/imageloop.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/imageloop.jsp?view=auto&rev=502433
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/imageloop.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/imageloop.jsp Thu Feb  1 17:31:52 2007
@@ -0,0 +1,58 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
+
+<!--
+/*
+ * 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.
+ */
+//-->
+
+<html>
+
+  <%@include file="inc/head.inc" %>
+  
+  <body>
+ 
+    <f:view>
+      <h:form>
+        <s:imageLoop id="imageloop" forceId="true" delay="1000" minDelay="200" maxDelay="4000" transitionTime="500" width="200" height="200">
+          <s:imageLoopItem url="images/imageloop1.png"/>
+          <s:imageLoopItems value="#{imageLoopBean.imageCollection}"/>
+          <s:imageLoopItems value="#{imageLoopBean.imageArray}"/>
+        </s:imageLoop>
+        <t:commandButton onclick="getImageLoop('imageloop').start(); return false" value="Start"/>
+        <t:commandButton onclick="getImageLoop('imageloop').stop(); return false" value="Stop"/>
+        <t:commandButton onclick="getImageLoop('imageloop').back(); return false" value="Back"/>
+        <t:commandButton onclick="getImageLoop('imageloop').forward(); return false" value="Next"/>
+        <t:commandButton onclick="getImageLoop('imageloop').accelerate(); return false" value="+"/>
+        <t:commandButton onclick="getImageLoop('imageloop').decelerate(); return false" value="-"/>
+        <t:commandButton onclick="getImageLoop('imageloop').reset(); return false" value="Reset"/>
+
+        <t:commandButton onclick="getImageLoop('imageloop').setImageIndex(0); return false" value="1"/>
+        <t:commandButton onclick="getImageLoop('imageloop').setImageIndex(1); return false" value="2"/>
+        <t:commandButton onclick="getImageLoop('imageloop').setImageIndex(2); return false" value="3"/>
+      </h:form>
+    </f:view>
+
+    <%@include file="inc/page_footer.jsp" %>
+
+  </body>
+</html>

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop1.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop1.png?view=auto&rev=502433
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop1.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop2.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop2.png?view=auto&rev=502433
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop2.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop3.png
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop3.png?view=auto&rev=502433
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/imageloop3.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message