0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041: package com.sun.rave.web.ui.component;
0042:
0043: import java.io.IOException;
0044: import javax.faces.component.UIComponent;
0045: import javax.faces.context.FacesContext;
0046: import javax.faces.el.MethodBinding;
0047: import javax.faces.el.ValueBinding;
0048:
0049: /**
0050: * Use the ui:button tag to display
0051: * an input button in the rendered HTML page. The input button submits the
0052: * associated form when activated by the user. The
0053: * corresponding ActionEvent events then occur on the server. <br
0054: * style="color: rgb(0, 0, 0);">
0055: * <h3 style="color: rgb(0, 0, 0);">HTML
0056: * Elements and Layout</h3>
0057: * <span
0058: * style="text-decoration: line-through; color: rgb(0, 0, 0);"></span><span
0059: * style="color: rgb(0, 0, 0);">This tag uses the XHTML
0060: * <input> element to create a button with a
0061: * text label.</span><br
0062: * style="color: rgb(0, 0, 0);">
0063: * <h3 style="color: rgb(0, 0, 0);">Client
0064: * Side Javascript Functions</h3>
0065: * The button component supports a client side javascript
0066: * object. To use this object all you need to do is get the
0067: * object by using document.getElementById() function to get the
0068: * object. It is recommended though you pass the result of the
0069: * getElementById() function to a local variable rather than accessing the
0070: * functions directly. The object supports the following
0071: * functions:
0072: * <ul>
0073: * <li style="color: rgb(0, 0, 0);"><span
0074: * style="font-style: italic;">isMini()</span>:
0075: * Test if button style is "mini" for
0076: * the button. Returns a boolean.</li>
0077: * <li style="color: rgb(0, 0, 0);"><span
0078: * style="font-style: italic;">isPrimary(): </span>Test
0079: * if button style is "primary" for
0080: * the button. Returns a boolean.</li>
0081: * <li style="color: rgb(0, 0, 0);"><span
0082: * style="font-style: italic;">isSecondary()</span>:
0083: * <span style="font-style: italic;">DEPRECATED
0084: * use isPrimary instead </span>Test
0085: * if button style is "secondary" for
0086: * the button. Returns a boolean.<br>
0087: * </li>
0088: * <li style="color: rgb(0, 0, 0);"><span
0089: * style="font-style: italic;">setMini(mini)</span>:
0090: * Set button style <span
0091: * style="text-decoration: line-through;"></span>to "mini"
0092: * for the button. If
0093: * the mini <span
0094: * style="text-decoration: line-through;"></span>attribute
0095: * is set to true,
0096: * the
0097: * element is shown with mini styles.</li>
0098: * <li style="color: rgb(0, 0, 0);"><span
0099: * style="font-style: italic;">setPrimary(primary)</span>:
0100: * Set button style<span
0101: * style="text-decoration: line-through;"></span>
0102: * to "primary" for the
0103: * given button. If the primary <span
0104: * style="text-decoration: line-through;"></span>attribute
0105: * is set to
0106: * true, the element is shown with primary style.</li>
0107: * <li style="color: rgb(0, 0, 0);"><span
0108: * style="font-style: italic;">setSecondary(secondary)</span>:
0109: * <span style="font-style: italic;">DEPRECATED
0110: * use setPrimary instead</span> Set
0111: * button style<span
0112: * style="text-decoration: line-through;"></span>
0113: * to "secondary" for the
0114: * given button. If the secondary <span
0115: * style="text-decoration: line-through;"></span>attribute
0116: * is set to
0117: * true, the element is shown with secondary styles.</li>
0118: * </ul>
0119: * There are two other common functions that are useful for a button.
0120: * <ul>
0121: * <li style="color: rgb(0, 0, 0);"><span
0122: * style="font-style: italic;"> common_stripStyleClass(javascriptObj,
0123: * classToRemove)</span>: Use this
0124: * function to remove a style class from a any js object that supports the
0125: * class property. Takes a javascript object and the style class
0126: * string to remove.<br>
0127: * </li>
0128: * <li style="color: rgb(0, 0, 0);"><span
0129: * style="font-style: italic;"> common_addStyleClass(this,
0130: * newType)</span>: Use this function
0131: * to add a new style class to any js object that supports the class
0132: * property. Takes a javascript object and the style class string to add.<br>
0133: * <span style="font-style: italic;"><br>
0134: * <br>
0135: * </span></li>
0136: * <span style="font-style: italic;"></span>
0137: * </ul>
0138: * <h3>Examples</h3>
0139: * <h4>Example 1: Create a primary
0140: * button:</h4>
0141: * <code><ui:button
0142: * id="button1" text="#{ButtonBean.text}"
0143: * action="#{ButtonBean.success}" /><br>
0144: * </code>
0145: * <h4>Example 2: Create a primary
0146: * mini button:</h4>
0147: * <code><ui:button
0148: * id="button1" text="#{ButtonBean.text}"
0149: * action="#{ButtonBean.success}" mini="true" /></code><br>
0150: * <h4>Example 3: Create a secondary
0151: * button:</h4>
0152: * <code><ui:button
0153: * id="button1" text="#{ButtonBean.text}"
0154: * action="#{ButtonBean.success}" secondary="true" /><br>
0155: * </code>
0156: * <h4>Example 4: Create a secondary
0157: * mini button:</h4>
0158: * <code><ui:button
0159: * id="button1" text="#{ButtonBean.text}"
0160: * action="#{ButtonBean.success}" secondary="true" isMini="true" /></code><br>
0161: * <h4>Example 5: Create a reset
0162: * button:</h4>
0163: * <code><ui:button
0164: * id="button1"
0165: * text="#{ButtonBean.text}" action="#{ButtonBean.success}" reset="true"
0166: * /><br>
0167: * </code>
0168: * <h4>Example 6: Create an image
0169: * button:</h4>
0170: * <code><ui:button
0171: * id="button1" imageURL="#{ButtonBean.image}"
0172: * action="#{ButtonBean.success}" /></code>
0173: * <br>
0174: * <p>Auto-generated component class.
0175: * Do <strong>NOT</strong> modify; all changes
0176: * <strong>will</strong> be lost!</p>
0177: */
0178:
0179: public abstract class ButtonBase extends
0180: javax.faces.component.UICommand {
0181:
0182: /**
0183: * <p>Construct a new <code>ButtonBase</code>.</p>
0184: */
0185: public ButtonBase() {
0186: super ();
0187: setRendererType("com.sun.rave.web.ui.Button");
0188: }
0189:
0190: /**
0191: * <p>Return the identifier of the component family to which this
0192: * component belongs. This identifier, in conjunction with the value
0193: * of the <code>rendererType</code> property, may be used to select
0194: * the appropriate {@link Renderer} for this component instance.</p>
0195: */
0196: public String getFamily() {
0197: return "com.sun.rave.web.ui.Button";
0198: }
0199:
0200: /**
0201: * <p>Return the <code>ValueBinding</code> stored for the
0202: * specified name (if any), respecting any property aliases.</p>
0203: *
0204: * @param name Name of value binding to retrieve
0205: */
0206: public ValueBinding getValueBinding(String name) {
0207: if (name.equals("text")) {
0208: return super .getValueBinding("value");
0209: }
0210: return super .getValueBinding(name);
0211: }
0212:
0213: /**
0214: * <p>Set the <code>ValueBinding</code> stored for the
0215: * specified name (if any), respecting any property
0216: * aliases.</p>
0217: *
0218: * @param name Name of value binding to set
0219: * @param binding ValueBinding to set, or null to remove
0220: */
0221: public void setValueBinding(String name, ValueBinding binding) {
0222: if (name.equals("text")) {
0223: super .setValueBinding("value", binding);
0224: return;
0225: }
0226: super .setValueBinding(name, binding);
0227: }
0228:
0229: // action
0230: private javax.faces.el.MethodBinding action = null;
0231:
0232: /**
0233: * <p>Method binding representing a method that processes
0234: * application actions from this component.</p>
0235: */
0236: public javax.faces.el.MethodBinding getAction() {
0237: if (this .action != null) {
0238: return this .action;
0239: }
0240: ValueBinding _vb = getValueBinding("action");
0241: if (_vb != null) {
0242: return (javax.faces.el.MethodBinding) _vb
0243: .getValue(getFacesContext());
0244: }
0245: return null;
0246: }
0247:
0248: /**
0249: * <p>Method binding representing a method that processes
0250: * application actions from this component.</p>
0251: * @see #getAction()
0252: */
0253: public void setAction(javax.faces.el.MethodBinding action) {
0254: this .action = action;
0255: }
0256:
0257: // actionListener
0258: private javax.faces.el.MethodBinding actionListener = null;
0259:
0260: /**
0261: * <p>Method binding representing a method that receives action from this, and possibly other, components.</p>
0262: */
0263: public javax.faces.el.MethodBinding getActionListener() {
0264: if (this .actionListener != null) {
0265: return this .actionListener;
0266: }
0267: ValueBinding _vb = getValueBinding("actionListener");
0268: if (_vb != null) {
0269: return (javax.faces.el.MethodBinding) _vb
0270: .getValue(getFacesContext());
0271: }
0272: return null;
0273: }
0274:
0275: /**
0276: * <p>Method binding representing a method that receives action from this, and possibly other, components.</p>
0277: * @see #getActionListener()
0278: */
0279: public void setActionListener(
0280: javax.faces.el.MethodBinding actionListener) {
0281: this .actionListener = actionListener;
0282: }
0283:
0284: // alt
0285: private String alt = null;
0286:
0287: /**
0288: * <p>Alternative text description used by screen reader tools</p>
0289: */
0290: public String getAlt() {
0291: if (this .alt != null) {
0292: return this .alt;
0293: }
0294: ValueBinding _vb = getValueBinding("alt");
0295: if (_vb != null) {
0296: return (String) _vb.getValue(getFacesContext());
0297: }
0298: return null;
0299: }
0300:
0301: /**
0302: * <p>Alternative text description used by screen reader tools</p>
0303: * @see #getAlt()
0304: */
0305: public void setAlt(String alt) {
0306: this .alt = alt;
0307: }
0308:
0309: // disabled
0310: private boolean disabled = false;
0311: private boolean disabled_set = false;
0312:
0313: /**
0314: * <p>Indicates that activation of this component by the user is not currently
0315: * permitted. In this component library, the disabled attribute also causes
0316: * the button to be renderered using a particular style.</p>
0317: */
0318: public boolean isDisabled() {
0319: if (this .disabled_set) {
0320: return this .disabled;
0321: }
0322: ValueBinding _vb = getValueBinding("disabled");
0323: if (_vb != null) {
0324: Object _result = _vb.getValue(getFacesContext());
0325: if (_result == null) {
0326: return false;
0327: } else {
0328: return ((Boolean) _result).booleanValue();
0329: }
0330: }
0331: return false;
0332: }
0333:
0334: /**
0335: * <p>Indicates that activation of this component by the user is not currently
0336: * permitted. In this component library, the disabled attribute also causes
0337: * the button to be renderered using a particular style.</p>
0338: * @see #isDisabled()
0339: */
0340: public void setDisabled(boolean disabled) {
0341: this .disabled = disabled;
0342: this .disabled_set = true;
0343: }
0344:
0345: // escape
0346: private boolean escape = false;
0347: private boolean escape_set = false;
0348:
0349: /**
0350: * <p>Escape HTML markup in the button text</p>
0351: */
0352: public boolean isEscape() {
0353: if (this .escape_set) {
0354: return this .escape;
0355: }
0356: ValueBinding _vb = getValueBinding("escape");
0357: if (_vb != null) {
0358: Object _result = _vb.getValue(getFacesContext());
0359: if (_result == null) {
0360: return false;
0361: } else {
0362: return ((Boolean) _result).booleanValue();
0363: }
0364: }
0365: return true;
0366: }
0367:
0368: /**
0369: * <p>Escape HTML markup in the button text</p>
0370: * @see #isEscape()
0371: */
0372: public void setEscape(boolean escape) {
0373: this .escape = escape;
0374: this .escape_set = true;
0375: }
0376:
0377: // imageURL
0378: private String imageURL = null;
0379:
0380: /**
0381: * <p>Resource path of an image to be displayed to create the visual
0382: * appearance of this button instead of the standard button image. Either
0383: * the "imageURL" or "text" attributes must be specified. When an
0384: * imageURL value is given, the button type is set to "image".</p>
0385: */
0386: public String getImageURL() {
0387: if (this .imageURL != null) {
0388: return this .imageURL;
0389: }
0390: ValueBinding _vb = getValueBinding("imageURL");
0391: if (_vb != null) {
0392: return (String) _vb.getValue(getFacesContext());
0393: }
0394: return null;
0395: }
0396:
0397: /**
0398: * <p>Resource path of an image to be displayed to create the visual
0399: * appearance of this button instead of the standard button image. Either
0400: * the "imageURL" or "text" attributes must be specified. When an
0401: * imageURL value is given, the button type is set to "image".</p>
0402: * @see #getImageURL()
0403: */
0404: public void setImageURL(String imageURL) {
0405: this .imageURL = imageURL;
0406: }
0407:
0408: // mini
0409: private boolean mini = false;
0410: private boolean mini_set = false;
0411:
0412: /**
0413: * <p>Indicates that the button should be rendered using a different style
0414: * than normal buttons. If the value is set to true, the button shall
0415: * appear somewhat smaller than a normal button. Mini buttons are useful
0416: * in situations where a button applies to an individual field on the
0417: * page, rather than a section, table, or whole page.</p>
0418: */
0419: public boolean isMini() {
0420: if (this .mini_set) {
0421: return this .mini;
0422: }
0423: ValueBinding _vb = getValueBinding("mini");
0424: if (_vb != null) {
0425: Object _result = _vb.getValue(getFacesContext());
0426: if (_result == null) {
0427: return false;
0428: } else {
0429: return ((Boolean) _result).booleanValue();
0430: }
0431: }
0432: return false;
0433: }
0434:
0435: /**
0436: * <p>Indicates that the button should be rendered using a different style
0437: * than normal buttons. If the value is set to true, the button shall
0438: * appear somewhat smaller than a normal button. Mini buttons are useful
0439: * in situations where a button applies to an individual field on the
0440: * page, rather than a section, table, or whole page.</p>
0441: * @see #isMini()
0442: */
0443: public void setMini(boolean mini) {
0444: this .mini = mini;
0445: this .mini_set = true;
0446: }
0447:
0448: // noTextPadding
0449: private boolean noTextPadding = false;
0450: private boolean noTextPadding_set = false;
0451:
0452: /**
0453: * <p>Indicates that padding should not be applied to the button text. By
0454: * default, whitespace characters are padded to button text greater than
0455: * or equal to 4 characters in length. If the value is set to true, no
0456: * padding is applied.</p>
0457: */
0458: public boolean isNoTextPadding() {
0459: if (this .noTextPadding_set) {
0460: return this .noTextPadding;
0461: }
0462: ValueBinding _vb = getValueBinding("noTextPadding");
0463: if (_vb != null) {
0464: Object _result = _vb.getValue(getFacesContext());
0465: if (_result == null) {
0466: return false;
0467: } else {
0468: return ((Boolean) _result).booleanValue();
0469: }
0470: }
0471: return false;
0472: }
0473:
0474: /**
0475: * <p>Indicates that padding should not be applied to the button text. By
0476: * default, whitespace characters are padded to button text greater than
0477: * or equal to 4 characters in length. If the value is set to true, no
0478: * padding is applied.</p>
0479: * @see #isNoTextPadding()
0480: */
0481: public void setNoTextPadding(boolean noTextPadding) {
0482: this .noTextPadding = noTextPadding;
0483: this .noTextPadding_set = true;
0484: }
0485:
0486: // onBlur
0487: private String onBlur = null;
0488:
0489: /**
0490: * <p>Scripting code executed when this element loses focus.</p>
0491: */
0492: public String getOnBlur() {
0493: if (this .onBlur != null) {
0494: return this .onBlur;
0495: }
0496: ValueBinding _vb = getValueBinding("onBlur");
0497: if (_vb != null) {
0498: return (String) _vb.getValue(getFacesContext());
0499: }
0500: return null;
0501: }
0502:
0503: /**
0504: * <p>Scripting code executed when this element loses focus.</p>
0505: * @see #getOnBlur()
0506: */
0507: public void setOnBlur(String onBlur) {
0508: this .onBlur = onBlur;
0509: }
0510:
0511: // onClick
0512: private String onClick = null;
0513:
0514: /**
0515: * <p>Scripting code executed when a mouse click
0516: * occurs over this component.</p>
0517: */
0518: public String getOnClick() {
0519: if (this .onClick != null) {
0520: return this .onClick;
0521: }
0522: ValueBinding _vb = getValueBinding("onClick");
0523: if (_vb != null) {
0524: return (String) _vb.getValue(getFacesContext());
0525: }
0526: return null;
0527: }
0528:
0529: /**
0530: * <p>Scripting code executed when a mouse click
0531: * occurs over this component.</p>
0532: * @see #getOnClick()
0533: */
0534: public void setOnClick(String onClick) {
0535: this .onClick = onClick;
0536: }
0537:
0538: // onDblClick
0539: private String onDblClick = null;
0540:
0541: /**
0542: * <p>Scripting code executed when a mouse double click
0543: * occurs over this component.</p>
0544: */
0545: public String getOnDblClick() {
0546: if (this .onDblClick != null) {
0547: return this .onDblClick;
0548: }
0549: ValueBinding _vb = getValueBinding("onDblClick");
0550: if (_vb != null) {
0551: return (String) _vb.getValue(getFacesContext());
0552: }
0553: return null;
0554: }
0555:
0556: /**
0557: * <p>Scripting code executed when a mouse double click
0558: * occurs over this component.</p>
0559: * @see #getOnDblClick()
0560: */
0561: public void setOnDblClick(String onDblClick) {
0562: this .onDblClick = onDblClick;
0563: }
0564:
0565: // onFocus
0566: private String onFocus = null;
0567:
0568: /**
0569: * <p>Scripting code executed when this component receives focus. An
0570: * element receives focus when the user selects the element by pressing
0571: * the tab key or clicking the mouse.</p>
0572: */
0573: public String getOnFocus() {
0574: if (this .onFocus != null) {
0575: return this .onFocus;
0576: }
0577: ValueBinding _vb = getValueBinding("onFocus");
0578: if (_vb != null) {
0579: return (String) _vb.getValue(getFacesContext());
0580: }
0581: return null;
0582: }
0583:
0584: /**
0585: * <p>Scripting code executed when this component receives focus. An
0586: * element receives focus when the user selects the element by pressing
0587: * the tab key or clicking the mouse.</p>
0588: * @see #getOnFocus()
0589: */
0590: public void setOnFocus(String onFocus) {
0591: this .onFocus = onFocus;
0592: }
0593:
0594: // onKeyDown
0595: private String onKeyDown = null;
0596:
0597: /**
0598: * <p>Scripting code executed when the user presses down on a key while the
0599: * component has focus.</p>
0600: */
0601: public String getOnKeyDown() {
0602: if (this .onKeyDown != null) {
0603: return this .onKeyDown;
0604: }
0605: ValueBinding _vb = getValueBinding("onKeyDown");
0606: if (_vb != null) {
0607: return (String) _vb.getValue(getFacesContext());
0608: }
0609: return null;
0610: }
0611:
0612: /**
0613: * <p>Scripting code executed when the user presses down on a key while the
0614: * component has focus.</p>
0615: * @see #getOnKeyDown()
0616: */
0617: public void setOnKeyDown(String onKeyDown) {
0618: this .onKeyDown = onKeyDown;
0619: }
0620:
0621: // onKeyPress
0622: private String onKeyPress = null;
0623:
0624: /**
0625: * <p>Scripting code executed when the user presses and releases a key while
0626: * the component has focus.</p>
0627: */
0628: public String getOnKeyPress() {
0629: if (this .onKeyPress != null) {
0630: return this .onKeyPress;
0631: }
0632: ValueBinding _vb = getValueBinding("onKeyPress");
0633: if (_vb != null) {
0634: return (String) _vb.getValue(getFacesContext());
0635: }
0636: return null;
0637: }
0638:
0639: /**
0640: * <p>Scripting code executed when the user presses and releases a key while
0641: * the component has focus.</p>
0642: * @see #getOnKeyPress()
0643: */
0644: public void setOnKeyPress(String onKeyPress) {
0645: this .onKeyPress = onKeyPress;
0646: }
0647:
0648: // onKeyUp
0649: private String onKeyUp = null;
0650:
0651: /**
0652: * <p>Scripting code executed when the user releases a key while the
0653: * component has focus.</p>
0654: */
0655: public String getOnKeyUp() {
0656: if (this .onKeyUp != null) {
0657: return this .onKeyUp;
0658: }
0659: ValueBinding _vb = getValueBinding("onKeyUp");
0660: if (_vb != null) {
0661: return (String) _vb.getValue(getFacesContext());
0662: }
0663: return null;
0664: }
0665:
0666: /**
0667: * <p>Scripting code executed when the user releases a key while the
0668: * component has focus.</p>
0669: * @see #getOnKeyUp()
0670: */
0671: public void setOnKeyUp(String onKeyUp) {
0672: this .onKeyUp = onKeyUp;
0673: }
0674:
0675: // onMouseDown
0676: private String onMouseDown = null;
0677:
0678: /**
0679: * <p>Scripting code executed when the user presses a mouse button while the
0680: * mouse pointer is on the component.</p>
0681: */
0682: public String getOnMouseDown() {
0683: if (this .onMouseDown != null) {
0684: return this .onMouseDown;
0685: }
0686: ValueBinding _vb = getValueBinding("onMouseDown");
0687: if (_vb != null) {
0688: return (String) _vb.getValue(getFacesContext());
0689: }
0690: return null;
0691: }
0692:
0693: /**
0694: * <p>Scripting code executed when the user presses a mouse button while the
0695: * mouse pointer is on the component.</p>
0696: * @see #getOnMouseDown()
0697: */
0698: public void setOnMouseDown(String onMouseDown) {
0699: this .onMouseDown = onMouseDown;
0700: }
0701:
0702: // onMouseMove
0703: private String onMouseMove = null;
0704:
0705: /**
0706: * <p>Scripting code executed when the user moves the mouse pointer while
0707: * over the component.</p>
0708: */
0709: public String getOnMouseMove() {
0710: if (this .onMouseMove != null) {
0711: return this .onMouseMove;
0712: }
0713: ValueBinding _vb = getValueBinding("onMouseMove");
0714: if (_vb != null) {
0715: return (String) _vb.getValue(getFacesContext());
0716: }
0717: return null;
0718: }
0719:
0720: /**
0721: * <p>Scripting code executed when the user moves the mouse pointer while
0722: * over the component.</p>
0723: * @see #getOnMouseMove()
0724: */
0725: public void setOnMouseMove(String onMouseMove) {
0726: this .onMouseMove = onMouseMove;
0727: }
0728:
0729: // onMouseOut
0730: private String onMouseOut = null;
0731:
0732: /**
0733: * <p>Scripting code executed when a mouse out movement
0734: * occurs over this component.</p>
0735: */
0736: public String getOnMouseOut() {
0737: if (this .onMouseOut != null) {
0738: return this .onMouseOut;
0739: }
0740: ValueBinding _vb = getValueBinding("onMouseOut");
0741: if (_vb != null) {
0742: return (String) _vb.getValue(getFacesContext());
0743: }
0744: return null;
0745: }
0746:
0747: /**
0748: * <p>Scripting code executed when a mouse out movement
0749: * occurs over this component.</p>
0750: * @see #getOnMouseOut()
0751: */
0752: public void setOnMouseOut(String onMouseOut) {
0753: this .onMouseOut = onMouseOut;
0754: }
0755:
0756: // onMouseOver
0757: private String onMouseOver = null;
0758:
0759: /**
0760: * <p>Scripting code executed when the user moves the mouse pointer into
0761: * the boundary of this component.</p>
0762: */
0763: public String getOnMouseOver() {
0764: if (this .onMouseOver != null) {
0765: return this .onMouseOver;
0766: }
0767: ValueBinding _vb = getValueBinding("onMouseOver");
0768: if (_vb != null) {
0769: return (String) _vb.getValue(getFacesContext());
0770: }
0771: return null;
0772: }
0773:
0774: /**
0775: * <p>Scripting code executed when the user moves the mouse pointer into
0776: * the boundary of this component.</p>
0777: * @see #getOnMouseOver()
0778: */
0779: public void setOnMouseOver(String onMouseOver) {
0780: this .onMouseOver = onMouseOver;
0781: }
0782:
0783: // onMouseUp
0784: private String onMouseUp = null;
0785:
0786: /**
0787: * <p>Scripting code executed when the user releases a mouse button while
0788: * the mouse pointer is on the component.</p>
0789: */
0790: public String getOnMouseUp() {
0791: if (this .onMouseUp != null) {
0792: return this .onMouseUp;
0793: }
0794: ValueBinding _vb = getValueBinding("onMouseUp");
0795: if (_vb != null) {
0796: return (String) _vb.getValue(getFacesContext());
0797: }
0798: return null;
0799: }
0800:
0801: /**
0802: * <p>Scripting code executed when the user releases a mouse button while
0803: * the mouse pointer is on the component.</p>
0804: * @see #getOnMouseUp()
0805: */
0806: public void setOnMouseUp(String onMouseUp) {
0807: this .onMouseUp = onMouseUp;
0808: }
0809:
0810: // primary
0811: private boolean primary = false;
0812: private boolean primary_set = false;
0813:
0814: /**
0815: * <p>Indicates that the button is the most commonly used button within a
0816: * group.</p>
0817: */
0818: public boolean isPrimary() {
0819: if (this .primary_set) {
0820: return this .primary;
0821: }
0822: ValueBinding _vb = getValueBinding("primary");
0823: if (_vb != null) {
0824: Object _result = _vb.getValue(getFacesContext());
0825: if (_result == null) {
0826: return false;
0827: } else {
0828: return ((Boolean) _result).booleanValue();
0829: }
0830: }
0831: return false;
0832: }
0833:
0834: /**
0835: * <p>Indicates that the button is the most commonly used button within a
0836: * group.</p>
0837: * @see #isPrimary()
0838: */
0839: public void setPrimary(boolean primary) {
0840: this .primary = primary;
0841: this .primary_set = true;
0842: }
0843:
0844: // reset
0845: private boolean reset = false;
0846: private boolean reset_set = false;
0847:
0848: /**
0849: * <p>Indicates that the button should be a HTML reset button. By default,
0850: * this value is false and the button is created as a submit button. If the
0851: * value is set to true, no action listener will be invoked.</p>
0852: */
0853: public boolean isReset() {
0854: if (this .reset_set) {
0855: return this .reset;
0856: }
0857: ValueBinding _vb = getValueBinding("reset");
0858: if (_vb != null) {
0859: Object _result = _vb.getValue(getFacesContext());
0860: if (_result == null) {
0861: return false;
0862: } else {
0863: return ((Boolean) _result).booleanValue();
0864: }
0865: }
0866: return false;
0867: }
0868:
0869: /**
0870: * <p>Indicates that the button should be a HTML reset button. By default,
0871: * this value is false and the button is created as a submit button. If the
0872: * value is set to true, no action listener will be invoked.</p>
0873: * @see #isReset()
0874: */
0875: public void setReset(boolean reset) {
0876: this .reset = reset;
0877: this .reset_set = true;
0878: }
0879:
0880: // style
0881: private String style = null;
0882:
0883: /**
0884: * <p>CSS style(s) to be applied when this component is rendered.</p>
0885: */
0886: public String getStyle() {
0887: if (this .style != null) {
0888: return this .style;
0889: }
0890: ValueBinding _vb = getValueBinding("style");
0891: if (_vb != null) {
0892: return (String) _vb.getValue(getFacesContext());
0893: }
0894: return null;
0895: }
0896:
0897: /**
0898: * <p>CSS style(s) to be applied when this component is rendered.</p>
0899: * @see #getStyle()
0900: */
0901: public void setStyle(String style) {
0902: this .style = style;
0903: }
0904:
0905: // styleClass
0906: private String styleClass = null;
0907:
0908: /**
0909: * <p>CSS style class(es) to be applied when this component is rendered.</p>
0910: */
0911: public String getStyleClass() {
0912: if (this .styleClass != null) {
0913: return this .styleClass;
0914: }
0915: ValueBinding _vb = getValueBinding("styleClass");
0916: if (_vb != null) {
0917: return (String) _vb.getValue(getFacesContext());
0918: }
0919: return null;
0920: }
0921:
0922: /**
0923: * <p>CSS style class(es) to be applied when this component is rendered.</p>
0924: * @see #getStyleClass()
0925: */
0926: public void setStyleClass(String styleClass) {
0927: this .styleClass = styleClass;
0928: }
0929:
0930: // tabIndex
0931: private int tabIndex = Integer.MIN_VALUE;
0932: private boolean tabIndex_set = false;
0933:
0934: /**
0935: * <p>The position of this component in the tabbing order sequence</p>
0936: */
0937: public int getTabIndex() {
0938: if (this .tabIndex_set) {
0939: return this .tabIndex;
0940: }
0941: ValueBinding _vb = getValueBinding("tabIndex");
0942: if (_vb != null) {
0943: Object _result = _vb.getValue(getFacesContext());
0944: if (_result == null) {
0945: return Integer.MIN_VALUE;
0946: } else {
0947: return ((Integer) _result).intValue();
0948: }
0949: }
0950: return Integer.MIN_VALUE;
0951: }
0952:
0953: /**
0954: * <p>The position of this component in the tabbing order sequence</p>
0955: * @see #getTabIndex()
0956: */
0957: public void setTabIndex(int tabIndex) {
0958: this .tabIndex = tabIndex;
0959: this .tabIndex_set = true;
0960: }
0961:
0962: // text
0963: /**
0964: * <p>Textual label used to create the visual appearance of this button.
0965: * Either the "imageURL" or "text" attributes must be specified. When a
0966: * text value is given, the standard button image is used, with the
0967: * specified text displayed on the button.</p>
0968: */
0969: public Object getText() {
0970: return getValue();
0971: }
0972:
0973: /**
0974: * <p>Textual label used to create the visual appearance of this button.
0975: * Either the "imageURL" or "text" attributes must be specified. When a
0976: * text value is given, the standard button image is used, with the
0977: * specified text displayed on the button.</p>
0978: * @see #getText()
0979: */
0980: public void setText(Object text) {
0981: setValue(text);
0982: }
0983:
0984: // toolTip
0985: private String toolTip = null;
0986:
0987: /**
0988: * <p>Display the text as a tooltip for this component</p>
0989: */
0990: public String getToolTip() {
0991: if (this .toolTip != null) {
0992: return this .toolTip;
0993: }
0994: ValueBinding _vb = getValueBinding("toolTip");
0995: if (_vb != null) {
0996: return (String) _vb.getValue(getFacesContext());
0997: }
0998: return null;
0999: }
1000:
1001: /**
1002: * <p>Display the text as a tooltip for this component</p>
1003: * @see #getToolTip()
1004: */
1005: public void setToolTip(String toolTip) {
1006: this .toolTip = toolTip;
1007: }
1008:
1009: // visible
1010: private boolean visible = false;
1011: private boolean visible_set = false;
1012:
1013: /**
1014: * <p>Use the visible attribute to indicate whether the component should be
1015: * viewable by the user in the rendered HTML page. If set to false, the
1016: * HTML code for the component is present in the page, but the component
1017: * is hidden with style attributes. By default, visible is set to true, so
1018: * HTML for the component HTML is included and visible to the user. If the
1019: * component is not visible, it can still be processed on subsequent form
1020: * submissions because the HTML is present.</p>
1021: */
1022: public boolean isVisible() {
1023: if (this .visible_set) {
1024: return this .visible;
1025: }
1026: ValueBinding _vb = getValueBinding("visible");
1027: if (_vb != null) {
1028: Object _result = _vb.getValue(getFacesContext());
1029: if (_result == null) {
1030: return false;
1031: } else {
1032: return ((Boolean) _result).booleanValue();
1033: }
1034: }
1035: return true;
1036: }
1037:
1038: /**
1039: * <p>Use the visible attribute to indicate whether the component should be
1040: * viewable by the user in the rendered HTML page. If set to false, the
1041: * HTML code for the component is present in the page, but the component
1042: * is hidden with style attributes. By default, visible is set to true, so
1043: * HTML for the component HTML is included and visible to the user. If the
1044: * component is not visible, it can still be processed on subsequent form
1045: * submissions because the HTML is present.</p>
1046: * @see #isVisible()
1047: */
1048: public void setVisible(boolean visible) {
1049: this .visible = visible;
1050: this .visible_set = true;
1051: }
1052:
1053: /**
1054: * <p>Restore the state of this component.</p>
1055: */
1056: public void restoreState(FacesContext _context, Object _state) {
1057: Object _values[] = (Object[]) _state;
1058: super .restoreState(_context, _values[0]);
1059: this .action = (javax.faces.el.MethodBinding) restoreAttachedState(
1060: _context, _values[1]);
1061: this .actionListener = (javax.faces.el.MethodBinding) restoreAttachedState(
1062: _context, _values[2]);
1063: this .alt = (String) _values[3];
1064: this .disabled = ((Boolean) _values[4]).booleanValue();
1065: this .disabled_set = ((Boolean) _values[5]).booleanValue();
1066: this .escape = ((Boolean) _values[6]).booleanValue();
1067: this .escape_set = ((Boolean) _values[7]).booleanValue();
1068: this .imageURL = (String) _values[8];
1069: this .mini = ((Boolean) _values[9]).booleanValue();
1070: this .mini_set = ((Boolean) _values[10]).booleanValue();
1071: this .noTextPadding = ((Boolean) _values[11]).booleanValue();
1072: this .noTextPadding_set = ((Boolean) _values[12]).booleanValue();
1073: this .onBlur = (String) _values[13];
1074: this .onClick = (String) _values[14];
1075: this .onDblClick = (String) _values[15];
1076: this .onFocus = (String) _values[16];
1077: this .onKeyDown = (String) _values[17];
1078: this .onKeyPress = (String) _values[18];
1079: this .onKeyUp = (String) _values[19];
1080: this .onMouseDown = (String) _values[20];
1081: this .onMouseMove = (String) _values[21];
1082: this .onMouseOut = (String) _values[22];
1083: this .onMouseOver = (String) _values[23];
1084: this .onMouseUp = (String) _values[24];
1085: this .primary = ((Boolean) _values[25]).booleanValue();
1086: this .primary_set = ((Boolean) _values[26]).booleanValue();
1087: this .reset = ((Boolean) _values[27]).booleanValue();
1088: this .reset_set = ((Boolean) _values[28]).booleanValue();
1089: this .style = (String) _values[29];
1090: this .styleClass = (String) _values[30];
1091: this .tabIndex = ((Integer) _values[31]).intValue();
1092: this .tabIndex_set = ((Boolean) _values[32]).booleanValue();
1093: this .toolTip = (String) _values[33];
1094: this .visible = ((Boolean) _values[34]).booleanValue();
1095: this .visible_set = ((Boolean) _values[35]).booleanValue();
1096: }
1097:
1098: /**
1099: * <p>Save the state of this component.</p>
1100: */
1101: public Object saveState(FacesContext _context) {
1102: Object _values[] = new Object[36];
1103: _values[0] = super .saveState(_context);
1104: _values[1] = saveAttachedState(_context, action);
1105: _values[2] = saveAttachedState(_context, actionListener);
1106: _values[3] = this .alt;
1107: _values[4] = this .disabled ? Boolean.TRUE : Boolean.FALSE;
1108: _values[5] = this .disabled_set ? Boolean.TRUE : Boolean.FALSE;
1109: _values[6] = this .escape ? Boolean.TRUE : Boolean.FALSE;
1110: _values[7] = this .escape_set ? Boolean.TRUE : Boolean.FALSE;
1111: _values[8] = this .imageURL;
1112: _values[9] = this .mini ? Boolean.TRUE : Boolean.FALSE;
1113: _values[10] = this .mini_set ? Boolean.TRUE : Boolean.FALSE;
1114: _values[11] = this .noTextPadding ? Boolean.TRUE : Boolean.FALSE;
1115: _values[12] = this .noTextPadding_set ? Boolean.TRUE
1116: : Boolean.FALSE;
1117: _values[13] = this .onBlur;
1118: _values[14] = this .onClick;
1119: _values[15] = this .onDblClick;
1120: _values[16] = this .onFocus;
1121: _values[17] = this .onKeyDown;
1122: _values[18] = this .onKeyPress;
1123: _values[19] = this .onKeyUp;
1124: _values[20] = this .onMouseDown;
1125: _values[21] = this .onMouseMove;
1126: _values[22] = this .onMouseOut;
1127: _values[23] = this .onMouseOver;
1128: _values[24] = this .onMouseUp;
1129: _values[25] = this .primary ? Boolean.TRUE : Boolean.FALSE;
1130: _values[26] = this .primary_set ? Boolean.TRUE : Boolean.FALSE;
1131: _values[27] = this .reset ? Boolean.TRUE : Boolean.FALSE;
1132: _values[28] = this .reset_set ? Boolean.TRUE : Boolean.FALSE;
1133: _values[29] = this .style;
1134: _values[30] = this .styleClass;
1135: _values[31] = new Integer(this .tabIndex);
1136: _values[32] = this .tabIndex_set ? Boolean.TRUE : Boolean.FALSE;
1137: _values[33] = this .toolTip;
1138: _values[34] = this .visible ? Boolean.TRUE : Boolean.FALSE;
1139: _values[35] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
1140: return _values;
1141: }
1142:
1143: }
|