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

com.sun.webui.jsf.component.Body Maven / Gradle / Ivy

There is a newer version: 4.4.0.1
Show newest version
/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at
 * https://woodstock.dev.java.net/public/CDDLv1.0.html.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at https://woodstock.dev.java.net/public/CDDLv1.0.html.
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
 */
package com.sun.webui.jsf.component;

import com.sun.faces.annotation.Component;
import com.sun.faces.annotation.Property;

import javax.el.ValueExpression;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;

import com.sun.webui.jsf.util.ThemeUtilities;
import com.sun.webui.jsf.util.FocusManager;
import com.sun.webui.jsf.util.LogUtil;
import com.sun.webui.theme.Theme;

/**
 * The Body component is used to contain the other components of the page.
 */
@Component(type = "com.sun.webui.jsf.Body", family = "com.sun.webui.jsf.Body", displayName = "Body", tagName = "body",
helpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_body",
propertiesHelpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_propsheets_body_props")
public class Body extends UIComponentBase {

    /**
     * @deprecated
     */
    public static final String FOCUS_PARAM =
            "com.sun.webui.jsf_body_focusComponent";
    /**
     * @deprecated
     */
    public static final String JAVASCRIPT_OBJECT = "_jsObject";

    /**
     * Default constructor.
     */
    public Body() {
        super();
        setRendererType("com.sun.webui.jsf.Body");
    }

    /**
     * 

Return the family for this component.

*/ public String getFamily() { return "com.sun.webui.jsf.Body"; } /** * @deprecated * @see #getFocus */ public String getFocusID(FacesContext context) { // Note that this code is duplicated in // Body renderer because we don't want to // reference a deprecated method. // String id = getFocus(); if (id != null || id.length() == 0) { // Need absolute id. // String absid = id; if (id.charAt(0) != NamingContainer.SEPARATOR_CHAR) { absid = String.valueOf(NamingContainer.SEPARATOR_CHAR).concat(id); } try { // Since a developer using setFocus may not be able to // identify a sub component of a ComplexComponent, that // must be done here. // UIComponent comp = findComponent(absid); if (comp != null && comp instanceof ComplexComponent) { id = ((ComplexComponent) comp).getFocusElementId(context); } } catch (Exception e) { if (LogUtil.finestEnabled()) { LogUtil.finest("Body.getFocusId, couldn't find " + " component with id " + id); } } } else { // Get client id cached in request map -- bugtraq #6316565. // Note: This must be a client Id to identify table children. // This interface is expected to be the actual id and does // not require checking for ComplexComponent. // id = FocusManager.getRequestFocusElementId(context); } return id; } /** * @deprecated */ public String getJavaScriptObjectName(FacesContext context) { return getClientId(context).replace(':', '_').concat(JAVASCRIPT_OBJECT); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Tag attribute methods // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * The component identifier for this component. This value must be unique * within the closest parent component that is a naming container. */ @Property(name = "id") @Override public void setId(String id) { super.setId(id); } /** * Use the rendered attribute to indicate whether the HTML code for the * component should be included in the rendered HTML page. If set to false, * the rendered HTML page does not include the HTML for the component. If * the component is not rendered, it is also not processed on any subsequent * form submission. */ @Property(name = "rendered") @Override public void setRendered(boolean rendered) { super.setRendered(rendered); } /** *

Specify the ID of the component that should receive * focus when the page is loaded. If the focus attribute is not set, or if the value * is null, no component has focus when the page is initially rendered. If * the page is submitted and reloaded, the component that submitted the page * receives focus. By setting the focus attribute, you can ensure that * a particular component receives focus each time.

*/ @Property(name = "focus", displayName = "Component to receive focus", category = "Behavior", isDefault = true, editorClassName = "com.sun.webui.jsf.component.propertyeditors.EventClientIdsEditor") private String focus = null; /** *

Specify the ID of the component that should receive * focus when the page is loaded. If the focus attribute is not set, or if the value * is null, no component has focus when the page is initially rendered. If * the page is submitted and reloaded, the component that submitted the page * receives focus. By setting the focus attribute, you can ensure that * a particular component receives focus each time.

*/ public String getFocus() { if (this.focus != null) { return this.focus; } ValueExpression _vb = getValueExpression("focus"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Specify the ID of the component that should receive * focus when the page is loaded. If the focus attribute is not set, or if the value * is null, no component has focus when the page is initially rendered. If * the page is submitted and reloaded, the component that submitted the page * receives focus. By setting the focus attribute, you can ensure that * a particular component receives focus each time.

* @see #getFocus() */ public void setFocus(String focus) { this.focus = focus; } /** *

The path to an image to be used as a background for the page.

*/ @Property(name = "imageURL", displayName = "Image URL", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.ImageUrlPropertyEditor") private String imageURL = null; /** *

The path to an image to be used as a background for the page.

*/ public String getImageURL() { if (this.imageURL != null) { return this.imageURL; } ValueExpression _vb = getValueExpression("imageURL"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

The path to an image to be used as a background for the page.

* @see #getImageURL() */ public void setImageURL(String imageURL) { this.imageURL = imageURL; } /** *

Scripting code executed when this element loses focus.

*/ @Property(name = "onBlur", displayName = "Blur Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onBlur = null; /** *

Scripting code executed when this element loses focus.

*/ public String getOnBlur() { if (this.onBlur != null) { return this.onBlur; } ValueExpression _vb = getValueExpression("onBlur"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when this element loses focus.

* @see #getOnBlur() */ public void setOnBlur(String onBlur) { this.onBlur = onBlur; } /** *

Scripting code executed when a mouse click * occurs over this component.

*/ @Property(name = "onClick", displayName = "Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onClick = null; /** *

Scripting code executed when a mouse click * occurs over this component.

*/ public String getOnClick() { if (this.onClick != null) { return this.onClick; } ValueExpression _vb = getValueExpression("onClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse click * occurs over this component.

* @see #getOnClick() */ public void setOnClick(String onClick) { this.onClick = onClick; } /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ @Property(name = "onDblClick", displayName = "Double Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onDblClick = null; /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ public String getOnDblClick() { if (this.onDblClick != null) { return this.onDblClick; } ValueExpression _vb = getValueExpression("onDblClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse double click * occurs over this component.

* @see #getOnDblClick() */ public void setOnDblClick(String onDblClick) { this.onDblClick = onDblClick; } /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

*/ @Property(name = "onFocus", displayName = "Focus Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onFocus = null; /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

*/ public String getOnFocus() { if (this.onFocus != null) { return this.onFocus; } ValueExpression _vb = getValueExpression("onFocus"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

* @see #getOnFocus() */ public void setOnFocus(String onFocus) { this.onFocus = onFocus; } /** *

Scripting code executed when the user presses down on a key while the * component has focus.

*/ @Property(name = "onKeyDown", displayName = "Key Down Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyDown = null; /** *

Scripting code executed when the user presses down on a key while the * component has focus.

*/ public String getOnKeyDown() { if (this.onKeyDown != null) { return this.onKeyDown; } ValueExpression _vb = getValueExpression("onKeyDown"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses down on a key while the * component has focus.

* @see #getOnKeyDown() */ public void setOnKeyDown(String onKeyDown) { this.onKeyDown = onKeyDown; } /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

*/ @Property(name = "onKeyPress", displayName = "Key Press Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyPress = null; /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

*/ public String getOnKeyPress() { if (this.onKeyPress != null) { return this.onKeyPress; } ValueExpression _vb = getValueExpression("onKeyPress"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

* @see #getOnKeyPress() */ public void setOnKeyPress(String onKeyPress) { this.onKeyPress = onKeyPress; } /** *

Scripting code executed when the user releases a key while the * component has focus.

*/ @Property(name = "onKeyUp", displayName = "Key Up Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyUp = null; /** *

Scripting code executed when the user releases a key while the * component has focus.

*/ public String getOnKeyUp() { if (this.onKeyUp != null) { return this.onKeyUp; } ValueExpression _vb = getValueExpression("onKeyUp"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user releases a key while the * component has focus.

* @see #getOnKeyUp() */ public void setOnKeyUp(String onKeyUp) { this.onKeyUp = onKeyUp; } /** *

Scripting code executed when when this page is loaded in a browser.

*/ @Property(name = "onLoad", displayName = "Onload Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onLoad = null; /** *

Scripting code executed when when this page is loaded in a browser.

*/ public String getOnLoad() { if (this.onLoad != null) { return this.onLoad; } ValueExpression _vb = getValueExpression("onLoad"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when when this page is loaded in a browser.

* @see #getOnLoad() */ public void setOnLoad(String onLoad) { this.onLoad = onLoad; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ @Property(name = "onMouseDown", displayName = "Mouse Down Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseDown = null; /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ public String getOnMouseDown() { if (this.onMouseDown != null) { return this.onMouseDown; } ValueExpression _vb = getValueExpression("onMouseDown"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

* @see #getOnMouseDown() */ public void setOnMouseDown(String onMouseDown) { this.onMouseDown = onMouseDown; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ @Property(name = "onMouseMove", displayName = "Mouse Move Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseMove = null; /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ public String getOnMouseMove() { if (this.onMouseMove != null) { return this.onMouseMove; } ValueExpression _vb = getValueExpression("onMouseMove"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

* @see #getOnMouseMove() */ public void setOnMouseMove(String onMouseMove) { this.onMouseMove = onMouseMove; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ @Property(name = "onMouseOut", displayName = "Mouse Out Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOut = null; /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ public String getOnMouseOut() { if (this.onMouseOut != null) { return this.onMouseOut; } ValueExpression _vb = getValueExpression("onMouseOut"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

* @see #getOnMouseOut() */ public void setOnMouseOut(String onMouseOut) { this.onMouseOut = onMouseOut; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ @Property(name = "onMouseOver", displayName = "Mouse In Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOver = null; /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ public String getOnMouseOver() { if (this.onMouseOver != null) { return this.onMouseOver; } ValueExpression _vb = getValueExpression("onMouseOver"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

* @see #getOnMouseOver() */ public void setOnMouseOver(String onMouseOver) { this.onMouseOver = onMouseOver; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ @Property(name = "onMouseUp", displayName = "Mouse Up Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseUp = null; /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ public String getOnMouseUp() { if (this.onMouseUp != null) { return this.onMouseUp; } ValueExpression _vb = getValueExpression("onMouseUp"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

* @see #getOnMouseUp() */ public void setOnMouseUp(String onMouseUp) { this.onMouseUp = onMouseUp; } /** *

Scripting code executed when this page is unloaded from a browser as a user exits the page.

*/ @Property(name = "onUnload", displayName = "Unload Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onUnload = null; /** *

Scripting code executed when this page is unloaded from a browser as a user exits the page.

*/ public String getOnUnload() { if (this.onUnload != null) { return this.onUnload; } ValueExpression _vb = getValueExpression("onUnload"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when this page is unloaded from a browser as a user exits the page.

* @see #getOnUnload() */ public void setOnUnload(String onUnload) { this.onUnload = onUnload; } /** *

Use the preserveFocus attribute to indicate whether the last * element to have the focus, receives the focus the * next time the page is rendered. If set to true the * focus is preserved; if set to false it is not. * If set to false and the focus attribute * is set then the element identified by that id will receive the * focus. The default value is true.

*/ @Property(name = "preserveFocus", displayName = "Preserve Focus", category = "Behavior") private boolean preserveFocus = true; private boolean preserveFocus_set = false; /** *

Use the preserveFocus attribute to indicate whether the last * element to have the focus, receives the focus the * next time the page is rendered. If set to true the * focus is preserved; if set to false it is not. * If set to false and the focus attribute * is set then the element identified by that id will receive the * focus. The default value is true.

*/ public boolean isPreserveFocus() { if (this.preserveFocus_set) { return this.preserveFocus; } ValueExpression _vb = getValueExpression("preserveFocus"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } // Get the default behavior from the theme. // String defaultPreserveFocus = null; Theme theme = ThemeUtilities.getTheme(FacesContext.getCurrentInstance()); try { defaultPreserveFocus = theme.getMessage("body.preserveFocus"); return Boolean.valueOf(defaultPreserveFocus).booleanValue(); } catch (Exception e) { } return this.preserveFocus; } /** *

Use the preserveFocus attribute to indicate whether the last * element to have the focus, receives the focus the * next time the page is rendered. If set to true the * focus is preserved; if set to false it is not. * If set to false and the focus attribute * is set then the element identified by that id will receive the * focus. The default value is true.

*/ public void setPreserveFocus(boolean preserveFocus) { this.preserveFocus = preserveFocus; this.preserveFocus_set = true; } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "style", displayName = "CSS Style(s)", category = "Appearance", editorClassName = "com.sun.jsfcl.std.css.CssStylePropertyEditor") private String style = null; /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyle() { if (this.style != null) { return this.style; } ValueExpression _vb = getValueExpression("style"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyle() */ public void setStyle(String style) { this.style = style; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "styleClass", displayName = "CSS Style Class(es)", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.StyleClassPropertyEditor") private String styleClass = null; /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyleClass() { if (this.styleClass != null) { return this.styleClass; } ValueExpression _vb = getValueExpression("styleClass"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyleClass() */ public void setStyleClass(String styleClass) { this.styleClass = styleClass; } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ @Property(name = "visible", displayName = "Visible", category = "Behavior") private boolean visible = false; private boolean visible_set = false; /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ public boolean isVisible() { if (this.visible_set) { return this.visible; } ValueExpression _vb = getValueExpression("visible"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } return true; } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

* @see #isVisible() */ public void setVisible(boolean visible) { this.visible = visible; this.visible_set = true; } /** *

Restore the state of this component.

*/ @Override public void restoreState(FacesContext _context, Object _state) { Object _values[] = (Object[]) _state; super.restoreState(_context, _values[0]); this.focus = (String) _values[1]; this.imageURL = (String) _values[2]; this.onBlur = (String) _values[3]; this.onClick = (String) _values[4]; this.onDblClick = (String) _values[5]; this.onFocus = (String) _values[6]; this.onKeyDown = (String) _values[7]; this.onKeyPress = (String) _values[8]; this.onKeyUp = (String) _values[9]; this.onLoad = (String) _values[10]; this.onMouseDown = (String) _values[11]; this.onMouseMove = (String) _values[12]; this.onMouseOut = (String) _values[13]; this.onMouseOver = (String) _values[14]; this.onMouseUp = (String) _values[15]; this.onUnload = (String) _values[16]; this.style = (String) _values[17]; this.styleClass = (String) _values[18]; this.visible = ((Boolean) _values[19]).booleanValue(); this.visible_set = ((Boolean) _values[20]).booleanValue(); this.preserveFocus = ((Boolean) _values[21]).booleanValue(); this.preserveFocus_set = ((Boolean) _values[22]).booleanValue(); } /** *

Save the state of this component.

*/ @Override public Object saveState(FacesContext _context) { Object _values[] = new Object[23]; _values[0] = super.saveState(_context); _values[1] = this.focus; _values[2] = this.imageURL; _values[3] = this.onBlur; _values[4] = this.onClick; _values[5] = this.onDblClick; _values[6] = this.onFocus; _values[7] = this.onKeyDown; _values[8] = this.onKeyPress; _values[9] = this.onKeyUp; _values[10] = this.onLoad; _values[11] = this.onMouseDown; _values[12] = this.onMouseMove; _values[13] = this.onMouseOut; _values[14] = this.onMouseOver; _values[15] = this.onMouseUp; _values[16] = this.onUnload; _values[17] = this.style; _values[18] = this.styleClass; _values[19] = this.visible ? Boolean.TRUE : Boolean.FALSE; _values[20] = this.visible_set ? Boolean.TRUE : Boolean.FALSE; _values[21] = this.preserveFocus ? Boolean.TRUE : Boolean.FALSE; _values[22] = this.preserveFocus_set ? Boolean.TRUE : Boolean.FALSE; return _values; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy