Package com.itextpdf.forms.form.element
Class InputField
- java.lang.Object
-
- com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
-
- com.itextpdf.layout.ElementPropertyContainer<T>
-
- com.itextpdf.layout.element.AbstractElement<T>
-
- com.itextpdf.forms.form.element.FormField<InputField>
-
- com.itextpdf.forms.form.element.InputField
-
- All Implemented Interfaces:
IFormField,IPlaceholderable,IAbstractElement,IBlockElement,IElement,IPropertyContainer,IAccessibleElement
public class InputField extends FormField<InputField> implements IPlaceholderable
Extension of theFormFieldclass representing a button so that aInputFieldRendereris used.
-
-
Field Summary
Fields Modifier and Type Field Description private ParagraphplaceholderThe placeholder paragraph.private introtationField rotation, counterclockwise.private static floatX_OFFSETDefault padding X offset.-
Fields inherited from class com.itextpdf.forms.form.element.FormField
tagProperties
-
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
-
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
-
Constructor Summary
Constructors Constructor Description InputField(java.lang.String id)Creates a new input field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessibilityPropertiesgetAccessibilityProperties()Gets theaccessibility properties.<T1> T1getDefaultProperty(int property)Gets the default property from this entity.ParagraphgetPlaceholder()Gets the placeholder paragraph.intgetRotation()Get rotation.protected IRenderermakeNewRenderer()Creates a new renderer instance.InputFieldsetComb(boolean isComb)SetsCombflag for the text field.InputFieldsetMaxLen(int maxLen)Sets the maximum length of the field's text, in characters.voidsetPlaceholder(Paragraph placeholder)Sets the placeholder paragraph.private voidsetProperties()InputFieldsetRotation(int rotation)Set rotation of the input field.InputFielduseAsPassword(boolean isPassword)Determines, whether the input field will be password.-
Methods inherited from class com.itextpdf.forms.form.element.FormField
getId, setAlternativeDescription, setHeight, setInteractive, setSize, setValue, setWidth
-
Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, getRenderer, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
-
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildren
-
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, getRenderer, setNextRenderer
-
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
-
-
-
Field Detail
-
X_OFFSET
private static final float X_OFFSET
Default padding X offset.- See Also:
- Constant Field Values
-
placeholder
private Paragraph placeholder
The placeholder paragraph.
-
rotation
private int rotation
Field rotation, counterclockwise. Must be a multiple of 90 degrees.
-
-
Method Detail
-
useAsPassword
public InputField useAsPassword(boolean isPassword)
Determines, whether the input field will be password.Usually means that instead of glyphs '*' will be shown in case of flatten field.
If the field is not flatten, value will be ignored.
- Parameters:
isPassword-trueis this field shall be considered as password,falseotherwise- Returns:
- this input field
-
getPlaceholder
public Paragraph getPlaceholder()
Gets the placeholder paragraph.- Specified by:
getPlaceholderin interfaceIPlaceholderable- Returns:
- the placeholder paragraph
-
setPlaceholder
public void setPlaceholder(Paragraph placeholder)
Sets the placeholder paragraph.- Specified by:
setPlaceholderin interfaceIPlaceholderable- Parameters:
placeholder- the paragraph to be used as placeholder
-
getDefaultProperty
public <T1> T1 getDefaultProperty(int property)
Description copied from class:FormFieldGets the default property from this entity.- Specified by:
getDefaultPropertyin interfaceIPropertyContainer- Overrides:
getDefaultPropertyin classFormField<InputField>- Type Parameters:
T1- the return type associated with the property- Parameters:
property- the property to be retrieved- Returns:
- the default property value. If the default property is not defined,
nullwill be returned
-
getRotation
public int getRotation()
Get rotation.- Returns:
- rotation value.
-
setRotation
public InputField setRotation(int rotation)
Set rotation of the input field.- Parameters:
rotation- new rotation value, counterclockwise. Must be a multiple of 90 degrees. It has sense only in interactive mode, seeFormField.setInteractive(boolean)- Returns:
- the edited
InputField
-
setComb
public InputField setComb(boolean isComb)
SetsCombflag for the text field. Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password and FileSelect flags are clear.If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs.
- Parameters:
isComb- boolean value specifying whether to enable combing- Returns:
- this
InputFieldinstance
-
setMaxLen
public InputField setMaxLen(int maxLen)
Sets the maximum length of the field's text, in characters.- Parameters:
maxLen- the current maximum text length- Returns:
- this
InputFieldinstance
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Gets theaccessibility properties. See alsoIAccessibleElement.- Specified by:
getAccessibilityPropertiesin interfaceIAccessibleElement- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Description copied from class:AbstractElementCreates a new renderer instance.- Specified by:
makeNewRendererin classAbstractElement<InputField>- Returns:
- new
IRenderer
-
setProperties
private void setProperties()
-
-