Home » openjdk-7 » javax » swing » text » html » [javadoc | source]
javax.swing.text.html
public class: FormView [javadoc | source]
java.lang.Object
   javax.swing.text.View
      javax.swing.text.ComponentView
         javax.swing.text.html.FormView

All Implemented Interfaces:
    ActionListener, SwingConstants

Component decorator that implements the view interface for form elements, <input>, <textarea>, and <select>. The model for the component is stored as an attribute of the the element (using StyleConstants.ModelAttribute), and is used to build the component of the view. The type of the model is assumed to of the type that would be set by HTMLDocument.HTMLReader.FormAction. If there are multiple views mapped over the document, they will share the embedded component models.

The following table shows what components get built by this view.
Element Type Component built
input, type button JButton
input, type checkbox JCheckBox
input, type image JButton
input, type password JPasswordField
input, type radio JRadioButton
input, type reset JButton
input, type submit JButton
input, type text JTextField
select, size > 1 or multiple attribute defined JList in a JScrollPane
select, size unspecified or 1 JComboBox
textarea JTextArea in a JScrollPane
input, type file JTextField

Nested Class Summary:
protected class  FormView.MouseEventListener  MouseEventListener class to handle form submissions when an input with type equal to image is clicked on. A MouseListener is necessary since along with the image data the coordinates associated with the mouse click need to be submitted. 
Field Summary
public static final  String SUBMIT    If a value attribute is not specified for a FORM input element of type "submit", then this default string is used.
     
    public static final  String RESET    If a value attribute is not specified for a FORM input element of type "reset", then this default string is used.
       
      static final  String PostDataProperty    Document attribute name for storing POST data. JEditorPane.getPostData() uses the same name, should be kept in sync. 
      Fields inherited from javax.swing.text.View:
      BadBreakWeight,  GoodBreakWeight,  ExcellentBreakWeight,  ForcedBreakWeight,  X_AXIS,  Y_AXIS,  sharedBiasReturn
      Constructor:
       public FormView(Element elem) 
        Creates a new FormView object.
        Parameters:
        elem - the element to decorate
      Method from javax.swing.text.html.FormView Summary:
      actionPerformed,   createComponent,   getMaximumSpan,   imageSubmit,   isLastTextOrPasswordField,   resetForm,   submitData
      Methods from javax.swing.text.ComponentView:
      createComponent,   getAlignment,   getComponent,   getMaximumSpan,   getMinimumSpan,   getPreferredSpan,   modelToView,   paint,   setComponentParent,   setParent,   viewToModel
      Methods from javax.swing.text.View:
      append,   breakView,   changedUpdate,   createFragment,   forwardUpdate,   forwardUpdateToView,   getAlignment,   getAttributes,   getBreakWeight,   getChildAllocation,   getContainer,   getDocument,   getElement,   getEndOffset,   getGraphics,   getMaximumSpan,   getMinimumSpan,   getNextVisualPositionFrom,   getParent,   getPreferredSpan,   getResizeWeight,   getStartOffset,   getToolTipText,   getView,   getViewCount,   getViewFactory,   getViewIndex,   getViewIndex,   insert,   insertUpdate,   isVisible,   modelToView,   modelToView,   modelToView,   paint,   preferenceChanged,   remove,   removeAll,   removeUpdate,   replace,   setParent,   setSize,   updateChildren,   updateLayout,   viewToModel,   viewToModel
      Methods from java.lang.Object:
      clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
      Method from javax.swing.text.html.FormView Detail:
       public  void actionPerformed(ActionEvent evt) 
        Responsible for processeing the ActionEvent. If the element associated with the FormView, has a type of "submit", "reset", "text" or "password" then the action is processed. In the case of a "submit" the form is submitted. In the case of a "reset" the form is reset to its original state. In the case of "text" or "password", if the element is the last one of type "text" or "password", the form is submitted. Otherwise, focus is transferred to the next component in the form.
       protected Component createComponent() 
        Create the component. This is basically a big switch statement based upon the tag type and html attributes of the associated element.
       public float getMaximumSpan(int axis) 
        Determines the maximum span for this view along an axis. For certain components, the maximum and preferred span are the same. For others this will return the value returned by Component.getMaximumSize along the axis of interest.
       protected  void imageSubmit(String imageData) 
        This method is called to submit a form in response to a click on an image -- an <INPUT> form element of type "image".
       boolean isLastTextOrPasswordField() 
        Iterates over the element hierarchy to determine if the element parameter, which is assumed to be an <INPUT> element of type password or text, is the last one of either kind, in the form to which it belongs.
        void resetForm() 
        Resets the form to its initial state by reinitializing the models associated with each form element to their initial values. param elem the element that triggered the reset
       protected  void submitData(String data) 
        This method is responsible for submitting the form data. A thread is forked to undertake the submission.