Package muntjac :: Package ui :: Module abstract_component_container :: Class AbstractComponentContainer
[hide private]
[frames] | no frames]

Class AbstractComponentContainer

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 --+               |
                                   |               |
                 util.IEventListener --+           |
                                       |           |
           terminal.paintable.IPaintable --+       |
                                           |       |
                              object --+   |       |
                                       |   |       |
  terminal.variable_owner.IVariableOwner --+       |
                                           |       |
                              object --+   |       |
                                       |   |       |
             terminal.sizeable.ISizeable --+       |
                                           |       |
                        component.IComponent --+   |
                                               |   |
         component_container.IComponentContainer --+
                                                   |
                                                  AbstractComponentContainer

Extension to AbstractComponent that defines the default implementation for the methods in IComponentContainer. Basic UI components that need to contain other components inherit this class to easily qualify as a component container.


Author: Vaadin Ltd.

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self)
Constructs a new component container.
source code
 
removeAllComponents(self)
Removes all components from the container.
source code
 
moveComponentsFrom(self, source)
Moves all components from an another container into this container.
source code
 
attach(self)
Notifies all contained components that the container is attached to a window.
source code
 
detach(self)
Notifies all contained components that the container is detached from a window.
source code
 
addListener(self, listener, iface=None)
Registers a new (generic) component event listener for the component:
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes a previously registered component event listener from this component.
source code
 
removeCallback(self, callback, eventType=None) source code
 
fireComponentAttachEvent(self, component)
Fires the component attached event.
source code
 
fireComponentDetachEvent(self, component)
Fires the component detached event.
source code
 
addComponent(self, c)
This only implements the events and component parent calls.
source code
 
removeComponent(self, c)
This only implements the events and component parent calls.
source code
 
setEnabled(self, enabled)
Enables or disables the component.
source code
 
setWidth(self, width, unit=None)
Sets the width of the object.
source code
 
repaintChangedChildTrees(self, invalidChildren, childrenMayBecomeUndefined, vertical) source code
 
getInvalidSizedChildren(self, vertical) source code
 
repaintChildTrees(self, dirtyChildren) source code
 
setHeight(self, height, unit=None)
Sets the height of the object.
source code
 
requestRepaintAll(self)
Causes a repaint of this component, and all components below it.
source code

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

Inherited from component_container.IComponentContainer: getComponentIterator, replaceComponent

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

Class Variables [hide private]

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)
(Constructor)

source code 

Constructs a new component container.

Overrides: object.__init__

removeAllComponents(self)

source code 

Removes all components from the container. This should probably be re-implemented in extending classes for a more powerful implementation.

Overrides: component_container.IComponentContainer.removeAllComponents

moveComponentsFrom(self, source)

source code 

Moves all components from an another container into this container. The components are removed from source.

Parameters:
  • source - the container which contains the components that are to be moved to this container.
Overrides: component_container.IComponentContainer.moveComponentsFrom
(inherited documentation)

attach(self)

source code 

Notifies all contained components that the container is attached to a window.

Overrides: component.IComponent.attach

See Also: IComponent.attach

detach(self)

source code 

Notifies all contained components that the container is detached from a window.

Overrides: component.IComponent.detach

See Also: IComponent.detach

addListener(self, listener, iface=None)

source code 

Registers a new (generic) component event listener for the component:

 class Listening(CustomComponent, IListener):

     # Stored for determining the source of an event
     ok = None

     status = None  # For displaying info about the event

     def __init__(self):
         layout = VerticalLayout()

         # Some miscellaneous component
         name = TextField("Say it all here")
         name.addListener(self)
         name.setImmediate(true)
         layout.addComponent(name)

         # Handle button clicks as generic events instead
         # of Button.ClickEvent events
         ok = new Button("OK")
         ok.addListener(self)
         layout.addComponent(ok)

         # For displaying information about an event
         status = new Label("")
         layout.addComponent(status)

         setCompositionRoot(layout)


     def componentEvent(event):
         # Act according to the source of the event
         if (event.getSource() == ok):
             getWindow().showNotification("Click!")

         status.setValue("Event from " +
                 event.getSource().__class__.__name__
                 + ": " + event.__class__.__name__)


 listening = Listening()
 layout.addComponent(listening)
Parameters:
  • listener - the new IListener to be registered.
Raises:
  • ValueError - unless method has a match in object
Overrides: event.method_event_source.IMethodEventSource.addListener
(inherited documentation)

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

source code 
Overrides: terminal.paintable.IPaintable.addCallback

removeListener(self, listener, iface=None)

source code 

Removes a previously registered component event listener from this component.

Parameters:
  • listener - the listener to be removed.
Overrides: event.method_event_source.IMethodEventSource.removeListener
(inherited documentation)

removeCallback(self, callback, eventType=None)

source code 
Overrides: terminal.paintable.IPaintable.removeCallback

fireComponentAttachEvent(self, component)

source code 

Fires the component attached event. This should be called by the addComponent methods after the component have been added to this container.

Parameters:
  • component - the component that has been added to this container.

fireComponentDetachEvent(self, component)

source code 

Fires the component detached event. This should be called by the removeComponent methods after the component have been removed from this container.

Parameters:
  • component - the component that has been removed from this container.

addComponent(self, c)

source code 

This only implements the events and component parent calls. The extending classes must implement component list maintenance and call this method after component list maintenance.

Parameters:
  • c - the component to be added.
Overrides: component_container.IComponentContainer.addComponent

removeComponent(self, c)

source code 

This only implements the events and component parent calls. The extending classes must implement component list maintenance and call this method before component list maintenance.

Parameters:
  • c - the component to be removed.
Overrides: component_container.IComponentContainer.removeComponent

setEnabled(self, enabled)

source code 

Enables or disables the component. The user can not interact disabled components, which are shown with a style that indicates the status, usually shaded in light gray color. Components are enabled by default. Children of a disabled component are automatically disabled; if a child component is explicitly set as disabled, changes in the disabled status of its parents do not change its status:

 enabled = new Button("Enabled")
 enabled.setEnabled(True)  # the default
 layout.addComponent(enabled)

 disabled = Button("Disabled")
 disabled.setEnabled(False)
 layout.addComponent(disabled)

This method will trigger a RepaintRequestEvent for the component and, if it is a ComponentContainer, for all its children recursively.

Parameters:
  • enabled - a boolean value specifying if the component should be enabled or not
Overrides: component.IComponent.setEnabled
(inherited documentation)

setWidth(self, width, unit=None)

source code 

Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Parameters:
Overrides: terminal.sizeable.ISizeable.setWidth
(inherited documentation)

setHeight(self, height, unit=None)

source code 

Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Parameters:
  • args - tuple of the form
    • (height)
      1. the height of the object in units specified by heightUnits property or the height of the component using string presentation. String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.
    • (height, unit)
      1. the height of the object.
      2. the unit used for the width. Possible values include UNITS_PIXELS, UNITS_POINTS, UNITS_PICAS, UNITS_EM, UNITS_EX, UNITS_MM, UNITS_CM, UNITS_INCH, UNITS_PERCENTAGE.
Overrides: terminal.sizeable.ISizeable.setHeight
(inherited documentation)

requestRepaintAll(self)

source code 

Causes a repaint of this component, and all components below it.

This should only be used in special cases, e.g when the state of a descendant depends on the state of a ancestor.

Overrides: component_container.IComponentContainer.requestRepaintAll
(inherited documentation)