public abstract class NavigationAction
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static int |
CLICK_NAVIGATION_ACTION |
static int |
FORM_NAVIGATION_ACTION
Constants used to identify navigation actions in the database.
|
static int |
LIST_SELECTION_NAVIGATION_ACTION |
static org.apache.log4j.Logger |
log
Used for logging.
|
static int |
TEXT_ENTRY_NAVIGATION_ACTION |
Modifier | Constructor and Description |
---|---|
protected |
NavigationAction()
An empty constructor needed for Castor.
|
protected |
NavigationAction(java.lang.String name)
Initializes the action with only a name.
|
Modifier and Type | Method and Description |
---|---|
void |
addFormParameterToSet(java.lang.String name,
java.lang.String value)
Adds a parameter to be set on the form.
|
int |
compareTo(java.lang.Object navigationAction)
So we can be sorted.
|
void |
delete()
Deletes the navigation action from the database.
|
void |
dumpToLog()
Dumps the contents of the navigation action to the log.
|
abstract java.lang.String[] |
getAttributes()
Returns a list of possible attributes for this action
|
java.lang.String |
getCriteria()
Gets the criteria used to identify clickable elements.
|
java.lang.String |
getFormParametersToSet()
Gets a string representing parameters to set.
|
protected java.util.HashSet<FormParameter> |
getFormParametersToSetAsSet()
Gets a reference to the
HashMap containing key/value
pairs to be set on the form before it gets submitted. |
java.lang.String |
getFormParametersToSetAsSingleValue()
Gets the form parameters to set as a single value.
|
FormParameter |
getFormParameterToSet(int sequence)
Gets a parameter to set by its sequence.
|
protected HtmlElementIdentifier |
getHtmlElementIdentifier()
Gets the parsed criteria object.
|
java.lang.String |
getHtmlElementIdentifierAttribute()
Gets the attribute portion of the HTML element identifier.
|
java.lang.String |
getHtmlElementIdentifierValidSeqencesStringValue()
Gets a string representing the value portion of the valid sequences.
|
java.lang.String |
getHtmlElementIdentifierValidSequences()
Gets the valid sequences of the HTML element identifier.
|
java.lang.String |
getHtmlElementIdentifierValue()
Gets the value portion of the HTML element identifier.
|
int |
getID()
Gets the database ID.
|
boolean |
getInvokedFromScript()
Indicates whether or not this is to be invoked from a script.
|
java.lang.String |
getName()
Gets the name of the action.
|
protected abstract NavigationActionDoer |
getNavigationActionDoerForHtmlElement(com.gargoylesoftware.htmlunit.html.HtmlElement htmlElement)
Gets a
NavigationActionDoer based on a
HtmlElement . |
java.util.List<NavigationActionDoer> |
getNavigationActionDoers(com.gargoylesoftware.htmlunit.html.HtmlPage page,
ScrapingSessionState scrapingSessionState)
Returns a list of
NavigationActionDoer objects based on criteria
held by this navigation action. |
abstract int |
getNavigationActionType()
Gets the numeric constant that represents the type
of the action.
|
int |
getNumFormParametersToSet()
Gets the number of form parameters to set.
|
ScrapeableFile |
getScrapeableFile()
Gets the scrapeable file containing this action.
|
int |
getSequence()
Gets the sequence of the navigation action.
|
ScrapeableFile |
getTargetScrapeableFile()
Gets the target scrapeable file.
|
java.lang.String |
getTargetScrapeableFileName() |
AbstractView |
getView()
Gets the view representing this navigation action.
|
void |
removeFormParameterToSet(int sequence)
Removes a parameter by its sequence.
|
void |
save()
Saves the object to the database.
|
void |
setCriteria(java.lang.String criteria)
Sets the criteria used to identify clickable elements.
|
void |
setFormParametersToSet(java.lang.String formParametersToSet)
Parses and sets the parameters to set as a URL-type string into
the hash map in this class.
|
void |
setFormParametersToSetAsSingleValue(java.lang.String valueToSet)
Sets all form parameters to be set as a single value.
|
void |
setFormParameterToSetName(int sequence,
java.lang.String name)
Sets the key portion of a parameter by its sequence.
|
void |
setFormParameterToSetValue(int sequence,
java.lang.String value)
Sets the value portion of a parameter by its sequence.
|
protected void |
setHtmlElementIdentifier(HtmlElementIdentifier htmlElementIdentifier)
Sets the parsed criteria object.
|
void |
setHtmlElementIdentifier(java.lang.String strValidSequences)
Sets a string representing the value portion of the valid sequences.
|
void |
setHtmlElementIdentifierAttribute(java.lang.String attribute)
Sets the attribute portion of the form criteria.
|
void |
setHtmlElementIdentifierValidSequences(java.lang.String sequences)
Sets the valid sequences of the HTML element identifier.
|
void |
setHtmlElementIdentifierValue(java.lang.String value)
Sets the value portion of the HTML element identifier.
|
protected void |
setID(int navigationActionID)
Sets the database ID.
|
void |
setInvokedFromScript(boolean invokedFromScript)
Determines whether or not this is to be invoked from a script.
|
void |
setName(java.lang.String name)
Sets the name of the action.
|
void |
setScrapeableFile(ScrapeableFile scrapeableFile)
Sets the scrapeable file containing this action.
|
void |
setSequence(int sequence)
Sets the sequence of the navigation action.
|
void |
setTargetScrapeableFile(ScrapeableFile targetScrapeableFile)
Sets the target scrapeable file.
|
void |
setTargetScrapeableFileName(java.lang.String targetScrapeableFileName) |
void |
setView(AbstractView view)
Sets the view representing this navigation action.
|
public static org.apache.log4j.Logger log
public static final int FORM_NAVIGATION_ACTION
public static final int TEXT_ENTRY_NAVIGATION_ACTION
public static final int CLICK_NAVIGATION_ACTION
public static final int LIST_SELECTION_NAVIGATION_ACTION
protected NavigationAction()
protected NavigationAction(java.lang.String name)
name
- The name of the action.public abstract java.lang.String[] getAttributes()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name.public int getID()
protected void setID(int navigationActionID)
navigationActionID
- The ID of the record.public boolean getInvokedFromScript()
public void setInvokedFromScript(boolean invokedFromScript)
invokedFromScript
- A boolean.public int getSequence()
public void setSequence(int sequence)
sequence
- The sequence.public ScrapeableFile getScrapeableFile()
ScrapeableFile
.public void setScrapeableFile(ScrapeableFile scrapeableFile)
scrapeableFile
- The ScrapeableFile
.public ScrapeableFile getTargetScrapeableFile()
ScrapeableFile
.public void setTargetScrapeableFile(ScrapeableFile targetScrapeableFile)
targetScrapeableFile
- A ScrapeableFile
.public java.lang.String getTargetScrapeableFileName()
public void setTargetScrapeableFileName(java.lang.String targetScrapeableFileName)
public java.lang.String getCriteria()
public void setCriteria(java.lang.String criteria)
criteria
- The criteria.public int compareTo(java.lang.Object navigationAction)
compareTo
in interface java.lang.Comparable
navigationAction
- The NavigationAction
we're comparing to.public AbstractView getView()
public void setView(AbstractView view)
view
- The view.public void delete()
protected HtmlElementIdentifier getHtmlElementIdentifier()
HtmlElementIdentifier
.protected void setHtmlElementIdentifier(HtmlElementIdentifier htmlElementIdentifier)
htmlElementIdentifier
- An HtmlElementIdentifier
.public java.lang.String getHtmlElementIdentifierAttribute()
public void setHtmlElementIdentifierAttribute(java.lang.String attribute)
attribute
- The attribute.public java.lang.String getHtmlElementIdentifierValue()
public void setHtmlElementIdentifierValue(java.lang.String value)
value
- The value.public java.lang.String getHtmlElementIdentifierValidSequences()
public void setHtmlElementIdentifierValidSequences(java.lang.String sequences)
sequences
- The sequences.public java.lang.String getHtmlElementIdentifierValidSeqencesStringValue()
public void setHtmlElementIdentifier(java.lang.String strValidSequences)
strValidSequences
- The valud portion of the string of sequences.public java.util.List<NavigationActionDoer> getNavigationActionDoers(com.gargoylesoftware.htmlunit.html.HtmlPage page, ScrapingSessionState scrapingSessionState)
NavigationActionDoer
objects based on criteria
held by this navigation action.page
- An HtmlPage
containing the elements
to find.scrapingSessionState
- Used to resolve variables.List
of NavigationActionDoer
objects.protected java.util.HashSet<FormParameter> getFormParametersToSetAsSet()
HashMap
containing key/value
pairs to be set on the form before it gets submitted.HashMap
of FormParameter
objects.public FormParameter getFormParameterToSet(int sequence)
sequence
- The sequence.FormParameter
containing the resulting
key/value pair, if the sequence is found.public java.lang.String getFormParametersToSetAsSingleValue()
public void setFormParameterToSetName(int sequence, java.lang.String name)
sequence
- The sequence.name
- The name.public void setFormParameterToSetValue(int sequence, java.lang.String value)
sequence
- The sequence.value
- The value.public void setFormParametersToSetAsSingleValue(java.lang.String valueToSet)
valueToSet
- The value to set.public void removeFormParameterToSet(int sequence)
sequence
- The sequence.public int getNumFormParametersToSet()
public void addFormParameterToSet(java.lang.String name, java.lang.String value)
name
- The name portion.value
- The value portion.public void setFormParametersToSet(java.lang.String formParametersToSet)
formParametersToSet
- A URL-type string of key/value pairs.public java.lang.String getFormParametersToSet()
protected abstract NavigationActionDoer getNavigationActionDoerForHtmlElement(com.gargoylesoftware.htmlunit.html.HtmlElement htmlElement)
NavigationActionDoer
based on a
HtmlElement
.htmlElement
- The HtmlElement
.NavigationActionDoer
.public abstract int getNavigationActionType()
public void save()
public void dumpToLog()