blob: f84338fc2712b9289b1563228f27bb83c93a2543 [file] [log] [blame]
/*
* Copyright (c) 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
*/
/*
* $Id: PaneTabLabelTag.java,v 1.1 2005/11/03 03:00:11 SherryShen Exp $
*/
package components.taglib;
import com.sun.org.apache.commons.logging.Log;
import com.sun.org.apache.commons.logging.LogFactory;
import jakarta.faces.component.UIComponent;
import jakarta.faces.el.ValueBinding;
import jakarta.faces.webapp.UIComponentTag;
/**
* This class creates a <code>PaneComponent</code> instance
* that represents a tab button control on the tab pane.
*/
public class PaneTabLabelTag extends UIComponentTag {
private static Log log = LogFactory.getLog(PaneTabLabelTag.class);
private String commandName = null;
public void setCommandName(String newCommandName) {
commandName = newCommandName;
}
private String image = null;
public void setImage(String newImage) {
image = newImage;
}
private String label = null;
public void setLabel(String newLabel) {
label = newLabel;
}
public String getComponentType() {
return ("Pane");
}
public String getRendererType() {
return ("TabLabel");
}
protected String paneTabLabelClass;
public String getPaneTabLabelClass() {
return paneTabLabelClass;
}
public void setPaneTabLabelClass(String newPaneTabLabelClass) {
paneTabLabelClass = newPaneTabLabelClass;
}
public void release() {
super.release();
this.commandName = null;
this.image = null;
this.label = null;
}
protected void setProperties(UIComponent component) {
super.setProperties(component);
if (commandName != null) {
if (isValueReference(commandName)) {
ValueBinding vb =
getFacesContext().getApplication().
createValueBinding(commandName);
component.setValueBinding("commandName", vb);
} else {
component.getAttributes().put("commandName", commandName);
}
}
if (image != null) {
if (isValueReference(image)) {
ValueBinding vb =
getFacesContext().getApplication().
createValueBinding(image);
component.setValueBinding("image", vb);
} else {
component.getAttributes().put("image", image);
}
}
if (label != null) {
if (isValueReference(label)) {
ValueBinding vb =
getFacesContext().getApplication().
createValueBinding(label);
component.setValueBinding("label", vb);
} else {
component.getAttributes().put("label", label);
}
}
if (paneTabLabelClass != null) {
if (isValueReference(paneTabLabelClass)) {
ValueBinding vb =
getFacesContext().getApplication().
createValueBinding(paneTabLabelClass);
component.setValueBinding("paneTabLabelClass", vb);
} else {
component.getAttributes().put("paneTabLabelClass",
paneTabLabelClass);
}
}
}
}