- java.lang.Object
-
- javax.swing.text.View
-
- javax.swing.text.ComponentView
-
- javax.swing.text.html.FormView
-
- All Implemented Interfaces:
- ActionListener, EventListener, SwingConstants
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 byHTMLDocument.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
Nested Classes Modifier and Type Class and Description protected class
FormView.MouseEventListener
MouseEventListener class to handle form submissions when an input with type equal to image is clicked on.
-
Field Summary
Fields Modifier and Type Field and Description static String
RESET
Deprecated.As of 1.3, value comes from UIManager UIManager property FormView.resetButtonTextstatic String
SUBMIT
Deprecated.As of 1.3, value now comes from UIManager property FormView.submitButtonText-
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
-
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
-
Constructor Summary
Constructors Constructor and Description FormView(Element elem)
Creates a new FormView object.
-
Method Summary
Methods Modifier and Type Method and Description void
actionPerformed(ActionEvent evt)
Responsible for processing the ActionEvent.protected Component
createComponent()
Create the component.float
getMaximumSpan(int axis)
Determines the maximum span for this view along an axis.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".protected void
submitData(String data)
This method is responsible for submitting the form data.-
Methods inherited from class javax.swing.text.ComponentView
getAlignment, getComponent, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, viewToModel
-
Methods inherited from class javax.swing.text.View
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setSize, updateChildren, updateLayout, viewToModel
-
-
-
-
Field Detail
-
SUBMIT
@Deprecated public static final String SUBMIT
Deprecated. As of 1.3, value now comes from UIManager property FormView.submitButtonTextIf a value attribute is not specified for a FORM input element of type "submit", then this default string is used.
-
RESET
@Deprecated public static final String RESET
Deprecated. As of 1.3, value comes from UIManager UIManager property FormView.resetButtonTextIf a value attribute is not specified for a FORM input element of type "reset", then this default string is used.
-
-
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 classComponentView
-
getMaximumSpan
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.- Overrides:
getMaximumSpan
in classComponentView
- Parameters:
axis
- may be either View.X_AXIS or View.Y_AXIS- Returns:
- the span the view would like to be rendered into >= 0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.
- Throws:
IllegalArgumentException
- for an invalid axis- See Also:
View.getPreferredSpan(int)
-
actionPerformed
public void actionPerformed(ActionEvent evt)
Responsible for processing 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 interfaceActionListener
- 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 -- an <INPUT> form element of type "image".- Parameters:
imageData
- the mouse click coordinates.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/text/html/FormView.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.