public class HTMLButton
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
action |
protected java.lang.String |
additionalTagFragments |
protected java.lang.String |
className |
protected java.lang.String |
type |
Constructor and Description |
---|
HTMLButton(java.lang.String label,
java.lang.String name)
Constructs a new button.
|
HTMLButton(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() |
void |
fetchValuesFromRequest(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 |
setAction(java.lang.String action) |
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 |
setDefaultAction(java.lang.String newDefaultAction) |
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.
|
protected java.lang.String type
protected java.lang.String action
protected java.lang.String className
protected java.lang.String additionalTagFragments
public HTMLButton(java.lang.String label, java.lang.String name)
label
- the labe to be seen by the username
- the name of the buttonpublic HTMLButton(java.lang.String label, java.lang.String name, java.lang.String onClickScriptlet)
label
- the label 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 static void setDefaultAction(java.lang.String newDefaultAction)
public void setAction(java.lang.String action)
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 fetchValuesFromRequest(GeneralizedRequest request)
request
- the current requestpublic boolean wasPressed()
public boolean wasPressedWithoutInitialization()
public void destroy()
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de