Package com.itextpdf.forms.form.element
Class Button
- 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<Button>
-
- com.itextpdf.forms.form.element.Button
-
- All Implemented Interfaces:
IFormField
,IAbstractElement
,IBlockElement
,IElement
,IPropertyContainer
,IAccessibleElement
public class Button extends FormField<Button>
Extension of theFormField
class representing a button in html.
-
-
Field Summary
Fields Modifier and Type Field Description private static Color
DEFAULT_BACKGROUND_COLOR
private static TextAlignment
DEFAULT_TEXT_ALIGNMENT
private static VerticalAlignment
DEFAULT_VERTICAL_ALIGNMENT
private boolean
singleLine
Indicates if it's the button with only single line caption.-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Button
add(IBlockElement element)
Adds any block element to the div's contents.Button
add(Image element)
Adds an image to the div's contents.AccessibilityProperties
getAccessibilityProperties()
Gets theaccessibility properties
.<T1> T1
getDefaultProperty(int property)
Gets the default property from this entity.boolean
isSingleLine()
Indicates if this element represents an input with type button in html.protected IRenderer
makeNewRenderer()
Creates a new renderer instance.Button
setSingleLineValue(java.lang.String value)
Sets passed string value to the single line button caption.IFormField
setValue(java.lang.String value)
Adds passed string value as paragraph to the button.-
Methods inherited from class com.itextpdf.forms.form.element.FormField
getId, setAlternativeDescription, setHeight, setInteractive, setSize, 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
-
DEFAULT_VERTICAL_ALIGNMENT
private static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT
-
DEFAULT_TEXT_ALIGNMENT
private static final TextAlignment DEFAULT_TEXT_ALIGNMENT
-
DEFAULT_BACKGROUND_COLOR
private static final Color DEFAULT_BACKGROUND_COLOR
-
singleLine
private boolean singleLine
Indicates if it's the button with only single line caption.
-
-
Constructor Detail
-
Button
public Button(java.lang.String id)
Creates a newButton
instance.- Parameters:
id
- the id
-
-
Method Detail
-
add
public Button add(IBlockElement element)
Adds any block element to the div's contents.- Parameters:
element
- aBlockElement
- Returns:
- this Element
-
add
public Button add(Image element)
Adds an image to the div's contents.- Parameters:
element
- anImage
- Returns:
- this Element
-
isSingleLine
public boolean isSingleLine()
Indicates if this element represents an input with type button in html.- Returns:
- true if it's the button with only one line caption.
-
setSingleLineValue
public Button setSingleLineValue(java.lang.String value)
Sets passed string value to the single line button caption. Value will be clipped if it is not fit into single line. For multiple line value usesetValue(String)
. Note that when adding other elements to the button after this method is called, this added value can be multiline.- Parameters:
value
- string value to be set as caption.- Returns:
- this same
Button
instance.
-
setValue
public IFormField setValue(java.lang.String value)
Adds passed string value as paragraph to the button. Value can be multiline if it is not fit into single line. For single line value usesetSingleLineValue(String)
. Note that the new value will replace all already added elements.- Specified by:
setValue
in interfaceIFormField
- Overrides:
setValue
in classFormField<Button>
- Parameters:
value
- string value to be added into button.- Returns:
- this same
IFormField
instance
-
getDefaultProperty
public <T1> T1 getDefaultProperty(int property)
Gets the default property from this entity.- Specified by:
getDefaultProperty
in interfaceIPropertyContainer
- Overrides:
getDefaultProperty
in classFormField<Button>
- 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,
null
will be returned
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Gets theaccessibility properties
. See alsoIAccessibleElement
.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Creates a new renderer instance.- Specified by:
makeNewRenderer
in classAbstractElement<Button>
- Returns:
- new
IRenderer
-
-