blob: ee2d0e698c25362eb6d426c3eb2ce9f42099a4d0 [file] [log] [blame]
/*
* Copyright (c) 2004, 2018 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 components.taglib;
import components.components.AreaComponent;
import components.renderkit.Util;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.ValueHolder;
import jakarta.faces.webapp.UIComponentTag;
/**
* <p>{@link UIComponentTag} for an image map hotspot.</p>
*/
public class AreaTag extends UIComponentTag {
private String alt = null;
public void setAlt(String alt) {
this.alt = alt;
}
private String targetImage = null;
public void setTargetImage(String targetImage) {
this.targetImage = targetImage;
}
private String coords = null;
public void setCoords(String coords) {
this.coords = coords;
}
private String onmouseout = null;
public void setOnmouseout(String newonmouseout) {
onmouseout = newonmouseout;
}
private String onmouseover = null;
public void setOnmouseover(String newonmouseover) {
onmouseover = newonmouseover;
}
private String shape = null;
public void setShape(String shape) {
this.shape = shape;
}
private String styleClass = null;
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
private String value = null;
public void setValue(String newValue) {
value = newValue;
}
public String getComponentType() {
return ("DemoArea");
}
public String getRendererType() {
return ("DemoArea");
}
public void release() {
super.release();
this.alt = null;
this.coords = null;
this.onmouseout = null;
this.onmouseover = null;
this.shape = null;
this.styleClass = null;
this.value = null;
}
protected void setProperties(UIComponent component) {
super.setProperties(component);
AreaComponent area = (AreaComponent) component;
if (alt != null) {
if (isValueReference(alt)) {
area.setValueBinding("alt", Util.getValueBinding(alt));
} else {
area.getAttributes().put("alt", alt);
}
}
if (coords != null) {
if (isValueReference(coords)) {
area.setValueBinding("coords", Util.getValueBinding(coords));
} else {
area.getAttributes().put("coords", coords);
}
}
if (onmouseout != null) {
if (isValueReference(onmouseout)) {
area.setValueBinding("onmouseout",
Util.getValueBinding(onmouseout));
} else {
area.getAttributes().put("onmouseout", onmouseout);
}
}
if (onmouseover != null) {
if (isValueReference(onmouseover)) {
area.setValueBinding("onmouseover",
Util.getValueBinding(onmouseover));
} else {
area.getAttributes().put("onmouseover", onmouseover);
}
}
if (shape != null) {
if (isValueReference(shape)) {
area.setValueBinding("shape", Util.getValueBinding(shape));
} else {
area.getAttributes().put("shape", shape);
}
}
if (styleClass != null) {
if (isValueReference(styleClass)) {
area.setValueBinding("styleClass",
Util.getValueBinding(styleClass));
} else {
area.getAttributes().put("styleClass", styleClass);
}
}
if (area instanceof ValueHolder) {
ValueHolder valueHolder = (ValueHolder) component;
if (value != null) {
if (isValueReference(value)) {
area.setValueBinding("value", Util.getValueBinding(value));
} else {
valueHolder.setValue(value);
}
}
}
// target image is required
area.setTargetImage(targetImage);
}
}