You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/05/13 00:02:04 UTC

svn commit: r655662 - in /myfaces/tomahawk/trunk/sandbox: core/src/main/java/org/apache/myfaces/custom/media/ core/src/main/java/org/apache/myfaces/custom/media/util/ core/src/main/resources-facesconfig/META-INF/ core/src/main/tld/ examples/src/main/we...

Author: lu4242
Date: Mon May 12 15:02:04 2008
New Revision: 655662

URL: http://svn.apache.org/viewvc?rev=655662&view=rev
Log:
TOMAHAWK-1247 Media component

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java   (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java   (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java   (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java   (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java   (with props)
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/clock.avi   (with props)
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/images/myFaces_logo.jpg   (with props)
    myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp   (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/home.jsp

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java Mon May 12 15:02:04 2008
@@ -0,0 +1,126 @@
+/*
+ * 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.media;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+
+
+public class MediaComponent extends UIComponentBase {
+
+    public static String COMPONENT_TYPE = "org.apache.myfaces.media";
+    public static String RENDERER_TYPE = "org.apache.myfaces.media";
+    
+    // Value binding constants
+    public static final String ATTRIBUTE_WIDTH = "width";
+    public static final String ATTRIBUTE_HEIGHT = "height";
+    public static final String ATTRIBUTE_SOURCE = "source";
+    public static final String ATTRIBUTE_CONTENT_TYPE = "contentType";    
+    
+    private String _source;
+    private String _contentType;      
+    private String _width;
+    private String _height;        
+
+    public String getFamily() {
+	return "org.apache.myfaces.media";
+    }
+
+    public String getWidth() {
+	if (_width != null) 
+	{
+	    return _width;
+	}
+
+	ValueBinding vb = getValueBinding(ATTRIBUTE_WIDTH);
+	return vb != null ? RendererUtils.getStringValue(getFacesContext(), vb)
+		: null;
+    }
+
+    public String getHeight() {
+	if (_height != null) 
+	{
+	    return _height;
+	}
+
+	ValueBinding vb = getValueBinding(ATTRIBUTE_HEIGHT);
+	return vb != null ? RendererUtils.getStringValue(getFacesContext(), vb)
+		: null;
+    }
+    
+    public String getContentType() {
+	if (_contentType != null) 
+	{
+	    return _contentType;
+	}
+
+	ValueBinding vb = getValueBinding(ATTRIBUTE_CONTENT_TYPE);
+	return vb != null ? RendererUtils.getStringValue(getFacesContext(), vb)
+		: null;
+    }
+    
+    public String getSource() {
+	if (_source != null) 
+	{
+	    return _source;
+	}
+
+	ValueBinding vb = getValueBinding(ATTRIBUTE_SOURCE);
+	return vb != null ? RendererUtils.getStringValue(getFacesContext(), vb)
+		: null;
+    }
+    
+    public void setWidth(String width) {
+	this._width = width;
+    }       
+    
+    public void setHeight(String height) {
+	this._height = height;
+    }    
+  
+    public void setContentType(String contentType) {
+        _contentType = contentType;
+    }
+
+    public void setSource(String _source) {
+        this._source = _source;
+    }
+
+    public Object saveState(FacesContext context) {
+	Object values[] = new Object[5];
+	values[0] = super.saveState(context);
+	values[1] = _source;
+	values[2] = _contentType;
+	values[3] = _width;	
+	values[4] = _height;	
+	return ((values));
+    }
+
+    public void restoreState(FacesContext context, Object state) {
+	Object values[] = (Object[]) state;
+	super.restoreState(context, values[0]);
+	_source = (String) values[1];
+	_contentType = (String) values[2];
+	_width = (String) values[3];
+	_height = (String) values[4];
+    }
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaComponent.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java Mon May 12 15:02:04 2008
@@ -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.media;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+import org.apache.myfaces.custom.media.util.MediaConstants;
+import org.apache.myfaces.custom.media.util.MediaUtil;
+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;
+
+public class MediaRenderer extends Renderer {
+
+    public void encodeBegin(FacesContext context, UIComponent component)
+	    throws IOException {
+
+	MediaComponent mediaComponent = (MediaComponent) component;
+
+	RendererUtils.checkParamValidity(context, component,
+		MediaComponent.class);
+
+	generateMediaTag(context, mediaComponent);
+    }
+
+    public void encodeEnd(FacesContext context, UIComponent component)
+	    throws IOException {
+	super.encodeEnd(context, component);
+    }
+
+    /*
+     * This helper method is used for generating the suitable media tag.
+     */
+    private void generateMediaTag(FacesContext context,
+	    MediaComponent mediaComponent) throws IOException {
+	
+	String source = mediaComponent.getSource();	
+	
+	/* if the src uri is an image then use the <img> tag */
+	if(MediaUtil.isImage(source)) 
+	{
+	    MediaUtil.generateImageTag(context, mediaComponent);
+	} 
+	else /* generate EMBED Tag */
+	{
+	    MediaUtil.generateEmbedTag(context, mediaComponent);
+	}
+	
+    }    
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java Mon May 12 15:02:04 2008
@@ -0,0 +1,97 @@
+/*
+ * 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.media;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase;
+
+public class MediaTag extends UIComponentTagBase {
+
+    /**
+     * return the component class ...
+     */
+    public String getComponentType() {
+	return MediaComponent.COMPONENT_TYPE;
+    }
+
+    /**
+     * Returns the component renderer ...
+     */
+    public String getRendererType() {
+	return MediaComponent.RENDERER_TYPE;
+    }
+
+    /**
+     * release the used resources ...
+     */
+    public void release() {
+	super.release();
+	_source = null;
+	_contentType = null;
+	_height = null;
+	_width = null;
+    }
+
+    protected void setProperties(UIComponent component) {
+	super.setProperties(component);
+	setStringProperty(component, MediaComponent.ATTRIBUTE_SOURCE, _source);
+	setStringProperty(component, MediaComponent.ATTRIBUTE_CONTENT_TYPE, _contentType);	
+	setStringProperty(component, MediaComponent.ATTRIBUTE_WIDTH, _width);
+	setStringProperty(component, MediaComponent.ATTRIBUTE_HEIGHT, _height);	
+    }
+
+    public String getSource() {
+	return _source;
+    }
+    
+    public String getContentType() {
+	return _contentType;
+    }    
+    
+    public String getWidth() {
+	return _width;
+    }
+    
+    public String getHeight() {
+	return _height;
+    }
+    
+    public void setSource(String source) {
+	this._source = source;
+    }  
+    
+    public void setContentType(String contentType) {
+	this._contentType = contentType;
+    }        
+
+    public void setWidth(String width) {
+	this._width = width;
+    }
+        
+    public void setHeight(String height) {
+	this._height = height;
+    }      
+
+    // Attributes ...
+    private String _source;
+    private String _contentType;    
+    private String _width;
+    private String _height;    
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/MediaTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java Mon May 12 15:02:04 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.media.util;
+
+/**
+ * This interface holds all the Media related constants.
+ */
+public interface MediaConstants {
+    public static final String DEFAULT_MEDIA_PLUGIN_PAGE = "http://www.microsoft.com/Windows/MediaPlayer/";
+    String EMBED_ELEM = "EMBED";
+    String NO_EMBED_ELEM = "NOEMBED";    
+    String PLUGINSPAGE_ATTR = "pluginspage";
+    String SHOW_DISPLAY_ATTR = "showdisplay";
+    String SHOW_GOTO_BAR_ATTR = "showgotobar";
+    String SHOW_STATUS_BAR_ATTR = "showstatusbar";    
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaConstants.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java Mon May 12 15:02:04 2008
@@ -0,0 +1,156 @@
+/*
+ * 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.media.util;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.custom.media.MediaComponent;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+
+/**
+ * This class acts as a helper for the Media component. 
+ */
+public class MediaUtil {
+    
+    final static String[] IMAGES_EXTENSIONS = new String[] {
+	"jpg",
+	"jpeg",
+	"png",
+	"mng",
+	"bmp",
+	"gif",
+	"dxf"
+    };
+    
+    /**
+     * This method checks whether the passed uri contains
+     * image.
+     * @param uri
+     * @return boolean.
+     */
+    public static boolean isImage(String uri) {
+	
+	for(int i = 0; i < IMAGES_EXTENSIONS.length; ++i) 
+	{
+	    if(uri.endsWith(IMAGES_EXTENSIONS[i])) 
+	    {
+		return true;
+	    }
+	}
+	
+	return false;
+    }
+    
+    /**
+     * This method is used for generating the EMBED Tag 
+     * from the mediaComponent attributes.
+     * @param context
+     * @param mediaComponent
+     * @throws IOException
+     */
+    public static void generateEmbedTag(FacesContext context,
+	    MediaComponent mediaComponent) throws IOException {
+
+	ResponseWriter writer = context.getResponseWriter();
+	String source = mediaComponent.getSource();
+	String contentType = mediaComponent.getContentType();
+	String width = mediaComponent.getWidth();
+	String height = mediaComponent.getHeight();
+
+	/* start writing the media component */
+	writer.startElement(MediaConstants.EMBED_ELEM, mediaComponent);
+
+	writer.writeAttribute(HTML.ID_ATTR,
+		mediaComponent.getClientId(context), null);
+	writer.writeAttribute(HTML.NAME_ATTR, mediaComponent.getId(),
+		JSFAttr.ID_ATTR);
+
+	writer.writeAttribute(HTML.SRC_ATTR, source, null);
+
+	writer.writeAttribute(HTML.TYPE_ATTR, contentType, null);
+
+	/* write the rest of attributes */
+
+	if (width != null && !"".equals(width)) {
+	    writer.writeAttribute(HTML.WIDTH_ATTR, width, null);
+	}
+
+	if (height != null && !"".equals(height)) {
+	    writer.writeAttribute(HTML.HEIGHT_ATTR, height, null);
+	}
+
+	writer.writeAttribute(MediaConstants.PLUGINSPAGE_ATTR,
+		MediaConstants.DEFAULT_MEDIA_PLUGIN_PAGE, null);
+	writer.writeAttribute(MediaConstants.SHOW_GOTO_BAR_ATTR, "true", null);
+	writer.writeAttribute(MediaConstants.SHOW_DISPLAY_ATTR, "true", null);
+	writer
+		.writeAttribute(MediaConstants.SHOW_STATUS_BAR_ATTR, "true",
+			null);
+
+	/* if no EMBED not supported */
+	writer.startElement(MediaConstants.NO_EMBED_ELEM, mediaComponent);
+	writer.write("<a href=\"" + 
+			source + 
+			"\">EMBED is not supported, Click here to see the resource</a>");
+	writer.endElement(MediaConstants.NO_EMBED_ELEM);
+    }
+    
+    /**
+     * This method is used for generating the IMG tag 
+     * from the mediaComponent attributes. 
+     * @param context
+     * @param mediaComponent
+     * @throws IOException
+     */
+    public static void generateImageTag(FacesContext context,
+	    MediaComponent mediaComponent) throws IOException {
+
+	ResponseWriter writer = context.getResponseWriter();
+	String source = mediaComponent.getSource();
+	String width = mediaComponent.getWidth();
+	String height = mediaComponent.getHeight();
+
+	/* start writing the media component */
+	writer.startElement(HTML.IMG_ELEM, mediaComponent);
+
+	writer.writeAttribute(HTML.ID_ATTR, mediaComponent.getClientId(context), null);
+	writer.writeAttribute(HTML.NAME_ATTR, mediaComponent.getId(), JSFAttr.ID_ATTR);
+
+	writer.writeAttribute(HTML.SRC_ATTR, source, null);
+
+	/* write the rest of attributes */
+
+	if (width != null && !"".equals(width)) 
+	{
+	    writer.writeAttribute(HTML.WIDTH_ATTR, width, null);
+	}
+
+	if (height != null && !"".equals(height)) 
+	{
+	    writer.writeAttribute(HTML.HEIGHT_ATTR, height, null);
+	}
+
+	writer.endElement(HTML.IMG_ELEM);
+    }    
+    
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/media/util/MediaUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

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?rev=655662&r1=655661&r2=655662&view=diff
==============================================================================
--- 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 Mon May 12 15:02:04 2008
@@ -304,6 +304,11 @@
 	 <component-class>org.apache.myfaces.custom.captcha.CAPTCHAComponent</component-class>
   </component>   
 
+  <component>
+	 <component-type>org.apache.myfaces.media</component-type>
+	 <component-class>org.apache.myfaces.custom.media.MediaComponent</component-class>
+  </component>   
+
   <!-- sandbox converters -->
 
   <converter>
@@ -648,6 +653,12 @@
   		<renderer-class>org.apache.myfaces.custom.captcha.CAPTCHARenderer</renderer-class>
   	</renderer>  	
   	
+  	<renderer>
+  		<component-family>org.apache.myfaces.media</component-family>
+  		<renderer-type>org.apache.myfaces.media</renderer-type>
+  		<renderer-class>org.apache.myfaces.custom.media.MediaRenderer</renderer-class>
+  	</renderer>  	  	
+  	
   </render-kit>
 
   <lifecycle>

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?rev=655662&r1=655661&r2=655662&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld Mon May 12 15:02:04 2008
@@ -1892,6 +1892,47 @@
 	      </description>
       </attribute>                  
     </tag>
+    
+    <tag>
+        <name>media</name>
+        <tag-class>org.apache.myfaces.custom.media.MediaTag</tag-class>
+        <body-content>JSP</body-content>
+        &ui_component_attributes;
+      <attribute>
+         <name>source</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+	     <type>java.lang.String</type>
+	      <description>
+			Determines the path of the media file.
+	      </description>
+      </attribute>
+      <attribute>
+         <name>contentType</name>
+         <required>true</required>
+         <rtexprvalue>true</rtexprvalue>
+	     <type>java.lang.String</type>
+	      <description>
+			Determines the media content type.
+	      </description>
+      </attribute> 
+      <attribute>
+         <name>width</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue> 
+	      <description>
+			Integer to indicate the media weight.
+	      </description>
+      </attribute>
+      <attribute>
+         <name>height</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>    
+	      <description>
+			Integer to indicate the media height.
+	      </description>
+      </attribute>                  
+    </tag>    
 
 
 </taglib>

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?rev=655662&r1=655661&r2=655662&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/home.jsp Mon May 12 15:02:04 2008
@@ -88,7 +88,7 @@
             <h:panelGrid style="padding-left:25px">
                 <h:outputLink value="dojo/splitpanejsfonly.jsf" ><f:verbatim>SplitPane - Dojos ContentPane widget to separate a page into panes of belonging content</f:verbatim></h:outputLink>
                 <h:outputLink value="dojo/titlepanejsfonly.jsf" ><f:verbatim>TitlePane - Dojos TitlePane; Displays some data with a title on top. Data can be collapsed leaving only the title shown. </f:verbatim></h:outputLink>
-                <h:outputLink value="accordionPnel.jsf" ><f:verbatim>AccordionPanel</f:verbatim></h:outputLink>
+                <h:outputLink value="accordionPanel.jsf" ><f:verbatim>AccordionPanel</f:verbatim></h:outputLink>
                 <h:outputLink value="hmenu.jsf" ><f:verbatim>Horizontal Menu</f:verbatim></h:outputLink>
 				<h:outputLink value="fieldset.jsf"><f:verbatim>FieldSet</f:verbatim></h:outputLink>
             </h:panelGrid>
@@ -196,6 +196,13 @@
 	                <f:verbatim>CAPTCHA - component to generate random text images for security purposes</f:verbatim>
 	            </h:outputLink>
          </h:panelGrid>
+         
+         <h:outputText value="Media"/>
+         <h:panelGrid style="padding-left:25px">
+	            <h:outputLink value="media.jsf" >
+	                <f:verbatim>Media - component to display media content, such as audio, video, or image in a player embedded in the user agent.</f:verbatim>
+	            </h:outputLink>
+         </h:panelGrid>         
         
         <f:verbatim><br/><br/><br/><br/><br/><br/><br/></f:verbatim>
     </h:form>

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

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

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

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

Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp?rev=655662&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp Mon May 12 15:02:04 2008
@@ -0,0 +1,54 @@
+<%@ 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"%>
+<html>
+
+<!--
+/*
+ * 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.
+ */
+//-->
+
+<%@include file="inc/head.inc"%>
+
+<body>
+
+<f:view>
+	   
+	<h:form id="form1">		
+		<h:panelGrid columns="2">
+			<h:outputText value="Sample Video : "/>			
+			<s:media id="media1" source="#{facesContext.externalContext.requestContextPath}/images/clock.avi" 
+					 contentType="application/x-mplayer2" width="300" height="300"/> 
+					 
+			<h:outputText value="Sample Image : "/>
+			<s:media id="media2" source="#{facesContext.externalContext.requestContextPath}/images/myFaces_logo.jpg" 
+					 contentType="image/jpg"/> 
+		</h:panelGrid>					 
+	</h:form>		
+	    
+
+	<%@include file="inc/page_footer.jsp"%>
+
+</f:view>
+
+</body>
+
+</html>
+

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/media.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL