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 import javax.faces.component.behavior.ClientBehaviorHolder; 23 24 import org.apache.myfaces.component.AlignProperty; 25 import org.apache.myfaces.component.EventAware; 26 import org.apache.myfaces.component.StyleAware; 27 import org.apache.myfaces.component.UniversalProperties; 28 import org.apache.myfaces.component.UserRoleUtils; 29 30 /** 31 * Unless otherwise specified, all attributes accept static values or EL expressions. 32 * 33 * @JSFComponent 34 * name = "t:swapImage" 35 * class = "org.apache.myfaces.custom.swapimage.HtmlSwapImage" 36 * tagClass = "org.apache.myfaces.custom.swapimage.HtmlSwapImageTag" 37 * @since 1.1.7 38 * @author Thomas Spiegl 39 * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (miƩ, 03 sep 2008) $ 40 */ 41 public abstract class AbstractHtmlSwapImage extends UIGraphic 42 implements UniversalProperties, AlignProperty, StyleAware, EventAware, ClientBehaviorHolder 43 { 44 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlSwapImage"; 45 public static final String COMPONENT_FAMILY = "javax.faces.Graphic"; 46 private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.SwapImage"; 47 private static final boolean DEFAULT_ISMAP = false; 48 49 /** 50 * HTML: Specifies the width of the border of this element, in pixels. Deprecated in HTML 4.01. 51 * 52 * @JSFProperty 53 * defaultValue="Integer.MIN_VALUE" 54 */ 55 public abstract String getBorder(); 56 57 /** 58 * HTML: The amount of white space to be inserted to the left and 59 * right of this element, in undefined units. 60 * Deprecated in HTML 4.01. 61 * 62 * @JSFProperty 63 */ 64 public abstract String getHspace(); 65 66 /** 67 * HTML: The amount of white space to be inserted above and 68 * below this element, in undefined units. 69 * Deprecated in HTML 4.01. 70 * 71 * @JSFProperty 72 */ 73 public abstract String getVspace(); 74 75 /** 76 * the url of the image displayed onmouseover 77 * 78 * @JSFProperty 79 * required="true" 80 */ 81 public abstract String getSwapImageUrl(); 82 83 /** 84 * activeImage will be rendered if: swapImage is a direct 85 * child of commandNavigation and the commandNavigation.isActive 86 * 87 * @JSFProperty 88 */ 89 public abstract String getActiveImageUrl(); 90 91 /** 92 * HTML: Specifies alternative text that can be used by a browser 93 * that can't show this element. 94 * 95 * @JSFProperty 96 */ 97 public abstract String getAlt(); 98 99 /** 100 * HTML: Overrides the natural height of this image, by specifying 101 * height in pixels. 102 * 103 * @JSFProperty 104 */ 105 public abstract String getHeight(); 106 107 /** 108 * HTML: Specifies server-side image map handling for this image. 109 * 110 * @JSFProperty 111 * defaultValue = "false" 112 */ 113 public abstract boolean isIsmap(); 114 115 /** 116 * HTML: A link to a long description of the image. 117 * 118 * @JSFProperty 119 */ 120 public abstract String getLongdesc(); 121 122 /** 123 * HTML: Specifies an image map to use with this image. 124 * 125 * @JSFProperty 126 */ 127 public abstract String getUsemap(); 128 129 /** 130 * HTML: Overrides the natural width of this image, by 131 * specifying width in pixels. 132 * 133 * @JSFProperty 134 */ 135 public abstract String getWidth(); 136 137 public boolean isRendered() 138 { 139 if (!UserRoleUtils.isVisibleOnUserRole(this)) return false; 140 return super.isRendered(); 141 } 142 143 }