You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by to...@apache.org on 2005/01/09 13:36:59 UTC

cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage HtmlSwapImage.java HtmlSwapImage.xml HtmlSwapImageRenderer.java HtmlSwapImageTag.java

tomsp       2005/01/09 04:36:59

  Modified:    webapps/examples/src/org/apache/myfaces/examples/resource
                        example_messages.properties
                        example_messages_ca.properties
                        example_messages_de.properties
                        example_messages_es.properties
                        example_messages_fr.properties
                        example_messages_ja.properties
                        example_messages_pt_BR.properties
               webapps/examples/web/WEB-INF examples-config.xml
               webapps/examples/web/inc navigation.jsp page_header.jsp
               conf     faces-config.xml
               tlds     myfaces_ext.tld
  Added:       webapps/examples/web swapimage.jsp
               src/components/org/apache/myfaces/custom/swapimage/resource
                        swapimage.js
               src/components/org/apache/myfaces/custom/swapimage
                        HtmlSwapImage.java HtmlSwapImage.xml
                        HtmlSwapImageRenderer.java HtmlSwapImageTag.java
  Log:
  added new component swapimage
  
  Revision  Changes    Path
  1.15      +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages.properties
  
  Index: example_messages.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- example_messages.properties	4 Jan 2005 15:41:06 -0000	1.14
  +++ example_messages.properties	9 Jan 2005 12:36:58 -0000	1.15
  @@ -34,6 +34,7 @@
   nav_css             = Stylesheet
   nav_newspaperTable  = Newspaper Table
   nav_HtmlEditor		= Html Editor
  +nav_swapimage       = SwapImage
   # buttons
   
   button_save = Save
  
  
  
  1.4       +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_ca.properties
  
  Index: example_messages_ca.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_ca.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- example_messages_ca.properties	4 Jan 2005 11:17:28 -0000	1.3
  +++ example_messages_ca.properties	9 Jan 2005 12:36:58 -0000	1.4
  @@ -33,6 +33,7 @@
   nav_css             = Full d'estils 
   nav_newspaperTable  = Taula de not�cies
   nav_HtmlEditor		= Editor Html
  +nav_swapimage       = SwapImage
   # buttons
   
   button_save = Desar 
  
  
  
  1.9       +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_de.properties
  
  Index: example_messages_de.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_de.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- example_messages_de.properties	4 Jan 2005 00:28:06 -0000	1.8
  +++ example_messages_de.properties	9 Jan 2005 12:36:58 -0000	1.9
  @@ -30,6 +30,7 @@
   nav_Date			= Datum
   nav_css             = Stylesheet
   nav_newspaperTable  = Newspaper Table
  +nav_swapimage       = SwapImage
   
   # buttons
   
  
  
  
  1.4       +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_es.properties
  
  Index: example_messages_es.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_es.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- example_messages_es.properties	4 Jan 2005 11:17:28 -0000	1.3
  +++ example_messages_es.properties	9 Jan 2005 12:36:58 -0000	1.4
  @@ -33,6 +33,7 @@
   nav_css             = Hoja de estilos
   nav_newspaperTable  = Tabla de Noticias
   nav_HtmlEditor		= Editor Html
  +nav_swapimage       = SwapImage
   # buttons
   
   button_save = Guardar 
  
  
  
  1.10      +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_fr.properties
  
  Index: example_messages_fr.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_fr.properties,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- example_messages_fr.properties	4 Jan 2005 00:28:06 -0000	1.9
  +++ example_messages_fr.properties	9 Jan 2005 12:36:58 -0000	1.10
  @@ -29,6 +29,7 @@
   nav_Date			= Date
   nav_css             = Stylesheet
   nav_newspaperTable  = Newspaper Table
  +nav_swapimage       = SwapImage
   
   # buttons
   
  
  
  
  1.10      +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_ja.properties
  
  Index: example_messages_ja.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_ja.properties,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- example_messages_ja.properties	4 Jan 2005 00:28:06 -0000	1.9
  +++ example_messages_ja.properties	9 Jan 2005 12:36:58 -0000	1.10
  @@ -31,6 +31,7 @@
   nav_panelstack      = \u30d1\u30cd\u30eb\u30b9\u30bf\u30c3\u30af
   nav_css             = \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8
   nav_newspaperTable  = Newspaper Table
  +nav_swapimage       = SwapImage
   
   # buttons
   
  
  
  
  1.4       +1 -0      incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_pt_BR.properties
  
  Index: example_messages_pt_BR.properties
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/src/org/apache/myfaces/examples/resource/example_messages_pt_BR.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- example_messages_pt_BR.properties	4 Jan 2005 00:28:06 -0000	1.3
  +++ example_messages_pt_BR.properties	9 Jan 2005 12:36:58 -0000	1.4
  @@ -31,6 +31,7 @@
   nav_panelstack      = Panel Stack
   nav_css             = Stylesheet
   nav_newspaperTable  = Newspaper Table
  +nav_swapimage       = SwapImage
   
   # buttons
   
  
  
  
  1.41      +5 -0      incubator-myfaces/webapps/examples/web/WEB-INF/examples-config.xml
  
  Index: examples-config.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/WEB-INF/examples-config.xml,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- examples-config.xml	4 Jan 2005 15:41:06 -0000	1.40
  +++ examples-config.xml	9 Jan 2005 12:36:58 -0000	1.41
  @@ -352,6 +352,11 @@
               <to-view-id>/newspaperTable.jsp</to-view-id>
           </navigation-case>
   
  +        <navigation-case>
  +            <from-outcome>go_swapimage</from-outcome>
  +            <to-view-id>/swapimage.jsp</to-view-id>
  +        </navigation-case>
  +
       </navigation-rule>
   
       <navigation-rule>
  
  
  
  1.47      +1 -0      incubator-myfaces/webapps/examples/web/inc/navigation.jsp
  
  Index: navigation.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/inc/navigation.jsp,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- navigation.jsp	4 Jan 2005 15:41:06 -0000	1.46
  +++ navigation.jsp	9 Jan 2005 12:36:58 -0000	1.47
  @@ -33,6 +33,7 @@
               <x:commandNavigation id="nav_2_4_14" value="#{example_messages['nav_panelstack']}" action="go_panelstack" />
               <x:commandNavigation id="nav_2_4_15" value="#{example_messages['nav_css']}" action="go_css" />
               <x:commandNavigation id="nav_2_4_16" value="#{example_messages['nav_newspaperTable']}" action="go_newspaperTable" />
  +            <x:commandNavigation id="nav_2_4_17" value="#{example_messages['nav_swapimage']}" action="go_swapimage" />
           </x:commandNavigation>
       </x:commandNavigation>
       <x:commandNavigation id="nav_3" value="#{example_messages['nav_Documentation']}" >
  
  
  
  1.46      +1 -0      incubator-myfaces/webapps/examples/web/inc/page_header.jsp
  
  Index: page_header.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/inc/page_header.jsp,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- page_header.jsp	4 Jan 2005 15:41:06 -0000	1.45
  +++ page_header.jsp	9 Jan 2005 12:36:58 -0000	1.46
  @@ -43,6 +43,7 @@
                   <x:navigationMenuItem id="nav_2_4_14" itemLabel="#{example_messages['nav_panelstack']}" action="go_panelstack" icon="images/myfaces.gif" />
   	            <x:navigationMenuItem id="nav_2_4_15" itemLabel="#{example_messages['nav_css']}" action="go_css" icon="images/myfaces.gif" />
                   <x:navigationMenuItem id="nav_2_4_16" itemLabel="#{example_messages['nav_newspaperTable']}" action="go_newspaperTable" icon="images/myfaces.gif" />
  +                <x:navigationMenuItem id="nav_2_4_17" itemLabel="#{example_messages['nav_swapimage']}" action="go_swapimage" icon="images/myfaces.gif" />
               </x:navigationMenuItem>
           </x:navigationMenuItem>
           <x:navigationMenuItem id="nav_3" itemLabel="#{example_messages['nav_Documentation']}" >
  
  
  
  1.1                  incubator-myfaces/webapps/examples/web/swapimage.jsp
  
  Index: swapimage.jsp
  ===================================================================
  <%@ page import="java.math.BigDecimal,
                   java.util.Date"%>
  <%@ 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/extensions" prefix="x"%>
  <html>
  
  <%@include file="inc/head.inc" %>
  
  <!--
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.
   */
  //-->
  
  <body>
  
  <!--
  managed beans used:
      carconf
  -->
  
  <f:view>
  
      <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
  
      <x:panelLayout id="page" layout="#{globalOptions.pageLayout}"
              styleClass="pageLayout"
              headerClass="pageHeader"
              navigationClass="pageNavigation"
              bodyClass="pageBody"
              footerClass="pageFooter" >
  
          <f:facet name="header">
              <f:subview id="header">
                  <jsp:include page="inc/page_header.jsp" />
              </f:subview>
          </f:facet>
  
          <f:facet name="navigation">
              <f:subview id="menu" >
                  <jsp:include page="inc/navigation.jsp" />
              </f:subview>
          </f:facet>
  
          <f:facet name="body">
              <h:panelGroup id="body">
  
                  <h:messages id="messageList" />
  
                  <x:swapImage url="images/swapimg.png" swapImageUrl="images/swapimg1.png" width="200" height="20" border="none" />
              </h:panelGroup>
          </f:facet>
  
          <%@include file="inc/page_footer.jsp" %>
  
      </x:panelLayout>
  
  </f:view>
  
  </body>
  
  </html>
  
  
  1.105     +13 -2     incubator-myfaces/conf/faces-config.xml
  
  Index: faces-config.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/conf/faces-config.xml,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- faces-config.xml	4 Jan 2005 16:09:57 -0000	1.104
  +++ faces-config.xml	9 Jan 2005 12:36:58 -0000	1.105
  @@ -106,6 +106,11 @@
     </component>
   
     <component>
  +     <component-type>org.apache.myfaces.Div</component-type>
  +     <component-class>org.apache.myfaces.custom.div.Div</component-class>
  +  </component>
  +
  +  <component>
       <component-type>org.apache.myfaces.HtmlCheckbox</component-type>
       <component-class>org.apache.myfaces.custom.checkbox.HtmlCheckbox</component-class>
     </component>
  @@ -252,10 +257,11 @@
     </component>
   
     <component>
  -        <component-type>org.apache.myfaces.Div</component-type>
  -      <component-class>org.apache.myfaces.custom.div.Div</component-class>
  +    <component-type>org.apache.myfaces.HtmlSwapImage</component-type>
  +    <component-class>org.apache.myfaces.custom.swapimage.HtmlSwapImage</component-class>
     </component>
   
  +
       <!-- additional "by type" converters -->
   
       <converter>
  @@ -534,6 +540,11 @@
              <renderer-class>org.apache.myfaces.custom.panelstack.HtmlPanelStackRenderer</renderer-class>
           </renderer>
   
  +        <renderer>
  +           <component-family>javax.faces.Graphic</component-family>
  +           <renderer-type>org.apache.myfaces.SwapImage</renderer-type>
  +           <renderer-class>org.apache.myfaces.custom.swapimage.HtmlSwapImageRenderer</renderer-class>
  +        </renderer>
   
       </render-kit>
   
  
  
  
  1.150     +24 -0     incubator-myfaces/tlds/myfaces_ext.tld
  
  Index: myfaces_ext.tld
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/tlds/myfaces_ext.tld,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- myfaces_ext.tld	5 Jan 2005 12:36:55 -0000	1.149
  +++ myfaces_ext.tld	9 Jan 2005 12:36:58 -0000	1.150
  @@ -1887,4 +1887,28 @@
               </description>
           </attribute>
   	</tag>
  +
  +    <!-- swap_image -->
  +    <tag>
  +        <name>swapImage</name>
  +        <tag-class>org.apache.myfaces.custom.swapimage.HtmlSwapImageTag</tag-class>
  +        <body-content>JSP</body-content>
  +        <attribute>
  +            <name>swapImageUrl</name>
  +            <required>true</required>
  +            <rtexprvalue>false</rtexprvalue>
  +            <description>
  +				the url of the image displayed onmouseover
  +            </description>
  +        </attribute>
  +        &ui_graphic_attributes;
  +        &html_universal_attributes;
  +        &html_img_attributes;
  +        <attribute><name>onclick</name>    <required>false</required>  <rtexprvalue>false</rtexprvalue></attribute>
  +        <attribute><name>ondblclick</name> <required>false</required>  <rtexprvalue>false</rtexprvalue></attribute>
  +        <attribute><name>onkeypress</name> <required>false</required>  <rtexprvalue>false</rtexprvalue></attribute>
  +        <attribute><name>onkeydown</name>  <required>false</required>  <rtexprvalue>false</rtexprvalue></attribute>
  +        <attribute><name>onkeyup</name>    <required>false</required>  <rtexprvalue>false</rtexprvalue></attribute>
  +    </tag>
  +
   </taglib>
  
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/resource/swapimage.js
  
  Index: swapimage.js
  ===================================================================
  function SI_MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  }
  
  function SI_MM_swapImage() { //v3.0
    var i,j=0,x,a=SI_MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
     if ((x=SI_MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  }
  
  function SI_MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=SI_MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
  }
  
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.java
  
  Index: HtmlSwapImage.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.swapimage;
  
  import org.apache.myfaces.component.UserRoleUtils;
  
  import javax.faces.component.UIGraphic;
  import javax.faces.el.ValueBinding;
  import javax.faces.context.FacesContext;
  
  /**
   * @author Thomas Spiegl
   * @version $Revision: 1.1 $ $Date: 2005/01/09 12:36:58 $
   *          $Log: HtmlSwapImage.java,v $
   *          Revision 1.1  2005/01/09 12:36:58  tomsp
   *          added new component swapimage
   *
   */
  public class HtmlSwapImage extends UIGraphic
  {
  
      //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
  
      public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSwapImage";
      public static final String COMPONENT_FAMILY = "javax.faces.Graphic";
      private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.SwapImage";
      private static final boolean DEFAULT_ISMAP = false;
  
      private String _swapImageUrl = null;
      private String _alt = null;
      private String _dir = null;
      private String _height = null;
      private Boolean _ismap = null;
      private String _lang = null;
      private String _longdesc = null;
      private String _onclick = null;
      private String _ondblclick = null;
      private String _onkeydown = null;
      private String _onkeypress = null;
      private String _onkeyup = null;
      private String _style = null;
      private String _styleClass = null;
      private String _title = null;
      private String _usemap = null;
      private String _width = null;
  
      public HtmlSwapImage()
      {
          setRendererType(DEFAULT_RENDERER_TYPE);
      }
  
      public String getFamily()
      {
          return COMPONENT_FAMILY;
      }
  
      public void setSwapImageUrl(String swapImageUrl)
      {
          _swapImageUrl = swapImageUrl;
      }
  
      public String getSwapImageUrl()
      {
          if (_swapImageUrl != null) return _swapImageUrl;
          ValueBinding vb = getValueBinding("swapImageUrl");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setAlt(String alt)
      {
          _alt = alt;
      }
  
      public String getAlt()
      {
          if (_alt != null) return _alt;
          ValueBinding vb = getValueBinding("alt");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setDir(String dir)
      {
          _dir = dir;
      }
  
      public String getDir()
      {
          if (_dir != null) return _dir;
          ValueBinding vb = getValueBinding("dir");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setHeight(String height)
      {
          _height = height;
      }
  
      public String getHeight()
      {
          if (_height != null) return _height;
          ValueBinding vb = getValueBinding("height");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setIsmap(boolean ismap)
      {
          _ismap = Boolean.valueOf(ismap);
      }
  
      public boolean isIsmap()
      {
          if (_ismap != null) return _ismap.booleanValue();
          ValueBinding vb = getValueBinding("ismap");
          Boolean v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
          return v != null ? v.booleanValue() : DEFAULT_ISMAP;
      }
  
      public void setLang(String lang)
      {
          _lang = lang;
      }
  
      public String getLang()
      {
          if (_lang != null) return _lang;
          ValueBinding vb = getValueBinding("lang");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setLongdesc(String longdesc)
      {
          _longdesc = longdesc;
      }
  
      public String getLongdesc()
      {
          if (_longdesc != null) return _longdesc;
          ValueBinding vb = getValueBinding("longdesc");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setOnclick(String onclick)
      {
          _onclick = onclick;
      }
  
      public String getOnclick()
      {
          if (_onclick != null) return _onclick;
          ValueBinding vb = getValueBinding("onclick");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setOndblclick(String ondblclick)
      {
          _ondblclick = ondblclick;
      }
  
      public String getOndblclick()
      {
          if (_ondblclick != null) return _ondblclick;
          ValueBinding vb = getValueBinding("ondblclick");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setOnkeydown(String onkeydown)
      {
          _onkeydown = onkeydown;
      }
  
      public String getOnkeydown()
      {
          if (_onkeydown != null) return _onkeydown;
          ValueBinding vb = getValueBinding("onkeydown");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setOnkeypress(String onkeypress)
      {
          _onkeypress = onkeypress;
      }
  
      public String getOnkeypress()
      {
          if (_onkeypress != null) return _onkeypress;
          ValueBinding vb = getValueBinding("onkeypress");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setOnkeyup(String onkeyup)
      {
          _onkeyup = onkeyup;
      }
  
      public String getOnkeyup()
      {
          if (_onkeyup != null) return _onkeyup;
          ValueBinding vb = getValueBinding("onkeyup");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setStyle(String style)
      {
          _style = style;
      }
  
      public String getStyle()
      {
          if (_style != null) return _style;
          ValueBinding vb = getValueBinding("style");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setStyleClass(String styleClass)
      {
          _styleClass = styleClass;
      }
  
      public String getStyleClass()
      {
          if (_styleClass != null) return _styleClass;
          ValueBinding vb = getValueBinding("styleClass");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setTitle(String title)
      {
          _title = title;
      }
  
      public String getTitle()
      {
          if (_title != null) return _title;
          ValueBinding vb = getValueBinding("title");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setUsemap(String usemap)
      {
          _usemap = usemap;
      }
  
      public String getUsemap()
      {
          if (_usemap != null) return _usemap;
          ValueBinding vb = getValueBinding("usemap");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
      public void setWidth(String width)
      {
          _width = width;
      }
  
      public String getWidth()
      {
          if (_width != null) return _width;
          ValueBinding vb = getValueBinding("width");
          return vb != null ? (String)vb.getValue(getFacesContext()) : null;
      }
  
  
      public boolean isRendered()
      {
          if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
          return super.isRendered();
      }
  
      public Object saveState(FacesContext context)
      {
          Object values[] = new Object[18];
          values[0] = super.saveState(context);
          values[1] = _swapImageUrl;
          values[2] = _alt;
          values[3] = _dir;
          values[4] = _height;
          values[5] = _ismap;
          values[6] = _lang;
          values[7] = _longdesc;
          values[8] = _onclick;
          values[9] = _ondblclick;
          values[10] = _onkeydown;
          values[11] = _onkeypress;
          values[12] = _onkeyup;
          values[13] = _style;
          values[14] = _styleClass;
          values[15] = _title;
          values[16] = _usemap;
          values[17] = _width;
          return ((Object) (values));
      }
  
      public void restoreState(FacesContext context, Object state)
      {
          Object values[] = (Object[])state;
          super.restoreState(context, values[0]);
          _swapImageUrl = (String)values[1];
          _alt = (String)values[2];
          _dir = (String)values[3];
          _height = (String)values[4];
          _ismap = (Boolean)values[5];
          _lang = (String)values[6];
          _longdesc = (String)values[7];
          _onclick = (String)values[8];
          _ondblclick = (String)values[9];
          _onkeydown = (String)values[10];
          _onkeypress = (String)values[11];
          _onkeyup = (String)values[12];
          _style = (String)values[13];
          _styleClass = (String)values[14];
          _title = (String)values[15];
          _usemap = (String)values[16];
          _width = (String)values[17];
      }
      //------------------ GENERATED CODE END ---------------------------------------
  }
  
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.xml
  
  Index: HtmlSwapImage.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!DOCTYPE component PUBLIC
    "-//MyFaces//DTD MyFaces component def 1.0//EN"
    "http://myfaces.apache.org/dtd/Component.dtd">
  <component generateStateMethods="true" generateUserRoleMethods="true" >
      <component-class>org.apache.myfaces.custom.swapimage.HtmlSwapImage</component-class>
      <base-class>javax.faces.component.UIGraphic</base-class>
      <component-type>org.apache.myfaces.HtmlSwapImage</component-type>
      <component-family>javax.faces.Graphic</component-family>
      <renderer-type>org.apache.myfaces.SwapImage</renderer-type>
      <field>
          <name>swapImageUrl</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>alt</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>dir</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>height</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>ismap</name>
          <type>boolean</type>
          <default-value>false</default-value>
      </field>
      <field>
          <name>lang</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>longdesc</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>onclick</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>ondblclick</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>onkeydown</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>onkeypress</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>onkeyup</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>style</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>styleClass</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>title</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>usemap</name>
          <type>java.lang.String</type>
      </field>
      <field>
          <name>width</name>
          <type>java.lang.String</type>
      </field>
  </component>
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageRenderer.java
  
  Index: HtmlSwapImageRenderer.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.swapimage;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.myfaces.component.html.util.AddResource;
  import org.apache.myfaces.renderkit.JSFAttr;
  import org.apache.myfaces.renderkit.RendererUtils;
  import org.apache.myfaces.renderkit.html.HTML;
  import org.apache.myfaces.renderkit.html.HtmlRenderer;
  import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
  
  import javax.faces.component.UIComponent;
  import javax.faces.component.UIGraphic;
  import javax.faces.context.FacesContext;
  import javax.faces.context.ResponseWriter;
  import java.io.IOException;
  
  /**
   * @author Thomas Spiegl
   * @version $Revision: 1.1 $ $Date: 2005/01/09 12:36:58 $
   *          $Log: HtmlSwapImageRenderer.java,v $
   *          Revision 1.1  2005/01/09 12:36:58  tomsp
   *          added new component swapimage
   *
   */
  public class HtmlSwapImageRenderer
          extends HtmlRenderer
  {
      private static final Log log = LogFactory.getLog(HtmlSwapImageRenderer.class);
  
      public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
              throws IOException
      {
          RendererUtils.checkParamValidity(facesContext, uiComponent, UIGraphic.class);
  
          ResponseWriter writer = facesContext.getResponseWriter();
  
          AddResource.addJavaScriptToHeader(
                  HtmlSwapImage.class, "swapimage.js", true, facesContext);
  
          String url;
          if (uiComponent instanceof HtmlSwapImage)
          {
              url = ((HtmlSwapImage)uiComponent).getUrl();
          }
          else
          {
              url = (String)uiComponent.getAttributes().get(JSFAttr.URL_ATTR);
          }
  
          if ((url != null) && (url.length() > 0))
          {
              writer.startElement(HTML.IMG_ELEM, uiComponent);
  
              String clientId = uiComponent.getClientId(facesContext);
              writer.writeAttribute(HTML.ID_ATTR, clientId, null);
  
              String src = facesContext.getApplication()
                      .getViewHandler().getResourceURL(facesContext, url);
              writer.writeURIAttribute(HTML.SRC_ATTR,
                                       facesContext.getExternalContext().encodeResourceURL(src),
                                       null);
  
              if (uiComponent instanceof HtmlSwapImage)
              {
                  String swapImageUrl = ((HtmlSwapImage) uiComponent).getSwapImageUrl();
                  if (swapImageUrl != null)
                  {
                      writer.writeAttribute(HTML.ONMOUSEOVER_ATTR, "SI_MM_swapImage('" + clientId + "','','" + swapImageUrl + "',1);", null);
                      writer.writeAttribute(HTML.ONMOUSEOUT_ATTR, "SI_MM_swapImgRestore();", null);
                  }
              }
  
              HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.IMG_PASSTHROUGH_ATTRIBUTES);
  
              writer.endElement(HTML.IMG_ELEM);
          }
          else
          {
              if (log.isWarnEnabled()) log.warn("Graphic with id " + uiComponent.getClientId(facesContext) + " has no value (url).");
          }
      }
  }
  
  
  
  1.1                  incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageTag.java
  
  Index: HtmlSwapImageTag.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.swapimage;
  
  import org.apache.myfaces.taglib.html.HtmlGraphicImageTagBase;
  
  import javax.faces.component.UIComponent;
  
  /**
   * @author Thomas Spiegl
   * @version $Revision: 1.1 $ $Date: 2005/01/09 12:36:58 $
   *          $Log: HtmlSwapImageTag.java,v $
   *          Revision 1.1  2005/01/09 12:36:58  tomsp
   *          added new component swapimage
   *
   */
  public class HtmlSwapImageTag
          extends HtmlGraphicImageTagBase
  {
      private static final String RENDERER_TYPE = "org.apache.myfaces.SwapImage";
  
      private String _swapImageUrl;
  
      public String getComponentType()
      {
          return HtmlSwapImage.COMPONENT_TYPE;
      }
  
      public String getRendererType()
      {
          return RENDERER_TYPE;
      }
  
      protected void setProperties(UIComponent component)
      {
          super.setProperties(component);
  
          ((HtmlSwapImage) component).setSwapImageUrl(_swapImageUrl);
      }
  
      public void setSwapImageUrl(String swapImageUrl)
      {
          _swapImageUrl = swapImageUrl;
      }
  
      public void setOnmouseover(String onmouseover)
      {
          throw new UnsupportedOperationException(HtmlSwapImageTag.class.getName() + ".setOnmouseover not supported.");
      }
  
      public void setOnmousedown(String onmousedown)
      {
          throw new UnsupportedOperationException(HtmlSwapImageTag.class.getName() + ".setOnmousedown not supported.");
      }
  
      public void setOnmouseup(String onmouseup)
      {
          throw new UnsupportedOperationException(HtmlSwapImageTag.class.getName() + ".setOnmouseup not supported.");
      }
  
      public void setOnmousemove(String onmousemove)
      {
          throw new UnsupportedOperationException(HtmlSwapImageTag.class.getName() + ".setOnmousemove not supported.");
      }
  
      public void setOnmouseout(String onmouseout)
      {
          throw new UnsupportedOperationException(HtmlSwapImageTag.class.getName() + ".setOnmouseout not supported.");
      }
  }