|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.Button
public class Button
A generic button component.
Nested Class Summary | |
---|---|
class |
Button.ClickEvent
Click event. |
static interface |
Button.ClickListener
Interface for listening for a Button.ClickEvent fired by a
Component . |
static class |
Button.ClickShortcut
A ShortcutListener specifically made to define a keyboard
shortcut that invokes a click on the given button. |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
---|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
---|
Field.ValueChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
---|
Buffered.SourceException |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Field Summary | |
---|---|
protected Button.ClickShortcut |
clickShortcut
|
static String |
STYLE_LINK
Deprecated. use BaseTheme.BUTTON_LINK instead. |
Constructor Summary | |
---|---|
Button()
Creates a new push button. |
|
Button(String caption)
Creates a new push button. |
|
Button(String caption,
boolean initialState)
Deprecated. use CheckBox instead of Button in "switchmode" |
|
Button(String caption,
Button.ClickListener listener)
Creates a new push button with click listener. |
|
Button(String caption,
Object target,
String methodName)
Creates a new push button with a method listening button clicks. |
|
Button(String caption,
Property dataSource)
Deprecated. use CheckBox instead of Button in "switchmode" |
Method Summary | |
---|---|
void |
addListener(Button.ClickListener listener)
Adds the button click listener. |
void |
addListener(FieldEvents.BlurListener listener)
Adds a BlurListener to the Component which gets fired
when a Field loses keyboard focus. |
void |
addListener(FieldEvents.FocusListener listener)
Adds a FocusListener to the Component which gets fired
when a Field receives keyboard focus. |
boolean |
booleanValue()
Get the boolean value of the button state. |
void |
changeVariables(Object source,
Map<String,Object> variables)
Invoked when the value of a variable has changed. |
void |
click()
Simulates a button click, notifying all server-side listeners. |
protected void |
fireClick()
Fires a click event to all listeners without any event details. |
protected void |
fireClick(MouseEventDetails details)
Fires a click event to all listeners. |
Class |
getType()
The type of the button as a property. |
boolean |
isDisableOnClick()
Determines if a button is automatically disabled when clicked. |
boolean |
isHtmlContentAllowed()
Return HTML rendering setting |
boolean |
isSwitchMode()
Deprecated. the CheckBox component should be used instead of
Button in switch mode |
void |
paintContent(PaintTarget target)
Paints the content of this component. |
void |
removeClickShortcut()
Removes the keyboard shortcut previously set with setClickShortcut(int, int...) . |
void |
removeListener(Button.ClickListener listener)
Removes the button click listener. |
void |
removeListener(FieldEvents.BlurListener listener)
Removes a BlurListener from the Component. |
void |
removeListener(FieldEvents.FocusListener listener)
Removes a FocusListener from the Component. |
void |
setClickShortcut(int keyCode,
int... modifiers)
Makes it possible to invoke a click on this button by pressing the given ShortcutAction.KeyCode and (optional) ShortcutAction.ModifierKey s.The shortcut is global (bound to the containing Window). |
void |
setDisableOnClick(boolean disableOnClick)
Determines if a button is automatically disabled when clicked. |
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Set whether the caption text is rendered as HTML or not. |
void |
setImmediate(boolean immediate)
Sets immediate mode. |
protected void |
setInternalValue(Object newValue)
Sets the internal field value. |
void |
setSwitchMode(boolean switchMode)
Deprecated. the CheckBox component should be used instead of
Button in switch mode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.ui.Field |
---|
getDescription, setCaption, setDescription |
Field Detail |
---|
@Deprecated public static final String STYLE_LINK
BaseTheme.BUTTON_LINK
instead.
protected Button.ClickShortcut clickShortcut
Constructor Detail |
---|
public Button()
public Button(String caption)
caption
- the Button caption.public Button(String caption, Button.ClickListener listener)
caption
- the Button caption.listener
- the Button click listener.public Button(String caption, Object target, String methodName)
Button(String, com.vaadin.ui.Button.ClickListener)
instead. The
method must have either no parameters, or only one parameter of
Button.ClickEvent type.
caption
- the Button caption.target
- the Object having the method for listening button clicks.methodName
- the name of the method in target object, that receives button
click events.@Deprecated public Button(String caption, boolean initialState)
CheckBox
instead of Button in "switchmode"
state
- the Initial state of the switch-button.initialState
- @Deprecated public Button(String caption, Property dataSource)
CheckBox
instead of Button in "switchmode"
state
- the Initial state of the switch-button.dataSource
- Method Detail |
---|
public void paintContent(PaintTarget target) throws PaintException
paintContent
in class AbstractField
event
- the PaintEvent.
IOException
- if the writing failed due to input/output error.
PaintException
- if the paint operation failed.public void changeVariables(Object source, Map<String,Object> variables)
changeVariables
in interface VariableOwner
changeVariables
in class AbstractField
source
- variables
- @Deprecated public boolean isSwitchMode()
CheckBox
component should be used instead of
Button in switch mode
true
if it is in Switch Mode, otherwise
false
.@Deprecated public void setSwitchMode(boolean switchMode)
CheckBox
component should be used instead of
Button in switch mode
switchMode
- The switchMode to set.public boolean booleanValue()
public void setImmediate(boolean immediate)
setImmediate
in class AbstractComponent
immediate
- the boolean value specifying if the component should be in the
immediate mode after the call.AbstractComponent.setImmediate(boolean)
public Class getType()
getType
in interface Property
getType
in class AbstractField
Property.getType()
public void addListener(Button.ClickListener listener)
listener
- the Listener to be added.public void removeListener(Button.ClickListener listener)
listener
- the Listener to be removed.public void click()
protected void fireClick()
fireClick(MouseEventDetails)
instead of
this method.
protected void fireClick(MouseEventDetails details)
details
- MouseEventDetails from which keyboard modifiers and other
information about the mouse click can be obtained. If the
button was clicked by a keyboard event, some of the fields may
be empty/undefined.protected void setInternalValue(Object newValue)
AbstractField
setInternalValue
in class AbstractField
newValue
- the new value to be set.public void addListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifier
BlurListener
to the Component which gets fired
when a Field
loses keyboard focus.
addListener
in interface FieldEvents.BlurNotifier
FieldEvents.BlurListener
public void removeListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifier
BlurListener
from the Component.
removeListener
in interface FieldEvents.BlurNotifier
FieldEvents.BlurListener
public void addListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifier
FocusListener
to the Component which gets fired
when a Field
receives keyboard focus.
addListener
in interface FieldEvents.FocusNotifier
FieldEvents.FocusListener
public void removeListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifier
FocusListener
from the Component.
removeListener
in interface FieldEvents.FocusNotifier
FieldEvents.FocusListener
public void setClickShortcut(int keyCode, int... modifiers)
ShortcutAction.KeyCode
and (optional) ShortcutAction.ModifierKey
s.
keyCode
- the keycode for invoking the shortcutmodifiers
- the (optional) modifiers for invoking the shortcut, null for
nonepublic void removeClickShortcut()
setClickShortcut(int, int...)
.
public boolean isDisableOnClick()
setDisableOnClick(boolean)
for details.
public void setDisableOnClick(boolean disableOnClick)
Note that this is only used when the click comes from the user, not when
calling click()
.
Also note that click shortcuts are not supported with this feature in Vaadin 6.x.
disableOnClick
- true to disable button when it is clicked, false otherwisepublic void setHtmlContentAllowed(boolean htmlContentAllowed)
htmlContentAllowed
- true
if caption is rendered as HTML,
false
otherwisepublic boolean isHtmlContentAllowed()
true
if the caption text is to be rendered as HTML,
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |