Package muntjac :: Package ui :: Module custom_layout :: Class CustomLayout
[hide private]
[frames] | no frames]

Class CustomLayout

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 --+                   |    
                                      |                   |    
                    util.IEventListener --+               |    
                                          |               |    
              terminal.paintable.IPaintable --+           |    
                                              |           |    
                                 object --+   |           |    
                                          |   |           |    
     terminal.variable_owner.IVariableOwner --+           |    
                                              |           |    
                                 object --+   |           |    
                                          |   |           |    
                terminal.sizeable.ISizeable --+           |    
                                              |           |    
                           component.IComponent --+       |    
                                                  |       |    
            component_container.IComponentContainer --+   |    
                                                      |   |    
                                         layout.ILayout --+    
                                                          |    
                                             object --+   |    
                                                      |   |    
                                  layout.IMarginHandler --+    
                                                          |    
                             abstract_layout.AbstractLayout --+
                                                              |
                                                             CustomLayout

A container component with freely designed layout and style. The layout consists of items with textually represented locations. Each item contains one sub-component, which can be any Muntjac component, such as a layout. The adapter and theme are responsible for rendering the layout with a given style by placing the items in the defined locations.

The placement of the locations is not fixed - different themes can define the locations in a way that is suitable for them. One typical example would be to create visual design for a web site as a custom layout: the visual design would define locations for "menu", "body", and "title", for example. The layout would then be implemented as an XHTML template for each theme.

The default theme handles the styles that are not defined by drawing the subcomponents just as in OrderedLayout.


Authors:
Vaadin Ltd., Richard Lincoln, Duy B. Vo

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, template=None)
Default constructor only used by subclasses.
source code
 
initTemplateContentsFromInputStream(self, templateStream) source code
 
addComponent(self, c, location='')
Adds the component into this container to given location.
source code
 
removeComponent(self, arg)
Removes the component from this container or the given location.
source code
 
getComponentIterator(self)
Gets the component container iterator for going trough all the components in the container.
source code
 
getComponentCount(self)
Gets the number of contained components.
source code
 
getComponent(self, location)
Gets the child-component by its location.
source code
 
paintContent(self, target)
Paints the content of this component.
source code
 
replaceComponent(self, oldComponent, newComponent)
Replaces the component in the container with another one without changing position.
source code
 
setStyle(self, name)
CustomLayout's template selecting was previously implemented with setStyle.
source code
 
getTemplateName(self)
Get the name of the template
source code
 
getTemplateContents(self)
Get the contents of the template
source code
 
setTemplateName(self, templateName)
Set the name of the template used to draw custom layout.
source code
 
setTemplateContents(self, templateContents)
Set the contents of the template used to draw the custom layout.
source code
 
setMargin(self, *args)
Although most layouts support margins, CustomLayout does not.
source code

Inherited from abstract_layout.AbstractLayout: changeVariables, fireClick, getMargin

Inherited from abstract_component_container.AbstractComponentContainer: addCallback, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, getInvalidSizedChildren, moveComponentsFrom, removeAllComponents, removeCallback, removeListener, repaintChangedChildTrees, repaintChildTrees, requestRepaintAll, setEnabled, setHeight, setWidth

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, 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, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, 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)
  _BUFFER_SIZE = 10000

Inherited from abstract_layout.AbstractLayout (private): _CLICK_EVENT

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, template=None)
(Constructor)

source code 

Default constructor only used by subclasses. Subclasses are responsible for setting the appropriate fields. Either setTemplateName, that makes layout fetch the template from theme, or setTemplateContents.

Template file is fetched from "<theme>/layout/<templateName>".

Raises:
  • IOException
Overrides: object.__init__

addComponent(self, c, location='')

source code 

Adds the component into this container to given location. If the location is already populated, the old component is removed. If the component is added without specifying the location (empty string is then used as location). Only one component can be added to the default "" location and adding more components into that location overwrites the old components.

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

removeComponent(self, arg)

source code 

Removes the component from this container or the given location.

Parameters:
  • arg - the component to be removed or the location identifier of the component.
Overrides: component_container.IComponentContainer.removeComponent

getComponentIterator(self)

source code 

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

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

getComponentCount(self)

source code 

Gets the number of contained components. Consistent with the iterator returned by getComponentIterator.

Returns:
the number of contained components

getComponent(self, location)

source code 

Gets the child-component by its location.

Parameters:
  • location - the name of the location where the requested component resides.
Returns:
the IComponent in the given location or null if not found.

paintContent(self, target)

source code 

Paints the content of this component.

Parameters:
  • target - the target UIDL stream where the component should paint itself to
Raises:
Overrides: abstract_component.AbstractComponent.paintContent

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)

setStyle(self, name)

source code 

CustomLayout's template selecting was previously implemented with setStyle. Overriding to improve backwards compatibility.

Parameters:
  • name - template name
Overrides: abstract_component.AbstractComponent.setStyle

Deprecated: Use setTemplateName instead

setTemplateName(self, templateName)

source code 

Set the name of the template used to draw custom layout.

With GWT-adapter, the template with name 'templatename' is loaded from VAADIN/themes/themename/layouts/templatename.html. If the theme has not been set (with Application.setTheme()), themename is 'default'.

setMargin(self, *args)

source code 

Although most layouts support margins, CustomLayout does not. The behaviour of this layout is determined almost completely by the actual template.

Parameters:
  • args - tuple of the form
    • (enabled)
    • (top, right, bottom, left)
Raises:
  • NotImplementedError - CustomLayout does not support margins
Overrides: layout.IMarginHandler.setMargin