Package pyjamas :: Package ui :: Module CustomButton :: Class CustomButton
[hide private]
[frames] | no frames]

Class CustomButton

source code

              object --+                    
                       |                    
                 Applier --+                
                           |                
           UIObject.UIObject --+            
                               |            
                   Widget.Widget --+        
                                   |        
      FocusListener.FocusHandler --+        
                                   |        
KeyboardListener.KeyboardHandler --+        
                                   |        
                      object --+   |        
                               |   |        
      MouseListener.MouseHandler --+        
                                   |        
                      object --+   |        
                               |   |        
      ClickListener.ClickHandler --+        
                                   |        
                Focus.FocusMixin --+        
                                   |        
             FocusWidget.FocusWidget --+    
                                       |    
                          object --+   |    
                                   |   |    
                 InnerHTML.InnerHTML --+    
                                       |    
                          object --+   |    
                                   |   |    
                 InnerText.InnerText --+    
                                       |    
                   ButtonBase.ButtonBase --+
                                           |
                                          CustomButton

Represents a button's face. Each face is associated with its own style modifier and, optionally, its own contents html, text, or image.

Instance Methods [hide private]
 
__init__(self, upImageText=None, downImageText=None, listener=None, **kwargs)
Constructor for CustomButton.
source code
 
updateButtonFace(self) source code
 
getDownDisabledFace(self)
Gets the downDisabled face of the button.
source code
 
getDownFace(self)
Gets the down face of the button.
source code
 
getDownHoveringFace(self)
Gets the downHovering face of the button.
source code
 
getHTML(self)
Gets the current face's html.
source code
 
getTabIndex(self) source code
 
getText(self)
Gets the current face's text.
source code
 
getUpDisabledFace(self)
Gets the upDisabled face of the button.
source code
 
getUpFace(self)
Gets the up face of the button.
source code
 
getUpHoveringFace(self)
Gets the upHovering face of the button.
source code
 
onBrowserEvent(self, event)
Listen to events raised by the browser and call the appropriate method of the listener (widget, ..) object.
source code
 
setAccessKey(self, key) source code
 
setEnabled(self, enabled)
Sets whether this button is enabled.
source code
 
setFocus(self, focused) source code
 
setHTML(self, html)
Sets the current face's html.
source code
 
setTabIndex(self, index) source code
 
setText(self, text)
Sets the current face's text.
source code
 
isDown(self)
Is this button down?
source code
 
onAttach(self)
Overridden on attach to ensure that a button face has been chosen before the button is displayed.
source code
 
onClick(self, sender=None)
Called when the user finishes clicking on this button.
source code
 
onClickCancel(self)
Called when the user aborts a click in progress; for example, by dragging the mouse outside of the button before releasing the mouse button.
source code
 
onClickStart(self)
Called when the user begins to click on this button.
source code
 
onDetach(self)
Called when this widget is being removed from the DOM tree of the document.
source code
 
setDown(self, down)
Sets whether this button is down.
source code
 
finishSetup(self)
Common setup between constructors.
source code
 
fireClickListeners(self, nativeEvent) source code
 
fireEvent(self) source code
 
getCurrentFace(self)
Gets the current face of the button.
source code
 
isHovering(self)
Is the mouse hovering over this button? Returns True
source code
 
setHovering(self, hovering)
Sets whether this button is hovering.
source code
 
toggleDown(self)
Toggle the up/down attribute.
source code
 
cleanupCaptureState(self)
Resets internal state if this button can no longer service events.
source code
 
createFace(self, delegateTo, name, faceID) source code
 
getFaceFromID(self, face_id) source code
 
setAriaPressed(self, newFace) source code
 
setCurrentFace(self, newFace)
Implementation note: default access for testing.
source code
 
setCurrentFaceFromID(self, faceID)
Sets the current face based on the faceID.
source code
 
setCurrentFaceElement(self, newFaceElement) source code
 
setDownDisabledFace(self, downDisabled)
Sets the downDisabled face of the button.
source code
 
setDownFace(self, down)
Sets the down face of the button.
source code
 
setDownHoveringFace(self, downHovering)
Sets the downHovering face of the button.
source code
 
setUpDisabledFace(self, upDisabled)
Sets the upDisabled face of the button.
source code
 
setUpFace(self, up)
Sets the up face of the button.
source code
 
setUpHoveringFace(self, upHovering)
Sets the upHovering face of the button.
source code
 
toggleDisabled(self)
Toggle the disabled attribute.
source code
 
toggleHover(self)
Toggle the hovering attribute.
source code

Inherited from ButtonBase.ButtonBase (private): _setWeirdProps

Inherited from Widget.Widget: doAttachChildren, doDetachChildren, getID, getLayoutData, getParent, isAttached, onLoad, removeFromParent, setContextMenu, setID, setLayoutData, setParent

Inherited from UIObject.UIObject: addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getHeight, getOffsetHeight, getOffsetWidth, getStyleAttribute, getStyleName, getStylePrimaryName, getTitle, getVisible, getWidth, isVisible, removeStyleDependentName, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleAttribute, setStyleName, setTitle, setVisible, setWidth, setzIndex, sinkEvents, unsinkEvents

Inherited from Applier: applyValues, retrieveValues, setDefaults, setElementProperties, updateInstance

Inherited from FocusListener.FocusHandler: addFocusListener, onFocus, onLostFocus, removeFocusListener

Inherited from KeyboardListener.KeyboardHandler: addKeyboardListener, onKeyDown, onKeyPress, onKeyUp, removeKeyboardListener

Inherited from MouseListener.MouseHandler: addMouseListener, onMouseDown, onMouseEnter, onMouseGlassEnter, onMouseGlassLeave, onMouseLeave, onMouseMove, onMouseUp, removeMouseListener

Inherited from ClickListener.ClickHandler: addClickListener, addDoubleClickListener, clearClickListener, clearDoubleClickListener, onDoubleClick, removeClickListener, removeDoubleClickListener

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

Inherited from Focus.FocusMixin: isEnabled, isReadonly, setReadonly

Class Methods [hide private]

Inherited from UIObject.UIObject (private): _getProps

Inherited from Applier (private): _getElementProps

Class Variables [hide private]
  STYLENAME_DEFAULT = "gwt-CustomButton"
  DOWN_ATTRIBUTE = 1
  HOVERING_ATTRIBUTE = 2
  DISABLED_ATTRIBUTE = 4
  UP = 0
  DOWN = 1
  UP_HOVERING = 2
  DOWN_HOVERING = DOWN_ATTRIBUTE | HOVERING_ATTRIBUTE
  UP_DISABLED = 4
  DOWN_DISABLED = DOWN | DISABLED_ATTRIBUTE
Calling possibilities: def __init__(self, upImage): def __init__(self, upImage, listener): def __init__(self, upImage, downImage): def __init__(self, upImage, downImage, listener): def __init__(self, upText): def __init__(self, upText, listener): def __init__(self, upText, downText): def __init__(self, upText, downText, listener): def __init__(self):

Inherited from UIObject.UIObject (private): _props

Inherited from Applier (private): _elem_props

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, upImageText=None, downImageText=None, listener=None, **kwargs)
(Constructor)

source code 

Constructor for CustomButton.

Overrides: object.__init__

getHTML(self)

source code 

Gets the current face's html.

Overrides: InnerHTML.InnerHTML.getHTML

getTabIndex(self)

source code 
Overrides: Focus.FocusMixin.getTabIndex

getText(self)

source code 

Gets the current face's text.

Overrides: InnerText.InnerText.getText

onBrowserEvent(self, event)

source code 

Listen to events raised by the browser and call the appropriate method of the listener (widget, ..) object.

Overrides: ClickListener.ClickHandler.onBrowserEvent
(inherited documentation)

setAccessKey(self, key)

source code 
Overrides: Focus.FocusMixin.setAccessKey

setEnabled(self, enabled)

source code 

Sets whether this button is enabled.

Overrides: Focus.FocusMixin.setEnabled

setFocus(self, focused)

source code 
Overrides: Focus.FocusMixin.setFocus

setHTML(self, html)

source code 

Sets the current face's html.

Overrides: InnerHTML.InnerHTML.setHTML

setTabIndex(self, index)

source code 
Overrides: Focus.FocusMixin.setTabIndex

setText(self, text)

source code 

Sets the current face's text.

Overrides: InnerText.InnerText.setText

onAttach(self)

source code 

Overridden on attach to ensure that a button face has been chosen before the button is displayed.

Overrides: Widget.Widget.onAttach

onClick(self, sender=None)

source code 

Called when the user finishes clicking on this button. The default behavior is to fire the click event to listeners. Subclasses that override onClickStart() should override this method to restore the normal widget display.

Overrides: ClickListener.ClickHandler.onClick

onClickCancel(self)

source code 

Called when the user aborts a click in progress; for example, by dragging the mouse outside of the button before releasing the mouse button. Subclasses that override onClickStart() should override this method to restore the normal widget display.

onClickStart(self)

source code 

Called when the user begins to click on this button. Subclasses may override this method to display the start of the click visually; such subclasses should also override onClick() and onClickCancel() to restore normal visual state. Each onClickStart will eventually be followed by either onClick or onClickCancel, depending on whether the click is completed.

onDetach(self)

source code 

Called when this widget is being removed from the DOM tree of the document.

Overrides: Widget.Widget.onDetach
(inherited documentation)

getCurrentFace(self)

source code 

Gets the current face of the button. Implementation note: Package so we can use it when testing the button.

cleanupCaptureState(self)

source code 

Resets internal state if this button can no longer service events. This can occur when the widget becomes detached or disabled.


Class Variable Details [hide private]

DOWN_DISABLED

Calling possibilities: def __init__(self, upImage): def __init__(self, upImage, listener): def __init__(self, upImage, downImage): def __init__(self, upImage, downImage, listener): def __init__(self, upText): def __init__(self, upText, listener): def __init__(self, upText, downText): def __init__(self, upText, downText, listener): def __init__(self):

TODO: I do not know how to handle the following cases: def __init__(self, upImage, listener): def __init__(self, upText, listener):

So how can I make difference between listener and downImage/downText ?

Value:
DOWN | DISABLED_ATTRIBUTE