
com.sun.mojarra.scales.component.YuiTab Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mojarra-scales Show documentation
Show all versions of mojarra-scales Show documentation
This is the core for Mojarra Scales. It has everything that Scales offers minus the multi-file upload component dependencies due to their size.
The newest version!
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
*
*/
package com.sun.mojarra.scales.component;
import com.sun.mojarra.scales.util.ScalesUtil;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
/**
* @author Jason Lee
*
*/
public class YuiTab extends UIOutput {
public static final String COMPONENT_FAMILY = "com.sun.mojarra.scales.YuiTab";
public static final String COMPONENT_TYPE = COMPONENT_FAMILY;
public static final String RENDERER_TYPE = COMPONENT_FAMILY;
private Object[] _state;
protected Boolean active = true;
protected Boolean disabled = false;
protected String style = "";
protected String styleClass = "";
protected String label;
public YuiTab() {
setRendererType(RENDERER_TYPE);
}
@Override
public String getFamily() {
return COMPONENT_FAMILY;
}
@Override
public void encodeBegin(FacesContext context) throws IOException {
super.encodeBegin(context);
// suppress rendering if "rendered" property on the component is false.
if (!isRendered()) {
return;
}
ResponseWriter writer = context.getResponseWriter();
String clientId = getClientId(context);
writer.startElement("div", this);
writer.writeAttribute("id", clientId, "id");
writer.writeAttribute("class", getAttributes().get("styleClass"), "class");
writer.writeAttribute("style", "overflow: auto; " + getAttributes().get("style"), "style");
writer.startElement("p", this);
}
@Override
public void encodeEnd(FacesContext context) throws IOException {
super.encodeEnd(context);
if (!isRendered()) {
return;
}
ResponseWriter writer = context.getResponseWriter();
writer.endElement("p");
writer.endElement("div");
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public Boolean getDisabled() {
return disabled;
}
public void setDisabled(Boolean disabled) {
this.disabled = disabled;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
public String getStyleClass() {
return styleClass;
}
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
@Override
public void restoreState(FacesContext _context, Object _state) {
this._state = (Object[]) _state;
super.restoreState(_context, this._state[0]);
active = (Boolean) this._state[1];
disabled = (Boolean) this._state[2];
label = (String) this._state[3];
}
@Override
public Object saveState(FacesContext _context) {
if (_state == null) {
_state = new Object[4];
}
_state[0] = super.saveState(_context);
_state[1] = active;
_state[2] = disabled;
_state[3] = label;
return _state;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy