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

org.apache.struts.faces.component.StylesheetComponent Maven / Gradle / Ivy

There is a newer version: 1.5.0-RC2
Show newest version
/*
 * $Id$
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.struts.faces.component;


import javax.el.ValueExpression;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;


/**
 * 

Custom component that replaces the Struts * <html:stylesheet> tag.

*/ public class StylesheetComponent extends UIOutput { // ------------------------------------------------------------ Constructors /** *

Create a new {@link StylesheetComponent} with default properties.

*/ public StylesheetComponent() { super(); setRendererType("org.apache.struts.faces.Stylesheet"); } // ------------------------------------------------------ Instance Variables /** *

Context-relative path of the stylesheet resource.

*/ private String path = null; // ---------------------------------------------------- Component Properties /** *

Return the component family to which this component belongs.

*/ public String getFamily() { return "org.apache.struts.faces.Stylesheet"; } /** *

Return the context-relative stylesheet path.

*/ public String getPath() { ValueExpression vb = getValueExpression("path"); if (vb != null) { return (String) vb.getValue(getFacesContext().getELContext()); } else { return path; } } /** *

Set the context-relative stylesheet path.

* * @param path The new path */ public void setPath(String path) { this.path = path; } // ---------------------------------------------------- StateManager Methods /** *

Restore the state of this component.

* * @param context FacesContext for the current request * @param state State object from which to restore our state */ public void restoreState(FacesContext context, Object state) { Object values[] = (Object[]) state; super.restoreState(context, values[0]); path = (String) values[1]; } /** *

Save the state of this component.

* * @param context FacesContext for the current request */ public Object saveState(FacesContext context) { Object values[] = new Object[2]; values[0] = super.saveState(context); values[1] = path; return values; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy