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

src.com.ibm.as400.util.html.RadioFormInput Maven / Gradle / Ivy

The newest version!
///////////////////////////////////////////////////////////////////////////////
//                                                                             
// JTOpen (IBM Toolbox for Java - OSS version)                                 
//                                                                             
// Filename: RadioFormInput.java
//                                                                             
// The source code contained herein is licensed under the IBM Public License   
// Version 1.0, which has been approved by the Open Source Initiative.         
// Copyright (C) 1997-2001 International Business Machines Corporation and     
// others. All rights reserved.                                                
//                                                                             
///////////////////////////////////////////////////////////////////////////////

package com.ibm.as400.util.html;

import com.ibm.as400.access.Trace;
import com.ibm.as400.access.ExtendedIllegalStateException;

import java.beans.PropertyVetoException;

/**
*  The RadioFormInput class represents a radio button input type in an
*  HTML form which represents a 1-of-many choice field.
*  The trailing slash "/" on the RadioFormInput tag allows it to 
*  conform to the XHTML specification.
*  

* Here is an example of a RadioFormInput tag:
* * <input type="radio" name="age" value="twentysomething" * checked="checked" /> Age 20-29 * * * @see com.ibm.as400.util.html.RadioFormInputGroup **/ public class RadioFormInput extends ToggleFormInput { private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others."; static final long serialVersionUID = 7708591176708456432L; /** * Constructs a default RadioFormInput object. **/ public RadioFormInput() { super(); } /** * Constructs a RadioFormInput object with the specified viewable text label * and initial checked value. * @param label The viewable text label. * @param checked If the radio button initializes to checked. **/ public RadioFormInput(String label, boolean checked) { super(label, checked); } /** * Constructs a RadioFormInput object with the specified control name, * initial input value, viewable text label, and initial checked value. * @param name The control name of the input field. * @param value The input value used when the field is submitted. * @param label The viewable text label. * @param checked If the radio button initializes to checked. **/ public RadioFormInput(String name, String value, String label, boolean checked) { super(label, checked); try { setName(name); setValue(value); } catch (PropertyVetoException e) { } } /** * Returns a comment tag. * This method should not be called. There is no XSL-FO support for this class. * @return The comment tag. **/ public String getFOTag() //@D1A { Trace.log(Trace.ERROR, "Attempting to getFOTag() for an object that doesn't support it."); return ""; } /** * Returns the tag for the radio button form input type. * @return The tag. **/ public String getTag() { //@C1D if (getName() == null) { Trace.log(Trace.ERROR, "Attempting to get tag before setting name."); throw new ExtendedIllegalStateException( "name", ExtendedIllegalStateException.PROPERTY_NOT_SET ); } if (getValue() == null) { Trace.log(Trace.ERROR, "Attempting to get tag before setting value."); throw new ExtendedIllegalStateException( "value", ExtendedIllegalStateException.PROPERTY_NOT_SET ); } if (getLabel() == null) { Trace.log(Trace.ERROR, "Attempting to get tag before setting label."); throw new ExtendedIllegalStateException( "label", ExtendedIllegalStateException.PROPERTY_NOT_SET ); } StringBuffer s = new StringBuffer(" "); s.append(getLabel()); return s.toString(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy