All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.webui.jsf.component.ImageComponent Maven / Gradle / Ivy

There is a newer version: 4.4.0.1
Show newest version
/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at
 * https://woodstock.dev.java.net/public/CDDLv1.0.html.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at https://woodstock.dev.java.net/public/CDDLv1.0.html.
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
 */
package com.sun.webui.jsf.component;

import javax.el.ValueExpression;
import javax.faces.component.UIGraphic;
import javax.faces.context.FacesContext;
import com.sun.faces.annotation.Component;
import com.sun.faces.annotation.Property;

/**
 * The ImageComponent is used to display in inline graphic image. 
 */
@Component(type = "com.sun.webui.jsf.Image", family = "com.sun.webui.jsf.Image",
displayName = "Image",
tagName = "image", instanceName = "image",
helpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_image_component",
propertiesHelpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_propsheets_image_component_props")
public class ImageComponent extends UIGraphic {

    /**
     * 

Construct a new ImageComponent.

*/ public ImageComponent() { super(); setRendererType("com.sun.webui.jsf.Image"); } /** *

Return the family for this component.

*/ @Override public String getFamily() { return "com.sun.webui.jsf.Image"; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Tag attribute methods // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * The component identifier for this component. This value must be unique * within the closest parent component that is a naming container. */ @Property(name = "id") @Override public void setId(String id) { super.setId(id); } /** * Use the rendered attribute to indicate whether the HTML code for the * component should be included in the rendered HTML page. If set to false, * the rendered HTML page does not include the HTML for the component. If * the component is not rendered, it is also not processed on any subsequent * form submission. */ @Property(name = "rendered") @Override public void setRendered(boolean rendered) { super.setRendered(rendered); } /** *

Return the ValueExpression stored for the * specified name (if any), respecting any property aliases.

* * @param name Name of value binding expression to retrieve */ @Override public ValueExpression getValueExpression(String name) { if (name.equals("url")) { return super.getValueExpression("value"); } return super.getValueExpression(name); } /** *

Set the ValueExpression stored for the * specified name (if any), respecting any property * aliases.

* * @param name Name of value binding to set * @param binding ValueExpression to set, or null to remove */ @Override public void setValueExpression(String name, ValueExpression binding) { if (name.equals("url")) { super.setValueExpression("value", binding); return; } super.setValueExpression(name, binding); } // Hide value @Property(name = "value", isHidden = true, isAttribute = false) @Override public Object getValue() { return super.getValue(); } /** *

Specifies the position of the image with respect to its context. * Valid values are: bottom (the default); middle; top; left; right.

*/ @Property(name = "align", displayName = "Align", category = "Appearance", editorClassName = "com.sun.webui.jsf.component.propertyeditors.HtmlAlignEditor") private String align = null; /** *

Specifies the position of the image with respect to its context. * Valid values are: bottom (the default); middle; top; left; right.

*/ public String getAlign() { if (this.align != null) { return this.align; } ValueExpression _vb = getValueExpression("align"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Specifies the position of the image with respect to its context. * Valid values are: bottom (the default); middle; top; left; right.

* @see #getAlign() */ public void setAlign(String align) { this.align = align; } /** *

Alternative textual description of the image rendered by this * component. The alt text can be used by screen readers and in tool tips, * and when image display is turned off in the web browser.

*/ @Property(name = "alt", displayName = "Alt Text", category = "Accessibility", editorClassName = "com.sun.rave.propertyeditors.StringPropertyEditor") private String alt = null; /** *

Alternative textual description of the image rendered by this * component. The alt text can be used by screen readers and in tool tips, * and when image display is turned off in the web browser.

*/ public String getAlt() { if (this.alt != null) { return this.alt; } ValueExpression _vb = getValueExpression("alt"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Alternative textual description of the image rendered by this * component. The alt text can be used by screen readers and in tool tips, * and when image display is turned off in the web browser.

* @see #getAlt() */ public void setAlt(String alt) { this.alt = alt; } /** *

Specifies the width of the img border in pixels. * The default value for this attribute depends on the web browser.

*/ @Property(name = "border", displayName = "Border", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int border = Integer.MIN_VALUE; private boolean border_set = false; /** *

Specifies the width of the img border in pixels. * The default value for this attribute depends on the web browser.

*/ public int getBorder() { if (this.border_set) { return this.border; } ValueExpression _vb = getValueExpression("border"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return 0; } /** *

Specifies the width of the img border in pixels. * The default value for this attribute depends on the web browser.

* @see #getBorder() */ public void setBorder(int border) { this.border = border; this.border_set = true; } /** *

Image height override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

*/ @Property(name = "height", displayName = "Height", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int height = Integer.MIN_VALUE; private boolean height_set = false; /** *

Image height override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

*/ public int getHeight() { if (this.height_set) { return this.height; } ValueExpression _vb = getValueExpression("height"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return Integer.MIN_VALUE; } /** *

Image height override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

* @see #getHeight() */ public void setHeight(int height) { this.height = height; this.height_set = true; } /** *

Specifies the amount of white space in pixels to be inserted to the * left and right of the image. The default value is not specified but is * generally a small, non-zero size.

*/ @Property(name = "hspace", displayName = "Horizontal Space", category = "Advanced", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int hspace = Integer.MIN_VALUE; private boolean hspace_set = false; /** *

Specifies the amount of white space in pixels to be inserted to the * left and right of the image. The default value is not specified but is * generally a small, non-zero size.

*/ public int getHspace() { if (this.hspace_set) { return this.hspace; } ValueExpression _vb = getValueExpression("hspace"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return Integer.MIN_VALUE; } /** *

Specifies the amount of white space in pixels to be inserted to the * left and right of the image. The default value is not specified but is * generally a small, non-zero size.

* @see #getHspace() */ public void setHspace(int hspace) { this.hspace = hspace; this.hspace_set = true; } /** *

The identifier of the desired theme image.

*/ @Property(name = "icon", displayName = "Icon", category = "Appearance", editorClassName = "com.sun.webui.jsf.component.propertyeditors.ThemeIconsEditor") private String icon = null; /** *

The identifier of the desired theme image.

*/ public String getIcon() { if (this.icon != null) { return this.icon; } ValueExpression _vb = getValueExpression("icon"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

The identifier of the desired theme image.

* @see #getIcon() */ public void setIcon(String icon) { this.icon = icon; } /** *

A verbose description of this image.

*/ @Property(name = "longDesc", displayName = "Long Description", category = "Accessibility", editorClassName = "com.sun.rave.propertyeditors.StringPropertyEditor") private String longDesc = null; /** *

A verbose description of this image.

*/ public String getLongDesc() { if (this.longDesc != null) { return this.longDesc; } ValueExpression _vb = getValueExpression("longDesc"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

A verbose description of this image.

* @see #getLongDesc() */ public void setLongDesc(String longDesc) { this.longDesc = longDesc; } /** *

Scripting code executed when a mouse click * occurs over this component.

*/ @Property(name = "onClick", displayName = "Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onClick = null; /** *

Scripting code executed when a mouse click * occurs over this component.

*/ public String getOnClick() { if (this.onClick != null) { return this.onClick; } ValueExpression _vb = getValueExpression("onClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse click * occurs over this component.

* @see #getOnClick() */ public void setOnClick(String onClick) { this.onClick = onClick; } /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ @Property(name = "onDblClick", displayName = "Double Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onDblClick = null; /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ public String getOnDblClick() { if (this.onDblClick != null) { return this.onDblClick; } ValueExpression _vb = getValueExpression("onDblClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse double click * occurs over this component.

* @see #getOnDblClick() */ public void setOnDblClick(String onDblClick) { this.onDblClick = onDblClick; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ @Property(name = "onMouseDown", displayName = "Mouse Down Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseDown = null; /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ public String getOnMouseDown() { if (this.onMouseDown != null) { return this.onMouseDown; } ValueExpression _vb = getValueExpression("onMouseDown"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

* @see #getOnMouseDown() */ public void setOnMouseDown(String onMouseDown) { this.onMouseDown = onMouseDown; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ @Property(name = "onMouseMove", displayName = "Mouse Move Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseMove = null; /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ public String getOnMouseMove() { if (this.onMouseMove != null) { return this.onMouseMove; } ValueExpression _vb = getValueExpression("onMouseMove"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

* @see #getOnMouseMove() */ public void setOnMouseMove(String onMouseMove) { this.onMouseMove = onMouseMove; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ @Property(name = "onMouseOut", displayName = "Mouse Out Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOut = null; /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ public String getOnMouseOut() { if (this.onMouseOut != null) { return this.onMouseOut; } ValueExpression _vb = getValueExpression("onMouseOut"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

* @see #getOnMouseOut() */ public void setOnMouseOut(String onMouseOut) { this.onMouseOut = onMouseOut; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ @Property(name = "onMouseOver", displayName = "Mouse In Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOver = null; /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ public String getOnMouseOver() { if (this.onMouseOver != null) { return this.onMouseOver; } ValueExpression _vb = getValueExpression("onMouseOver"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

* @see #getOnMouseOver() */ public void setOnMouseOver(String onMouseOver) { this.onMouseOver = onMouseOver; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ @Property(name = "onMouseUp", displayName = "Mouse Up Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseUp = null; /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ public String getOnMouseUp() { if (this.onMouseUp != null) { return this.onMouseUp; } ValueExpression _vb = getValueExpression("onMouseUp"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

* @see #getOnMouseUp() */ public void setOnMouseUp(String onMouseUp) { this.onMouseUp = onMouseUp; } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "style", displayName = "CSS Style(s)", category = "Appearance", editorClassName = "com.sun.jsfcl.std.css.CssStylePropertyEditor") private String style = null; /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyle() { if (this.style != null) { return this.style; } ValueExpression _vb = getValueExpression("style"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyle() */ public void setStyle(String style) { this.style = style; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "styleClass", displayName = "CSS Style Class(es)", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.StyleClassPropertyEditor") private String styleClass = null; /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyleClass() { if (this.styleClass != null) { return this.styleClass; } ValueExpression _vb = getValueExpression("styleClass"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyleClass() */ public void setStyleClass(String styleClass) { this.styleClass = styleClass; } /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

*/ @Property(name = "toolTip", displayName = "Tool Tip", category = "Behavior", editorClassName = "com.sun.rave.propertyeditors.StringPropertyEditor") private String toolTip = null; /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

*/ public String getToolTip() { if (this.toolTip != null) { return this.toolTip; } ValueExpression _vb = getValueExpression("toolTip"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

* @see #getToolTip() */ public void setToolTip(String toolTip) { this.toolTip = toolTip; } /** *

Absolute or relative URL to the image to be rendered.

*/ @Property(name = "url", displayName = "Url", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.ImageUrlPropertyEditor") @Override public String getUrl() { return (String) getValue(); } /** *

Absolute or relative URL to the image to be rendered.

* @see #getUrl() */ @Override public void setUrl(String url) { setValue((Object) url); } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ @Property(name = "visible", displayName = "Visible", category = "Behavior") private boolean visible = false; private boolean visible_set = false; /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ public boolean isVisible() { if (this.visible_set) { return this.visible; } ValueExpression _vb = getValueExpression("visible"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } return true; } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

* @see #isVisible() */ public void setVisible(boolean visible) { this.visible = visible; this.visible_set = true; } /** *

Specifies the amount of white space in pixels to be inserted above and * below the image. The default value is not specified but is generally a * small, non-zero size.

*/ @Property(name = "vspace", displayName = "Vertical Space", category = "Advanced", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int vspace = Integer.MIN_VALUE; private boolean vspace_set = false; /** *

Specifies the amount of white space in pixels to be inserted above and * below the image. The default value is not specified but is generally a * small, non-zero size.

*/ public int getVspace() { if (this.vspace_set) { return this.vspace; } ValueExpression _vb = getValueExpression("vspace"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return Integer.MIN_VALUE; } /** *

Specifies the amount of white space in pixels to be inserted above and * below the image. The default value is not specified but is generally a * small, non-zero size.

* @see #getVspace() */ public void setVspace(int vspace) { this.vspace = vspace; this.vspace_set = true; } /** *

Image width override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

*/ @Property(name = "width", displayName = "Width", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int width = Integer.MIN_VALUE; private boolean width_set = false; /** *

Image width override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

*/ public int getWidth() { if (this.width_set) { return this.width; } ValueExpression _vb = getValueExpression("width"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return Integer.MIN_VALUE; } /** *

Image width override. When specified, the width and height attributes * tell web browsers to override the natural image or object size in favor * of these values, specified in pixels. Some browsers might not support * this behavior.

* @see #getWidth() */ public void setWidth(int width) { this.width = width; this.width_set = true; } /** *

Restore the state of this component.

*/ @Override public void restoreState(FacesContext _context, Object _state) { Object _values[] = (Object[]) _state; super.restoreState(_context, _values[0]); this.align = (String) _values[1]; this.alt = (String) _values[2]; this.border = ((Integer) _values[3]).intValue(); this.border_set = ((Boolean) _values[4]).booleanValue(); this.height = ((Integer) _values[5]).intValue(); this.height_set = ((Boolean) _values[6]).booleanValue(); this.hspace = ((Integer) _values[7]).intValue(); this.hspace_set = ((Boolean) _values[8]).booleanValue(); this.icon = (String) _values[9]; this.longDesc = (String) _values[10]; this.onClick = (String) _values[11]; this.onDblClick = (String) _values[12]; this.onMouseDown = (String) _values[13]; this.onMouseMove = (String) _values[14]; this.onMouseOut = (String) _values[15]; this.onMouseOver = (String) _values[16]; this.onMouseUp = (String) _values[17]; this.style = (String) _values[18]; this.styleClass = (String) _values[19]; this.toolTip = (String) _values[20]; this.visible = ((Boolean) _values[21]).booleanValue(); this.visible_set = ((Boolean) _values[22]).booleanValue(); this.vspace = ((Integer) _values[23]).intValue(); this.vspace_set = ((Boolean) _values[24]).booleanValue(); this.width = ((Integer) _values[25]).intValue(); this.width_set = ((Boolean) _values[26]).booleanValue(); } /** *

Save the state of this component.

*/ @Override public Object saveState(FacesContext _context) { Object _values[] = new Object[27]; _values[0] = super.saveState(_context); _values[1] = this.align; _values[2] = this.alt; _values[3] = new Integer(this.border); _values[4] = this.border_set ? Boolean.TRUE : Boolean.FALSE; _values[5] = new Integer(this.height); _values[6] = this.height_set ? Boolean.TRUE : Boolean.FALSE; _values[7] = new Integer(this.hspace); _values[8] = this.hspace_set ? Boolean.TRUE : Boolean.FALSE; _values[9] = this.icon; _values[10] = this.longDesc; _values[11] = this.onClick; _values[12] = this.onDblClick; _values[13] = this.onMouseDown; _values[14] = this.onMouseMove; _values[15] = this.onMouseOut; _values[16] = this.onMouseOver; _values[17] = this.onMouseUp; _values[18] = this.style; _values[19] = this.styleClass; _values[20] = this.toolTip; _values[21] = this.visible ? Boolean.TRUE : Boolean.FALSE; _values[22] = this.visible_set ? Boolean.TRUE : Boolean.FALSE; _values[23] = new Integer(this.vspace); _values[24] = this.vspace_set ? Boolean.TRUE : Boolean.FALSE; _values[25] = new Integer(this.width); _values[26] = this.width_set ? Boolean.TRUE : Boolean.FALSE; return _values; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy