Package muntjac :: Package ui :: Module panel :: Class Panel
[hide private]
[frames] | no frames]

Class Panel

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 --+    
                                                      |    
abstract_component_container.AbstractComponentContainer --+
                                                          |
                                             object --+   |
                                                      |   |
                        terminal.scrollable.IScrollable --+
                                                          |
                                             object --+   |
                                                      |   |
           component_container.IComponentAttachListener --+
                                                          |
                                             object --+   |
                                                      |   |
           component_container.IComponentDetachListener --+
                                                          |
                                         object --+       |
                                                  |       |
                            event.action.IContainer --+   |
                                                      |   |
                                 event.action.INotifier --+
                                                          |
                                 object --+               |
                                          |               |
                        util.IEventListener --+           |
                                              |           |
                  terminal.paintable.IPaintable --+       |
                                                  |       |
                                     object --+   |       |
                                              |   |       |
         terminal.variable_owner.IVariableOwner --+       |
                                                  |       |
                                     object --+   |       |
                                              |   |       |
                    terminal.sizeable.ISizeable --+       |
                                                  |       |
                               component.IComponent --+   |
                                                      |   |
                                   component.IFocusable --+
                                                          |
                                                         Panel

Panel - a simple single component container.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, *args)
Creates a new panel with caption and or content.
source code
 
setCaption(self, caption)
Sets the caption of the panel.
source code
 
getLayout(self)
Gets the current layout of the panel.
source code
 
setLayout(self, newLayout)
Sets the layout of the panel.
source code
 
getContent(self)
Returns the content of the Panel.
source code
 
setContent(self, newContent)
Set the content of the Panel.
source code
 
createDefaultContent(self)
Create a IComponentContainer which is added by default to the Panel if user does not specify any content.
source code
 
paintContent(self, target)
Paints any needed component-specific things to the given UIDL stream.
source code
 
requestRepaintAll(self)
Causes a repaint of this component, and all components below it.
source code
 
addComponent(self, c)
Adds the component into this container.
source code
 
removeComponent(self, c)
Removes the component from this container.
source code
 
getComponentIterator(self)
Gets the component container iterator for going through all the components in the container.
source code
 
changeVariables(self, source, variables)
Called when one or more variables handled by the implementing class are changed.
source code
 
getScrollLeft(self)
Gets scroll left offset.
source code
 
getScrollOffsetX(self) source code
 
getScrollTop(self)
Gets scroll top offset.
source code
 
getScrollOffsetY(self) source code
 
isScrollable(self)
Is programmatic scrolling enabled.
source code
 
setScrollable(self, isScrollingEnabled)
Sets the panel as programmatically scrollable.
source code
 
setScrollLeft(self, pixelsScrolled)
Sets the horizontal scroll position.
source code
 
setScrollOffsetX(self, pixels) source code
 
setScrollTop(self, pixelsScrolledDown)
Sets the vertical scroll position.
source code
 
setScrollOffsetY(self, pixels) source code
 
replaceComponent(self, oldComponent, newComponent)
Replaces the component in the container with another one without changing position.
source code
 
componentAttachedToContainer(self, event)
A new component is attached to container.
source code
 
componentDetachedFromContainer(self, event)
A component has been detached from container.
source code
 
attach(self)
Notifies the component that it is connected to an application.
source code
 
detach(self)
Notifies the component that it is detached from the application.
source code
 
removeAllComponents(self)
Removes all components from this container.
source code
 
getActionManager(self) source code
 
addAction(self, action) source code
 
removeAction(self, action) source code
 
addActionHandler(self, actionHandler)
Registers a new action handler for this container
source code
 
removeActionHandler(self, actionHandler)
Removes a previously registered action handler for the contents of this container.
source code
 
removeAllActionHandlers(self)
Removes all action handlers
source code
 
addListener(self, listener, iface=None)
Add a click listener to the Panel.
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Remove a click listener from the Panel.
source code
 
removeCallback(self, callback, eventType=None) source code
 
fireClick(self, parameters)
Fire a click event to all click listeners.
source code
 
getTabIndex(self)
Gets the tabulator index of the IFocusable component.
source code
 
setTabIndex(self, tabIndex)
Sets the tabulator index of the IFocusable component.
source code
 
focus(self)
Moves keyboard focus to the component.
source code

Inherited from abstract_component_container.AbstractComponentContainer: fireComponentAttachEvent, fireComponentDetachEvent, getInvalidSizedChildren, moveComponentsFrom, repaintChangedChildTrees, repaintChildTrees, setEnabled, setHeight, setWidth

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, fireRequestRepaintEvent, 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, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidthUnits, withdrawCallback, withdrawListener

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

Class Variables [hide private]
  CLIENT_WIDGET = None
hash(x)
  _CLICK_EVENT = 'click'
  STYLE_LIGHT = 'light'

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 panel with caption and or content. A VerticalLayout is used as content by default.

Parameters:
  • args - tuple of the form
    • (content)
      1. the content for the panel (HTML/XHTML).
    • (caption)
      1. the caption used in the panel (HTML/XHTML).
    • (caption, content)
      1. the caption of the panel.
      2. the content used in the panel (HTML/XHTML).
Overrides: object.__init__

setCaption(self, caption)

source code 

Sets the caption of the panel.

Note that the caption is interpreted as HTML/XHTML and therefore care should be taken not to enable HTML injection and XSS attacks using panel captions. This behavior may change in future versions.

@see AbstractComponent.setCaption

Parameters:
  • caption - the new caption string for the component.
Overrides: component.IComponent.setCaption

getLayout(self)

source code 

Gets the current layout of the panel.

Returns:
the Current layout of the panel.

Deprecated: A Panel can now contain a IComponentContainer which is not necessarily a ILayout. Use getContent instead.

setLayout(self, newLayout)

source code 

Sets the layout of the panel.

If given layout is null, a VerticalLayout with margins set is used as a default.

Components from old layout are not moved to new layout by default. Use function in ILayout interface manually.

Parameters:
  • newLayout - the New layout of the panel.

Deprecated: A Panel can now contain a IComponentContainer which is not necessarily a ILayout. Use setContent instead.

setContent(self, newContent)

source code 

Set the content of the Panel. If null is given as the new content then a layout is automatically created and set as the content.

Parameters:
  • newContent - The new content

paintContent(self, target)

source code 

Paints any needed component-specific things to the given UIDL stream. The more general paint method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.

Parameters:
  • target - the target UIDL stream where the component should paint itself to
Raises:
Overrides: abstract_component.AbstractComponent.paintContent
(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)

addComponent(self, c)

source code 

Adds the component into this container.

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

See Also: AbstractComponentContainer.addComponent

removeComponent(self, c)

source code 

Removes the component from this container.

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

See Also: AbstractComponentContainer.removeComponent

getComponentIterator(self)

source code 

Gets the component container iterator for going through all the components in the container.

Returns:
the iterator of the components inside the container.
Overrides: component_container.IComponentContainer.getComponentIterator

changeVariables(self, source, variables)

source code 

Called when one or more variables handled by the implementing class are changed.

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

See Also: muntjac.terminal.VariableOwner.changeVariables

getScrollLeft(self)

source code 

Gets scroll left offset.

Scrolling offset is the number of pixels this scrollable has been scrolled right.

Returns:
Horizontal scrolling position in pixels.
Overrides: terminal.scrollable.IScrollable.getScrollLeft
(inherited documentation)

getScrollOffsetX(self)

source code 

Deprecated: use getScrollLeft instead

getScrollTop(self)

source code 

Gets scroll top offset.

Scrolling offset is the number of pixels this scrollable has been scrolled down.

Returns:
Vertical scrolling position in pixels.
Overrides: terminal.scrollable.IScrollable.getScrollTop
(inherited documentation)

getScrollOffsetY(self)

source code 

Deprecated: use getScrollTop instead

isScrollable(self)

source code 

Is programmatic scrolling enabled.

Whether programmatic scrolling with setScrollLeft and setScrollTop is enabled.

Returns:
True if the scrolling is enabled, otherwise False.
Overrides: terminal.scrollable.IScrollable.isScrollable
(inherited documentation)

setScrollable(self, isScrollingEnabled)

source code 

Sets the panel as programmatically scrollable.

Panel is by default not scrollable programmatically with setScrollLeft and setScrollTop, so if you use those methods, you need to enable scrolling with this method. Components that extend Panel may have a different default for the programmatic scrollability.

Parameters:
  • isScrollingEnabled - true if the scrolling is allowed.
Overrides: terminal.scrollable.IScrollable.setScrollable

setScrollLeft(self, pixelsScrolled)

source code 

Sets the horizontal scroll position.

Setting the horizontal scroll position with this method requires that programmatic scrolling of the component has been enabled. For Panel it is disabled by default, so you have to call setScrollable. Components extending Panel may have a different default for programmatic scrollability.

Parameters:
  • pixelsScrolled - the xOffset.
Overrides: terminal.scrollable.IScrollable.setScrollLeft

setScrollOffsetX(self, pixels)

source code 

Deprecated: use setScrollLeft() method instead

setScrollTop(self, pixelsScrolledDown)

source code 

Sets the vertical scroll position.

Setting the vertical scroll position with this method requires that programmatic scrolling of the component has been enabled. For Panel it is disabled by default, so you have to call setScrollable. Components extending Panel may have a different default for programmatic scrollability.

Parameters:
  • pixelsScrolled - the yOffset.
Overrides: terminal.scrollable.IScrollable.setScrollTop

setScrollOffsetY(self, pixels)

source code 

Deprecated: use setScrollTop() method instead

replaceComponent(self, oldComponent, newComponent)

source code 

Replaces the component in the container with another one without changing position.

This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. IComponent attach and detach events should be taken care as with add and remove.

Parameters:
  • oldComponent - the old component that will be replaced.
  • newComponent - the new component to be replaced.
Overrides: component_container.IComponentContainer.replaceComponent
(inherited documentation)

componentAttachedToContainer(self, event)

source code 

A new component is attached to container.

Parameters:
  • event - the component attach event.
Overrides: component_container.IComponentAttachListener.componentAttachedToContainer

componentDetachedFromContainer(self, event)

source code 

A component has been detached from container.

Parameters:
  • event - the component detach event.
Overrides: component_container.IComponentDetachListener.componentDetachedFromContainer

attach(self)

source code 

Notifies the component that it is connected to an application.

Overrides: component.IComponent.attach

See Also: IComponent.attach

detach(self)

source code 

Notifies the component that it is detached from the application.

Overrides: component.IComponent.detach

See Also: IComponent.detach

removeAllComponents(self)

source code 

Removes all components from this container.

Overrides: component_container.IComponentContainer.removeAllComponents

addAction(self, action)

source code 
Overrides: event.action.INotifier.addAction

removeAction(self, action)

source code 
Overrides: event.action.INotifier.removeAction

addActionHandler(self, actionHandler)

source code 

Registers a new action handler for this container

Parameters:
  • actionHandler - the new handler to be added.
Overrides: event.action.IContainer.addActionHandler
(inherited documentation)

removeActionHandler(self, actionHandler)

source code 

Removes a previously registered action handler for the contents of this container.

Parameters:
  • actionHandler - the handler to be removed.
Overrides: event.action.IContainer.removeActionHandler
(inherited documentation)

addListener(self, listener, iface=None)

source code 

Add a click listener to the Panel. The listener is called whenever the user clicks inside the Panel. Also when the click targets a component inside the Panel, provided the targeted component does not prevent the click event from propagating.

Use removeListener to remove the listener.

Parameters:
  • listener - The listener to add
Raises:
  • ValueError - unless method has a match in object
Overrides: event.method_event_source.IMethodEventSource.addListener

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

source code 
Overrides: terminal.paintable.IPaintable.addCallback

removeListener(self, listener, iface=None)

source code 

Remove a click listener from the Panel. The listener should earlier have been added using addListener.

Parameters:
  • listener - The listener to remove
Overrides: event.method_event_source.IMethodEventSource.removeListener

removeCallback(self, callback, eventType=None)

source code 
Overrides: terminal.paintable.IPaintable.removeCallback

fireClick(self, parameters)

source code 

Fire a click event to all click listeners.

Parameters:
  • parameters - The raw "value" of the variable change from the client side

getTabIndex(self)

source code 

Gets the tabulator index of the IFocusable component.

Returns:
tab index set for the IFocusable component
Overrides: component.IFocusable.getTabIndex
(inherited documentation)

setTabIndex(self, tabIndex)

source code 

Sets the tabulator index of the IFocusable component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index:

 loginBox = Form()
 loginBox.setCaption("Login")
 layout.addComponent(loginBox)

 # Create the first field which will be focused
 username = TextField("User name")
 loginBox.addField("username", username)

 # Set focus to the user name
 username.focus()

 password = TextField("Password")
 loginBox.addField("password", password)

 login = Button("Login")
 loginBox.getFooter().addComponent(login)

 # An additional component which natural focus order would
 # be after the button.
 remember = CheckBox("Remember me")
 loginBox.getFooter().addComponent(remember)

 username.setTabIndex(1)
 password.setTabIndex(2)
 remember.setTabIndex(3)  # Different than natural place
 login.setTabIndex(4)

After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.

If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.

A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.

Parameters:
  • tabIndex - the tab order of this component. Indexes usually start from 1. Zero means that default tab order should be used. A negative value means that the field should not be included in the tabbing sequence.
Overrides: component.IFocusable.setTabIndex
(inherited documentation)

focus(self)

source code 

Moves keyboard focus to the component.

Overrides: component.IFocusable.focus

See Also: IFocusable.focus