com.arsdigita.bebop.form
Class Submit

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.form.Widget
                      extended bycom.arsdigita.bebop.form.Submit
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Lockable

public class Submit
extends Widget

Submit buttons on HTML forms. The button will only do anything useful if it is contained directly or indirectky in a Form.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/form/Submit.java#9 $
Author:
Karl Goldstein, Uday Mathur, Stas Freidin, Rory Solomon, Michael Pih

Nested Class Summary
 
Nested classes inherited from class com.arsdigita.bebop.form.Widget
Widget.ValidationGuard
 
Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
Submit(GlobalizedMessage label)
           Create a new submit button.
Submit(ParameterModel model)
          Create a new submit button.
Submit(String name)
          Creates a new submit button.
Submit(String name, GlobalizedMessage label)
           Create a new submit button.
Submit(String name, String label)
          Creates a new submit button.
 
Method Summary
 void avoidDoubleClick(boolean avoid)
          Determine whether or not javascript should be included in the onClick field to try to prevent doubleclicks.
protected  void generateWidget(PageState state, Element parent)
           Generates the DOM for this widget
protected  ParameterData getParameterData(PageState ps)
           
 String getType()
          Returns a string naming the type of this widget.
 GlobalizedMessage getValue()
           Return the the buttons label.
 Object getValue(PageState ps)
          Get the value of the submit button.
 boolean isCompound()
          Returns true if the widget consists of multiple HTML elements.
 boolean isSelected(PageState ps)
          Return true if the user clicked on this submit button to submit the form in which the button is contained.
 void lock()
          Lock an object.
 void register(Form f, FormModel m)
          Registers getName()+".x" and getName()+".y" so that html image submits will work too
 void setButtonLabel(GlobalizedMessage buttonLabel)
           Sets the text that will be displayed on the actual button.
 void setButtonLabel(String buttonLabel)
           Sets the text that will be displayed on the actual button.
 void setSize(int n)
          Set the HTML size attribute of this widget.
 
Methods inherited from class com.arsdigita.bebop.form.Widget
addError, addError, addPrintListener, addValidationListener, clone, createParameterListener, firePrintEvent, fireValidation, generateErrors, generateXML, getDefaultValue, getElementTag, getErrors, getForm, getName, getParameterModel, isPassIn, removePrintListener, removeValidationListener, respond, setDefaultValue, setDisabled, setForm, setHint, setOnBlur, setOnChange, setOnFocus, setOnKeyUp, setOnSelect, setParameterModel, setPassIn, setPrintListener, setReadOnly, setValidateInvisible, setValidationGuard, setValue, toString, validateInvisible
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
children, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, register, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

Submit

public Submit(String name)
Creates a new submit button. The button will use name for both its name attribute and as the label displayed to the user.

Parameters:
name - the button's name and label

Submit

public Submit(String name,
              String label)
Creates a new submit button.

Parameters:
name - the button's name
label - the label displayed on the button

Submit

public Submit(GlobalizedMessage label)

Create a new submit button.

Parameters:
label - the label displayed on the button

Submit

public Submit(String name,
              GlobalizedMessage label)

Create a new submit button.

Parameters:
name - the button's name
label - the label displayed on the button

Submit

public Submit(ParameterModel model)
Create a new submit button.

Parameters:
model - a ParameterModel value
Method Detail

isCompound

public boolean isCompound()
Description copied from class: Widget
Returns true if the widget consists of multiple HTML elements.

Specified by:
isCompound in class Widget

getType

public String getType()
Returns a string naming the type of this widget.

Specified by:
getType in class Widget

avoidDoubleClick

public void avoidDoubleClick(boolean avoid)
Determine whether or not javascript should be included in the onClick field to try to prevent doubleclicks.

Parameters:
avoid - true to avoid doubleclicks, false otherwise.

setButtonLabel

public void setButtonLabel(String buttonLabel)

Sets the text that will be displayed on the actual button.

Parameters:
buttonLabel - The label that shows up on the button.

setButtonLabel

public void setButtonLabel(GlobalizedMessage buttonLabel)

Sets the text that will be displayed on the actual button.

Parameters:
buttonLabel - The label that shows up on the button.

getValue

public Object getValue(PageState ps)
Get the value of the submit button. Submit buttons are special, since only the value for the submit button that is clicked is submitted by the browser. Contrary to what getValue does for other widgets, the value returned from this incarnation of getValue is either the value that was included in the current request, or, if there is none, the default value. Must not be final, because globalized Submit needs to override.

Overrides:
getValue in class Widget
Parameters:
ps - describes the request currently being processed

getValue

public GlobalizedMessage getValue()

Return the the buttons label.

Returns:
GlobalizedMessage The buttons label.

generateWidget

protected void generateWidget(PageState state,
                              Element parent)

Generates the DOM for this widget

Overrides:
generateWidget in class Widget
Parameters:
state - The current PageState.
parent - This widget's parent.

isSelected

public boolean isSelected(PageState ps)
Return true if the user clicked on this submit button to submit the form in which the button is contained.

Returns:
true if the user clicked this button to submit the enclosing form.

lock

public void lock()
Description copied from interface: Lockable
Lock an object. Locked objects are to be considered immutable. Any attempt to modify them, e.g., through a setXXX method should lead to an exception.

Most lockable Bebop classes throw an IllegalStateException if an attempt is made to modify a locked instance.

Specified by:
lock in interface Lockable
Overrides:
lock in class SimpleComponent

setSize

public void setSize(int n)
Set the HTML size attribute of this widget.

Parameters:
n - The size of this widget, in characters

register

public void register(Form f,
                     FormModel m)
Registers getName()+".x" and getName()+".y" so that html image submits will work too

Specified by:
register in interface Component
Overrides:
register in class Widget

getParameterData

protected ParameterData getParameterData(PageState ps)
Overrides:
getParameterData in class Widget
Returns:
the parameter value for this widget


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC