Package muntjac :: Package ui :: Module button :: Class Button
[hide private]
[frames] | no frames]

Class Button

source code

                            object --+                    
                                     |                    
                   util.IEventListener --+                
                                         |                
             terminal.paintable.IPaintable --+            
                                             |            
                                object --+   |            
                                         |   |            
    terminal.variable_owner.IVariableOwner --+            
                                             |            
                                object --+   |            
                                         |   |            
               terminal.sizeable.ISizeable --+            
                                             |            
                          component.IComponent --+        
                                                 |        
                                    object --+   |        
                                             |   |        
  event.method_event_source.IMethodEventSource --+        
                                                 |        
              abstract_component.AbstractComponent --+    
                                                     |    
                                object --+           |    
                                         |           |    
                   data.buffered.IBuffered --+       |    
                                             |       |    
                                object --+   |       |    
                                         |   |       |    
             data.validatable.IValidatable --+       |    
                                             |       |    
            data.buffered.IBufferedValidatable --+   |    
                                                 |   |    
                                    object --+   |   |    
                                             |   |   |    
            data.property.IValueChangeNotifier --+   |    
                                                 |   |    
                                    object --+   |   |    
                                             |   |   |    
            data.property.IValueChangeListener --+   |    
                                                 |   |    
                                object --+       |   |    
                                         |       |   |    
                     data.property.IViewer --+   |   |    
                                             |   |   |    
                         data.property.IEditor --+   |    
                                                 |   |    
                        object --+               |   |    
                                 |               |   |    
               util.IEventListener --+           |   |    
                                     |           |   |    
         terminal.paintable.IPaintable --+       |   |    
                                         |       |   |    
                            object --+   |       |   |    
                                     |   |       |   |    
terminal.variable_owner.IVariableOwner --+       |   |    
                                         |       |   |    
                            object --+   |       |   |    
                                     |   |       |   |    
           terminal.sizeable.ISizeable --+       |   |    
                                         |       |   |    
                      component.IComponent --+   |   |    
                                             |   |   |    
                          component.IFocusable --+   |    
                                                 |   |    
                                      field.IField --+    
                                                     |    
                                        object --+   |    
                                                 |   |    
                    event.action.IShortcutNotifier --+    
                                                     |    
                                        object --+   |    
                                                 |   |    
       data.property.IReadOnlyStatusChangeNotifier --+    
                                                     |    
                                        object --+   |    
                                                 |   |    
       data.property.IReadOnlyStatusChangeListener --+    
                                                     |    
                          abstract_field.AbstractField --+
                                                         |
                                            object --+   |
                                                     |   |
                      event.field_events.IBlurNotifier --+
                                                         |
                                            object --+   |
                                                     |   |
                     event.field_events.IFocusNotifier --+
                                                         |
                                                        Button

A generic button component.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, *args)
Creates a new push button.
source code
 
paintContent(self, target)
Paints the content of this component.
source code
 
changeVariables(self, source, variables)
Invoked when the value of a variable has changed.
source code
 
isSwitchMode(self)
Checks if it is switchMode.
source code
 
setSwitchMode(self, switchMode)
Sets the switchMode.
source code
 
booleanValue(self)
Get the boolean value of the button state.
source code
 
setImmediate(self, immediate)
Sets immediate mode.
source code
 
getType(self)
The type of the button as a property.
source code
 
addListener(self, listener, iface=None)
Adds the button click listener.
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes the button click listener.
source code
 
removeCallback(self, callback, eventType=None) source code
 
fireClick(self, details=None)
Fires a click event to all listeners.
source code
 
setInternalValue(self, newValue)
Sets the internal field value.
source code
 
setClickShortcut(self, keyCode, *modifiers)
Makes it possible to invoke a click on this button by pressing the given KeyCode and (optional) ModifierKeys.
source code
 
removeClickShortcut(self)
Removes the keyboard shortcut previously set with setClickShortcut.
source code
 
isDisableOnClick(self)
Determines if a button is automatically disabled when clicked.
source code
 
setDisableOnClick(self, disableOnClick)
Determines if a button is automatically disabled when clicked.
source code

Inherited from abstract_field.AbstractField: __str__, addShortcutListener, addValidator, attach, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getActionManager, getErrorMessage, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, getValue, isEmpty, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, readValueFromProperty, removeShortcutListener, removeValidator, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setWriteThrough, shouldHideErrors, validate, valueChange

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, fireRequestRepaintEvent, getApplication, getCSSHeight, getCSSWidth, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isVisible, paint, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeightUnits, setIcon, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidthUnits, withdrawCallback, withdrawListener

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from abstract_field.AbstractField: constructField

Class Variables [hide private]
  CLIENT_WIDGET = None
hash(x)
  STYLE_LINK = 'link'

Inherited from abstract_component.AbstractComponent: SIZE_PATTERN

Inherited from terminal.sizeable.ISizeable: SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNIT_SYMBOLS

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 

Creates a new push button.

Parameters:
  • args - tuple of the form
    • ()
    • (caption)
      1. the Button caption
    • (caption, listener)
      1. the Button caption
      2. the Button click listener
    • (caption, target, methodName)
      1. the Button caption
      2. the object having the method for listening button clicks
      3. the name of the method in target object, that receives button click events
    • (state)
      1. the initial state of the switch-button
    • (state, dataSource)
      1. the initial state of the switch-button
      2. boolean property
Overrides: object.__init__

paintContent(self, target)

source code 

Paints the content of this component.

Parameters:
  • target - the PaintEvent.
Raises:
  • IOException - if the writing failed due to input/output error.
  • PaintException - if the paint operation failed.
Overrides: abstract_component.AbstractComponent.paintContent

changeVariables(self, source, variables)

source code 

Invoked when the value of a variable has changed. Button listeners are notified if the button is clicked.

Parameters:
  • source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
  • variables - the Mapping from variable names to new variable values.
Overrides: terminal.variable_owner.IVariableOwner.changeVariables

isSwitchMode(self)

source code 

Checks if it is switchMode.

Returns:
True if it is in Switch Mode, otherwise False.

Deprecated: the CheckBox component should be used instead of Button in switch mode

setSwitchMode(self, switchMode)

source code 

Sets the switchMode.

Parameters:
  • switchMode - The switchMode to set.

Deprecated: the CheckBox component should be used instead of Button in switch mode

booleanValue(self)

source code 

Get the boolean value of the button state.

Returns:
True iff the button is pressed down or checked.

setImmediate(self, immediate)

source code 

Sets immediate mode. Push buttons can not be set in non-immediate mode.

Parameters:
  • immediate - the boolean value specifying if the component should be in the immediate mode after the call.
Overrides: abstract_component.AbstractComponent.setImmediate

getType(self)

source code 

The type of the button as a property.

Overrides: abstract_field.AbstractField.getType

See Also: IProperty.getType

addListener(self, listener, iface=None)

source code 

Adds the button click listener.

Parameters:
  • listener - the Listener to be added.
Raises:
  • ValueError - unless method has a match in object
Overrides: event.field_events.IFocusNotifier.addListener

addCallback(self, callback, eventType=None, *args)

source code 
Overrides: event.field_events.IFocusNotifier.addCallback

removeListener(self, listener, iface=None)

source code 

Removes the button click listener.

Parameters:
  • listener - the Listener to be removed.
Overrides: event.field_events.IFocusNotifier.removeListener

removeCallback(self, callback, eventType=None)

source code 
Overrides: event.field_events.IFocusNotifier.removeCallback

fireClick(self, details=None)

source code 

Fires a click event to all listeners.

Parameters:
  • 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.

setInternalValue(self, newValue)

source code 

Sets the internal field value. This is purely used by AbstractField to change the internal IField value. It does not trigger valuechange events. It can be overridden by the inheriting classes to update all dependent variables.

Parameters:
  • newValue - the new value to be set.
Overrides: abstract_field.AbstractField.setInternalValue
(inherited documentation)

setClickShortcut(self, keyCode, *modifiers)

source code 

Makes it possible to invoke a click on this button by pressing the given KeyCode and (optional) ModifierKeys.

The shortcut is global (bound to the containing Window).

Parameters:
  • keyCode - the keycode for invoking the shortcut
  • modifiers - the (optional) modifiers for invoking the shortcut, null for none

isDisableOnClick(self)

source code 

Determines if a button is automatically disabled when clicked. See setDisableOnClick for details.

Returns:
true if the button is disabled when clicked, false otherwise

setDisableOnClick(self, disableOnClick)

source code 

Determines if a button is automatically disabled when clicked. If this is set to true the button will be automatically disabled when clicked, typically to prevent (accidental) extra clicks on a button.

Parameters:
  • disableOnClick - true to disable button when it is clicked, false otherwise