Package muntjac :: Package ui :: Module label :: Class Label
[hide private]
[frames] | no frames]

Class Label

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.property.IProperty --+
                                                   |
                                      object --+   |
                                               |   |
                           data.property.IViewer --+
                                                   |
                                      object --+   |
                                               |   |
              data.property.IValueChangeListener --+
                                                   |
                                      object --+   |
                                               |   |
              data.property.IValueChangeNotifier --+
                                                   |
                                                  Label

Label component for showing non-editable short texts.

The label content can be set to the modes specified by the final members CONTENT_*

The contents of the label may contain simple formatting:

The b,i,u and li tags can contain all the tags in the list recursively.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, contentSource='', contentMode=None)
Creates a new instance of Label with text-contents read from given datasource.
source code
 
setReadOnly(self, readOnly)
Set the component to read-only.
source code
 
isReadOnly(self)
Is the component read-only ? Readonly is not used in label - this returns always false.
source code
 
paintContent(self, target)
Paints the content of this component.
source code
 
getValue(self)
Gets the value of the label.
source code
 
setValue(self, newValue)
Set the value of the label.
source code
 
__str__(self)
Returns the value of the IProperty in human readable textual format.
source code
 
getType(self)
Gets the type of the IProperty.
source code
 
getPropertyDataSource(self)
Gets the viewing data-source property.
source code
 
setPropertyDataSource(self, newDataSource)
Sets the property as data-source for viewing.
source code
 
getContentMode(self)
Gets the content mode of the Label.
source code
 
setContentMode(self, contentMode)
Sets the content mode of the Label.
source code
 
addListener(self, listener, iface=None)
Adds the value change listener.
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes the value change listener.
source code
 
removeCallback(self, callback, eventType=None) source code
 
fireValueChange(self)
Emits the options change event.
source code
 
valueChange(self, event)
Listens the value change events from data source.
source code
 
compareTo(self, other)
Compares the Label to other objects.
source code
 
stripTags(self, xml)
Strips the tags from the XML.
source code

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, attach, changeVariables, childRequestedRepaint, detach, 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, isVisible, paint, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeightUnits, setIcon, setImmediate, 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 Variables [hide private]
  CLIENT_WIDGET = None
hash(x)
  CONTENT_TEXT = 0
Content mode, where the label contains only plain text.
  CONTENT_PREFORMATTED = 1
Content mode, where the label contains preformatted text.
  CONTENT_UIDL = 2
Formatted content mode, where the contents is XML restricted to the UIDL
  CONTENT_XHTML = 3
Content mode, where the label contains XHTML.
  CONTENT_XML = 4
Content mode, where the label contains well-formed or well-balanced XML.
  CONTENT_RAW = 5
Content mode, where the label contains RAW output.
  CONTENT_DEFAULT = 0
The default content mode is plain text.
  _CONTENT_MODE_NAME = ['text', 'pre', 'uidl', 'xhtml', 'xml', '...
Array of content mode names that are rendered in UIDL as mode attribute.
  _DATASOURCE_MUST_BE_SET = 'Datasource must be set'

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

Instance Variables [hide private]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, contentSource='', contentMode=None)
(Constructor)

source code 

Creates a new instance of Label with text-contents read from given datasource.

Overrides: object.__init__

setReadOnly(self, readOnly)

source code 

Set the component to read-only. Readonly is not used in label.

Parameters:
  • readOnly - True to enable read-only mode, False to disable it.
Overrides: data.property.IProperty.setReadOnly

isReadOnly(self)

source code 

Is the component read-only ? Readonly is not used in label - this returns always false.

Returns:
True if the component is in read only mode.
Overrides: data.property.IProperty.isReadOnly

paintContent(self, target)

source code 

Paints the content of this component.

Parameters:
  • target - the Paint Event.
Raises:
Overrides: abstract_component.AbstractComponent.paintContent

getValue(self)

source code 

Gets the value of the label. Value of the label is the XML contents of the label.

Returns:
the Value of the label.
Overrides: data.property.IProperty.getValue

setValue(self, newValue)

source code 

Set the value of the label. Value of the label is the XML contents of the label.

Parameters:
  • newValue - the New value of the label.
Raises:
Overrides: data.property.IProperty.setValue

__str__(self)
(Informal representation operator)

source code 

Returns the value of the IProperty in human readable textual format. The return value should be assignable to the setValue method if the IProperty is not in read-only mode.

Returns:
String representation of the value stored in the IProperty
Overrides: object.__str__
(inherited documentation)

getType(self)

source code 

Gets the type of the IProperty.

Returns:
type of the IProperty
Overrides: data.property.IProperty.getType

See Also: IProperty.getType

getPropertyDataSource(self)

source code 

Gets the viewing data-source property.

Returns:
the data source property.
Overrides: data.property.IViewer.getPropertyDataSource

setPropertyDataSource(self, newDataSource)

source code 

Sets the property as data-source for viewing.

Parameters:
  • newDataSource - the new data source IProperty
Overrides: data.property.IViewer.setPropertyDataSource

getContentMode(self)

source code 

Gets the content mode of the Label.

Possible content modes include:

  • CONTENT_TEXT Content mode, where the label contains only plain text. The getValue() result is coded to XML when painting.
  • CONTENT_PREFORMATTED Content mode, where the label contains preformatted text.
  • CONTENT_UIDL Formatted content mode, where the contents is XML restricted to the UIDL 1.0 formatting markups.
  • CONTENT_XHTML Content mode, where the label contains XHTML. Contents is then enclosed in DIV elements having namespace of "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
  • CONTENT_XML Content mode, where the label contains well-formed or well-balanced XML. Each of the root elements must have their default namespace specified.
  • CONTENT_RAW Content mode, where the label contains RAW output. Output is not required to comply to with XML. In Web Adapter output is inserted inside the resulting HTML document as-is. This is useful for some specific purposes where possibly broken HTML content needs to be shown, but in most cases XHTML mode should be preferred.
Returns:
the Content mode of the label.

setContentMode(self, contentMode)

source code 

Sets the content mode of the Label.

Possible content modes include:

  • CONTENT_TEXT Content mode, where the label contains only plain text. The getValue() result is coded to XML when painting.
  • CONTENT_PREFORMATTED Content mode, where the label contains preformatted text.
  • CONTENT_UIDL Formatted content mode, where the contents is XML restricted to the UIDL 1.0 formatting markups.
  • CONTENT_XHTML Content mode, where the label contains XHTML. Contents is then enclosed in DIV elements having namespace of "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
  • CONTENT_XML Content mode, where the label contains well-formed or well-balanced XML. Each of the root elements must have their default namespace specified.
  • CONTENT_RAW Content mode, where the label contains RAW output. Output is not required to comply to with XML. In Web Adapter output is inserted inside the resulting HTML document as-is. This is useful for some specific purposes where possibly broken HTML content needs to be shown, but in most cases XHTML mode should be preferred.
Parameters:
  • contentMode - the New content mode of the label.

addListener(self, listener, iface=None)

source code 

Adds the value change listener.

Parameters:
  • listener - the new IListener to be registered.
Raises:
  • ValueError - unless method has a match in object
Overrides: data.property.IValueChangeNotifier.addListener

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

source code 
Overrides: data.property.IValueChangeNotifier.addCallback

removeListener(self, listener, iface=None)

source code 

Removes the value change listener.

Parameters:
  • listener - the listener to be removed.
Overrides: data.property.IValueChangeNotifier.removeListener

removeCallback(self, callback, eventType=None)

source code 
Overrides: data.property.IValueChangeNotifier.removeCallback

valueChange(self, event)

source code 

Listens the value change events from data source.

Parameters:
  • event - value change event object
Overrides: data.property.IValueChangeListener.valueChange

compareTo(self, other)

source code 

Compares the Label to other objects.

Labels can be compared to other labels for sorting label contents. This is especially handy for sorting table columns.

In RAW, PREFORMATTED and TEXT modes, the label contents are compared as is. In XML, UIDL and XHTML modes, only CDATA is compared and tags ignored. If the other object is not a Label, its toString() return value is used in comparison.

Parameters:
  • other - the Other object to compare to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

stripTags(self, xml)

source code 

Strips the tags from the XML.

Parameters:
  • xml - the string containing a XML snippet.
Returns:
the original XML without tags.

Class Variable Details [hide private]

CONTENT_TEXT

Content mode, where the label contains only plain text. The getValue()

Value:
0

CONTENT_XHTML

Content mode, where the label contains XHTML. Contents is then enclosed

Value:
3

CONTENT_RAW

Content mode, where the label contains RAW output. Output is not

Value:
5

_CONTENT_MODE_NAME

Array of content mode names that are rendered in UIDL as mode attribute.

Value:
['text', 'pre', 'uidl', 'xhtml', 'xml', 'raw']