myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage HtmlSwapImage.java HtmlSwapImage.xml HtmlSwapImageRenderer.java HtmlSwapImageTag.java
Date Sun, 09 Jan 2005 21:56:33 GMT
tomsp       2005/01/09 13:56:33

  Modified:    webapps/examples/web swapimage.jsp
               tlds     myfaces_ext.tld
               .        .cvsignore
               src/components/org/apache/myfaces/custom/navigation
                        HtmlCommandNavigation.java
               src/components/org/apache/myfaces/custom/swapimage
                        HtmlSwapImage.java HtmlSwapImage.xml
                        HtmlSwapImageRenderer.java HtmlSwapImageTag.java
  Log:
  added new component swapimage
  
  Revision  Changes    Path
  1.2       +1 -1      incubator-myfaces/webapps/examples/web/swapimage.jsp
  
  Index: swapimage.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/swapimage.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- swapimage.jsp	9 Jan 2005 12:36:58 -0000	1.1
  +++ swapimage.jsp	9 Jan 2005 21:56:33 -0000	1.2
  @@ -51,7 +51,7 @@
           </f:facet>
   
           <f:facet name="navigation">
  -            <f:subview id="menu" >
  +            <f:subview id="menu">
                   <jsp:include page="inc/navigation.jsp" />
               </f:subview>
           </f:facet>
  
  
  
  1.151     +9 -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.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- myfaces_ext.tld	9 Jan 2005 12:36:58 -0000	1.150
  +++ myfaces_ext.tld	9 Jan 2005 21:56:33 -0000	1.151
  @@ -1901,6 +1901,15 @@
   				the url of the image displayed onmouseover
               </description>
           </attribute>
  +        <attribute>
  +            <name>activeImageUrl</name>
  +            <required>true</required>
  +            <rtexprvalue>false</rtexprvalue>
  +            <description>
  +				activeImage will be rendered if: swapImage is a direct child of commandNavigation
  +                and the commandNavigation.isActive
  +            </description>
  +        </attribute>
           &ui_graphic_attributes;
           &html_universal_attributes;
           &html_img_attributes;
  
  
  
  1.11      +1 -0      incubator-myfaces/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/.cvsignore,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- .cvsignore	24 Dec 2004 13:21:50 -0000	1.10
  +++ .cvsignore	9 Jan 2005 21:56:33 -0000	1.11
  @@ -19,3 +19,4 @@
   incubator-myfaces.iws
   myfaces-1.0.8-src.tgz
   *.sig
  +intellij
  
  
  
  1.5       +21 -3     incubator-myfaces/src/components/org/apache/myfaces/custom/navigation/HtmlCommandNavigation.java
  
  Index: HtmlCommandNavigation.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/navigation/HtmlCommandNavigation.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HtmlCommandNavigation.java	9 Dec 2004 00:59:15 -0000	1.4
  +++ HtmlCommandNavigation.java	9 Jan 2005 21:56:33 -0000	1.5
  @@ -27,6 +27,7 @@
   import javax.faces.event.FacesEvent;
   import javax.faces.event.PhaseId;
   import java.util.Iterator;
  +import java.util.List;
   
   /**
    * Command, that represents a navigation item.
  @@ -135,7 +136,7 @@
               }
               // p is now the HtmlPanelNavigation
   
  -            if (getChildCount() == 0)
  +            if (!hasCommandNavigationChildren())
               {
                   //item is an end node --> deactivate all other nodes, and then...
                   if (!(p instanceof HtmlPanelNavigation))
  @@ -156,6 +157,23 @@
                   setOpen(true);
               }
           }
  +    }
  +
  +    private boolean hasCommandNavigationChildren()
  +    {
  +        if (getChildCount() == 0)
  +        {
  +            return false;
  +        }
  +        List list = getChildren();
  +        for (int i = 0, sizei = list.size(); i < sizei; i++)
  +        {
  +            if (list.get(i) instanceof HtmlCommandNavigation)
  +            {
  +                return true;
  +            }
  +        }
  +        return false;
       }
   
   
  
  
  
  1.2       +53 -35    incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.java
  
  Index: HtmlSwapImage.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlSwapImage.java	9 Jan 2005 12:36:58 -0000	1.1
  +++ HtmlSwapImage.java	9 Jan 2005 21:56:33 -0000	1.2
  @@ -25,6 +25,9 @@
    * @author Thomas Spiegl
    * @version $Revision$ $Date$
    *          $Log$
  + *          Revision 1.2  2005/01/09 21:56:33  tomsp
  + *          added new component swapimage
  + *
    *          Revision 1.1  2005/01/09 12:36:58  tomsp
    *          added new component swapimage
    *
  @@ -40,6 +43,7 @@
       private static final boolean DEFAULT_ISMAP = false;
   
       private String _swapImageUrl = null;
  +    private String _activeImageUrl = null;
       private String _alt = null;
       private String _dir = null;
       private String _height = null;
  @@ -79,6 +83,18 @@
           return vb != null ? (String)vb.getValue(getFacesContext()) : null;
       }
   
  +    public void setActiveImageUrl(String activeImageUrl)
  +    {
  +        _activeImageUrl = activeImageUrl;
  +    }
  +
  +    public String getActiveImageUrl()
  +    {
  +        if (_activeImageUrl != null) return _activeImageUrl;
  +        ValueBinding vb = getValueBinding("activeImageUrl");
  +        return vb != null ? (String)vb.getValue(getFacesContext()) : null;
  +    }
  +
       public void setAlt(String alt)
       {
           _alt = alt;
  @@ -281,25 +297,26 @@
   
       public Object saveState(FacesContext context)
       {
  -        Object values[] = new Object[18];
  +        Object values[] = new Object[19];
           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;
  +        values[2] = _activeImageUrl;
  +        values[3] = _alt;
  +        values[4] = _dir;
  +        values[5] = _height;
  +        values[6] = _ismap;
  +        values[7] = _lang;
  +        values[8] = _longdesc;
  +        values[9] = _onclick;
  +        values[10] = _ondblclick;
  +        values[11] = _onkeydown;
  +        values[12] = _onkeypress;
  +        values[13] = _onkeyup;
  +        values[14] = _style;
  +        values[15] = _styleClass;
  +        values[16] = _title;
  +        values[17] = _usemap;
  +        values[18] = _width;
           return ((Object) (values));
       }
   
  @@ -308,22 +325,23 @@
           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];
  +        _activeImageUrl = (String)values[2];
  +        _alt = (String)values[3];
  +        _dir = (String)values[4];
  +        _height = (String)values[5];
  +        _ismap = (Boolean)values[6];
  +        _lang = (String)values[7];
  +        _longdesc = (String)values[8];
  +        _onclick = (String)values[9];
  +        _ondblclick = (String)values[10];
  +        _onkeydown = (String)values[11];
  +        _onkeypress = (String)values[12];
  +        _onkeyup = (String)values[13];
  +        _style = (String)values[14];
  +        _styleClass = (String)values[15];
  +        _title = (String)values[16];
  +        _usemap = (String)values[17];
  +        _width = (String)values[18];
       }
       //------------------ GENERATED CODE END ---------------------------------------
   }
  
  
  
  1.2       +4 -0      incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.xml
  
  Index: HtmlSwapImage.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImage.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlSwapImage.xml	9 Jan 2005 12:36:58 -0000	1.1
  +++ HtmlSwapImage.xml	9 Jan 2005 21:56:33 -0000	1.2
  @@ -13,6 +13,10 @@
           <type>java.lang.String</type>
       </field>
       <field>
  +        <name>activeImageUrl</name>
  +        <type>java.lang.String</type>
  +    </field>
  +    <field>
           <name>alt</name>
           <type>java.lang.String</type>
       </field>
  
  
  
  1.2       +16 -5     incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageRenderer.java
  
  Index: HtmlSwapImageRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlSwapImageRenderer.java	9 Jan 2005 12:36:58 -0000	1.1
  +++ HtmlSwapImageRenderer.java	9 Jan 2005 21:56:33 -0000	1.2
  @@ -23,6 +23,7 @@
   import org.apache.myfaces.renderkit.html.HTML;
   import org.apache.myfaces.renderkit.html.HtmlRenderer;
   import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
  +import org.apache.myfaces.custom.navigation.HtmlCommandNavigation;
   
   import javax.faces.component.UIComponent;
   import javax.faces.component.UIGraphic;
  @@ -34,6 +35,9 @@
    * @author Thomas Spiegl
    * @version $Revision$ $Date$
    *          $Log$
  + *          Revision 1.2  2005/01/09 21:56:33  tomsp
  + *          added new component swapimage
  + *
    *          Revision 1.1  2005/01/09 12:36:58  tomsp
    *          added new component swapimage
    *
  @@ -50,13 +54,20 @@
   
           ResponseWriter writer = facesContext.getResponseWriter();
   
  -        AddResource.addJavaScriptToHeader(
  -                HtmlSwapImage.class, "swapimage.js", true, facesContext);
  +        AddResource.addJavaScriptToHeader(HtmlSwapImage.class, "swapimage.js", facesContext);
   
           String url;
           if (uiComponent instanceof HtmlSwapImage)
           {
  -            url = ((HtmlSwapImage)uiComponent).getUrl();
  +            if (uiComponent.getParent() instanceof HtmlCommandNavigation)
  +            {
  +                url = ((HtmlCommandNavigation) uiComponent.getParent()).isActive() ?
  +                    ((HtmlSwapImage) uiComponent).getActiveImageUrl() : ((HtmlSwapImage)uiComponent).getUrl();
  +            }
  +            else
  +            {
  +                url = ((HtmlSwapImage)uiComponent).getUrl();
  +            }
           }
           else
           {
  
  
  
  1.2       +12 -2     incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageTag.java
  
  Index: HtmlSwapImageTag.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/swapimage/HtmlSwapImageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlSwapImageTag.java	9 Jan 2005 12:36:58 -0000	1.1
  +++ HtmlSwapImageTag.java	9 Jan 2005 21:56:33 -0000	1.2
  @@ -23,6 +23,9 @@
    * @author Thomas Spiegl
    * @version $Revision$ $Date$
    *          $Log$
  + *          Revision 1.2  2005/01/09 21:56:33  tomsp
  + *          added new component swapimage
  + *
    *          Revision 1.1  2005/01/09 12:36:58  tomsp
    *          added new component swapimage
    *
  @@ -33,6 +36,7 @@
       private static final String RENDERER_TYPE = "org.apache.myfaces.SwapImage";
   
       private String _swapImageUrl;
  +    private String _activeImageUrl;
   
       public String getComponentType()
       {
  @@ -49,11 +53,17 @@
           super.setProperties(component);
   
           ((HtmlSwapImage) component).setSwapImageUrl(_swapImageUrl);
  +        ((HtmlSwapImage) component).setActiveImageUrl(_activeImageUrl);
       }
   
       public void setSwapImageUrl(String swapImageUrl)
       {
           _swapImageUrl = swapImageUrl;
  +    }
  +
  +    public void setActiveImageUrl(String activeImageUrl)
  +    {
  +        _activeImageUrl = activeImageUrl;
       }
   
       public void setOnmouseover(String onmouseover)
  
  
  

Mime
View raw message