|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.text.ComponentView javax.swing.text.html.FormView
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 | |
private class |
FormView.BrowseFileAction
BrowseFileAction is used for input type == file. |
protected class |
FormView.MouseEventListener
MouseEventListener class to handle form submissions when an input with type equal to image is clicked on. |
(package private) class |
FormView.SubmitThread
The SubmitThread is responsible for submitting the form. |
Nested classes inherited from class javax.swing.text.ComponentView |
|
Field Summary | |
private short |
maxIsPreferred
Used to indicate if the maximum span should be the same as the preferred span. |
static String |
RESET
Deprecated. As of 1.3, value comes from UIManager UIManager property FormView.resetButtonText |
static String |
SUBMIT
Deprecated. As of 1.3, value now comes from UIManager property FormView.submitButtonText |
Fields inherited from class javax.swing.text.ComponentView |
|
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 | |
FormView(Element elem)
Creates a new FormView object. |
Method Summary | |
void |
actionPerformed(ActionEvent evt)
Responsible for processeing the ActionEvent. |
private void |
appendBuffer(StringBuffer buffer,
String name,
String value)
Appends name / value pairs into the buffer. |
protected Component |
createComponent()
Create the component. |
private JComponent |
createInputComponent(AttributeSet attr,
Object model)
Creates a component for an <INPUT> element based on the value of the "type" attribute. |
(package private) void |
getFormData(StringBuffer buffer)
Iterates over the element hierarchy, extracting data from the models associated with the relevant form elements. |
private Element |
getFormElement()
Returns the Element representing the FORM . |
private String |
getImageData(Point point)
Extracts the value of the name attribute associated with the input element of type image. |
private String |
getInputElementData(AttributeSet attr)
Returns the data associated with an <INPUT> form element. |
float |
getMaximumSpan(int axis)
Determines the maximum span for this view along an axis. |
private String |
getTextAreaData(AttributeSet attr)
Returns the data associated with the <TEXTAREA> form element. |
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". |
private boolean |
isControl(Element elem)
Returns true if the Element elem represents a control. |
(package private) 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. |
private void |
loadElementDataIntoBuffer(Element elem,
StringBuffer buffer)
Loads the data associated with the element into the buffer. |
private void |
loadSelectData(AttributeSet attr,
StringBuffer buffer)
Loads the buffer with the data associated with the Select form element. |
(package private) void |
resetForm()
Resets the form to its initial state by reinitializing the models associated with each form element to their initial values. |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SUBMIT
public static final String RESET
private short maxIsPreferred
Constructor Detail |
public FormView(Element elem)
elem
- the element to decorateMethod Detail |
protected Component createComponent()
createComponent
in class ComponentView
private JComponent createInputComponent(AttributeSet attr, Object model)
model
- the value of the StyleConstants.ModelAttribute
public float getMaximumSpan(int axis)
getMaximumSpan
in class ComponentView
axis
- may be either View.X_AXIS or View.Y_AXIS
IllegalArgumentException
- for an invalid axispublic void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
evt
- the ActionEvent.protected void submitData(String data)
protected void imageSubmit(String imageData)
imageData
- the mouse click coordinates.private String getImageData(Point point)
point
- associated with the mouse click.
private Element getFormElement()
FORM
.
void getFormData(StringBuffer buffer)
buffer
- the buffer that contains that data to submitprivate void loadElementDataIntoBuffer(Element elem, StringBuffer buffer)
private String getInputElementData(AttributeSet attr)
private String getTextAreaData(AttributeSet attr)
private void loadSelectData(AttributeSet attr, StringBuffer buffer)
private void appendBuffer(StringBuffer buffer, String name, String value)
private boolean isControl(Element elem)
elem
represents a control.
boolean isLastTextOrPasswordField()
void resetForm()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |