org.ceryle.ui
Class FormPanel.FormFieldPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ceryle.ui.FormPanel.FormFieldPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Cloneable, Accessible
- Enclosing class:
- FormPanel
protected class FormPanel.FormFieldPanel
- extends JPanel
- implements Cloneable
A subclass of JPanel providing a form component containing a field
title, editable field or text area, and optionally a pair of control
buttons to allow addition of similar fields to the form layout.
- See Also:
- Serialized Form
|
Method Summary |
Object |
clone()
Returns a cloned image of this FormFieldPanel. |
protected JPanel |
createButtonPanel()
Creates the small panel containing "+" (clone) and "-" (remove) icons,
returning the JPanel. |
protected JComponent |
createField(String content,
int rows,
int cols)
Generates the JTextComponent based on the number of requested
rows, either as a JTextField (when rows=1) or a JTextArea. |
protected String |
getContent()
Returns the text content of this form field. |
protected String |
getDefaultText()
Returns the default content of this form field. |
Element |
getElement()
Returns the DOM Element serving as this form field's template. |
protected String |
getHREF()
Returns the content of the 'href' attribute contributing to this form
field, null if empty or it has not been set. |
protected int |
getPreferredHeight()
|
String |
getTitle()
Returns this form field's title as a String. |
boolean |
isEmpty()
Returns true if the content of the JTextComponent used as the
form field is empty. |
protected void |
setContent(String content)
Sets the text content of this form field to the String content. |
protected void |
setElementContent(String content)
If the original element was an XHTML <a> element, writes
content to its href attribute. |
protected void |
setHREF(String uriRef)
Sets the content of this form field's 'href' attribute to the String uriRef. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
FormPanel.FormFieldPanel
public FormPanel.FormFieldPanel(Element element,
String title)
- Constructor for a small panel containing a form field or text area, and its
label. This is designed as a component of a FormPanel. The field content
is derived from the content of the provided Element. If the element is
an XHTML <a> element, its href is used rather
than element text (NOTE: link text is current ignored and preserved).
- Parameters:
element - a reference to the DOM Element acting as this FormFieldPanel's templatetitle - the content of the field title (ie., the field label)
getPreferredHeight
protected int getPreferredHeight()
createField
protected JComponent createField(String content,
int rows,
int cols)
- Generates the JTextComponent based on the number of requested
rows, either as a JTextField (when rows=1) or a JTextArea.
createButtonPanel
protected JPanel createButtonPanel()
- Creates the small panel containing "+" (clone) and "-" (remove) icons,
returning the JPanel.
If isType is true, suppresses creation of the buttons.
If isLink is true, adds 'browse' and 'go' buttons.
getTitle
public String getTitle()
- Returns this form field's title as a String.
getElement
public Element getElement()
- Returns the DOM Element serving as this form field's template.
getDefaultText
protected String getDefaultText()
- Returns the default content of this form field. This comes from the
internally-stored default content, not its current GUI content,
which can be obtained via getContent().
setContent
protected void setContent(String content)
- Sets the text content of this form field to the String content.
getContent
protected String getContent()
- Returns the text content of this form field. This comes from the
current GUI content, not the internally-stored default.
If the content is null, an empty String is returned.
setHREF
protected void setHREF(String uriRef)
- Sets the content of this form field's 'href' attribute to the String uriRef.
getHREF
protected String getHREF()
- Returns the content of the 'href' attribute contributing to this form
field, null if empty or it has not been set.
isEmpty
public boolean isEmpty()
- Returns true if the content of the JTextComponent used as the
form field is empty. This reflects a trimming of whitespace in
order to avoid including fields whose content consists solely of it.
setElementContent
protected void setElementContent(String content)
- If the original element was an XHTML <a> element, writes
content to its href attribute.
Otherwise, this removes any existing Text children of this FormFieldPanel's
internal Element and appends a single Text node containing the String
content. If content is null or an empty String, this will
set the content to an empty String.
Note:
Any non-empty child Element nodes are also removed (since they might have
initially been, say, <b> or <b> elements),
with empty elements being left alone since we're trying to preserve
<meta> elements. The effect of this is to remove any bold,
italic, or other wrapper elements, leaving alone empty elements such as meta.
clone
public Object clone()
- Returns a cloned image of this FormFieldPanel. By necessity, this
is generated from the owner document of the internally-stored
Element (provided in the class constructor) and added as the next
sibling to the original. The content of the clone is set to the
original content of the template, not the current content of the field.
- Overrides:
clone in class Object
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.