View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.custom.swapimage;
20  
21  import javax.faces.component.UIGraphic;
22  
23  import org.apache.myfaces.component.AlignProperty;
24  import org.apache.myfaces.component.StyleAware;
25  import org.apache.myfaces.component.UniversalProperties;
26  import org.apache.myfaces.component.UserRoleUtils;
27  
28  /**
29   * Unless otherwise specified, all attributes accept static values or EL expressions.
30   * 
31   * @JSFComponent
32   *   name = "t:swapImage"
33   *   class = "org.apache.myfaces.custom.swapimage.HtmlSwapImage"
34   *   tagClass = "org.apache.myfaces.custom.swapimage.HtmlSwapImageTag"
35   * @since 1.1.7
36   * @author Thomas Spiegl
37   * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (Wed, 03 Sep 2008) $
38   */
39  public abstract class AbstractHtmlSwapImage extends UIGraphic
40      implements UniversalProperties, AlignProperty, StyleAware
41  {
42      public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSwapImage";
43      public static final String COMPONENT_FAMILY = "javax.faces.Graphic";
44      private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.SwapImage";
45      private static final boolean DEFAULT_ISMAP = false;
46  
47      /**
48       * HTML: Specifies the width of the border of this element, in pixels. Deprecated in HTML 4.01.
49       * 
50       * @JSFProperty
51       *   defaultValue="Integer.MIN_VALUE"
52       */
53      public abstract String getBorder();
54  
55      /**
56       * HTML: The amount of white space to be inserted to the left and 
57       * right of this element, in undefined units. 
58       * Deprecated in HTML 4.01.
59       * 
60       * @JSFProperty
61       */
62      public abstract String getHspace();
63      
64      /**
65       *  HTML: The amount of white space to be inserted above and 
66       *  below this element, in undefined units. 
67       *  Deprecated in HTML 4.01.
68       * 
69       * @JSFProperty
70       */
71      public abstract String getVspace();
72      
73      /**
74       * the url of the image displayed onmouseover
75       * 
76       * @JSFProperty
77       *   required="true"
78       */
79      public abstract String getSwapImageUrl();
80  
81      /**
82       * activeImage will be rendered if: swapImage is a direct 
83       * child of commandNavigation and the commandNavigation.isActive
84       * 
85       * @JSFProperty
86       */
87      public abstract String getActiveImageUrl();
88  
89      /**
90       * HTML: Specifies alternative text that can be used by a browser 
91       * that can't show this element.
92       * 
93       * @JSFProperty
94       */
95      public abstract String getAlt();
96  
97      /**
98       * HTML: Overrides the natural height of this image, by specifying 
99       * height in pixels.
100      * 
101      * @JSFProperty
102      */
103     public abstract String getHeight();
104 
105     /**
106      * HTML: Specifies server-side image map handling for this image.
107      * 
108      * @JSFProperty
109      *   defaultValue = "false"
110      */
111     public abstract boolean isIsmap();
112 
113     /**
114      * HTML: A link to a long description of the image.
115      * 
116      * @JSFProperty
117      */
118     public abstract String getLongdesc();
119 
120     /**
121      * HTML: Script to be invoked when the element is clicked.
122      * 
123      * @JSFProperty
124      */
125     public abstract String getOnclick();
126 
127     /**
128      * HTML: Script to be invoked when the element is double-clicked.
129      * 
130      * @JSFProperty
131      */
132     public abstract String getOndblclick();
133 
134     /**
135      * HTML: Script to be invoked when a key is pressed down over this element.
136      * 
137      * @JSFProperty
138      */
139     public abstract String getOnkeydown();
140 
141     /**
142      * HTML: Script to be invoked when a key is pressed over this element.
143      * 
144      * @JSFProperty
145      */
146     public abstract String getOnkeypress();
147 
148     /**
149      * HTML: Script to be invoked when a key is released over this element.
150      * 
151      * @JSFProperty
152      */
153     public abstract String getOnkeyup();
154 
155     /**
156      * HTML: Specifies an image map to use with this image.
157      * 
158      * @JSFProperty
159      */
160     public abstract String getUsemap();
161 
162     /**
163      * HTML: Overrides the natural width of this image, by 
164      * specifying width in pixels.
165      * 
166      * @JSFProperty
167      */
168     public abstract String getWidth();
169 
170     public boolean isRendered()
171     {
172         if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
173         return super.isRendered();
174     }
175 
176 }