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

jakarta.faces.component.UIGraphic Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

package jakarta.faces.component;

import jakarta.el.ValueExpression;

/**
 * 

* UIGraphic is a {@link UIComponent} that displays a graphical image to the user. The user cannot * manipulate this component; it is for display purposes only. *

* *

* By default, the rendererType property must be set to "jakarta.faces.Image". This value can * be changed by calling the setRendererType() method. *

*/ public class UIGraphic extends UIComponentBase { /** * Properties that are tracked by state saving. */ enum PropertyKeys { /** *

* The local value of this {@link UIComponent}. *

*/ value } // ------------------------------------------------------ Manifest Constants /** *

* The standard component type for this component. *

*/ public static final String COMPONENT_TYPE = "jakarta.faces.Graphic"; /** *

* The standard component family for this component. *

*/ public static final String COMPONENT_FAMILY = "jakarta.faces.Graphic"; // ------------------------------------------------------------ Constructors /** *

* Create a new {@link UIGraphic} instance with default property values. *

*/ public UIGraphic() { super(); setRendererType("jakarta.faces.Image"); } // ------------------------------------------------------ Instance Variables // private Object value = null; // -------------------------------------------------------------- Properties @Override public String getFamily() { return COMPONENT_FAMILY; } /** *

* Return the image URL for this {@link UIGraphic}. This method is a typesafe alias for getValue(). *

* * @return the url. */ public String getUrl() { return (String) getValue(); } /** *

* Set the image URL for this {@link UIGraphic}. This method is a typesafe alias for setValue(). *

* * @param url The new image URL */ public void setUrl(String url) { setValue(url); } /** *

* Returns the value property of the UIGraphic. This will typically be rendered as an URL. *

* * @return the value. */ public Object getValue() { return getStateHelper().eval(PropertyKeys.value); } /** *

* Sets the value property of the UIGraphic. This will typically be rendered as an URL. *

* * @param value the new value */ public void setValue(Object value) { getStateHelper().put(PropertyKeys.value, value); } // ---------------------------------------------------------------- Bindings /** *

* Return any {@link ValueExpression} set for value if a {@link ValueExpression} for url is * requested; otherwise, perform the default superclass processing for this method. *

* * @param name Name of the attribute or property for which to retrieve a {@link ValueExpression} * @return the value expression, or null. * @throws NullPointerException if name is null * @since 1.2 */ @Override public ValueExpression getValueExpression(String name) { if ("url".equals(name)) { return super.getValueExpression("value"); } else { return super.getValueExpression(name); } } /** *

* Store any {@link ValueExpression} specified for url under value instead; otherwise, perform * the default superclass processing for this method. *

* * @param name Name of the attribute or property for which to set a {@link ValueExpression} * @param binding The {@link ValueExpression} to set, or null to remove any currently set * {@link ValueExpression} * * @throws NullPointerException if name is null * @since 1.2 */ @Override public void setValueExpression(String name, ValueExpression binding) { if ("url".equals(name)) { super.setValueExpression("value", binding); } else { super.setValueExpression(name, binding); } } // ----------------------------------------------------- StateHolder Methods }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy