public class MustButton extends MustInputField
GroupOfMarkupables
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
additionalTagFragments |
protected java.lang.String |
className |
java.lang.String |
imageFileName |
int |
imageHeight |
int |
imageWidth |
protected java.lang.String |
type |
comment, focus, name, placeholder, toolTipText
Constructor and Description |
---|
MustButton(java.lang.String label,
java.lang.String name)
Constructs a new button.
|
MustButton(java.lang.String label,
java.lang.String name,
java.lang.String onClickScriptlet)
Constructs a new button for a scriptlet to be executed instead of a submit.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys the markupable.
|
void |
fetchYourValueFromRequest(GeneralizedRequest request)
Causes the component to read user input by calling request.getParameter and
update the internal mirrored value.
|
java.lang.String |
getCreationTag()
Returns the tag sequence that's needed to show this object in the user
interface.
|
boolean |
isEnabled()
Determines whether this button is enabled.
|
void |
setAdditionalTagFragments(java.lang.String additionalTagFragments)
Sets the component's additional tag fragments.
|
void |
setClassName(java.lang.String className)
Sets the component's class name - may be used to assign formatting
via stylesheets.
|
void |
setConfirmationText(java.lang.String confirmationText)
Activates the JavaScript confirmation function and sets the confirmation
text.
|
static void |
setDefaultAdditionalTagFragments(java.lang.String newDefaultAdditionalTagFragments)
Sets the component's default additional tag fragments.
|
static void |
setDefaultClassName(java.lang.String newDefaultClassName)
Sets the component's default class name - may be used to assign formatting
via stylesheets.
|
static void |
setDefaultType(java.lang.String newDefaultType) |
void |
setEnabled(boolean enabled)
Enables or disables this button, depending on the value of the
parameter
enabled . |
void |
setSpecialPressedCondition(java.lang.String specialPressedConditionParameterName,
java.lang.String specialPressedConditionValue)
Sets a special pressed condition - useful for additional logic in JavaScript.
|
void |
setText(java.lang.String text)
Sets the button's text.
|
void |
setType(java.lang.String type) |
void |
setVisible(boolean visible)
Sets the visibility of the component.
|
boolean |
wasPressed()
True if the button was pressed - auto-initialized - may be asked only once
a request.
|
boolean |
wasPressedWithoutInitialization()
True if the button was pressed - not auto-initialized -
useful for previous plausibility checks -
last call to the regular wasPressed recommended.
|
getName, setComment, setFocus, setPlaceHolder, setToolTipText, toString
public java.lang.String imageFileName
public int imageWidth
public int imageHeight
protected java.lang.String type
protected java.lang.String className
protected java.lang.String additionalTagFragments
public MustButton(java.lang.String label, java.lang.String name)
label
- the labe to be seen by the username
- the name of the buttonpublic MustButton(java.lang.String label, java.lang.String name, java.lang.String onClickScriptlet)
label
- the labe to be seen by the username
- the name of the button - using # at the end of the name causes
sequential instance numbersonClickScriptlet
- the scriptlet to be executed (JavaScript) - if
this parameter is not null, the button type is 'button', not 'submit'.public void setConfirmationText(java.lang.String confirmationText)
function confirmedAction(confirmationText,actionParameterValue) {
if (confirm(confirmationText)) {
document.formname.actionparm.value = actionParameterValue;
document.formname.submit();
}
}
...
confirmationText
- The text to be displayed to confirm the action.public static void setDefaultType(java.lang.String newDefaultType)
public void setType(java.lang.String type)
public void setSpecialPressedCondition(java.lang.String specialPressedConditionParameterName, java.lang.String specialPressedConditionValue)
specialPressedConditionParameterName
- then name of the parameter to be loaded to check whether the action concernes this button.specialPressedConditionValue
- the value of the parameter to indicate whether the button should be treated as pressed.public void setText(java.lang.String text)
text
- the text (label) of the buttonpublic static void setDefaultClassName(java.lang.String newDefaultClassName)
newDefaultClassName
- the component's default class namepublic void setClassName(java.lang.String className)
newDefaultClassName
- the component's class namepublic static void setDefaultAdditionalTagFragments(java.lang.String newDefaultAdditionalTagFragments)
newDefaultClassName
- the component's default additional tag fragments.public void setAdditionalTagFragments(java.lang.String additionalTagFragments)
newDefaultClassName
- the component's additional tag fragments.public boolean isEnabled()
setEnabled
method.true
if the button is enabled;
false
otherwise.setEnabled(boolean)
public void setEnabled(boolean enabled)
enabled
. An enabled button can respond to user
input and generate events. Components are enabled initially by default.enabled
- If true
, this button is enabled;
otherwise this button is disabled.isEnabled()
public void setVisible(boolean visible)
visible
- whether or not the component should be visiblepublic java.lang.String getCreationTag()
public void fetchYourValueFromRequest(GeneralizedRequest request)
fetchYourValueFromRequest
in interface ValueFetcher
fetchYourValueFromRequest
in class MustInputField
request
- the current requestpublic boolean wasPressed()
public boolean wasPressedWithoutInitialization()
public void destroy()
Markupable
destroy
in interface Markupable
destroy
in class MustInputField
Markupable.destroy()
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de