|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.FormElement
org.faceless.pdf2.FormButton
public final class FormButton
A type of FormElement
representing a "Push Button", of the kind used to
trigger an action like submitting or resetting a form.
A push buttons has no value - it's getValue()
method will always return
null
. However, each WidgetAnnotation
returned by the FormElement.getAnnotations()
method may have a different value specified - although these values are not
submitted with the form. Buttons may also have images associated with them,
which can be set via the WidgetAnnotation.setButtonImage(org.faceless.pdf2.PDFImage)
method.
Here's an example showing how to add a pushbutton which submits the form.
PDFAction act = PDFAction.formSubmit("/servlet/Submit", PDFAction.METHOD_HTTP_POST)); Form form = pdf.getForm(); FormButton button = new FormButton(); WidgetAnnotation annot = button.addAnnotation(pdf.getLastPage(), 100,100,200,120); annot.setValue("Submit"); annot.setAction(Event.MOUSEUP, act); form.addElement("SubmitButton", button);
Constructor Summary | |
---|---|
FormButton()
Create a new FormButton element. |
|
FormButton(PDFPage page,
float x1,
float y1,
float x2,
float y2)
Create a new FormButton element, and add a single annotation at the specified position. |
Method Summary | |
---|---|
WidgetAnnotation |
addAnnotation(PDFPage page,
float x1,
float y1,
float x2,
float y2)
Add an annotation for this Form element at the specified position on the specified page. |
String |
getValue()
FormButton elements don't have a value, so this method always
returns null - try calling the WidgetAnnotation.getValue()
method on the WidgetAnnotation class to get back the text label of a
button. |
void |
rebuild()
Cause the annotations to be rebuilt. |
String |
toString()
|
Methods inherited from class org.faceless.pdf2.FormElement |
---|
addPropertyChangeListener, duplicate, flatten, getAction, getAnnotation, getAnnotations, getDescription, getForm, isReadOnly, isRequired, isSubmitted, removePropertyChangeListener, setAction, setDescription, setReadOnly, setRequired, setSubmitted |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FormButton()
addAnnotation
method
public FormButton(PDFPage page, float x1, float y1, float x2, float y2)
FormButton button = new FormButton(); button.addAnnotation(page,x1,y1,x2,y2);
page
- the page to place the annotation onx1
- the left-most X co-ordinate of the annotationy1
- the top-most Y co-ordinate of the annotationx2
- the right-most X co-ordinate of the annotationy2
- the bottom-most Y co-ordinate of the annotationMethod Detail |
---|
public WidgetAnnotation addAnnotation(PDFPage page, float x1, float y1, float x2, float y2)
page
- the page to place the annotation onx1
- the left-most X co-ordinate of the annotationy1
- the top-most Y co-ordinate of the annotationx2
- the right-most X co-ordinate of the annotationy2
- the bottom-most Y co-ordinate of the annotationpublic String getValue()
FormButton
elements don't have a value, so this method always
returns null
- try calling the WidgetAnnotation.getValue()
method on the WidgetAnnotation
class to get back the text label of a
button.
getValue
in class FormElement
public void rebuild()
FormElement
rebuild
in class FormElement
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |