Spec-Zone .ru
спецификации, руководства, описания, API
JavaTM 2 Platform
Standard Edition

javax.swing.text.html
Class FormView

java.lang.Object
  |
  +--javax.swing.text.View
        |
        +--javax.swing.text.ComponentView
              |
              +--javax.swing.text.html.FormView

public class FormView
extends ComponentView
implements ActionListener

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 components produced get their opaque property set to false. 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


Inner Class Summary
protected  class FormView.MouseEventListener
          MouseEventListener class to handle form submissions when an input with type equal to image is clicked on.
 
Field Summary
static String RESET
           
static String SUBMIT
          If a value attribute is not specified for a FORM input element of type "submit" or "reset", then these default strings are used.
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Constructor Summary
FormView(Element elem)
          Creates a new FormView object.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          Responsible for processeing the ActionEvent.
protected  Component createComponent()
          Create the component.
protected  void imageSubmit(String imageData)
          This method is called to submit a form in response to a click on an image.
protected  void submitData(String data)
          This method is responsible for submitting the form data.
 
Methods inherited from class javax.swing.text.ComponentView
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, setSize, viewToModel
 
Methods inherited from class javax.swing.text.View
breakView, changedUpdate, createFragment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, removeUpdate, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBMIT

public static final String SUBMIT
If a value attribute is not specified for a FORM input element of type "submit" or "reset", then these default strings are used.

RESET

public static final String RESET
Constructor Detail

FormView

public FormView(Element elem)
Creates a new FormView object.
Parameters:
elem - the element to decorate
Method Detail

createComponent

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.
Overrides:
createComponent in class ComponentView

actionPerformed

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.
Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - the ActionEvent.

submitData

protected void submitData(String data)
This method is responsible for submitting the form data. A thread is forked to undertake the submission.

imageSubmit

protected void imageSubmit(String imageData)
This method is called to submit a form in response to a click on an image. i.e an form element of type "image".
Parameters:
the - mouse click coordinates.

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.