|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.click.control.AbstractControl
org.apache.click.control.AbstractLink
org.apache.click.control.ActionLink
org.apache.click.extras.control.SubmitLink
public class SubmitLink
Provides a Submit Link control, <a href=""></a>, that can
submit a Form.
getSubmitScript(java.lang.String) for more details on
the JavaScript used to submit the Form.
Also note: if SubmitLink is not added to a Form, it behaves
like an ActionLink control.
Here is an example:
public class MyPage extends Page {
public void onInit() {
// Create a Form control
Form form = new Form("form");
addControl(form);
// Add a SubmitLink to the Form
SubmitLink link = new SubmitLink("link");
form.add(link);
}
}
getSubmitScript(java.lang.String) method.
Here is an example of providing a confirmation popup message before submitting
the Form:
public MyPage extends Page {
public void onInit() {
Form form = new Form("form");
SubmitLink link = new SubmitLink("link", "Delete");
form.add(link);
// Get the submit script for the given form id
String submitScript = submitLink.getSubmitScript(form.getId());
// Add a confirmation popup message
scriptLink.setOnClick("var confirm = window.confirm('Are you sure?'); if (confirm) "
+ submitScript + " else return false;");
}
}
| Field Summary |
|---|
| Fields inherited from class org.apache.click.control.ActionLink |
|---|
ACTION_LINK, clicked, VALUE |
| Fields inherited from class org.apache.click.control.AbstractLink |
|---|
disabled, imageSrc, label, parameters, renderLabelAndImage, tabindex, title |
| Fields inherited from class org.apache.click.control.AbstractControl |
|---|
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles |
| Fields inherited from interface org.apache.click.Control |
|---|
CONTROL_MESSAGES |
| Constructor Summary | |
|---|---|
SubmitLink()
Create an SubmitLink with no name defined. |
|
SubmitLink(Object listener,
String method)
Create an SubmitLink for the given listener object and listener method. |
|
SubmitLink(String name)
Create an SubmitLink for the given name. |
|
SubmitLink(String name,
Object listener,
String method)
Create an SubmitLink for the given name, listener object and listener method. |
|
SubmitLink(String name,
String label)
Create an SubmitLink for the given name and label. |
|
SubmitLink(String name,
String label,
Object listener,
String method)
Create an SubmitLink for the given name, label, listener object and listener method. |
|
| Method Summary | |
|---|---|
void |
bindRequestValue()
This method binds the submitted request value to the SubmitLink's value. |
Form |
getForm()
Return the parent Form or null if no Form is available. |
List<Element> |
getHeadElements()
Return the list of HEAD elements
to be included in the page. |
String |
getHref(Object value)
Return the SubmitLink anchor <a> tag href attribute for the given value. |
String |
getOnClick()
Returns the button onclick attribute value, or null if not defined. |
String |
getParameterPrefix()
Return the parameter prefix that is applied to the SubmitLink parameters. |
String |
getSubmitScript(String formId)
Return the JavaScript that submits the Form with the given formId. |
boolean |
hasParentForm()
Return true if SubmitLink has a parent Form control, false otherwise. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the SubmitLink. |
void |
setForm(Form form)
Set the SubmitLink Form. |
void |
setOnClick(String value)
Sets the button onclick attribute value. |
void |
setParameterPrefix(String prefix)
Set the parameter prefix that is applied to the SubmitLink parameters. |
| Methods inherited from class org.apache.click.control.ActionLink |
|---|
getHref, getValue, getValueDouble, getValueInteger, getValueLong, isClicked, onProcess, setName, setParent, setValue, setValueObject |
| Methods inherited from class org.apache.click.control.AbstractLink |
|---|
bindRequestParameters, defineParameter, getId, getImageSrc, getLabel, getParameter, getParameters, getParameterValues, getState, getTabIndex, getTag, getTitle, hasParameters, isAjaxTarget, isDisabled, isRenderLabelAndImage, removeState, renderImgTag, renderParameters, restoreState, saveState, setDisabled, setImageSrc, setLabel, setParameter, setParameters, setParameterValues, setRenderLabelAndImage, setState, setTabIndex, setTitle |
| Methods inherited from class org.apache.click.control.AbstractControl |
|---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getControlSizeEst, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setListener, setStyle, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SubmitLink(String name)
name - the action link name
IllegalArgumentException - if the name is null
public SubmitLink(String name,
String label)
name - the action link namelabel - the action link label
IllegalArgumentException - if the name is null
public SubmitLink(Object listener,
String method)
listener - the listener target objectmethod - the listener method to call
IllegalArgumentException - if the name, listener or method is null
or if the method is blank
public SubmitLink(String name,
Object listener,
String method)
name - the action link namelistener - the listener target objectmethod - the listener method to call
IllegalArgumentException - if the name, listener or method is null
or if the method is blank
public SubmitLink(String name,
String label,
Object listener,
String method)
name - the action link namelabel - the action link labellistener - the listener target objectmethod - the listener method to call
IllegalArgumentException - if the name, listener or method is null
or if the method is blankpublic SubmitLink()
| Method Detail |
|---|
public Form getForm()
public void setForm(Form form)
form - the SubmitLink Formpublic String getOnClick()
public void setOnClick(String value)
value - the onclick attribute value.public void setParameterPrefix(String prefix)
prefix - the parameter prefixpublic String getParameterPrefix()
public boolean hasParentForm()
public String getSubmitScript(String formId)
"return Click.submitLinkAction(this, 'formId');"The Click.submitLinkAction function takes as parameters a reference to the SubmitLink and the id of the Form to submit. (The Click.submitLinkAction is defined in /click/extras-control.js)
formId - the id of the Form to submit
IllegalStateException - if the form id is nullpublic String getHref(Object value)
getHref in class ActionLinkvalue - the SubmitLink value parameter
public void bindRequestValue()
bindRequestValue in class ActionLinkpublic List<Element> getHeadElements()
elements
to be included in the page. The list of resources are:
getHeadElements in interface ControlgetHeadElements in class AbstractControlpublic void render(HtmlStringBuffer buffer)
render in interface Controlrender in class AbstractLinkbuffer - the specified buffer to render the control's output to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||